Compare commits

...

1084 Commits

Author SHA1 Message Date
Michael Kaufmann
d69a7eeb07 sql text field corrections
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2023-01-08 15:47:54 +01:00
Michael Kaufmann
a8a112af49 sql text field corrections
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2023-01-08 15:44:32 +01:00
Michael Kaufmann
46c696811d fix customer listing for admins when deactivated customers exist; fix potential row-size too large error for panel_customers; fix possible undefined timestamps in opcache-info; set version to 2.0.1
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2023-01-08 15:37:46 +01:00
Michael Kaufmann
1d2f5a693c fix cli-updater
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2023-01-08 13:27:17 +01:00
Michael Kaufmann
5688690eb8 set version to 2.0.0 for upcoming stable release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2023-01-08 11:00:59 +01:00
Michael Kaufmann
f7f356e896 fix csrf for clearing apcu/opcache cache
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-31 09:08:34 +01:00
Michael Kaufmann
5a807e3dbe do not show apcuinfo or opcacheinfo to users with change_serversettings=0
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-31 08:51:05 +01:00
Michael Kaufmann
fede81700e set correct expected return-code from exception in unit-test
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-31 00:50:30 +01:00
Michael Kaufmann
b7264cdc5d adjust tests for new reseller permission (edit ipsandports not necessary)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-31 00:47:37 +01:00
Michael Kaufmann
0527f22dc9 dont show page content for resellers withouth required permissions to actually do something
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-31 00:42:58 +01:00
Michael Kaufmann
d643e8c673 exclude csrf_token from froxlor-config.json export; exclude system.updatecheck_data from settings-export
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-30 21:48:59 +01:00
Michael Kaufmann
f2485ecd9a adjust Request-class methods to be more flexible
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-30 21:43:27 +01:00
Michael Kaufmann
983d929460 validate image data/filename when importing
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-30 14:39:32 +01:00
Maurice Preuß (envoyr)
37980060ea update form validation for customers
Signed-off-by: Maurice Preuß (envoyr) <envoyr@froxlor.org>
2022-12-27 15:21:53 +01:00
Maurice Preuß (envoyr)
03a39ca69f Merge branch 'main' of github.com:Froxlor/Froxlor 2022-12-26 14:12:45 +01:00
Maurice Preuß (envoyr)
1b63534563 update csrf initialization
Signed-off-by: Maurice Preuß (envoyr) <envoyr@froxlor.org>
2022-12-26 14:12:21 +01:00
Michael Kaufmann
07814f8e46 fix email 2fa; insert task to rebuild vhosts after customer changes password for statistics-page
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-26 13:00:34 +01:00
Michael Kaufmann
c696542cf5 remove unnecessary domains_see_all column
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-26 12:12:06 +01:00
Michael Kaufmann
15ed0521c5 use proxymap for mysql connection in postfix
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-26 11:39:23 +01:00
Maurice Preuß (envoyr)
ae4b961ac1 fix edit button for ssl certificates 2022-12-25 22:44:49 +01:00
Maurice Preuß (envoyr)
6ad78a4818 add csrf token header to jquery requests 2022-12-25 22:14:39 +01:00
Maurice Preuß (envoyr)
ddc95762eb fix of name translation due to incorrect display in lists and forms 2022-12-25 20:54:35 +01:00
Maurice Preuß (envoyr)
6bf0396c76 fix user details in form fields
Signed-off-by: Maurice Preuß (envoyr) <envoyr@froxlor.org>
2022-12-25 20:42:34 +01:00
Maurice Preuß (envoyr)
746d30c65b fix unknown configuration directive on some systems
Signed-off-by: Maurice Preuß (envoyr) <envoyr@froxlor.org>
2022-12-25 20:23:56 +01:00
Michael Kaufmann
9013fd63d7 correct pure-ftpd quota-query
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-22 19:16:26 +01:00
Michael Kaufmann
7079e2f2bf correct sql-alter-queries in updater
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-22 19:15:42 +01:00
rex2630
03466158a7 Renamed name to Last name instead (#1060) 2022-12-22 19:11:09 +01:00
Michael Kaufmann
ef8dabeb89 re-add edit button in ssl-certificates overview when manually set
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-22 11:14:11 +01:00
rex2630
38fb3bc25a Deleted duplicated string (#1058) 2022-12-22 09:29:12 +01:00
Maurice Preuß (envoyr)
d2d3cec4f5 Merge branch 'main' of github.com:Froxlor/Froxlor 2022-12-21 20:25:11 +01:00
Maurice Preuß (envoyr)
669072d996 update navigation for better mobile handling
Signed-off-by: Maurice Preuß (envoyr) <envoyr@froxlor.org>
2022-12-21 20:23:54 +01:00
Michael Kaufmann
a81065a1b0 add dashboard-language string, fix missing { in customer_mysql
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-21 11:54:29 +01:00
Michael Kaufmann
4f89d7a9f0 set theme correctly when updating from 0.10.x
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-20 23:07:52 +01:00
Maurice Preuß (envoyr)
996b2e4a78 fix translation strings and update session lifetime to default panel sessiontimeout
Signed-off-by: Maurice Preuß (envoyr) <envoyr@froxlor.org>
2022-12-20 21:27:53 +01:00
Maurice Preuß (envoyr)
4acd1d4ef6 add missing translation strings
Signed-off-by: Maurice Preuß (envoyr) <envoyr@froxlor.org>
2022-12-20 19:59:24 +01:00
Michael Kaufmann
795a3d846c regex-validate services commands
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-20 19:38:05 +01:00
Michael Kaufmann
2dd226c96c allow domain-redirect to internal-ipaddress
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-20 17:20:40 +01:00
Michael Kaufmann
24fa1d39ed add pass_authorizationheader=1 to froxlor vhost php-config; fix issue with assigning mysql-server when editing customer with mysql=0 prior; fix blank page when customer does not have resources but opens page via url manipulation
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-16 10:52:12 +01:00
Michael Kaufmann
c19b7d02ab allow api _plainsql special parameter only for internal calls, not needed anywhere else
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-14 18:42:06 +01:00
Michael Kaufmann
e5b6492804 fix typo when creating new home for new customer
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-14 14:46:51 +01:00
Michael Kaufmann
f4f00352eb add missing csrf-token to configuration-form
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-14 10:53:32 +01:00
Michael Kaufmann
ebc44a737e trim fpm ini directives of possible newline characters
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-08 23:16:27 +01:00
Michael Kaufmann
4d908ff6ee fix session-timeout not being set
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-08 10:05:44 +01:00
Michael Kaufmann
34e3290497 adding csrf-token to all forms
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-08 09:33:34 +01:00
Maurice Preuß (envoyr)
fe37313b7b update readme, fix badges and links
Signed-off-by: Maurice Preuß (envoyr) <envoyr@froxlor.org>
2022-12-07 10:58:45 +01:00
Michael Kaufmann
3d033262ed adjustments to dovecot-sql config template; correct enctype for form
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-06 23:08:54 +01:00
Michael Kaufmann
6135ba8468 backward compatibility for updaters to update cron.d configuration file after update
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-06 16:47:16 +01:00
Michael Kaufmann
d7a2ec35cc clearify customer add/edit name/company requirements
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-06 16:25:33 +01:00
Michael Kaufmann
4501eb2723 fix correct increasing of used customers and recalculat resources
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-06 08:26:42 +01:00
Michael Kaufmann
609c15688c fix api-key edit (thx Davidd), fix dns-editor ttl field (thx Rolf)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-05 20:58:57 +01:00
Michael Kaufmann
5b7a76b608 Update CONTRIBUTING.md 2022-12-05 10:14:35 +01:00
Michael Kaufmann
4eaf9d2c46 add new graphics/logos; theme dependent logos; layout fixes in forgot-password/reset-password sites;
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-04 13:18:33 +01:00
Maurice Preuß
b3da3cf218 Merge pull request #1056 from Froxlor/dependabot/npm_and_yarn/loader-utils-1.4.2
Bump loader-utils from 1.4.0 to 1.4.2
2022-12-03 20:01:46 +01:00
Michael Kaufmann
abf3328ea9 fix api-key creation
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-02 13:42:33 +01:00
Michael Kaufmann
89f73f571e use same error message for invalid user and disabled password reset to not give away if a user exists
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-02 13:25:17 +01:00
Michael Kaufmann
63f6d221cd secure logo uploading, avoid frame-inclusion, adjustments to SECURITY.md and minor changes in UI for domain import and darkmode
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-12-02 09:24:08 +01:00
Michael Kaufmann
40997762a4 small adjustments for tooltip/popover and icons in top-right menu
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-30 10:06:13 +01:00
Michael Kaufmann
fa547197e8 fix server-side version-check response message check
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-27 15:38:35 +01:00
Michael Kaufmann
ae8cd3dc8a enhance version-check and beautify displayed information
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-27 15:33:25 +01:00
Maurice Preuß (envoyr)
685b6076a0 enable tooltip and popover
Signed-off-by: Maurice Preuß (envoyr) <envoyr@froxlor.org>
2022-11-27 12:51:39 +01:00
Michael Kaufmann
137db0432e adjust validate-test for 'sql username too long' for mariadb
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-24 10:29:39 +01:00
Michael Kaufmann
73fe533870 adjust mysql-usernamelength values for mariadb according to docs
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-24 10:03:40 +01:00
Michael Kaufmann
4b7ae46fd7 fix missing language-strings
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-21 12:52:33 +01:00
Michael Kaufmann
777991e0e3 honor caneditdomain flag correctly; corrected error messages; updated external URLs
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-20 12:22:03 +01:00
Michael Kaufmann
eb13796976 use correct docs-url
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-19 12:51:18 +01:00
Michael Kaufmann
51aafafd73 update links to new docs.froxlor.org pages (v2 will be /latest/ when released); fixed required-checkbox attribute when having a hidden fallback to value 0 (bool checkboxes); added automatic creation of symlink for bin/froxlor-cli to /usr/local/bin
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-17 14:27:51 +01:00
dependabot[bot]
7084cd8c54 Bump loader-utils from 1.4.0 to 1.4.2
Bumps [loader-utils](https://github.com/webpack/loader-utils) from 1.4.0 to 1.4.2.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v1.4.2/CHANGELOG.md)
- [Commits](https://github.com/webpack/loader-utils/compare/v1.4.0...v1.4.2)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-15 02:29:29 +00:00
Michael Kaufmann
ed231f159f forgot to save the last changes before committing
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-14 15:57:49 +01:00
Michael Kaufmann
da6c1992fa added documentation links to sidebar
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-14 12:59:51 +01:00
Michael Kaufmann
5fa98811ab fix reduction of used resources when deleting a customer
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-13 18:04:29 +01:00
Michael Kaufmann
6904acc9ea use preinstalled dh params file instead of generating a new one which takes a lot of time
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-13 15:09:16 +01:00
Michael Kaufmann
cc1d427a69 enable ssl for postfix/dovecot by default using a self-signed certificate if not otherwise specified
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-12 16:36:57 +01:00
Michael Kaufmann
1d938f2a43 remove 'default_password_scheme' for dovecot configs as hashes can be different now and are read by given hash-algo prefix;
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-12 09:38:43 +01:00
Michael Kaufmann
f49fd5f0f7 show replacer-variables in php-config add/edit and fpm-versions add/edit; catch potential Exception thrown by Form::processForm() to display the error nicely; minor fixes in field-visibility for phpconfigs depending on php-interface and webserver; validate fcgid/fpm enable-flag correctly if not POST'ed at the same time (older behaviour)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-09 17:07:48 +01:00
Michael Kaufmann
2b12cde77e minor UI/UX fix for settings import (button label)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-08 15:18:39 +01:00
Michael Kaufmann
61dc40ec88 respect domains 'no try_files' option correctly; fix directory-protection generator in nginx
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-08 12:41:54 +01:00
Michael Kaufmann
ec8338592d add notice for settings that might require reconfiguration of specific services
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-08 10:24:39 +01:00
Michael Kaufmann
b6d850dac3 adjusting texts of standardcustomer-index file; always display current year in copyright
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-08 08:30:21 +01:00
envoyr
1b75863823 update domain default page 2022-11-06 15:34:20 +01:00
Maurice Preuß
73aa2ec431 fix html section and use import 2022-11-06 13:58:22 +01:00
Maurice Preuß
fc42b04537 fix missing use Froxlor\UI\Request 2022-11-06 13:49:09 +01:00
Michael Kaufmann
da82403b55 don't check for resource availability if none is going to be given to the customer
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-06 13:45:09 +01:00
Michael Kaufmann
c05245c891 correct recalculation of resource usage for admins
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-06 11:55:18 +01:00
Michael Kaufmann
1f70327112 show traffic details in admin and customer listings with the info-icon
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-06 11:27:32 +01:00
Michael Kaufmann
78945768ec add persistent db storage to goaccess-traffictool to have more data in the output index.html; add security questions when deleting certificates as we do for apikeys and dns-entries
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-06 10:11:40 +01:00
Maurice Preuß
8eedf87ac3 Merge pull request #1051 from Froxlor/dependabot/npm_and_yarn/node-forge-1.3.1
Bump node-forge from 1.2.1 to 1.3.1
2022-11-05 14:13:48 +01:00
Michael Kaufmann
4fc50fba1f avoid possible html injection via forgot-password-error-message
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-05 12:51:23 +01:00
Michael Kaufmann
4a4188a96b prefer combined operators, refs #999
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-05 11:07:18 +01:00
Michael Kaufmann
b0a66b687d allow plaintext_auth in dovecot by default in case no ssl certificate is used
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-04 19:59:30 +01:00
Maurice Preuß
6bb2036ebc use bytes instead of kilobytes 2022-11-04 18:32:38 +01:00
Michael Kaufmann
d16608c94a correctly calculate traffic usage and output bytes in Traffic-Api-Command instead of KB
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-04 18:02:04 +01:00
Michael Kaufmann
338eca4eb6 rework monthly traffic stats mail
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-04 16:08:07 +01:00
Michael Kaufmann
0608713b6a fix traffic/dispace usage reports
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-04 15:44:00 +01:00
Michael Kaufmann
6acd4f4df3 corrected usage in reportscron
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-04 14:28:17 +01:00
Michael Kaufmann
a14af67e2d typo
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-04 14:16:25 +01:00
Michael Kaufmann
a310df0704 language fixes
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-04 14:15:26 +01:00
Michael Kaufmann
ecd209b1d9 revert storing traffic in bytes as webalizer/awstats store in KB so goaccess needs to do that as well in order to stay consinstent throughout the system
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-04 12:49:26 +01:00
Michael Kaufmann
8aa857ea36 store traffic in bytes
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-04 12:44:56 +01:00
Michael Kaufmann
dbec714af8 fix traffic display in dashboards
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-04 12:39:10 +01:00
Michael Kaufmann
5abe663cbe fix stats-alias-path for subdomains with parent having speciallogfile == 1
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-03 12:08:16 +01:00
Michael Kaufmann
91c8fed5f4 fix stats-url generation in vhosts
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-03 11:38:21 +01:00
Michael Kaufmann
1bf9b38cfb fix callGoaccessGetTraffic parameters
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-03 11:17:02 +01:00
Michael Kaufmann
2698a730eb fix reading in JSON values from goaccess stats in case they are really large and cant be handled by php's json_decode
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-03 10:09:52 +01:00
Michael Kaufmann
1ecbad497a fix updating of path in directory-protections when changing traffic tool
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-03 09:13:23 +01:00
Michael Kaufmann
a8dc576833 add 'goaccess' as new and default traffic analyzer tool
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-03 08:58:11 +01:00
Michael Kaufmann
a052333296 enhance listing of customer domains; add third openbasedir-option to make 'parentdirectory of domain-docroot' value possible (refs #515); corrected some formfield definitions
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-01 15:36:21 +01:00
Michael Kaufmann
0f218914a2 re-add replacer-information for php-configs
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-01 15:32:10 +01:00
Michael Kaufmann
cc8814bf16 Merge branch 'main' of github.com:Froxlor/Froxlor 2022-11-01 14:22:05 +01:00
envoyr
67ca368863 Merge branch 'main' of github.com:Froxlor/Froxlor 2022-11-01 13:56:05 +01:00
envoyr
b6b0148495 update packages and badge color for dark mode 2022-11-01 13:54:17 +01:00
Michael Kaufmann
ec0094e754 UI/UX fixes in dns-editor and logfiles-viewer
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-11-01 13:38:27 +01:00
Michael Kaufmann
19284cad00 forgot to remove leftover variable in Ftps.update()
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-30 15:06:07 +01:00
Michael Kaufmann
e86f093d31 forgot to remove leftover prepared statement variable in Ftps.add()
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-30 14:31:21 +01:00
Michael Kaufmann
5aa059bb24 prefer sha256 (the old-way) over sha1 mixup for two different ftpds
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-30 14:22:25 +01:00
Michael Kaufmann
1f43f5d514 pure-ftpd compatible password hashes for ftp users
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-30 11:11:12 +01:00
Michael Kaufmann
85e3b6af0e add installation command for cron in case it's somehow not present on the system
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-27 14:21:09 +02:00
Michael Kaufmann
7cb5135725 secure userinput when adding/editing admins/customers
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-27 14:20:07 +02:00
Michael Kaufmann
afde51ecf6 email validation check input before display
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-27 14:14:16 +02:00
envoyr
34d5583333 display better exception for traffic results if admin has no customers 2022-10-25 13:37:33 +02:00
envoyr
3acc5457b2 fix darkmode search, textarea, progress bars and list groups 2022-10-25 13:00:04 +02:00
Michael Kaufmann
1f69ab7e3f fix keep-current-password when editing mysql-server
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-24 14:25:53 +02:00
Michael Kaufmann
a55cd86a4c adjust button styles in ssl- and dns-editor; don't show notice about pcntl when using --no-fork
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-23 20:43:21 +02:00
envoyr
996976d9f3 fix traffic overview in darkmode 2022-10-23 20:01:50 +02:00
envoyr
cc83099670 remove mix-manifest.json and fix gray colors 2022-10-23 19:43:27 +02:00
envoyr
8e17dda79a refactored scss files and beautify darkmode 2022-10-23 17:35:18 +02:00
Michael Kaufmann
861786f064 fix formfield visibility of ipandports:listen_statement; adjusted settings submit-buttons; fix traffic timescale-selectbox for responsive devices
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-21 10:51:06 +02:00
Michael Kaufmann
e30ad7ef9b added shortcut-add-action link to sidebar menu
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-19 10:16:17 +02:00
Michael Kaufmann
8b87bd055e optimize form-submit buttons on mobile devices
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-19 08:59:32 +02:00
Michael Kaufmann
b9e9cb9377 add subnavigation to hosting-plans
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-19 08:32:48 +02:00
Michael Kaufmann
f07bc950c6 Revert "update github-actions to redirect output as wanted"
This reverts commit 3de0d7ae6e.
2022-10-18 22:38:46 +02:00
Michael Kaufmann
3de0d7ae6e update github-actions to redirect output as wanted
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-18 22:36:19 +02:00
Michael Kaufmann
a2c8096b57 update github-actions to use node16
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-18 22:32:34 +02:00
Michael Kaufmann
e7ccc7bf76 more sub-navigation links; rename 'cancel' to 'discard changes' as it is a form-reset button
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-18 20:39:01 +02:00
Michael Kaufmann
3e1ad050a8 add more subnavigation for customer-email section; correctly display next_to elements when type=label in formfields
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-18 13:52:26 +02:00
Michael Kaufmann
60beaf8440 fix form-control-plaintext color; make non-href action buttons in table-listings <span> instead of <a>; deactivate let's encrypt for froxlor vhost correctly if dns check returns false
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-18 12:20:28 +02:00
Michael Kaufmann
56f5c7b487 fix missing custom_notes for admins/resellers
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-18 09:30:02 +02:00
Michael Kaufmann
5b3db2f096 Merge branch 'main' of github.com:Froxlor/Froxlor 2022-10-18 08:57:48 +02:00
Michael Kaufmann
3e931443f7 fix wrongly-escaping of some form-field values
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-18 08:57:34 +02:00
envoyr
afc821099a add jammy to yes-to-all supported os 2022-10-17 22:28:41 +02:00
envoyr
91cae70b5b fix php version for bookworm and jammy 2022-10-17 22:05:26 +02:00
Michael Kaufmann
c91047bb62 fix custom rss feed for customers on dashboard
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-17 19:30:58 +02:00
Michael Kaufmann
b4ba8f9225 fixing brainfart
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-17 17:29:38 +02:00
Michael Kaufmann
28f6d59336 allow optional length parameter for Froxlor.generatePassword API command
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-17 17:26:13 +02:00
Michael Kaufmann
2987ae5a05 respect newsfeed-visibility-settings; fix typo for saving column-visibility in apikeys; added back-to-overview button in cronjobs-edit; strings fixes
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-17 08:52:58 +02:00
Michael Kaufmann
71274f8f08 rewirk tablecolum js a bit when more than once tablelisting is on one page; do not allow empty column selection
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-16 17:10:57 +02:00
Michael Kaufmann
1704875cea remove unnecessary language selection in login-form
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-16 15:28:30 +02:00
Michael Kaufmann
dd30ab8f93 corrected updating language format and also update default-language of admins/customers to new format
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-16 14:15:19 +02:00
Michael Kaufmann
68c93a17b3 fix column-customizer for non-api based resources; add more no_search=true tags in various tablelistings where search is not available
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-16 13:35:50 +02:00
Michael Kaufmann
64142d2158 dont show search-icon/exclude specific non-searchable fields from overviews
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-16 13:13:26 +02:00
Michael Kaufmann
21954505b2 only set default_theme to fixed value if in update process of 0.10.x to 2.0.0-beta1 (or later)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-16 11:39:30 +02:00
Michael Kaufmann
d3ed765945 fix link to internal frolxor.panel user, thx to Davidd
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-16 11:16:18 +02:00
Michael Kaufmann
1c653c7cb1 only show link to customer when user is admin in Domain::domainWithCustomerLink callback
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-16 09:29:32 +02:00
Michael Kaufmann
4003c53dc4 use correct response field for domain-name in ssl-overview
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-16 09:18:53 +02:00
Michael Kaufmann
7d55b94a91 corrected default sorting field for sslcertificates overview
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-15 12:46:27 +02:00
Michael Kaufmann
f19f7ba936 add default-sorting to dns-record tablelisting; add edit-domain button in ssl-editor
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-15 11:11:05 +02:00
Michael Kaufmann
6953d0f883 minor fixes to fpm/php resources-forms and language-strings
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-13 16:53:36 +02:00
Michael Kaufmann
52857c208a fix standardSuccess language-replacer parameter; if hide-incompatible-settings is activated, also hide settings-overview-panel if incompatible
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-13 11:24:58 +02:00
Michael Kaufmann
a1b5f57f99 fix saving subdomain when only http2 flag has changed; fix superfluous comma in user/form.html.twig
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-10 15:22:00 +02:00
Michael Kaufmann
0757cc25ce fix ftp user passwords
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-07 17:56:51 +02:00
Michael Kaufmann
fb163f8006 minor adjustments in templates
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-07 12:29:11 +02:00
Michael Kaufmann
a37beef18e fix shell-select for customer ftp-accounts if shell is enabled; fix typo in UserCommand
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-06 14:23:56 +02:00
Michael Kaufmann
13c53b074c show search-text on listings with link to remove set filter
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-10-02 10:35:43 +02:00
dependabot[bot]
8bd133b488 Bump twig/twig from 3.4.1 to 3.4.3 (#1055)
Bumps [twig/twig](https://github.com/twigphp/Twig) from 3.4.1 to 3.4.3.
- [Release notes](https://github.com/twigphp/Twig/releases)
- [Changelog](https://github.com/twigphp/Twig/blob/3.x/CHANGELOG)
- [Commits](https://github.com/twigphp/Twig/compare/v3.4.1...v3.4.3)

---
updated-dependencies:
- dependency-name: twig/twig
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-30 20:20:31 +02:00
Michael Kaufmann
e944a886b6 add default-sorting of listings in frontend
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-30 09:44:11 +02:00
Michael Kaufmann
fa826aa87e format diskspace and traffic correctly in recalculate resources
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-26 17:45:46 +02:00
Michael Kaufmann
4701f41e67 fix typo in actions_links merge in form-template
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-26 13:07:06 +02:00
Michael Kaufmann
b1f7cf4bc7 minor language additions and css adjustments
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-20 08:09:53 +02:00
Michael Kaufmann
fd596801e2 use correct classes and not 0.10.x format
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-17 17:20:58 +02:00
Michael Kaufmann
5591bc41b4 add missing update steps of 0.10.x to (last) 0.10.38; more darkmode adjustments
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-17 17:17:09 +02:00
Michael Kaufmann
8f2fbe675a color adjustment for tables rows in darkmode
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-17 12:12:22 +02:00
Michael Kaufmann
11b1688ae6 minor adjustments for darkmode and formfields mandatory-flag for checkboxes
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-16 10:36:06 +02:00
Michael Kaufmann
04a485ca77 minor fixes in darkmode
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-14 20:44:30 +02:00
Michael Kaufmann
7687b27e13 work on darkmode
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-14 11:48:42 +02:00
Michael Kaufmann
8660afc010 adjust ftp and mail to new traffic-data too
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-13 08:53:56 +02:00
Michael Kaufmann
ddedce1671 more work on traffic and npm dependencies update
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-12 21:52:32 +02:00
Michael Kaufmann
15a1ff2f83 translate welcome-screen for unconfigured installations
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-11 17:08:24 +02:00
Michael Kaufmann
589f2b8124 adjust awstats default paths
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-08 16:45:21 +02:00
Michael Kaufmann
2e8e09cb2c rework search-result-window
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-08 15:05:19 +02:00
Michael Kaufmann
5f2f3bee0a DirectoryMatch the start of the folder, not every folder in any subdirectory
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-08 13:13:23 +02:00
Michael Kaufmann
9decb077d3 fixing icons
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-08 13:13:06 +02:00
Michael Kaufmann
1290cbea15 update npm requirements
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-08 10:29:06 +02:00
Michael Kaufmann
bc7e4be47a more work on new traffic view
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-08 10:27:03 +02:00
dependabot[bot]
21c0e27f2f Bump node-forge from 1.2.1 to 1.3.1
Bumps [node-forge](https://github.com/digitalbazaar/forge) from 1.2.1 to 1.3.1.
- [Release notes](https://github.com/digitalbazaar/forge/releases)
- [Changelog](https://github.com/digitalbazaar/forge/blob/main/CHANGELOG.md)
- [Commits](https://github.com/digitalbazaar/forge/compare/v1.2.1...v1.3.1)

---
updated-dependencies:
- dependency-name: node-forge
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-07 14:39:09 +00:00
Michael Kaufmann
6f2652f9dd start work on traffic-view refactoring
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-07 12:56:02 +02:00
Michael Kaufmann
5f95293e0d cleanup language file
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-02 10:11:12 +02:00
Michael Kaufmann
3fdc034f17 minor enhancements in dns-editor
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-02 09:50:18 +02:00
Michael Kaufmann
a7454b00b4 add icon to show admin/customer custom-notes in overview
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-09-01 15:44:38 +02:00
Michael Kaufmann
754b56aba0 fix missing use-statement for new subdomains in php-config setting
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-08-29 19:03:45 +02:00
Michael Kaufmann
5c7f5be5b9 fix generated json for config-services script after install
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-08-26 16:59:43 +02:00
Michael Kaufmann
05634adc66 display which is the default password-hash; fix language selection on login
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-08-26 16:07:40 +02:00
Michael Kaufmann
f47d203215 block access to more folders to enhance security
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-08-26 14:14:00 +02:00
Michael Kaufmann
546040541c add possibility to show subdomains fully in php-settings listing; UI adjustments
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-08-26 09:54:06 +02:00
Michael Kaufmann
7f6ea29e15 correction for mandatory fields in forms
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-08-26 09:06:42 +02:00
Michael Kaufmann
8f64460647 set new beta version for the new major release this year
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-08-25 21:49:26 +02:00
Michael Kaufmann
e5620b22e0 fix preselected values in customer-edit form; adjust version checking to include '-beta' and drop long unused '-svn'
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-08-25 21:42:53 +02:00
Michael Kaufmann
5525b927c1 various minor fixes for issues found by community member awsome
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-08-25 21:02:54 +02:00
envoyr
402dc8cf42 Merge remote-tracking branch 'refs/remotes/origin/0.11-dev' into 0.11-dev 2022-08-21 17:49:21 +02:00
envoyr
b5f5c4f4b5 update admin traffic overview 2022-08-21 17:47:17 +02:00
Michael Kaufmann
bcda1d51c4 added new cli command froxlor:user for unlocking, password-changing and info-display of a user
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-08-21 12:47:20 +02:00
Michael Kaufmann
f389226aae fix styling of deactivated/locked customers in overview and 0-value in edit-form
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-08-21 11:43:25 +02:00
Michael Kaufmann
3ee04a6e75 install-finish-magic
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-08-20 13:44:44 +02:00
Michael Kaufmann
07094f231a minor fixes in installation process
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-08-20 11:21:49 +02:00
Michael Kaufmann
2c9b2c1d67 fixes for finishing installation correctly
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-08-20 10:44:05 +02:00
Michael Kaufmann
9dc95e086d correct Dropdown directory selection; fixes #1044
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-08-16 08:33:37 +02:00
Michael Kaufmann
94a19ee2b6 more minor fixes and code-cleaning
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-08-10 12:01:26 +02:00
Michael Kaufmann
e82d7b5d8b add missing namespaces, fix typo
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-08-10 11:15:06 +02:00
Michael Kaufmann
16a9b18dad fix type of parameter in Validate::validate()
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-08-10 11:06:38 +02:00
Michael Kaufmann
50e35e149c various minor bugfixes; composer requirements update
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-08-10 00:17:11 +02:00
Michael Kaufmann
31500522ce make froxlor_master_cronkjob a froxlor-cli command; secure files/folders in froxlor-virtualhost;
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-08-09 15:49:44 +02:00
Michael Kaufmann
293c0ceb9d move needed view() function declaration above first potential usage
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-07-31 16:45:05 +02:00
Michael Kaufmann
5b3ea24725 add paramter 'mail-notify' to froxlor:update CLI script to notify the system administrator via email about a new version (once per version)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-07-31 16:26:39 +02:00
Michael Kaufmann
fabc68d13f pass mysql_server after adding to Mysqls.get command, do not validate in Mysqls.get if left empty on purpose
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-07-29 09:49:24 +02:00
Michael Kaufmann
dfb2d625c9 use correct target-dbserver to add db and user when using multiple database servers
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-07-29 09:35:11 +02:00
Michael Kaufmann
4d1a6728f6 fix first time updatecheck run when null is returned from Update::getUpdateCheckData()
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-07-24 11:51:32 +02:00
Michael Kaufmann
b6267e610a add interval for external update-check; add parameter 'force' to Froxlor.checkUpdate() API call; fix session/language update when changing language
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-07-24 11:47:10 +02:00
Michael Kaufmann
771d6c483a add onpage mini-search for listings
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-07-23 11:52:22 +02:00
Michael Kaufmann
b48c135d6d re-add image-logo upload in settings
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-07-22 11:44:01 +02:00
Michael Kaufmann
6b36508388 autofocus login field
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-07-22 09:01:21 +02:00
Michael Kaufmann
d6b97399d4 fix missing languages-array for change-language action
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-07-22 08:57:47 +02:00
Michael Kaufmann
8b930f7655 inject success-message to avoid re-sending of form
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-07-22 08:52:52 +02:00
Michael Kaufmann
72d14770de catch php errors to return valid JSON when invoking API, refs #1047
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-07-22 08:37:19 +02:00
Michael Kaufmann
cb3be2556b dont show section if section is not visible completely
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-07-22 08:36:40 +02:00
Michael Kaufmann
b5e613a794 re-add update paths from last 0.9.x 2022-07-22 08:09:18 +02:00
Michael Kaufmann
faba5b0715 update sql-users with their corresponding password-hash-algorithm; remove a few notices for empty values in str_replace and others
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-07-17 12:22:06 +02:00
Michael Kaufmann
430aefe0f7 added input-file option for automatic cli-installation
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-07-08 16:52:22 +02:00
Michael Kaufmann
7c812df4e0 re-enable quota and sieve plugins for dovecot in buster and bullseye config-templates, fixes #1042
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-07-07 15:29:10 +02:00
Michael Kaufmann
f1ad8b6cfd rework FileDir::makePathfield() is mode is 'dropdown' to show all directories correctly (depth limited); fixes #1044
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-07-07 15:28:50 +02:00
Michael Kaufmann
c8183fbbbf avoid accessing api_keys page if not allowed for loggedin user
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-06-30 14:53:58 +02:00
Michael Kaufmann
d4e94c0390 rearrange logfiles-view template contents to suite the overall layout better
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-06-30 14:02:21 +02:00
Michael Kaufmann
546a001092 fix passing complex passwords with special characters to mysqldump in backup-cron; fixes #1038
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-06-28 20:08:40 +02:00
Michael Kaufmann
7f546bb096 store userdata.inc.php when cli-install is finished and passthru config-services command so output can be seen
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-06-22 15:35:22 +02:00
Michael Kaufmann
fca80de995 fixes to install (mostly CLI)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-06-02 20:33:27 +02:00
Michael Kaufmann
bbd754c198 add USERNAME replacer to all email templates; fixes #1032
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-06-01 14:07:01 +02:00
Michael Kaufmann
d545e7e09d add CLI install command (more testing tbd)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-06-01 14:05:18 +02:00
Michael Kaufmann
f3b277237e add missing whitespace after channel-name fir update.noupdatesavail language string
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-26 14:06:32 +02:00
Michael Kaufmann
ceb621b9b5 set update-channel to testing for unittests as long as this branch is not main/stable
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-26 13:50:31 +02:00
Michael Kaufmann
75fedcb7e8 return more detailed message (include update_channel if testing)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-26 13:46:44 +02:00
Michael Kaufmann
66c3694809 fix lng() usage in RunApiCommand-class; fix title-tag content if newerversion=0 in update-check
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-26 13:29:26 +02:00
Michael Kaufmann
282e6f4cd7 update UI version check via AutoUpdate class in Froxlor.checkUpdate()
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-26 13:14:43 +02:00
Michael Kaufmann
ac143b2bbf Merge branch '0.11-dev' of github.com:Froxlor/Froxlor into 0.11-dev 2022-05-26 13:13:57 +02:00
envoyr
3b1250f557 add install/*.json to .gitignore 2022-05-26 13:12:43 +02:00
Michael Kaufmann
3e3ced946f add styling classes to dnszone textarea
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-26 12:29:03 +02:00
Michael Kaufmann
2e72fa8445 use new Language class in formfields
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-26 12:24:44 +02:00
Michael Kaufmann
dbd1fe3846 corrected domain-formfields visibility flag for ssl-related settings
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-26 12:07:55 +02:00
Michael Kaufmann
c087ac18d5 fix wrong number of bound variables when customers_see_all == 0
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-25 18:57:50 +02:00
Michael Kaufmann
ab6a8fefd2 make test-hostname actually an invalid hostname when testing for invalid hostnames
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-24 20:24:37 +02:00
Michael Kaufmann
d8bcf52b3b add frontend for new MysqlServer API command
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-24 19:50:30 +02:00
Michael Kaufmann
7cbc14f4aa enhance MysqlServer.add(), implement MysqlServer.update(), adjusted MysqlServer.get() to be callable by customer if allowed access to the given dbserver
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-24 09:30:09 +02:00
Michael Kaufmann
d3a8c8628e add with_ips parameter to SubDomains.listing() and SubDomains.get(); add column ips/ports to domain tablelisting (admin and customer)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-23 13:50:50 +02:00
Michael Kaufmann
9b5d3aed97 fix emails-edit formfield
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-23 13:07:59 +02:00
Michael Kaufmann
e02164049e add update cli-command; add update-channel setting (stable|testing)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-22 20:18:18 +02:00
Michael Kaufmann
1de39ac39c minor fix in templates due to new Language class + other minor language fixes
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-21 17:29:14 +02:00
Michael Kaufmann
309abc6150 remove some already fixed todo markers
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-21 17:03:34 +02:00
Michael Kaufmann
f6c265dfa1 re-adding the different certificate sources for domains in overview
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-20 15:41:06 +02:00
Michael Kaufmann
fef416ce84 fix show-version check on login/footer-template
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-20 14:50:51 +02:00
envoyr
0311ced7c3 check/uncheck all-checkbox 2022-05-16 14:42:05 +02:00
envoyr
8e85437b4b align switch correctly to the right 2022-05-16 14:06:23 +02:00
Michael Kaufmann
a68db7c80d adjust css/js of global-search; added missing id fields for searchable entities
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-15 19:01:44 +02:00
Michael Kaufmann
e6916de532 do not list column to available columns list if not visible
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-15 18:44:16 +02:00
Michael Kaufmann
14d5c9da6c add more columns for custom-column selection (customer view)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-15 18:39:36 +02:00
Michael Kaufmann
b12d9abaf2 add more columns for custom-column selection (admin view)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-15 17:50:12 +02:00
Michael Kaufmann
a5115414a8 verify 2FA code once before storing secret and activation for login to be sure it works; fixes #1030
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-15 12:27:48 +02:00
Michael Kaufmann
dd896659ae dynamically load dns-record help-text for selected dns-type; fixes #719
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-15 11:45:50 +02:00
Michael Kaufmann
ed7faae947 output preflight-checks nicely
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-15 10:27:46 +02:00
Michael Kaufmann
07a1ad8c58 add date/datetime input fields to relevant formfields
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-15 10:07:25 +02:00
Michael Kaufmann
4d5473ff14 translate new install-language-string to german
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-14 14:10:29 +02:00
Michael Kaufmann
616334284b migrate old replacer format in lng files
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-13 16:50:27 +02:00
Michael Kaufmann
fb38e0e21d add basic/advanced switcher for installation-mode
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-13 15:15:20 +02:00
Michael Kaufmann
7e14e9edd7 minor ui/lang adjustments; add security question for backup-abort action
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-13 11:22:14 +02:00
Michael Kaufmann
cc11e2de51 avoid jumping through install steps by url-manipulating; fix pre-selections of select-multiple-settings values;
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-12 14:53:22 +02:00
Michael Kaufmann
300db4602b fixes to installation and sequence of events in there
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-12 13:38:34 +02:00
Michael Kaufmann
cb3143e76d possibility to specify both ipv4 and ipv6
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-11 16:51:27 +02:00
envoyr
4c9b6adb1f merge branch '0.11-dev' of github.com:Froxlor/Froxlor into 0.11-dev 2022-05-11 16:27:04 +02:00
envoyr
5cab0e46bd small fixes for error reporting 2022-05-11 16:26:41 +02:00
Michael Kaufmann
da0136650e base for simple/extended install-mode
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-11 16:26:09 +02:00
Michael Kaufmann
56e4739b98 fix wrong sql-field for cronjobs_run description
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-11 11:35:10 +02:00
Michael Kaufmann
3adc5dc119 remove config-templates for centos; unmaintained and rarely used - also voted on discord to be removed
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-09 08:51:45 +02:00
Michael Kaufmann
ed73dbb5f3 set default-ca for acme.sh after updating acme.sh
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-09 08:40:09 +02:00
Michael Kaufmann
7dd96ff6bd also adjust error messages when adding admins + fix phpunit tests
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-08 13:28:57 +02:00
Michael Kaufmann
31b79d6471 distinct error messages for loginname begins with customer.prefix and loginname exists on the system
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-08 13:22:14 +02:00
Michael Kaufmann
d42e71fa9f small adjustments to install when ssl is activated and gentoo-config-templates
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-07 13:23:32 +02:00
Michael Kaufmann
2ae67c39fd fix wrong checkbox markup for install-specific checkboxes
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-06 17:02:57 +02:00
Michael Kaufmann
008cbc964f fixes and adjustments (+ notes) to install (on gentoo)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-06 16:23:11 +02:00
Michael Kaufmann
ac638041fa check for supported distribution in config-services parameter 'yes-to-all'
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-06 14:13:52 +02:00
Michael Kaufmann
b15d452981 enable re-selecting of system-distribution; move some distribution-related settings which are adjusted via installation to config-templates 'defaults'
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-06 10:19:19 +02:00
Michael Kaufmann
d0eaf12b34 fix checkbox-value for installation; fix session-initialization; preselect various guessable fields to ease installation
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-05 17:26:28 +02:00
Michael Kaufmann
65eeab299d set values for finishing json-parameter string for config-services call
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-05 16:12:36 +02:00
Michael Kaufmann
df6df4c5d3 validating input of install
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-05 15:02:09 +02:00
Michael Kaufmann
ad49a63eae use floating labels for installation, looks less confusing
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-04 15:35:48 +02:00
Michael Kaufmann
f67d596866 language enhancements and tiny fixes in new installation
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-04 14:15:19 +02:00
Michael Kaufmann
f8386062cf create self-signed certificate as last fallback if system-wide cert/key file cannot be found; add english translations for installation (wip)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-02 19:16:58 +02:00
Michael Kaufmann
c4a2d87d70 use PhpHelper::parseArrayToPhpFile in new MysqlServer API command; show asterisk for mandatory fields in formfields; add ssl-flag for ssl-enabled ip in installation
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-02 10:00:59 +02:00
Michael Kaufmann
00a3424f65 resolve old lng-references
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-02 08:56:39 +02:00
Michael Kaufmann
7b6d5f1642 add Crypt::createSelfSignedCertificate; bugfix display of no-ssl-ip in domain-add formfield
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-02 08:33:42 +02:00
envoyr
82ea54863d added more fields and defaults 2022-05-01 18:27:00 +02:00
envoyr
fb8143991c merge branch '0.11-dev' of github.com:Froxlor/Froxlor into 0.11-dev 2022-05-01 17:27:36 +02:00
envoyr
86e01191d2 make a more complete version of the installer 2022-05-01 17:26:51 +02:00
Michael Kaufmann
0535420334 possibility to use complete string-identifier paths in standard_error and standard_success
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-01 17:08:22 +02:00
Michael Kaufmann
54b467887b use correct array-structure for output of preconfig
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-01 16:58:51 +02:00
Michael Kaufmann
c59c5efc11 migrate update/preconfig to a more OOP way and remove unnecessary file/dir complexity
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-05-01 16:48:43 +02:00
envoyr
1557482d17 merge branch '0.11-dev' of github.com:Froxlor/Froxlor into 0.11-dev 2022-05-01 13:48:12 +02:00
envoyr
b9bb689796 add array to string/file helper 2022-05-01 13:47:50 +02:00
Michael Kaufmann
e768d834c1 add new setting to preselect system distribution to ease configuration
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-30 14:01:49 +02:00
Michael Kaufmann
14c86d3d21 add cli parameter -s to froxlor:api-call to show possible command-parameters
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-30 13:11:33 +02:00
envoyr
98c7c81fb8 merge branch '0.11-dev' of github.com:Froxlor/Froxlor into 0.11-dev 2022-04-30 11:59:58 +02:00
envoyr
4ea31c7124 update installer class and ui 2022-04-30 11:59:38 +02:00
Michael Kaufmann
c7226a16d2 make selection of config-services downloadable as json e.g. for config-services script
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-30 11:26:39 +02:00
Michael Kaufmann
422950d386 add cli command to run API commands
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-30 10:18:09 +02:00
Michael Kaufmann
9b064cdcce more php8.1 compatibility
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-29 18:01:59 +02:00
Michael Kaufmann
3065b5fbf9 unittests / php8.1
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-29 17:51:31 +02:00
Michael Kaufmann
10313d9058 fix allowed_myserver parameter in unit-test
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-29 17:02:01 +02:00
Michael Kaufmann
449897039c add testing for mysql-server/customer-update of allowed_mysqlserver; beautify config-command/file details
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-29 16:53:01 +02:00
Michael Kaufmann
bff499caed hopefully the last language migrations needed
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-29 10:33:42 +02:00
Michael Kaufmann
9ab185a71c even more language migration/fixing
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-29 10:23:45 +02:00
Michael Kaufmann
6116dda9bb more language migrations
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-29 10:01:58 +02:00
Michael Kaufmann
0dc77997fe more language cleanup and adding mysql-servers to customer add/delete in UI
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-29 09:36:46 +02:00
Michael Kaufmann
fe747b321c fix unit-tests with new language-class; fix language access in standard_error/standard_success; add MysqlServer API command and possibility to allow/disallow customers available mysql-servers
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-29 08:55:07 +02:00
envoyr
4f4c71d79b major refactoring of almost all files 2022-04-28 20:48:00 +02:00
Michael Kaufmann
a2e95b960f use new language class in API
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-28 18:14:00 +02:00
envoyr
373dfa7ad9 merge branch '0.11-dev' of github.com:Froxlor/Froxlor into 0.11-dev 2022-04-28 17:43:36 +02:00
envoyr
3d7d03b1f5 fix language strings in formfiles, navigation and tablelisting 2022-04-28 17:43:12 +02:00
Michael Kaufmann
450c682e7f try to fix github actions with new install/froxlor.sql.php; migrate update-functions into class
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-28 17:42:41 +02:00
Michael Kaufmann
6cc8ab0fb4 additional removes for new language mgmt; combined pre-requirement checks for cli commands; removed updaters for 0.9.x and 0.10.x (the last 0.10.x will be upgradable to 0.11.x of course)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-28 17:11:40 +02:00
envoyr
da89315a10 fix view function in init and update dirname level in install 2022-04-28 16:57:35 +02:00
envoyr
5d08d5235d major changes in language management and installer 2022-04-28 16:49:11 +02:00
Michael Kaufmann
f2ea821948 forgot to save one more file, again fix wrong visible-callback for ssl-editor in domain-listing
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-25 09:05:58 +02:00
Michael Kaufmann
0c647e0acb fix wrong visible-callback for ssl-editor in domain-listing; fix adding new certificate via form; don't show logs-icon when domain is email_only
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-25 08:36:11 +02:00
Michael Kaufmann
eb8b17efd7 update debian/ubuntu instructions
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-24 18:48:44 +02:00
Michael Kaufmann
57eeca5818 fix missing $ for a variable in Lighttpd-class
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-24 18:44:39 +02:00
Michael Kaufmann
1adb095918 corrections in config-templates
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-24 13:20:34 +02:00
Michael Kaufmann
b5794e463f add icon to display detailed commands/file-contents from config-templates in admin_configfiles
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-24 11:08:09 +02:00
Michael Kaufmann
000cb93def updating config-file xml's; prepare config-details view via ajax for config-commands/files to show in configuration
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-23 19:42:23 +02:00
envoyr
91d41af44a add button to restore table column defaults and ux improvements 2022-04-23 18:59:25 +02:00
envoyr
6ca071a31f merge branch '0.11-dev' of github.com:Froxlor/Froxlor into 0.11-dev 2022-04-23 16:11:51 +02:00
envoyr
3f17e893b5 add bootstrap to global variable 2022-04-23 16:11:43 +02:00
Michael Kaufmann
7178b49101 add security question when deleting api-key
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-23 10:00:41 +02:00
Michael Kaufmann
d267f408eb re-add contextual classes to domain-entry depending on deactivated/termination_date
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-22 14:29:36 +02:00
Michael Kaufmann
68fcfd2cf5 fix ajax responses; re-add statistics link to main-domains for customers
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-22 13:52:08 +02:00
Michael Kaufmann
8c1621cced fix deprecated jquery calls; move editapikey jq call to Ajax.php; fix edit of apikeys::allowed_from and allow cidr
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-22 13:17:09 +02:00
envoyr
a615b04eb4 add function to manage table columns 2022-04-22 10:59:56 +02:00
envoyr
03df082cf2 merge branch '0.11-dev' of github.com:Froxlor/Froxlor into 0.11-dev 2022-04-22 10:37:13 +02:00
Michael Kaufmann
b869c84f4d add new IPTools class; add new callback to show link to domain in domain-overview; validate possible allowed_ip-ranges in FroxlorRPC; fix possible duplicate ips for mysql-access-host in installation
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-22 10:36:46 +02:00
envoyr
5752222baa update alert ui 2022-04-21 20:02:14 +02:00
envoyr
d3ae4c5d72 improve error messages and language 2022-04-21 19:07:14 +02:00
envoyr
e638511826 merge branch '0.11-dev' of github.com:Froxlor/Froxlor into 0.11-dev 2022-04-21 18:20:13 +02:00
envoyr
cb7f180d8d update cron fpm config builder and webpack assets 2022-04-21 18:19:23 +02:00
Michael Kaufmann
f82d78ad5d add 'back to overview' links when adding/editing entities
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-20 17:08:49 +02:00
Michael Kaufmann
35a8fe7372 Merge branch '0.11-dev' of github.com:Froxlor/Froxlor into 0.11-dev 2022-04-20 17:06:57 +02:00
envoyr
16c38b4066 merge branch '0.11-dev' of https://github.com/Froxlor/Froxlor into 0.11-dev 2022-04-20 17:01:33 +02:00
envoyr
8c942178d2 fix font assets path, logo path, database installation and checks 2022-04-20 17:01:25 +02:00
Michael Kaufmann
74021ae142 fix ftp-action-links in listing; fix display of running/scheduled backup-job
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-20 16:51:40 +02:00
Michael Kaufmann
949f258f54 reflect same permission requirement for documentroot in Domains.add() and Domains.update()
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-20 16:18:02 +02:00
Michael Kaufmann
b1191917b8 avoid redirect-loop when displaying error in admin-autoupdate; fix description for 'move to domain to other customer'
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-20 16:12:42 +02:00
Michael Kaufmann
ebceab96b4 introduce static configs to enable/disable web-update (and possibly more later on)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-20 15:18:50 +02:00
Michael Kaufmann
b362c1f232 remove unused IgnorantRecursiveDirectoryIterator and fix uninitialized variables
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-20 15:13:35 +02:00
Michael Kaufmann
58c646f59e allow api interaction via kind-of-RESTful style via api.php?/module/command/
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-17 20:59:25 +02:00
Michael Kaufmann
d1dda00a1c Merge branch '0.11-dev' of github.com:Froxlor/Froxlor into 0.11-dev 2022-04-17 17:18:13 +02:00
Michael Kaufmann
9f0253819b adjustments
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-17 17:18:09 +02:00
Dennis Dudek
25d9c52c58 remove unnecessary ternaries (#1027)
* remove unnecessary ternaries

* fix: !($id <= 0);

* remove ternary
2022-04-14 09:02:10 +02:00
Dennis Dudek
d90676a793 Optimised phpdoc and array value use in foreach (#1026)
* use array values by already destructed values in foreach
corrected php docs to use string|array

* use values by already desctructered array values in foreach
2022-04-13 10:37:25 +02:00
Dennis Dudek
7a13e4a421 remove nested dirname and use level parameter for better readability (#1025) 2022-04-13 10:14:03 +02:00
Michael Kaufmann
3fbf23cb47 switch from crypt() to password_hash() and password_verify(), thx to kapsonfire for the hint
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-10 14:35:20 +02:00
Michael Kaufmann
90682b774a fine-tuning configservices cli script
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-10 14:32:43 +02:00
envoyr
cf19331f75 Merge branch '0.11-dev' of github.com:Froxlor/Froxlor into 0.11-dev 2022-04-10 13:41:19 +02:00
envoyr
e9d1f9d68f update search 2022-04-10 13:41:07 +02:00
Michael Kaufmann
5081d6d916 fix php compatibility hopefully for real now
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-10 10:29:43 +02:00
Michael Kaufmann
f540ed4eb5 require correct version of symfony/console to be php7.4 compatible
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-10 10:15:29 +02:00
Michael Kaufmann
0f4325f68d migrate shell/helper scripts to symfony/console components
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-10 10:05:21 +02:00
Michael Kaufmann
7f0eb97f9b show apikey details in modal-overlay; todo: edit allowed_from and valid_until
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-09 13:32:08 +02:00
Michael Kaufmann
9272c15706 add advanced_mode flag to various settings; exclude from output and global-search when settings-mode is 'basic'
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-08 18:41:28 +02:00
Michael Kaufmann
578b2811a5 add new settings_mode setting to switch between basic and advanced view
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-08 15:53:20 +02:00
Michael Kaufmann
01c6096998 use correct (new) class to call getThemes()
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-03 23:00:14 +02:00
Michael Kaufmann
2bb5c31a0f use correct method to get CurrentUser data-field
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-03 20:04:55 +02:00
Michael Kaufmann
64994e6444 don't try to globalsearch specific 'settings' search
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-03 18:56:40 +02:00
Michael Kaufmann
a4b780e7f7 don't search setting when using specific search and not settings: specified
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-03 18:54:37 +02:00
Michael Kaufmann
7779ec376a remove unused lib/version.inc.php file; added module-specific search to global-search; added new table for user-column-settings
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-03 18:42:49 +02:00
Michael Kaufmann
07049909ef remove accidentally added character
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-03 14:44:13 +02:00
Michael Kaufmann
c7833beff4 fix exit statement in cli scripts
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-03 14:42:02 +02:00
Michael Kaufmann
d18fa771f4 respect domain.writeerrorlog and domain.writeaccesslog when using log-to-pipe
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-03 14:35:09 +02:00
Michael Kaufmann
1441ed9a99 make search-result links a filter/search for the overview instead of the direct edit-link; show number of total entries in overview; show 'back to overview' button when showing search-result
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-01 16:47:22 +02:00
Michael Kaufmann
0312548e88 don't rely on executable flag for php-sessionclean script
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-01 14:48:55 +02:00
Michael Kaufmann
ef04d6532a fix phpunit-tests for dev-versions
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-01 10:36:27 +02:00
Michael Kaufmann
eacf383928 set valid version
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-01 10:32:39 +02:00
Michael Kaufmann
5f0429ef77 set development version to 0.11.0-dev
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-01 10:27:37 +02:00
Michael Kaufmann
78a4c109e4 validate sql_search and sql_orderby API parameters, fix unit-tests as of new default skin is 'Froxlor'
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-04-01 09:37:07 +02:00
envoyr
6ce2afa6a4 remove compiled assets from git 2022-03-27 16:02:07 +02:00
envoyr
957f41ae87 update default theme in froxlor.sql 2022-03-27 15:36:13 +02:00
Michael Kaufmann
4e8fddadff fix filename of template
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-27 15:00:44 +02:00
Michael Kaufmann
60433358f6 remove Sparkle-theme (old template-engine)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-27 14:59:17 +02:00
Michael Kaufmann
fb7091403c migrate recalc.resource-usage
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-27 14:58:52 +02:00
Michael Kaufmann
51ba6c757e migrate customer::backups
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-27 13:19:26 +02:00
Michael Kaufmann
943301e908 refactor error-reporting for admin/customer; remove now unused Froxlor\UI\Template class
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-27 12:44:44 +02:00
FliegenKLATSCH
2a91dafe20 Fix distro in postfix smtpd banner (#1014) 2022-03-27 11:11:05 +02:00
Michael Kaufmann
0b7443e875 refactor admin_acpuinfo
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-26 16:47:46 +01:00
FliegenKLATSCH
1d455ec4fb Set RC 1 if an exception occured (#1013) 2022-03-26 14:09:18 +01:00
Michael Kaufmann
439635d329 fix typo and re-add button to reset opcache in opcache-overview
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-26 14:09:16 +01:00
Michael Kaufmann
82fc148d8e migrate admin_opcacheinfo
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-25 09:32:33 +01:00
Michael Kaufmann
9a9089cde3 a few old session-variable leftovers
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-25 08:11:31 +01:00
Michael Kaufmann
2b53c4b918 migrate phpinfo page
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-24 15:10:00 +01:00
Michael Kaufmann
04a08f9095 add empty index.html file to all folders to avoid accidental folder-content disclosure if 'Options Indexes' is set for a (parent)folder containing froxlor in webserver-config
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-24 14:35:30 +01:00
Michael Kaufmann
bf41c84c6a migrate admin_settings::testmail
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-24 14:25:29 +01:00
Michael Kaufmann
25b9e5b540 migrated admin_messages; minor fixes in admin-listing and ipsandports::add defaults
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-24 13:40:43 +01:00
Michael Kaufmann
66f97738c2 added more entities to globalsearch (customer-side)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-21 09:07:43 +01:00
Michael Kaufmann
59682ba620 added a few more entities to globalsearch (admin-side)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-20 09:53:30 +01:00
Michael Kaufmann
860306b855 adjustments in ssl-certificates for customers; fix change-password for customers
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-18 19:25:25 +01:00
Michael Kaufmann
c1f4ee4e05 fully migrate admin_updates; removed unused Froxlor\UI\Paging;
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-18 16:11:56 +01:00
envoyr
69895943bd update ui class and traffic stats 2022-03-18 12:53:34 +01:00
Michael Kaufmann
ba0d33392c 2fa template migration; fix menu-active-state; removed unused code from UI/HTML-class
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-18 11:41:07 +01:00
Michael Kaufmann
12bf7db481 add language strings for configfiles
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-18 10:28:02 +01:00
Michael Kaufmann
406b9241ce fix user/form heading-icon; re-add button to set panel configured manually
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-18 10:04:33 +01:00
Michael Kaufmann
974e02694e first refactor of config-files
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-18 09:37:50 +01:00
Michael Kaufmann
dc798c63c7 migrate admin-autoupdate
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-16 14:32:10 +01:00
Michael Kaufmann
d30c9a2ff7 migrated ssl-editor; also usable as admin now
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-16 13:54:57 +01:00
Michael Kaufmann
401eb60062 admin-updates, settings-import and some minor ui tweaks
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-16 13:22:59 +01:00
Michael Kaufmann
d25c5ec4dd tiny fixes in customer_email
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-15 09:06:02 +01:00
Michael Kaufmann
6a9c2b8fdf remove old/unused javascript files
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-15 09:05:25 +01:00
Michael Kaufmann
0d282d29d8 move email settings to the top and hide then optional domain-settings when adding/editing domain as admin; fixes #1012
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-15 09:05:05 +01:00
Michael Kaufmann
af6b5f0ec5 correctly secure session-cookie
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-14 23:08:11 +01:00
Michael Kaufmann
164b46ece3 get rid of session variable in URL
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-14 22:51:59 +01:00
Michael Kaufmann
2972d95e8b use new form style for settings too
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-14 18:36:34 +01:00
envoyr
2c5c0258bf multiple ui improvements 2022-03-14 18:18:35 +01:00
Michael Kaufmann
31fbe434b4 domain import form
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-14 17:29:16 +01:00
Michael Kaufmann
21228b5359 style apikeys and integrity-check
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-14 12:36:53 +01:00
Michael Kaufmann
05cc08c376 add dns-editor in twig/tablelisting/formfield
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-14 11:13:21 +01:00
Michael Kaufmann
237476b30d add parsedown for markdown-usage in a few cases
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-13 16:33:57 +01:00
Michael Kaufmann
7e9e89e1fd handle speciallogfile-warning-note when editing domain as admin
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-13 16:16:48 +01:00
Michael Kaufmann
343339d510 generated css/js
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-13 12:21:10 +01:00
Michael Kaufmann
9a524da5b4 re-add some of the js/ajax actions
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-13 12:16:42 +01:00
Michael Kaufmann
b098dd1e15 correct alias-domainid for reverse-lookup-search
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-11 17:07:26 +01:00
Michael Kaufmann
e4144d8c6a logfiles view to twig
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-11 16:20:16 +01:00
Michael Kaufmann
9c60cf006f fomfields for admin/domains and some fixes in tablelistings
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-10 16:39:49 +01:00
Michael Kaufmann
5def8c1635 Merge branch '0.11-dev' of github.com:Froxlor/Froxlor into 0.11-dev 2022-03-09 14:10:47 +01:00
Michael Kaufmann
f236896764 use prepared statements for global-search
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-09 14:10:44 +01:00
envoyr
7e78bc6dd1 removed typeahead 2022-03-08 21:53:41 +01:00
envoyr
ba1a16b39e update search 2022-03-08 21:29:14 +01:00
Michael Kaufmann
1a40c9ba17 restructure searchresult
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-08 17:33:21 +01:00
Michael Kaufmann
218028de2b add userinfo to ajax calls; combine settings and global-search to one
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-08 16:57:55 +01:00
Michael Kaufmann
f758d0d943 fix installation for mariadb-10.5; minor fixes for global search later
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-07 18:43:06 +01:00
Michael Kaufmann
3c20fe4202 fix settings-search
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-07 10:37:00 +01:00
envoyr
958e783e77 add favicon 2022-03-06 20:55:04 +01:00
envoyr
bc64c82119 add language to ajax and typeahead 2022-03-06 20:54:36 +01:00
envoyr
3da11ca7fb remove incorrectly created files 2022-03-06 19:42:48 +01:00
Michael Kaufmann
3f9769103b function for setting-search
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-06 10:59:55 +01:00
Michael Kaufmann
a3a33c0da4 mail & filetemplates listing/forms
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-06 09:43:06 +01:00
Michael Kaufmann
54ce296018 some work on mail/file template formfields
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-05 11:46:35 +01:00
Michael Kaufmann
8256f31374 minor fixes in pagination and alertbox stuff
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-04 16:12:25 +01:00
Michael Kaufmann
30d64973c3 fix pagination back links
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-04 12:19:40 +01:00
Michael Kaufmann
7b28a33aba fix nav-sections to be open when active; show error if customer has no (email)domain assigned when trying to add a new address
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-04 10:47:22 +01:00
Michael Kaufmann
0c93a5166b admin_cronjobs form and admin/customer logger overview
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-04 10:21:45 +01:00
Michael Kaufmann
56f51703c7 testing api-key listing
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-03-03 19:19:18 +01:00
envoyr
7a26ade8de update preview image to english version 2022-02-28 19:08:28 +01:00
envoyr
49b77f9ed0 Merge branch '0.11-dev' of github.com:Froxlor/Froxlor into 0.11-dev 2022-02-28 18:54:29 +01:00
envoyr
289498296d update preview image 2022-02-28 18:54:07 +01:00
Michael Kaufmann
bd1e5c83e6 fix tablelisting in customer_extras; formatting js files
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-28 13:57:53 +01:00
envoyr
8742c9302e update icons 2022-02-28 13:54:39 +01:00
envoyr
95f2e63ac8 fix data when no field is set 2022-02-28 13:45:06 +01:00
envoyr
8f6f85ea8e update listing, handle fields with or without callbacks or callbacks only 2022-02-28 13:28:57 +01:00
Michael Kaufmann
8ff6e71729 tablelisting fpmdaemons
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-28 12:10:44 +01:00
Michael Kaufmann
5133d26f6f more tablelistings and php-related formfields
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-28 10:51:19 +01:00
envoyr
bebdb3a93f optimize spacing and imports of tabellisting 2022-02-28 09:33:32 +01:00
envoyr
4fc84652c5 forget to push spacing 2022-02-28 09:30:49 +01:00
envoyr
1c228c9ba9 fix class name and spacing 2022-02-28 09:28:13 +01:00
Michael Kaufmann
5b961be0f8 enhanced listing actions
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-28 09:21:04 +01:00
envoyr
2b771b11d6 fix usage info 2022-02-28 09:01:29 +01:00
envoyr
fb9dccc94a update naming 2022-02-27 21:10:23 +01:00
envoyr
639a262599 implement visible callbacks for tabellisting 2022-02-27 20:53:24 +01:00
envoyr
3186c2b37d rename tabellisting column to filed 2022-02-27 20:04:40 +01:00
Michael Kaufmann
f1e91af58a show note if no entries exist for a listing
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-27 18:54:36 +01:00
envoyr
1a6b899c67 refactoring callbacks, add class for table rows 2022-02-27 16:36:23 +01:00
Michael Kaufmann
d9f909150d more work on settings
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-27 16:03:24 +01:00
Michael Kaufmann
a73f6ffef5 forgot to save
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-27 14:37:32 +01:00
Michael Kaufmann
ab5ffc7545 beginning of rework/redesign of settings
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-27 14:34:05 +01:00
envoyr
c48a22a58e fix pagination and collections 2022-02-25 21:56:12 +01:00
envoyr
fb6660b78a add editorconfig 2022-02-25 21:25:15 +01:00
envoyr
d48baf0cb5 Merge branch '0.11-dev' of github.com:Froxlor/Froxlor into 0.11-dev 2022-02-25 21:17:45 +01:00
envoyr
7cfdf80a14 update listing and add pagination 2022-02-25 20:52:09 +01:00
Michael Kaufmann
6b5cabb125 more overview/actions-links
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-25 20:41:48 +01:00
Michael Kaufmann
fc4725cd61 more action-menu and info-box testing for overviews
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-25 20:13:13 +01:00
Michael Kaufmann
cdc4eccdd9 action-menu and info-box testing for overviews
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-25 19:36:22 +01:00
Michael Kaufmann
8c6452bb05 customer-extras overviews
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-25 17:17:29 +01:00
Michael Kaufmann
01798650fe fix unittests for FroxlorRPC-class round #3 (maybe)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-25 15:51:26 +01:00
Michael Kaufmann
5d7649a274 fix unittests for FroxlorRPC-class again (maybe)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-25 15:42:25 +01:00
Michael Kaufmann
bbc3644e23 fix unittests for FroxlorRPC-class (maybe)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-25 15:32:05 +01:00
Michael Kaufmann
d933549646 don't send header() on CLI environment
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-25 15:16:59 +01:00
Michael Kaufmann
1faa9f17ab minor icon tweaks
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-25 14:30:38 +01:00
Michael Kaufmann
038b6f9510 customer ftp/mysql listing
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-25 14:25:58 +01:00
Michael Kaufmann
c7cc2d4357 email listing
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-25 11:22:00 +01:00
Michael Kaufmann
5b675c25a3 don't show SU link for yourself
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-25 10:10:47 +01:00
Michael Kaufmann
c2ec309a01 more work on tablelisting
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-25 09:52:35 +01:00
envoyr
5964c3b685 update listing, collections and callbacks 2022-02-24 21:39:31 +01:00
envoyr
703e436b32 Merge branch '0.11-dev' of github.com:Froxlor/Froxlor into 0.11-dev 2022-02-24 15:39:04 +01:00
envoyr
9b184a758e format href to link if it is a linker array 2022-02-24 15:38:10 +01:00
Michael Kaufmann
6c71bbbcb0 Merge remote-tracking branch 'origin/master' into 0.11-dev 2022-02-24 08:51:56 +01:00
Michael Kaufmann
84f5de42a9 move php-sessionclean script to scripts-dir instead of install/scripts/; add cronjob calling php-sessionclean if php-fpm is enabled; remove testing-note for let's encrypt in german language file
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-24 08:49:36 +01:00
Michael Kaufmann
dcdc63679c fix language for options in tables
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-24 08:32:58 +01:00
envoyr
92ba16aa7f Merge branch '0.11-dev' of github.com:Froxlor/Froxlor into 0.11-dev 2022-02-23 18:28:13 +01:00
envoyr
c4940897a3 add actions to the listing 2022-02-23 18:24:51 +01:00
Michael Kaufmann
af50eb5462 small enhancements to Collection
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-23 17:57:10 +01:00
Michael Kaufmann
511c219d19 forgot a line of old code
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-23 17:41:31 +01:00
Michael Kaufmann
8c2a4aeec4 add tablisting.ipsandports
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-23 17:40:36 +01:00
envoyr
04263cb69f update tabellisting and callbacks, make columns invisible 2022-02-23 17:33:54 +01:00
envoyr
4e4e4eca94 move html from callbacks to twig 2022-02-23 16:27:13 +01:00
Michael Kaufmann
9177273484 more progressbar stuff
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-23 09:55:23 +01:00
Michael Kaufmann
b11f466a0a progressbar callback to behave like 0.10.x
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-23 09:27:52 +01:00
Michael Kaufmann
fca96864c6 Merge branch '0.11-dev' of github.com:Froxlor/Froxlor into 0.11-dev 2022-02-22 19:31:32 +01:00
Michael Kaufmann
56519b4072 more work on add/edit forms
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-22 19:31:28 +01:00
envoyr
2317930263 add decimal places to numbers 2022-02-22 19:18:36 +01:00
envoyr
4af1dff6fd fix titles 2022-02-22 19:10:53 +01:00
envoyr
8f7876b850 update table listing and add callbacks 2022-02-22 19:07:04 +01:00
envoyr
855e220d14 update table and add listing and collection class 2022-02-22 17:09:36 +01:00
Michael Kaufmann
5f2550e19c Merge branch '0.11-dev' of github.com:Froxlor/Froxlor into 0.11-dev 2022-02-22 11:37:38 +01:00
Michael Kaufmann
1974cb5217 do updatecheck
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-22 11:37:30 +01:00
envoyr
51d441b4e9 update admins and customers page 2022-02-21 20:34:58 +01:00
envoyr
60029ba1c3 Merge branch '0.11-dev' of github.com:Froxlor/Froxlor into 0.11-dev 2022-02-21 19:29:48 +01:00
envoyr
ffe536a57f make tables more customizable 2022-02-21 19:29:34 +01:00
Michael Kaufmann
322719fec8 lot of formfield corrections; form-adjustments; implementing of add/edit for most customer_* pages
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-21 17:42:04 +01:00
envoyr
1e4da4850e hardening requests 2022-02-20 18:30:57 +01:00
envoyr
e057314795 update templates introduce request helper 2022-02-20 18:00:59 +01:00
Michael Kaufmann
e0540ceb7c more work on formfields and display
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-20 16:53:47 +01:00
Michael Kaufmann
e6d12be7b3 update some more formfields; improved formfields with wrapper fieldrow()-macro to reduce duplicate markup; enable next_to functionality for some fields
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-20 12:50:29 +01:00
envoyr
23ecc40b1a fix standard error response 2022-02-20 11:45:45 +01:00
envoyr
ddc53e87fa fix response 2022-02-20 11:42:52 +01:00
envoyr
424a00b39e update api and ajax handling and response 2022-02-20 11:38:08 +01:00
Michael Kaufmann
d5e53cc7db check session in lib/ajax if we're going to do more than just reading the newsfeed
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-19 13:58:12 +01:00
Michael Kaufmann
90d2333eef change port field in ipsandports to type-number
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-19 11:15:03 +01:00
Michael Kaufmann
0b61bd9a79 migrate ipsandports.add/edit
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-18 22:33:59 +01:00
Michael Kaufmann
ef4feb07e6 migrate admin.add/edit
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-18 22:19:36 +01:00
Michael Kaufmann
357e97e1ca fix padding-top of heading
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-18 21:54:54 +01:00
Michael Kaufmann
06f77b41fd fix install-requirement messages for php
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-18 21:14:06 +01:00
envoyr
36dbb3bdcc set minimum php version to 7.4 and fix templates 2022-02-18 18:50:45 +01:00
envoyr
e1b09e49fd add missing froxlor-details 2022-02-18 17:42:47 +01:00
envoyr
36b87971fb fix row cols 2022-02-18 17:28:26 +01:00
envoyr
8b2ba97823 update templates and base structure 2022-02-18 17:06:23 +01:00
Michael Kaufmann
14008d1432 dashboard-resource-items
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-18 14:44:26 +01:00
Michael Kaufmann
c1c09da18d more cleanup in admin_customers for add/edit form
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-18 12:41:49 +01:00
Michael Kaufmann
0fd7b9a551 forgot to add a file
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-18 10:46:39 +01:00
Michael Kaufmann
829b99bc06 first form-migrate tests with customer-add-form
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-18 10:42:02 +01:00
Michael Kaufmann
28526b4544 add change pwd|lang|theme; twig-ify standard_error()
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-17 22:03:09 +01:00
Michael Kaufmann
9dce16e5c7 kinda fix error-handlers; more work on admin-dashboard
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-17 17:23:04 +01:00
envoyr
b4d9b1037d add dark mode 2022-02-17 15:30:05 +01:00
Michael Kaufmann
5d80c40b25 a bit more dashboard work
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-17 14:57:08 +01:00
Michael Kaufmann
f836342ff2 newsfeed + more admin dashboard info
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-17 13:58:29 +01:00
Michael Kaufmann
402a91c841 minor adjustments for mobile in dashboard; color-adjustments
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-17 12:15:47 +01:00
Michael Kaufmann
181fa96431 first work on dashboard template (admin and customer)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-17 12:01:54 +01:00
envoyr
96b2b2e065 add missing css 2022-02-17 08:13:32 +01:00
Michael Kaufmann
f930565d45 forgot-password function on login
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-16 21:08:25 +01:00
envoyr
14111583f1 merge changes into branch 2022-02-16 20:37:10 +01:00
envoyr
a4d6d183ff update base structure 2022-02-16 20:29:42 +01:00
Michael Kaufmann
0be8b9c313 beautification and mobile-fixes
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-16 16:47:18 +01:00
Michael Kaufmann
91197bcff2 update composer.json and fix dependencies for php <8.0 to stay 7.4 compatible
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-16 15:32:48 +01:00
Michael Kaufmann
2a3262ef45 actually show admin-dashboard
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-16 15:00:27 +01:00
Michael Kaufmann
759d11d1a0 add userarea-layout + sidebar and topmenu
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-16 14:54:06 +01:00
envoyr
4fd6ebf5b7 fix jquery 2022-02-16 12:37:28 +01:00
envoyr
f8a00a5f1e fix javascript and images, update css 2022-02-16 11:59:52 +01:00
Maurice Preuß
f7db5497af 0.11 dev (#1010)
* update layout and bootstrap package

* update templates

Co-authored-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-16 09:57:17 +01:00
Michael Kaufmann
3ba196fec6 add dberrornice template for database-errors
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-16 09:25:27 +01:00
Michael Kaufmann
2ced9cdc2d add missing query-field
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-16 08:36:32 +01:00
Michael Kaufmann
407a1daebf first non-install template (login); mostly testing
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-15 20:37:27 +01:00
Michael Kaufmann
f37d9d000c make selecting the used OS actually do something (load default-setting-adjustments required/needed; TBD)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-15 15:43:18 +01:00
Michael Kaufmann
96cdb34d71 first tiny fixes to get the installation running
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-15 11:31:49 +01:00
Michael Kaufmann
56a9a71248 preparing for re-design using new template-engine for future 0.11.x releases
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-15 11:18:19 +01:00
Michael Kaufmann
1d7d32130a setting version to 0.10.33 for upcoming release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-04 13:24:41 +01:00
Michael Kaufmann
9babcde3e5 additional mkdir/chmod parameter fixes and cron-lock file adjustments
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-02-04 10:52:12 +01:00
Kris
9ec76c9fd6 Improve composer.json syntax (#1008)
* Improve composer.json syntax

* Run composer upgrade with PHP 7.4
2022-01-26 14:10:08 +01:00
Michael Kaufmann
61dfeb947f fix incorrect parameter type for mkdir() and chmod()
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-01-25 15:47:37 +01:00
Michael Kaufmann
6fdf2636fc update docs url for api-documentation
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-01-25 14:54:52 +01:00
Michael Kaufmann
0a38d1ab5f add workflow to automatically trigger api-docs generation in Froxlor/Documentation
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-01-21 17:02:35 +01:00
Michael Kaufmann
7c80dc3d1d add script for php-session cleanup
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-01-21 16:02:21 +01:00
Manuel
5ab49e3f50 Call PHP-FPM only when file exists (#1006)
Added `<If "-f %{SCRIPT_FILENAME}">` to load only PHP files that exists. This is to prevent `File not found` error from PHP-FPM and let Apache handle the error output. It removes also unnecessary PHP-FPM calls and `AH01071: Got error ‘Primary script unknown` in PHP error log.

Usually you can find the error whenever someone goes fishing for paths like wp-login.php.

The `<If>` directive is only available in Apache 2.4+ and not 2.2 or earlier.
2022-01-21 12:25:14 +01:00
Michael Kaufmann
06849133a8 modernize parameters of Cronjob::inserttask()
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-01-21 10:39:32 +01:00
Oskar Eisemuth
4a912e3902 Feature/crontaskid (#1005)
* Add \Froxlor\Cron\TaskId for fixed task id naming

* Replace Cronjob::inserttask numbers with \Froxlor\Cron\TaskId constants

* Use TaskId in Froxlor\Cron\System\TasksCron

* Use TaskId in Froxlor\System\Cronjob,
simplify getOutstandingTasks.
Rename lng['tasks'] cronjob task description.
WARNING: DELETE_DOMAIN_PDNS, DELETE_DOMAIN_SSL now use %domain%

* Remove Froxlor\System\Cronjob type 3 check
2022-01-21 10:03:45 +01:00
Michael Kaufmann
bcb95e9b7d check resource-usage for Mysql.add(), thx again to zerody
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-01-18 23:18:54 +01:00
Michael Kaufmann
c97f5f1e29 updated README; sanitize script parameter in index.php; sanitize description fields of entities (thx to zerody for pointing these out)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-01-18 09:29:13 +01:00
timdeluxe
4d289e2a7f Improves text for global open basedir setting (#1004) 2022-01-13 19:50:39 +01:00
Michael Kaufmann
c491f2c03e put commands for cronjob setup at the end of the list (should be the last thing to execute)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-01-13 18:42:40 +01:00
Michael Kaufmann
5832346f75 set version to 0.10.32 for upcoming release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-01-07 15:38:12 +01:00
Michael Kaufmann
4b4770ab36 add missing change-check when ssl-specialsettings are changed
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2022-01-03 20:27:19 +01:00
Michael Kaufmann
8c998dd6f2 Update README.md 2022-01-02 14:53:59 +01:00
Michael Kaufmann
965359ec79 Update README.md 2022-01-02 14:35:36 +01:00
Michael Kaufmann
d1d42f2055 allow setting path to acme.sh installation; fixes #1002
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-12-31 10:38:49 +01:00
Michael Kaufmann
5f41b37770 test dns entry string without any whitespaces/tabs/etc.
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-12-27 16:08:46 +01:00
Michael Kaufmann
61265778a5 fix unit-test
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-12-27 16:01:45 +01:00
Michael Kaufmann
8f0f890145 fix too strict comparison for isemaildomain check in Dns-Zone generation; fixes #1003
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-12-27 15:38:59 +01:00
Michael Kaufmann
5ccae3f9bb do not check for allowed-phpconfigs if fpm/fcgid is not activated (no possibility to select a config anyway)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-12-14 11:23:36 +01:00
Michael Kaufmann
f4d9e64804 set version to 0.10.31 for upcoming release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-12-03 15:30:09 +01:00
Michael Kaufmann
149c0935fa fix Domains.update() with correct path and change_serversettings=0; refs #1001
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-11-27 22:06:29 +01:00
Michael Kaufmann
cb0b537f6c allow settings/updating documentroot (only relative to customer homedirectory) when change_serversettings permission is not granted; fixes #1000
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-11-27 18:04:36 +01:00
Michael Kaufmann
b54c012579 respect deactivated flag when createstdsubdomain's default falls back to 'true' if the customer has one (prior to deactivating); refs #998
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-11-15 20:24:55 +01:00
Michael Kaufmann
389d83f5a3 fix behaviour in Customers.update() in case 'createstdsubdomain' is not set when called via API (wrong default); fixes #998
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-11-15 20:04:01 +01:00
Michael Kaufmann
00771381e8 set correct php-version numbers for installation dependencies-check; fixes #997
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-11-13 20:20:05 +01:00
Michael Kaufmann
46df429909 set version to 0.10.30 for upcoming release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-11-05 09:27:58 +01:00
Michael Kaufmann
eb841da007 avoid possible DivisionByZeroError in APCu info page, fixes #995
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-11-04 07:44:03 +01:00
Michael Kaufmann
c4a2db03be enable bind for testing-scenarios explicitly
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-11-03 14:16:21 +01:00
Michael Kaufmann
e5838f00cf add quota-plugin parameters to dovecot-config-templates; update standardcustomer index.html; set nameserver disabled by default
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-11-03 14:08:57 +01:00
Michael Kaufmann
bcde7e93df check whether the domain to clean from pdns actually still exists there; fixes #992
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-10-21 12:00:36 +02:00
Michael Kaufmann
bd8327afbe soften/correct permissions on pdns configs; fixes #991
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-10-21 11:56:34 +02:00
Michael Kaufmann
b961eba382 fix api documentation for Domains.add() and Domains.update(); fixes #987
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-10-20 16:51:16 +02:00
Michael Kaufmann
a552ea878e avoid undefined index of 'wwwserveralias' field if issueing/renewing lets encrypt certificate for froxlor-hostname
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-10-17 11:48:40 +02:00
Michael Kaufmann
4ad2a1da1c add complete list of nameserver-ips and given axfr-servers to allow-axfr-ips list for PowerDNS; fixes #985
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-10-14 19:07:05 +02:00
Michael Kaufmann
37ae69f07a correct language strings in phpconfig formfield for new setting; refs #980
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-10-14 17:13:55 +02:00
Michael Kaufmann
9870db2560 add possibility to assign new/edited php-config to all customer accounts; fixes #980
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-10-14 17:09:29 +02:00
Michael Kaufmann
724a5e172a don't remove 0-value parameter values from bulk-actions
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-10-12 16:29:04 +02:00
Michael Kaufmann
8e166cb842 adjust debian 11 config templates, fixes #982
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-10-12 14:25:42 +02:00
Michael Kaufmann
5e281cf486 fix allowed-phpconfigs check in SubDomains.add() and SubDomains.update()
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-10-11 19:26:13 +02:00
Michael Kaufmann
5d2f44ecd8 only validate custom database name if used at all
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-10-11 18:59:26 +02:00
Michael Kaufmann
5009c625d8 prep.statement cannot be used for create database query; regex-validate database_name
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-10-11 18:55:15 +02:00
Michael Kaufmann
eb592340b0 use prepared statement for creating databases to avoid sql injections in custom db-names
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-10-11 18:33:48 +02:00
Michael Kaufmann
c6f556c8d9 set version to 0.10.29.1 for bugfix release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-10-10 14:45:17 +02:00
Michael Kaufmann
db1df84ef1 correct db-exists check in installation-process
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-10-10 14:32:02 +02:00
Michael Kaufmann
52135a1d3a set version to 0.10.29 for upcoming release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-10-08 08:46:58 +02:00
Michael Kaufmann
7f13bd09da add optional ssl parameters to powerdns-config-template
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-10-08 08:39:22 +02:00
Nick Ufer
7ccbb37c4e feat: adds mysql tls support (#979) 2021-10-08 08:28:32 +02:00
Michael Kaufmann
7feddf0aec generate unpredictable unique session ids
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-10-02 12:38:17 +02:00
Michael Kaufmann
e73523531a let user decide whether an existing database should be backup'ed and removed when installing froxlor; dont rely on parse_ini_file for OS check; enhance mysqldump so there is no issues with complex passwords and bash-escaping
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-09-24 10:49:57 +02:00
Michael Kaufmann
a47b790e19 actually integrate the new czech language file; refs #976
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-09-04 09:30:44 +02:00
Michael Kaufmann
319eec6124 fix session for 2fa enabled logins
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-08-27 13:17:05 +02:00
Michael Kaufmann
21983f27b6 secure commonly used filename-variable against url manipulation
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-08-25 16:36:09 +02:00
Michael Kaufmann
5d375b784d login action always goes to index.php
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-08-25 16:30:56 +02:00
Michael Kaufmann
4b22470872 set php session security related settings (correctly in every case)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-08-25 16:21:33 +02:00
Michael Kaufmann
ec1c37aa06 set version to 0.10.28 for upcoming release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-08-20 09:23:23 +02:00
Nicolas
67351ec3c2 Adding support for PowerDNS-Replication (#974)
Adding support for powerdns-replication
2021-08-19 12:00:09 +02:00
Michael Kaufmann
f1887aaaf2 enable iterate_query in dovecot by default
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-08-13 09:28:10 +02:00
Michael Kaufmann
afd2d7b5e9 fix dns-validation in Domains.add() and Domains.update() when using Let's Encrypt DNS-check
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-08-08 11:14:57 +02:00
Michael Kaufmann
c967e585b5 avoid duplicate entries in mysql-access-host setting
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-08-06 08:11:06 +02:00
Michael Kaufmann
73e364d4ba fix compare of old/new value of aliasdomain when editing a domain as customer to avoid unnecessary regeneration of configfiles
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-08-04 14:55:22 +02:00
Michael Kaufmann
eb49331b21 remove superfluous inserttask when editing domain as it will be called when there are actually changes to the domain earlier
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-08-04 14:06:32 +02:00
Michael Kaufmann
0a1a3e023f check dns for lets encrypt when adding/editing domains and via cron; fixes #971
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-08-04 13:44:13 +02:00
Michael Kaufmann
bef5cedcd0 only add link to customername when editing domain when panel.allow_domain_change_customer is false
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-08-02 16:58:34 +02:00
Stefan Weil
f8e2bc7bff Fix some typos in code (found by codespell) (#970)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-08-01 19:00:33 +02:00
Stefan Weil
09038ac7aa Fix some typos (found by codespell) (#969)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-07-31 09:51:54 +02:00
Michael Kaufmann
4c507232c7 add setting for a custom system group for all customer-users (required libnss-extrausers); fixes #953
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-07-30 12:16:37 +02:00
Michael Kaufmann
86939a64da add buypass testing/staging ACME endpoint; create CAA entries accordingly if activated; refs #968
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-07-29 21:24:43 +02:00
Jens Meißner
926ce427fc Add Buypass to the list of ACME providers. (#968) 2021-07-29 21:15:49 +02:00
Michael Kaufmann
53401eebfb integrity check should allow utf8_* charachter sets and not only 'utf8', thx to lod
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-07-29 21:04:46 +02:00
Michael Kaufmann
bef580929e Update README.md 2021-07-27 08:14:08 +02:00
Michael Kaufmann
c7b7c67ff4 normalize ipv6 addresses to avoid possible comparison problems; fixes #965
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-07-26 17:53:44 +02:00
Michael Kaufmann
ed42d4e3df try to fix github action...
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-07-24 20:31:34 +02:00
Michael Kaufmann
69a2ebce36 create user as froxlor would create it for mysql-8.0
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-07-24 20:29:56 +02:00
Michael Kaufmann
15f08739fa add github action workflow for mysql
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-07-24 20:17:42 +02:00
nachtgeist
571690c8c5 admin_customers/edit domain: make customer login name a link (#962) 2021-07-23 16:35:31 +02:00
rex2630
b2005d7f29 [WIP] Czech language (#870)
* Update czech.lng.php
2021-07-21 20:41:07 +02:00
Michael Kaufmann
4354598c64 fix unittests
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-07-21 10:21:58 +02:00
Michael Kaufmann
05d4bdc499 restore behaviour for unittests as 'create stdsubdomain' default was yes in the settings but no for direct API usage
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-07-21 10:10:18 +02:00
Michael Kaufmann
25c6a37df2 fix wrong variable-name in Customers.delete()
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-07-21 10:03:20 +02:00
Michael Kaufmann
41a470fe36 added option to disable creation of default subdomain; fixes #960
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-07-21 09:53:54 +02:00
Michael Kaufmann
8a4aa2a721 fix lng strings
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-07-20 23:45:57 +02:00
Michael Kaufmann
1d903770fc have more power over theme logo, custom theme logo and uploaded logo; refs #958
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-07-20 20:35:54 +02:00
Nicolas
934be5a238 Fix SOA-Record (#959) 2021-07-20 19:29:06 +02:00
Michael Kaufmann
5608f0407f correct heredoc indentation in AcmeSh for php-7.1; fixes #957
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-07-20 08:11:32 +02:00
Kai
ce9d8dad7f Feature-request #672 - database name prefixes + custom name (#956)
* Fix makeoption function call

* Update formfield.mysql_add.php

Added database name

* Update formfield.mysql_add.php

* Update formfield.mysql_add.php

* Update Mysqls.php

* Update DbManager.php

* Update formfield.mysql_add.php

* Update german.lng.php

* Update formfield.mysql_add.php

* Update Mysqls.php

* Added field database_name (Feature #672)

* Added Testfunction for customer choosed database name

* Fixed test for customer choosed database name
Added docs for param $name

* Fixed mysql api command add
Removed doubled code

* Set settings for customer choosed db name

* Fixed wrong excepted for database name

* Renamed parameter database_name to custom_suffix

* Changed testCustomerMysqlsList
Added testCustomerMysqlsDBNameDelete
2021-07-19 19:10:12 +02:00
Michael Kaufmann
d6fe263e68 Update issue templates 2021-07-19 07:20:46 +02:00
Michael Kaufmann
156846a845 set version to 0.10.27 for upcoming release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-07-18 10:57:38 +02:00
Michael Kaufmann
abe00b79a7 Update README.md
add github actions build badge
2021-07-17 14:16:29 +02:00
Michael Kaufmann
26ab659c6a Ga testing (#955)
* switch from travis-ci to github actions

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-07-17 14:14:35 +02:00
Michael Kaufmann
b0273c68d2 remove debian jessie config-templates (outdated); set debian stretch as deprecated; add debian bullseye config templates
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-07-16 12:15:03 +02:00
Michael Kaufmann
720cf9d74f Merge branch 'master' of github.com:Froxlor/Froxlor 2021-07-13 09:01:25 +02:00
Michael Kaufmann
35cd567c48 check whether there was an image upload at all
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-07-13 09:01:22 +02:00
Michael Kaufmann
2332d5be7b Merge pull request #949 from bashgeek/custom-css
Custom CSS File in default theme
2021-07-13 08:38:23 +02:00
Daniel
14cdc3801a Merge branch 'Froxlor-master' into custom-css 2021-07-13 10:31:35 +08:00
Daniel
d85efe480e conflict 2021-07-13 10:31:24 +08:00
Daniel
4f2ceaa3ab wip 2021-07-13 10:29:36 +08:00
Michael Kaufmann
3b6792d548 Merge branch 'master' of github.com:Froxlor/Froxlor 2021-07-12 17:29:25 +02:00
Michael Kaufmann
36de6e09d4 remove beta notice from let's encrypt settings
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-07-12 17:29:21 +02:00
Michael Kaufmann
300c410b18 Merge pull request #948 from bashgeek/logo-custom-login
Custom Logo(s) via Image-Upload in Panel Settings
2021-07-12 17:28:42 +02:00
Daniel Schmitz
282d7d9101 migrate old image + fix versioning 2021-07-09 17:07:50 +08:00
Daniel Schmitz
48f6601003 check mime types 2021-07-09 16:42:21 +08:00
Daniel
c4c4279171 Merge branch 'Froxlor:master' into logo-custom-login 2021-07-09 16:32:59 +08:00
Michael Kaufmann
b88f9c1f18 allow defining php_value/php_admin_value for session.save_path when using php-fpm; fixes #954
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-07-09 08:23:46 +02:00
Daniel Schmitz
0dac045dc9 wip 2021-07-07 14:11:54 +08:00
Daniel Schmitz
80b5f97367 wip 2021-07-07 14:10:21 +08:00
Daniel Schmitz
7a8b39fad0 wip 2021-07-07 14:00:55 +08:00
Daniel Schmitz
9f5978e875 german translations 2021-07-07 13:33:33 +08:00
Daniel
155fd757bf Merge branch 'Froxlor:master' into logo-custom-login 2021-07-07 13:30:22 +08:00
Daniel Schmitz
518ec202ab wip 2021-07-07 13:26:15 +08:00
Michael Kaufmann
871083d613 Merge pull request #952 from bashgeek/install-warnings
Installer Cleanup & Bug Fixes
2021-06-28 08:06:59 +02:00
Daniel Schmitz
79f0c8d28f wip 2021-06-28 11:01:22 +08:00
Daniel
dfbb4127e2 Merge branch 'Froxlor:master' into logo-custom-login 2021-06-28 10:39:02 +08:00
Daniel Schmitz
b9b2f00f30 wip 2021-06-28 10:37:23 +08:00
Daniel Schmitz
6923f9d926 Revert "wip"
This reverts commit cacbf7fec7.
2021-06-28 10:35:15 +08:00
Daniel Schmitz
cacbf7fec7 wip 2021-06-28 10:34:21 +08:00
Michael Kaufmann
73991e855c Support ZeroSSL via acme.sh (v3); refs #946
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-06-27 09:00:44 +02:00
Michael Kaufmann
0208812013 prefer custom zone entries over automatically created ones when system.dns_createmailentry is enabled, fixes #944
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-06-27 08:41:16 +02:00
Michael Kaufmann
48bd2561f7 Merge pull request #947 from Froxlor/dependabot/composer/phpmailer/phpmailer-6.5.0
Bump phpmailer/phpmailer from 6.4.1 to 6.5.0
2021-06-27 08:37:38 +02:00
Michael Kaufmann
af12c4102b Merge pull request #950 from kruegerj/patch-1
Update focal.xml
2021-06-24 07:57:00 +02:00
kruegerj
d2efa3ecc4 Update focal.xml 2021-06-24 03:16:12 +02:00
Daniel Schmitz
acb04566f5 wip 2021-06-23 11:28:07 +08:00
Daniel Schmitz
abb98ae960 wip 2021-06-23 11:21:33 +08:00
Daniel Schmitz
0d202a7e4d wip 2021-06-23 11:20:18 +08:00
Daniel Schmitz
c69ef20b17 wip 2021-06-23 10:58:52 +08:00
dependabot[bot]
5872d0682a Bump phpmailer/phpmailer from 6.4.1 to 6.5.0
Bumps [phpmailer/phpmailer](https://github.com/PHPMailer/PHPMailer) from 6.4.1 to 6.5.0.
- [Release notes](https://github.com/PHPMailer/PHPMailer/releases)
- [Changelog](https://github.com/PHPMailer/PHPMailer/blob/master/changelog.md)
- [Commits](https://github.com/PHPMailer/PHPMailer/compare/v6.4.1...v6.5.0)

---
updated-dependencies:
- dependency-name: phpmailer/phpmailer
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-22 15:20:44 +00:00
Michael Kaufmann
c4fa8feb8c update dev tools
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-06-17 08:25:43 +02:00
Michael Kaufmann
61a50cc657 add setting for default serveralias value for new domains, refs #944
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-06-16 15:10:52 +02:00
Michael Kaufmann
3df3261ac0 switch from freenode irc network to libera.chat irc network as freenode is dead
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-06-16 11:57:38 +02:00
Michael Kaufmann
f2636e14f0 Merge pull request #945 from MisterDuval/patch-1
Deny all robots
2021-06-01 15:06:31 +02:00
MisterDuval
a23f22f561 Deny all robots
Search engine and all Robots should be denied to the whole Froxlor directory. This file will help!
2021-06-01 14:45:47 +02:00
Michael Kaufmann
8cf3f4ee24 set version to 0.10.26 for upcoming maintenance releasae
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-05-14 08:21:53 +02:00
Michael Kaufmann
e83f7634f8 Merge pull request #938 from Froxlor/dependabot/composer/phpmailer/phpmailer-6.4.1
Bump phpmailer/phpmailer from 6.2.0 to 6.4.1
2021-05-04 19:57:10 +02:00
dependabot[bot]
6eb6595a46 Bump phpmailer/phpmailer from 6.2.0 to 6.4.1
Bumps [phpmailer/phpmailer](https://github.com/PHPMailer/PHPMailer) from 6.2.0 to 6.4.1.
- [Release notes](https://github.com/PHPMailer/PHPMailer/releases)
- [Changelog](https://github.com/PHPMailer/PHPMailer/blob/master/changelog.md)
- [Commits](https://github.com/PHPMailer/PHPMailer/compare/v6.2.0...v6.4.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-04 17:43:20 +00:00
Michael Kaufmann
bd48fb7328 catch exception of password-complexity check when changing account password; fixes #935
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-04-14 08:59:44 +02:00
Michael Kaufmann
769525bb56 do not touch/chown error/access log if log is disabled, fixes #934
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-04-12 09:42:25 +02:00
Michael Kaufmann
9195fb3c98 additionally sort by length of username for libnss-extrausers passwd file to have the main user as first in result in any case; fixes #933
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-04-12 09:37:36 +02:00
Michael Kaufmann
82922f7aea add new settings for legal-notes; terms-of-use and privacy-policy; fixes #930
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-03-24 14:36:48 +01:00
Michael Kaufmann
db1a39b6d9 match composePhpOptions() definition everywhere
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-03-24 13:49:58 +01:00
Michael Kaufmann
7fbbc2ea0b add vhost replacer {FPMSOCKET} for custom vhost configs; fixes #931
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-03-24 13:46:24 +01:00
Michael Kaufmann
91d4432108 check rr against possible existing CNAME entries, fixes #927
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-03-15 17:33:30 +01:00
Michael Kaufmann
c8914312aa Refactoring columns from large table to avoid '1118 Row size too large' error
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-03-11 09:45:52 +01:00
Michael Kaufmann
3fd89c48e8 set version to 0.10.25 for upcoming maintenance release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-03-05 20:27:55 +01:00
Michael Kaufmann
eceb144a77 also trigger removal of domain in powerdns database if used; refs #923
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-03-04 12:09:03 +01:00
Michael Kaufmann
1d9651b18a trgger acme.sh removal for domains if customers is being deleted; fixes #923
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-03-04 12:07:20 +01:00
Michael Kaufmann
49db4e60cb escape passwords for email content (new email-account, new ftp-account and new database); fixes #905
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-03-03 11:25:58 +01:00
Michael Kaufmann
53e8ccbccb added 'deactivated' parameter to EmailAccounts.update() so admins can disable individual email-accounts, will be overridden if customer is deactivatd and re-enabled; fixes #921
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-03-03 10:59:16 +01:00
Michael Kaufmann
6d8fc215f1 add description field to panel_domains and mail_virtual table, API parameter 'description' for Domains.add()/Domains.update() and Email.add()/Emails.update(); fixes #910
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-03-03 10:25:42 +01:00
Michael Kaufmann
f94c303cb3 add API parameter 'show_usages' for Customers.listing() and Customers.get() to return number of domains, and diskspaced used split into webspace_used, mailspace_used and dbspace_used; fixes #912
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-03-03 09:50:30 +01:00
Michael Kaufmann
2be1873354 fix frontend issue with displaying correct options in domain listing when using php8, thx to cscholz
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-02-24 19:56:26 +01:00
Michael Kaufmann
d1d36c32fe Merge pull request #920 from RipClaw2971/patch-1
lowercase domain names for ssl-certificate file check (fallback)
2021-02-24 13:07:26 +01:00
RipClaw2971
3b3527348f Update AcmeSh.php
Renewed certificates are not recognized if the domain is in upper/lower case.
2021-02-24 13:00:31 +01:00
Michael Kaufmann
036d5f0713 Merge pull request #919 from nachtgeist/soa
dns: make mail address of SOA records configurable
2021-02-21 18:27:57 +01:00
Daniel Reichelt
a1b8807b0f dns: make mail address of SOA records configurable 2021-02-21 13:00:30 +01:00
Michael Kaufmann
356a087b6a Merge pull request #918 from nachtgeist/pns
dns: check NS entry to be used as primary NS
2021-02-21 09:14:37 +01:00
Michael Kaufmann
0a77fd7150 Merge pull request #917 from nachtgeist/pw
system: validatePassword(): also quote the delimiter ('/')
2021-02-21 09:13:02 +01:00
Daniel Reichelt
67d67a287f system: validatePassword(): also quote the delimiter ('/')
Quoting the default regex delimiter is required for the password
complexity check to work if '/' had been specified as special character
in Froxlor's account settings.
2021-02-21 02:33:46 +01:00
Daniel Reichelt
1f792466bf dns: check NS entry to be used as primary NS
Don't just blindly use the first custom NS entry for SOA, actually check
if it pertains to the domain in question
2021-02-21 02:33:23 +01:00
Michael Kaufmann
5a6343b47c php8 compatibility, fixes #916
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-02-16 12:38:01 +01:00
Michael Kaufmann
841c529107 fix check for required firstname/name/company in Customers.update(), fixes #915
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-02-15 23:26:18 +01:00
Michael Kaufmann
41c3f21f0b list only phpenabled and http-enabled domains in php-configuration overview; fixes #911
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-02-11 16:16:04 +01:00
Michael Kaufmann
b8c0688ba0 added possibility to use 'in' sql-operation in sql_where parameter for Api-calls; php-8 compat fix in admin_traffic
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-02-11 12:09:42 +01:00
Michael Kaufmann
24e02e99fb set version to 0.10.24 for upcoming maintenance release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-02-05 15:46:08 +01:00
Michael Kaufmann
97bb7b6227 add filecontent to allowed form-fields to not be escaped
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-02-05 15:44:49 +01:00
Michael Kaufmann
5ceddc8c65 remove not (yet) used cli script
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-02-05 15:42:38 +01:00
Michael Kaufmann
3a17d03796 add option to specify (optional) fileextension/suffix for generated dkim-private keys; fixes #907
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-01-20 12:12:41 +01:00
Michael Kaufmann
57ae195930 for percentage calculation always use bytes so we don't compare KiB with GiB or similar
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-01-18 21:22:29 +01:00
Michael Kaufmann
9b86d576fa do not display usages on dashboard in fixed size-units but dynamically adjusted
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-01-18 20:49:55 +01:00
Michael Kaufmann
02a12eda13 add missing field 'include_default_vhostconf' to settings table for new installations
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-01-16 10:50:49 +01:00
Michael Kaufmann
a31da97d66 exclude some formfields from xss-cleaning as it could alter the wanted content
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-01-13 10:14:51 +01:00
Michael Kaufmann
9f13aa9a12 only pass binding variable for prepared sql statement if variable exists
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-01-13 08:52:00 +01:00
Michael Kaufmann
2841051649 correctly read in domain's ssl-ips for CAA entries if enabled, fixes #903
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-01-12 21:08:10 +01:00
Michael Kaufmann
acfbf55d15 Check return of validateFormField() just for non-falsey values and not expect boolean data-type; fixes #904
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-01-12 19:17:38 +01:00
Michael Kaufmann
5848df28fd Merge pull request #902 from bashgeek/master
Put in trailing slash to /awstats/ location in nginx config
2021-01-12 12:25:22 +01:00
Michael Kaufmann
21925f48c3 set minimum required php-version to 7.1 and recommended php-version to 7.4
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2021-01-06 13:36:35 +01:00
Daniel
17a64c58c2 Put in a trailing "/" for /awstats/ location 2020-12-31 16:01:42 +08:00
Daniel
0ca38cff31 Merge pull request #1 from Froxlor/master
up
2020-12-31 15:59:07 +08:00
Michael Kaufmann
5efc1849b4 fix hide-incompatible-settings feature
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-12-30 17:16:15 +01:00
Michael Kaufmann
f213d666e2 fix typo
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-12-30 16:46:01 +01:00
Michael Kaufmann
78495b6487 update link to perl-fastcgi wiki on nginx.com; added setting to hide incompatible settings (depending on webserver)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-12-30 16:41:26 +01:00
Michael Kaufmann
ab1c76e104 set version to 0.10.23.1 for bugfix release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-12-28 19:48:31 +01:00
Michael Kaufmann
a671223823 corrected too few arguments to function Froxlor\Cron\Traffic\TrafficCron::callAwstatsGetTraffic(); fixes #901
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-12-28 19:43:40 +01:00
Michael Kaufmann
3a99e10296 set version to 0.10.23 for upcoming maintenance release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-12-28 11:09:56 +01:00
Michael Kaufmann
38031aaff9 add missing return-code in DomainZones.add which messes up the error handling when using API
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-12-23 13:42:36 +01:00
Michael Kaufmann
65773bce57 automatically set php-fpm default config to php-version that is used for the installation to avoid confusion
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-12-21 17:15:02 +01:00
Michael Kaufmann
ee5de56a94 also validate existence of ssl-key file in vhost generation
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-12-10 09:47:58 +01:00
Michael Kaufmann
aba97df9b2 added date-range parameters for Traffic.listing(), fixes #878
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-12-10 09:44:43 +01:00
Michael Kaufmann
79e670f797 trigger rebuild of cronjobs also if customer email is changed, fixes #896
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-12-10 09:41:35 +01:00
Michael Kaufmann
8670cb6742 Merge pull request #900 from heptalium/master
Protect only private keys and leave certificates world readable.
2020-12-10 09:29:51 +01:00
Michael Kaufmann
bde87950a5 fix optional parameters of phpErrHandler
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-11-27 14:07:01 +01:00
Jens Meißner
aa1d2ab01d Set certificate files explicitly world readable. 2020-11-24 17:38:49 +01:00
Jens Meißner
2a770a93b1 Protect only private keys and leave certificates world readable. 2020-11-23 20:32:24 +01:00
Michael Kaufmann
5b85a1c183 use Validate::validateEmail() also for PHPMailer::ValidateAddress() call
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-11-17 17:31:49 +01:00
Michael Kaufmann
caf8893558 use Validate::validateEmail() instead of pure filter_var
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-11-17 17:18:23 +01:00
Michael Kaufmann
a280461cf6 add unicode flag for filter-validate-email (>=php7.1)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-11-17 10:39:11 +01:00
Michael Kaufmann
455c655580 corrected validation of idn-tld's, fixes #899
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-11-14 11:59:46 +01:00
Michael Kaufmann
ecd707424f change example of dhparams.pem folder so it does not conflict with default ssl-certificates-folder which gets purged by froxlor regulary
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-11-13 13:01:19 +01:00
Michael Kaufmann
60fe330de1 Merge pull request #875 from negrusti/patch-2
Data integrity - remove default values from some columns
2020-11-12 09:01:03 +01:00
Michael Kaufmann
cdb871b82b fix delete_userfiles flag not being passed via webinterface email-address-overview
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-11-12 08:54:52 +01:00
Michael Kaufmann
35c4e3d1b9 set version to 0.10.22 for upcoming maintenance release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-11-06 14:47:20 +01:00
Michael Kaufmann
b3f82f0981 remove duplicate AXFR records as nameserver get added automatically in case they have also been added to the axfr list
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-11-01 21:00:27 +01:00
Michael Kaufmann
b1b68364be do not allow setting www as CNAME record if domain has automatic www-Alias enabled, fixes #895
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-10-31 16:16:05 +01:00
Michael Kaufmann
ea76ce8fcc secure requests; refs #893
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-10-31 15:57:59 +01:00
Michael Kaufmann
16eca628dd add Unittest for traffic-filtering by customer-name, refs #894
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-10-31 15:53:07 +01:00
Michael Kaufmann
6bf5eccc24 update dependencies and add voku\AntiXSS
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-10-31 15:50:16 +01:00
Michael Kaufmann
63d00cd453 forgot to add the language strings to the commit for avoid deletion of (super)admin
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-10-31 15:48:01 +01:00
Michael Kaufmann
c79cba26f3 avoid deletion of (super)admin with id 1 due to fallbacks in the code using it; fixes #886
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-10-31 10:02:11 +01:00
Michael Kaufmann
36eb3cc1aa [domainbulk] remove reqiurement for customer-select in webinterface as it is an API-parameter
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-10-31 09:45:50 +01:00
Michael Kaufmann
15a13a7783 append file-extension for dkim-private-keys as external tools may require it (rspamd e.g.); thx to rseffner for finding this
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-10-20 15:28:51 +02:00
Michael Kaufmann
816874872d make given documentroot of domain relative to customerroot of no absolute path if given; fixes #892
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-10-14 16:58:19 +02:00
Michael Kaufmann
0e8449f28d Merge pull request #891 from andlinger/patch-1
Fixed typo in contribution document
2020-10-14 14:26:48 +02:00
Michael Kaufmann
3dcbbb9e7b do not set description to empty value if not passed as parameter as it is optionally; fixes #890
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-10-14 14:25:23 +02:00
David Andlinger
5ab9e6865d fixed typo 2020-10-14 14:17:37 +02:00
Michael Kaufmann
3a47b2050e fix awstats/webalizer directory protection when using nginx; fixes #888
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-10-13 20:18:44 +02:00
Michael Kaufmann
907c475361 create quotatallies entry if it not exists, fixes #885; correction in api-doc for Ftps.update ftp_password parameter, fixes #889
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-10-13 19:52:29 +02:00
Michael Kaufmann
0dfb4bdcdb list dns entries after add/delete action handling so the table of entries always shows the current state withouth reloading the page; fixes #887
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-10-12 09:50:48 +02:00
Michael Kaufmann
a5dc7b93a2 unify customerid/loginname api-parameter-descriptions; fixes #883
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-10-05 19:59:02 +02:00
Michael Kaufmann
244d2823a6 Merge pull request #882 from heavygale/patch-3
Fix for notices "Trying to access array offset on value of type bool" in ReportsCron.php
2020-10-03 13:10:40 +02:00
heavygale
2f0251bb19 Fix for "Trying to access array offset on value of type bool"
Proper check for success of query before accessing the result array. This notices occures if there's no custom mail-template for trafficmaxpercent_subject or trafficmaxpercent_mailbody for the required language.
2020-10-03 12:55:14 +02:00
Michael Kaufmann
a37d795ff3 set version to 0.10.21 for maintenance release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-10-02 18:01:53 +02:00
Michael Kaufmann
d9331cca61 check for fallback of ssl-certificate in ips/ports correctly of lets encrypt is used
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-09-18 11:49:26 +02:00
Michael Kaufmann
f169129e27 remove obsolete/unused table
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-09-07 21:53:18 +02:00
Michael Kaufmann
746548492b output traffic values correctly when not using bcmath and kind of fix wrong unit display on mouseover, fixes #425
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-09-07 21:51:24 +02:00
Michael Kaufmann
4ad8b62576 for ssl-fallback-check not only check for empty value but also for existence of certificate, thx to df8oe
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-09-06 14:12:25 +02:00
Michael Kaufmann
1eed3d1166 remove underscore from dkim-selector when creating the certificates too, refs #619
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-08-13 09:04:58 +02:00
Michael Kaufmann
6a32720c9a remove underscore from dkim-selector in the output certificate files too as (old) dkim-filter read the selector from this filename; refs #619
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-08-09 10:54:22 +02:00
Michael Kaufmann
e389ae4bf8 setting version to 0.10.20 for upcoming maintenance release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-08-07 19:43:16 +02:00
Michael Kaufmann
970ecb469e use overridden limit_extensions and idle_timeout in vhost config when using fpm and not mod_proxy
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-08-07 17:16:56 +02:00
Grigory Morozov
92b6914610 Update froxlor.sql
Data integrity - under no circumstances the empty string is a valid value for these fields
2020-08-07 21:58:06 +07:00
Michael Kaufmann
7e57352bc0 remove underscore from dkim-selector, refs #619
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-07-30 07:59:22 +02:00
Michael Kaufmann
e3d42a3f62 show current count of results besides total count in listings, fixes #869
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-07-29 08:46:50 +02:00
Michael Kaufmann
456a287621 fix missing query-parameters for IpsAndPorts.listing() when using sql_search
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-07-29 08:36:55 +02:00
Michael Kaufmann
eff630da8d unset any limit as we do not have pagination when showing search-results, refs #869
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-07-29 08:28:04 +02:00
Michael Kaufmann
aa45a0302e fix permanent rebuilding of vhost configs, refs 0af655f106
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-07-29 08:23:49 +02:00
Michael Kaufmann
aa14487995 update jquery library, fixes #872
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-07-28 13:28:47 +02:00
Michael Kaufmann
10b52486b5 ups, forgot to save the file so it's missing a critical return :P
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-07-25 17:28:46 +02:00
Michael Kaufmann
0af655f106 fix permanent rebuilding of vhost configs due to always-true renew check of let's encrypt certificates
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-07-25 17:21:52 +02:00
Michael Kaufmann
665c87cca7 fix index on longtext field which is not working due to unknown length; fixes #868
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-07-25 17:21:13 +02:00
Michael Kaufmann
1c50838d37 Merge pull request #871 from tczaude/master
issue 868 : Add new performance indexes
2020-07-24 20:37:26 +02:00
tczaude
ac5bc78e12 fix showUpdateStep 2020-07-24 19:32:04 +02:00
tczaude
a5e6ef674f issue 868 : Add new performerce indexes 2020-07-24 14:35:55 +02:00
Michael Kaufmann
03bc94e69c insert task to sync certificates for all cases (issue and renew)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-07-07 12:10:40 +02:00
Michael Kaufmann
37176c94a1 set version to 0.10.19 for upcoming release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-07-03 14:12:48 +02:00
Michael Kaufmann
a141c83ad4 do not call strtotime on the validTo_time_t key of cert_data as it already is an UNIX-timestamp, refs #865
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-06-23 20:35:50 +02:00
Michael Kaufmann
7c3ff95d22 check for possible CNAME overrides of A/AAAA record in dns-editor, fixes #864
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-06-23 09:39:00 +02:00
Michael Kaufmann
d653f6842f check for acme.sh upgrade on every run; fix not running --install-cronjob without having an issue command
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-06-21 19:50:46 +02:00
Michael Kaufmann
35a69fbfe0 add missing parmeter customerid for SubDomains.delete() which is required when called as admin; fixes #862
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-06-18 13:05:17 +02:00
Michael Kaufmann
e733701459 trigger removal cronjob of lets encrypt certificate via acme.sh also when domain update removes letsencrypt flag from domain
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-06-17 14:09:26 +02:00
Michael Kaufmann
70677fced2 fix double-adding of _ecc to certificate folder when deleting let's encrypt certificate
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-06-17 12:08:54 +02:00
Michael Kaufmann
daa223ed42 return full domain object on Domains.update() call, fixes #861
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-06-17 09:29:02 +02:00
Michael Kaufmann
0398f4cdba set version to 0.10.18 for upcoming release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-06-12 15:17:09 +02:00
Michael Kaufmann
1a0953e77e fix typo in response status message, fixes #858
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-06-08 11:42:44 +02:00
Michael Kaufmann
490704f8e1 Heredoc/nowdoc with an indented closing marker is not supported in PHP 7.2 or earlier.
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-06-06 20:57:24 +02:00
Michael Kaufmann
2748f1b633 also display error when domain does not resolv to any A or AAAA record in lets-encrypt-dns-validation
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-06-06 15:37:06 +02:00
Michael Kaufmann
8e60c6b201 update api documentation for Ftps.update(), fixes #857
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-06-05 16:23:41 +02:00
Michael Kaufmann
d4716b2376 correct documentation for Customers.add(), fixes #856
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-06-05 15:33:49 +02:00
Michael Kaufmann
2c98fc4c2d fix wrong certificate folder for fallback ceck (ecc/non-ecc)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-06-04 07:42:13 +02:00
Michael Kaufmann
65e1f633ef Merge pull request #855 from daxara/detect_distr
Auto detection in CLI & checks
2020-05-31 20:59:26 +02:00
Ante de Baas
ed4dbba278 also perform checks in Install class 2020-05-31 20:46:27 +02:00
Ante de Baas
1a6082ca91 complete if statement 2020-05-31 20:36:52 +02:00
Ante de Baas
da1d94149a saet defaults and do some checks 2020-05-31 20:34:47 +02:00
Ante de Baas
e7cfceb65d add comment 2020-05-31 20:18:37 +02:00
Ante de Baas
1f48ca4711 autodeterct distribution in CLI 2020-05-31 20:10:07 +02:00
Michael Kaufmann
fe0fb8dd5f fix non-static method called statically in \Froxlor\FileDir
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-05-31 16:38:53 +02:00
Michael Kaufmann
4a5ab7d95d Merge pull request #854 from daxara/detect_distr
fix bugs in dist detection
2020-05-31 16:36:52 +02:00
Ante de Baas
0d44adf265 fix bugs is dist detection 2020-05-31 16:00:50 +02:00
Michael Kaufmann
0b63b4e110 Merge pull request #853 from daxara/centos7
[centos7] proftp requires epel, awstats needs install and awstats cron moved
2020-05-31 15:02:57 +02:00
Michael Kaufmann
ba7e9688c5 Merge pull request #852 from daxara/centos8
Centos8 config updated
2020-05-31 15:02:31 +02:00
Ante de Baas
443ae1df68 proftp requires epel, awstats needs install and awstats cron moved 2020-05-31 14:57:07 +02:00
Ante de Baas
b59aa6f140 undo dnf -y 2020-05-31 14:28:37 +02:00
Ante de Baas
4e9df61fef awstats cron is moved to cron.hourly 2020-05-31 13:15:55 +02:00
Ante de Baas
b350815aa0 install awstats and requirements 2020-05-31 13:11:58 +02:00
Ante de Baas
b672c722b9 no user interaction on package installation 2020-05-31 13:05:52 +02:00
Ante de Baas
db60606cfa proftpd requires epel 2020-05-31 12:52:31 +02:00
Ante de Baas
2524491883 centos8 uses 'dandified yum' 2020-05-31 12:47:28 +02:00
Ante de Baas
de061e7e36 add missing apacheconf_htpasswddir dir 2020-05-31 12:46:33 +02:00
Michael Kaufmann
9ecd182a91 Merge pull request #851 from daxara/master
rename rhel7 to centos7 for consistency
2020-05-31 11:26:12 +02:00
Ante de Baas
a7934bcb7b rename rhel7 to centos7 for consistancy 2020-05-31 11:17:43 +02:00
Michael Kaufmann
9dc2c09da7 Merge pull request #850 from daxara/rhel8
Add CentOS 8 configuration-templates
2020-05-31 09:30:51 +02:00
Michael Kaufmann
b23e4a4d85 Merge pull request #849 from daxara/detect_distr
Detect distribution upon installation and set setting-defaults (if any) for that distribution
2020-05-31 09:29:42 +02:00
Michael Kaufmann
394ec4cd4a fix ecc certificate paths
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-05-31 09:13:22 +02:00
Ante de Baas
6ccfb7efbb remove old code 2020-05-30 10:10:57 +02:00
Ante de Baas
1454d8d40f get defaults from configparser 2020-05-30 10:08:05 +02:00
Ante de Baas
0fde1ce7e9 remove dev comment 2020-05-30 09:15:15 +02:00
Ante de Baas
86155f7a9c use Distribution in german language 2020-05-30 09:11:43 +02:00
Ante de Baas
60578a5d31 rename to CentOS because its most likely to be used 2020-05-29 17:46:38 +02:00
Ante de Baas
7fcacb4637 rename to centos because its most likey to be used 2020-05-29 17:45:37 +02:00
Ante de Baas
fb35fb9a3a read distribution from xml and selection via selectbox 2020-05-29 17:33:48 +02:00
Ante de Baas
6128954231 rename propery to property 2020-05-29 15:54:37 +02:00
Ante de Baas
f4d4490d08 change property tagnames 2020-05-29 15:45:04 +02:00
Ante de Baas
27f0c4eb53 remove distribution names from language files 2020-05-29 15:42:38 +02:00
Ante de Baas
cb1df3a7e0 show failue as nice red message 2020-05-29 15:29:53 +02:00
Ante de Baas
a572ac3914 add rhel8 config file 2020-05-29 15:10:06 +02:00
Ante de Baas
498ff15e98 add redhat defaults 2020-05-29 14:59:48 +02:00
Ante de Baas
022ed1a9a8 add setting defaults per distribution when given 2020-05-29 14:59:40 +02:00
Ante de Baas
814339cc73 Merge branch 'master' into detect_distr 2020-05-29 13:54:36 +02:00
Ante de Baas
0bb48a3cdf fix nginx capitalisation. 2020-05-29 13:45:46 +02:00
Ante de Baas
67d74406bd add os distribution detection 2020-05-29 13:36:31 +02:00
Michael Kaufmann
d73d8da2fd read certificate data folder from acme.sh.env file, fixes #846
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-05-28 20:08:49 +02:00
Michael Kaufmann
3c7bdcb5e0 Merge pull request #847 from Froxlor/dependabot/composer/phpmailer/phpmailer-6.1.6
Bump phpmailer/phpmailer from 6.1.4 to 6.1.6
2020-05-28 10:47:26 +02:00
dependabot[bot]
c6ac73f74f Bump phpmailer/phpmailer from 6.1.4 to 6.1.6
Bumps [phpmailer/phpmailer](https://github.com/PHPMailer/PHPMailer) from 6.1.4 to 6.1.6.
- [Release notes](https://github.com/PHPMailer/PHPMailer/releases)
- [Changelog](https://github.com/PHPMailer/PHPMailer/blob/master/changelog.md)
- [Commits](https://github.com/PHPMailer/PHPMailer/compare/v6.1.4...v6.1.6)

Signed-off-by: dependabot[bot] <support@github.com>
2020-05-27 17:01:04 +00:00
Michael Kaufmann
fdcb294244 Merge pull request #844 from daxara/dns_rhel7
Named DNS for RHEL7
2020-05-25 22:02:40 +02:00
Ante de Baas
8898c7c165 add named dns config 2020-05-25 21:38:58 +02:00
Michael Kaufmann
d4c0acb353 Merge pull request #843 from rubo77/usage
show disk-usage also on unlimited accounts
2020-05-25 09:28:37 +02:00
Ruben Barkow-Kuder
9ea32b69cb show disk-usage also on unlimited accounts
Signed-off-by: Ruben Barkow-Kuder <github@r.z11.de>
2020-05-25 03:14:38 +02:00
Michael Kaufmann
0524c70d2b add config-templates for ubuntu focal (partly tested only for now)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-05-24 12:16:17 +02:00
Michael Kaufmann
6ca7920147 fix missing language files in config-services cli script; set ubuntu xenial deprecated, remove Ubuntu trusty; fix a2dismod command in buster config-template as php7.3 is default
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-05-24 11:55:20 +02:00
Michael Kaufmann
65b2e4efa7 do not check for mariadb.sys user on mariadb-10.4 when testing with travis
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-05-23 21:17:43 +02:00
Michael Kaufmann
7000fd2c30 Merge pull request #841 from rubo77/patch-1
Don't suggest php5 during update as default
2020-05-23 21:16:39 +02:00
Ruben Barkow-Kuder
3b1ff03b33 Don't suggest php5 during update as default 2020-05-23 20:12:27 +02:00
Michael Kaufmann
ffa9205f95 fix sql query to remove duplicates before setting unique key in updater, fixes #840
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-05-18 20:48:56 +02:00
Michael Kaufmann
bc73ed0c75 adjust tls default value to tlsv1.2; refs #839
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-05-18 20:48:04 +02:00
Michael Kaufmann
17fd350d33 Merge pull request #839 from negrusti/patch-2
TLSv1 is deprecated
2020-05-18 20:07:30 +02:00
Grigory Morozov
c2e57dfd60 TLSv1 is deprecated 2020-05-18 05:18:42 +07:00
Michael Kaufmann
50f2047da3 set version to 0.10.17 for upcoming maintenance release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-05-15 20:35:25 +02:00
Michael Kaufmann
ecb9470b65 fix including of language-strings in reports-cron, fixes #836
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-05-15 15:16:24 +02:00
Michael Kaufmann
6d90b5ba80 remove leftover GROUP BY from testing
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-05-15 09:56:24 +02:00
Michael Kaufmann
eb3590dc34 add unique-key domainid to domain_ssl_settings table
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-05-15 09:49:53 +02:00
Michael Kaufmann
bddf9b496c enable internal api-call to bypass customer_hide_options check in certain situations where it is needed, fixes #803
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-05-15 09:35:20 +02:00
Michael Kaufmann
edc702dafa check for required min version of php every time (frontend and cron), fixes #833
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-05-08 10:03:01 +02:00
Michael Kaufmann
85dfc1030a Merge pull request #832 from RipClaw2971/bugfix
Certificate file cannot be read to database
2020-05-04 16:11:42 +02:00
Andreas Grundler
c0dd432916 Certificate file cannot be read to database if the domain contains capital letters. 2020-05-04 12:08:20 +02:00
Michael Kaufmann
b3db4dd887 set version to 0.10.16 for upcoming release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-05-01 16:27:23 +02:00
Michael Kaufmann
14413a3e8d try to fix travis irc notifications again
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-04-30 20:10:52 +02:00
Michael Kaufmann
a02a081c6b try to fix travis irc notifications
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-04-30 20:03:54 +02:00
Michael Kaufmann
43070e4808 remove possible trailing slash of apache DocumentRoot diretives as sugggested by the httpd-docs, thx to jonbert
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-04-30 19:49:20 +02:00
Michael Kaufmann
98c636c282 let send-to-alternative-email be optional if no address is given instead of displaying error that the email address is invalid; fixes #829
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-04-30 13:03:19 +02:00
Michael Kaufmann
8dace6eca5 remove special characters from name when generating extrausers file
add froxlor hostname to 2fa-qrcode; refs #814

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-04-28 07:59:37 +02:00
Michael Kaufmann
78fc4f84b2 add optional dns validation for let's encrypt activated domains; fixes #817
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-04-14 10:28:33 +02:00
Michael Kaufmann
9018404faa Double check whether installation of acme.sh worked when not installed yet and do not continue if not; fixes #823
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-04-14 08:10:36 +02:00
Michael Kaufmann
8bdd843bd9 fix renew of froxlors own letsencrypt certificate; fix only variables should be passed by reference in BackupCron; fix possible notice or double inclusion of language file in ReportsCron
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-04-08 09:07:48 +02:00
Michael Kaufmann
0d35f5cb29 restructure acmesh implementation and let acme.sh take care of renewing the certificates itself; fixes #792, fixes #816
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-04-04 18:04:39 +02:00
Michael Kaufmann
6815c1c20b Merge pull request #821 from chrschn/master
Fix renewal of ECC/ECDSA certificates.
2020-03-29 23:52:34 +02:00
Christian Schneider
048e6c13ae Fix renewal of ECC/ECDSA certificates.
The ACME v2 implementation uses separate directoies for ECC and on-ECC
certificates. The renew command for a domain checks if an ECC directory
exists (having a "_ecc" suffix) and refuses the command unless the
"--ecc" flag was specified.

Confusingly, this flag is only required to *renew* an ECC certificate,
but not to issue it.

This fixes https://github.com/Froxlor/Froxlor/issues/820.
2020-03-29 22:36:26 +02:00
Michael Kaufmann
aedb829a74 Merge pull request #819 from HBerni/hberni-p0002
fixed parsing due to changes in dovecots default mail_log_prefix
2020-03-21 17:36:00 +01:00
HBerni
4745581720 fixed parsing due to changes in dovecots default mail_log_prefix
regex supports old and new default format now
(see https://wiki2.dovecot.org/Upgrading/2.3)
2020-03-21 16:39:01 +01:00
Michael Kaufmann
489ccbe07a fix removing ip address if ip is set as system-ipaddress but there are other entries of that ip with a different port
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-03-12 07:01:26 +01:00
Michael Kaufmann
a46e7a3bc4 set correct umask to create user config in installation
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-03-10 07:48:35 +01:00
Michael Kaufmann
a4431e25d3 remove ssl-certificates connected to domains that are being deleted when deleting a customer; fixes #818
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-03-10 07:36:22 +01:00
Michael Kaufmann
1fe9f1e9d6 fix language strings for cron cmdline setting and fallback to php binary if no setting is found
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-03-08 10:30:33 +01:00
Michael Kaufmann
13767df562 set version to 0.10.15 for bugfix release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-03-08 07:39:39 +01:00
Michael Kaufmann
02c5f80854 correct chmod value for userdata.inc.php file to be written on installation; fixes #815
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-03-08 07:35:19 +01:00
Michael Kaufmann
d7550ae58a fix deactivated check in api
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-03-06 22:10:01 +01:00
Michael Kaufmann
cf2c7fa31c deny api access to deactivated users with valid api-key
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-03-06 22:03:41 +01:00
Michael Kaufmann
32b6285589 set version to 0.10.14 for upcoming release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-03-06 20:47:20 +01:00
Michael Kaufmann
7e361274c5 forgot one escapeshellarg() and enhanced security on userdata.inc.php creation when installing
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-03-06 20:44:17 +01:00
Michael Kaufmann
62ce21c9ec secure shell-execution of mysqldump on installation if given database-name exists
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-03-04 19:35:57 +01:00
Michael Kaufmann
6b09720ef8 use unpredictable tmpfile-name in installation if lib/userdata.inc.php cannot be written due to permission
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-03-04 19:34:18 +01:00
Michael Kaufmann
8807ae7dad allow private ip ranges in ips-and-ports as some configurations require that; fixes #802
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-03-02 09:51:44 +01:00
Michael Kaufmann
5f3f208534 remove superfluous comma in sql query which causes invalid sql
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-03-01 09:16:47 +01:00
Michael Kaufmann
f11ceacf89 store ace-string of domain besides idn-converted string to have correct sorting in the frontend; fixes #809
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-02-29 09:50:29 +01:00
Michael Kaufmann
26e43077c2 make customer firstname,name,company and customer-no available for all templates; fixes #808
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-02-29 08:16:55 +01:00
Michael Kaufmann
d6c8b92523 add Froxlor.integrityCheck() API call to externally run integrity/consistency check, fixes #801
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-02-15 07:30:56 +01:00
Michael Kaufmann
03450dcfa2 fix listing of customer email addresses if 'domain' section is hidden via settings, fixes #803
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-02-15 07:25:23 +01:00
Michael Kaufmann
f39aab6f32 disable sslsessiontickets-option in domain-add/edit if globally disabled in the settings
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-02-15 07:11:28 +01:00
Michael Kaufmann
7f999302fa do not require enabled vhost-container for froxlor-vhost to change sslsessiontickets-setting
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-02-14 19:26:06 +01:00
Michael Kaufmann
8294985588 require set password complexity for admins too when resetting password; display correct error message if password complexity is not satisfied
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-02-08 10:03:41 +01:00
Michael Kaufmann
a7653551b2 set version to 0.10.13 for upcoming maintenance release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-02-07 16:37:06 +01:00
Michael Kaufmann
734c02e33f update php-fpm defaults; update paths for current stable php-7.3; read froxlor default php.ini from file rather then using phpconfig with id=1; fixes #796
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-01-31 13:17:49 +01:00
Michael Kaufmann
ace18cb7c9 use correct default-versions for configuration-step to disable mod_php for debian buster and ubuntu bionic
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-01-31 12:58:04 +01:00
Michael Kaufmann
1270204cd9 fix wrongly initialized resource-usage when re-calculating it; fixes #797
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-01-31 09:49:29 +01:00
Michael Kaufmann
2831923708 Merge pull request #795 from lpedretti/master
Fixed the case that the spf record is not inserted with it's quotes, and so the condition fails and 2 spf records are inserted in the domain
2020-01-24 16:58:10 +01:00
Leonardo Pedretti
6b1ae648b4 Fixed the case that the spf record is not inserted with it's quotes, and so the condition fails and 2 spf records are inserted in the domain 2020-01-23 11:59:28 -03:00
Michael Kaufmann
6c43f1bc56 fix Domains.update() if called as admin/reseller without change_serversettings privileges, thx to rseffner
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-01-22 09:14:07 +01:00
Michael Kaufmann
2e273a41b5 fix IpsAndPorts when checking for system.ipaddress in update() and delete()
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-01-19 10:45:48 +01:00
Michael Kaufmann
2004bbe38d dont access db result arrays directly without checking whether it's false due to an error (php7.4 related)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-01-19 10:13:28 +01:00
Michael Kaufmann
e44e07784f validate nameserver ip-addresses for binds allow-transfer block; fixes #791
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-01-19 10:08:06 +01:00
Michael Kaufmann
8d6275e1aa set version to 0.10.12 for upcoming maintenance release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-01-10 17:41:20 +01:00
Michael Kaufmann
f21d4f8770 when not using awstats, disable awstats-related settings; add minor tweaks to unit-tests
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-01-10 16:44:13 +01:00
Michael Kaufmann
fc97b4d4e9 Merge pull request #786 from patschi/logformat-awstats
Allow configuring awstats LogFormat
2020-01-10 16:32:33 +01:00
Patrik Kernstock
05051309c7 Merge branch 'master' into logformat-awstats 2020-01-09 23:24:26 +00:00
Patrik Kernstock
0f025a6627 Language file update
Signed-off-by: Patrik Kernstock <patrik@kernstock.net>
2020-01-09 23:21:11 +00:00
Michael Kaufmann
f6f5765b54 avoid settig more than one catchall address for one domain in Emails.update(), thx to mrairstone
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-01-09 14:45:51 +01:00
Michael Kaufmann
ac82aa80d2 correct logfiles_format migration; only needed if setting is non-empty
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-01-09 14:14:04 +01:00
Michael Kaufmann
57503d9c6e try to touch logfile from settings in order for is_writable to work correctly, thx to rubberduck
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-01-09 14:10:50 +01:00
Michael Kaufmann
f55ad16d82 Merge pull request #785 from patschi/logformat
Allow using more advanced webserver LogFormat
2020-01-09 09:16:03 +01:00
Patrik Kernstock
ea7834c1d1 Added small notice to lng for awstats LogFormat
Signed-off-by: Patrik Kernstock <patrik@kernstock.net>
2020-01-08 22:08:15 +00:00
Patrik Kernstock
b355711de9 Improvements as suggested by @d00p
Signed-off-by: Patrik Kernstock <patrik@kernstock.net>
2020-01-08 22:08:15 +00:00
Michael Kaufmann
a5287726a4 fix issue in PhpHelper::trimArray() returning an empty array, fixes #751
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-01-03 23:32:21 +01:00
Patrik Kernstock
b393c7d6e6 Merge branch 'master' into logformat 2020-01-03 22:32:45 +01:00
Michael Kaufmann
dd2782771a set version to 0.10.11 for upcoming maintenance release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-01-03 13:24:31 +01:00
Michael Kaufmann
25d0bbb766 switch from algo26-matthias/idna-covert to our own fork as we cannot update to >2.1 without having a minimum requirement for php-7.2 but we need a few fixes for php-7.4 support later on
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-01-03 12:48:01 +01:00
Michael Kaufmann
b4dedca3db Update README.md 2020-01-02 13:53:22 +01:00
Patrik Kernstock
09aed61dbf Merge branch 'master' into logformat-awstats 2020-01-02 12:44:35 +01:00
Patrik Kernstock
ca39501530 Fixed awstats_logformat field for new installs
Signed-off-by: Patrik Kernstock <patrik@kernstock.net>
2020-01-02 12:39:25 +01:00
Patrik Kernstock
28fd88e53e Merge branch 'master' into logformat 2020-01-02 12:31:51 +01:00
Michael Kaufmann
e01c2e02fb fix update query for new fpm-custom_config value, refs #783
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2020-01-02 12:28:48 +01:00
Michael Kaufmann
762bfae61a Merge pull request #783 from patschi/phpfpm-custom-settings
Ability to add custom config to PHPFPM version
2020-01-02 10:19:19 +01:00
Patrik Kernstock
a4d4e16efc Small comment added to escaping double-quote
Signed-off-by: Patrik Kernstock <patrik@kernstock.net>
2019-12-31 22:46:03 +01:00
Patrik Kernstock
7f83ad31f4 Fixed dbversion in SQL/Froxlor.php
Signed-off-by: Patrik Kernstock <patrik@kernstock.net>
2019-12-31 22:30:54 +01:00
Patrik Kernstock
e143ba4577 Allow configuring awstats LogFormat
Signed-off-by: Patrik Kernstock <patrik@kernstock.net>
2019-12-31 22:29:29 +01:00
Patrik Kernstock
6799a56ba1 Allow using more advanced LogFormat
Signed-off-by: Patrik Kernstock <patrik@kernstock.net>
2019-12-31 20:18:52 +01:00
Patrik Kernstock
484fe8acbc Fixed db_DBVERISON in Froxlor.php
Signed-off-by: Patrik Kernstock <patrik@kernstock.net>
2019-12-31 17:22:37 +01:00
Patrik Kernstock
550af5b943 Fixed german lng, fixed db_version in SQL
Signed-off-by: Patrik Kernstock <patrik@kernstock.net>
2019-12-31 17:18:17 +01:00
Patrik Kernstock
7ae59477af New update step, changed order of lang strings
Signed-off-by: Patrik Kernstock <patrik@kernstock.net>
2019-12-31 16:14:26 +01:00
Michael Kaufmann
acefa41806 Merge pull request #781 from patschi/accesslog-logtype
Use logtype for access_log for IPsAndPorts too
2019-12-31 16:01:42 +01:00
Patrik Kernstock
b39c8029cd Merge branch 'master' into phpfpm-custom-settings 2019-12-31 15:51:27 +01:00
Patrik Kernstock
69ff416361 Fixed SQL, minor comments/lng updates
Signed-off-by: Patrik Kernstock <patrik@kernstock.net>
2019-12-31 15:34:46 +01:00
Michael Kaufmann
3eb1718fe0 add option to disable SSL sessiontickets globally for older systems, fixes #784
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-12-31 12:27:35 +01:00
Michael Kaufmann
37c434d4fc testsystem does not listen on socket for mysql
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-12-31 09:29:09 +01:00
Michael Kaufmann
1eb14d7564 update composer-dependencies; add connection-test to Mysqls.update() when changing passwords; validate ssl-certificates to avoid private/public key mismatch and a failed webserver start, fixes #778
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-12-31 09:23:28 +01:00
Michael Kaufmann
1c17df69d2 Merge pull request #782 from patschi/fix-dhparams-indent
Fix dhparam indent
2019-12-31 08:11:40 +01:00
Patrik Kernstock
c61b3b73bd Ability to add custom config to PHPFPM version
Addresses #643

Signed-off-by: Patrik Kernstock <patrik@kernstock.net>
2019-12-31 05:48:36 +01:00
Patrik Kernstock
18c87baec8 Fix dhparam indent 2019-12-31 03:53:12 +01:00
Patrik Kernstock
631b2b59a5 Use logtype for access_log for IPsAndPorts too 2019-12-31 03:51:19 +01:00
Michael Kaufmann
1e0510a43d fix SysLog.delete(), SysLog.listing() and SysLog.listingCount() when called as admin/reseller withouth customers_see_all permission
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-12-21 15:12:51 +01:00
Michael Kaufmann
e62f675c4c apply 'notryfiles', 'writeaccesslog' and 'writeerrorlog' flags to subdomains when editing a domain
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-12-18 08:44:02 +01:00
Michael Kaufmann
fe389ab208 setting version to 0.10.10 for upcoming maintenance release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-12-13 16:23:43 +01:00
Michael Kaufmann
63d915804a lowercase domainnames when adding new (sub)domain to avoid issues with certificates on filesystem
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-12-11 20:12:51 +01:00
Michael Kaufmann
466c09137b add new 'ssl-enabled' flag for domains and subdomains so ssl can be deactivated (by a customer too) even if there are ssl-ip/ports assigned; introduce new honorcipherorder and sessiontickets flags for more control over ssl-related settings on a per domain base (admin only); fixes #767 and fixes #769
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-12-10 10:21:35 +01:00
Michael Kaufmann
3a738b7070 fix mysql8 issue with group by and sorting within; fixes #774
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-12-08 10:43:12 +01:00
Michael Kaufmann
5ee9d3064a add new API function Froxlor.generatePassword() to return a random password based on froxlor settings regarding min-length, included characters, etc.; fixes #768
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-12-06 11:51:40 +01:00
Michael Kaufmann
adb5c6734a set version to 0.10.9 for upcoming maintenance release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-12-06 10:20:01 +01:00
Michael Kaufmann
7dff46b63e set production Lets Encrypt endpoint as default in settings like the installation does; do nat-sorting only on username-related fields, fixes #765
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-12-05 07:52:11 +01:00
Michael Kaufmann
12883bafd6 check for valid result when reading database usage from information_schema; fixes #766
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-12-04 07:15:28 +01:00
Michael Kaufmann
c2b88200f0 Merge pull request #763 from RipClaw2971/bugfix
SQL error in lib/Froxlor/Api/Commands/Certificates.php
2019-11-29 19:52:13 +01:00
Andreas Grundler
634199780b Bugfix 2019-11-29 19:22:43 +01:00
Michael Kaufmann
e0275840ab set version to 0.10.8 for upcoming maintenance release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-29 17:14:02 +01:00
Michael Kaufmann
bae8c86901 fix removing of ssl-ip-relation to domain if no ssl-ip is selected via interface, thx to Patient Nr0
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-27 18:32:27 +01:00
Michael Kaufmann
e8be3ee643 use correct apiendpoint for lets encrypt; pass debug-flag onto acme.sh; fixes #762
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-27 07:42:23 +01:00
Michael Kaufmann
35ecdfa2f5 fix searching for alias-domains by link in customer_domains
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-24 12:52:25 +01:00
Michael Kaufmann
3e4a3ef4b0 fix duplicate domain entries in customer-domain-list when domain has aliases, thx to crazy4chrissi
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-24 11:33:10 +01:00
Michael Kaufmann
cdf02ceab6 set version to 0.10.7 for upcoming maintenance release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-22 16:14:13 +01:00
Michael Kaufmann
d24056c925 fix vhost-merging of specialsettings in nginx; fixes #757
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-22 16:12:11 +01:00
Michael Kaufmann
d2852fbd5d add new setting to set default value of domain-edit-setting 'Apply specialsettings to all subdomains' and 'Apply php-config to all subdomains'
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-22 16:10:27 +01:00
Michael Kaufmann
d76ebc7c06 fix sort-ordering parameter for pagination
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-20 13:08:36 +01:00
Michael Kaufmann
4fbaacb159 fix domain listing for admin-domains
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-20 12:20:20 +01:00
Michael Kaufmann
2d43a8714d let's try to fix the mysql-user-create/update issue, fingers crossed; refs #758
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-20 11:06:21 +01:00
Michael Kaufmann
620a22bf3e fix listing of subdomains for customers, fixes #759
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-20 09:33:28 +01:00
Michael Kaufmann
5e01018f30 fix typo in SysLog.delete(), thx to Wolfgang
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-18 14:47:56 +01:00
Michael Kaufmann
c84732a0cd fix issue when adding new database users with already-hashed passwords, refs #758
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-18 10:48:31 +01:00
Michael Kaufmann
dfce1fea3c re-add \Froxlor\UI\Paging as it's still required for api_keys.php because they are not (yet) listable via API
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-17 15:20:46 +01:00
Michael Kaufmann
e6dad6c6d0 Use authentication_string for mysql-5.7 and mysql-8 (not password-field) - let's see what happens
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-17 14:29:37 +01:00
Michael Kaufmann
605d2340d1 first unittest for mysql-users and their password, refs #758
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-17 13:42:35 +01:00
Michael Kaufmann
d5df4dd7a4 set version to 0.10.6 for upcoming maintenance release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-15 16:43:36 +01:00
Michael Kaufmann
57497bd03f if no ssl IP/port is selected when editing a domain within the webinterface, set the remove_ssl_ipandport parameter to true to not fallback to defaults
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-15 16:36:14 +01:00
Michael Kaufmann
1a3cc52188 fix parameters defaults for Domains.update() and add new parameter 'remove_ssl_ipandport' to clear ssl ip/port instead of defaulting to the current set value; fixes #756
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-15 15:11:24 +01:00
Michael Kaufmann
21f6874a61 check whether there actually is quota read for a user if newly created, thx again to J-BBB
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-15 12:58:28 +01:00
Michael Kaufmann
b34e66dfd6 fix install-dir replacement in configfiles, thx to J-BBB
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-15 08:02:46 +01:00
Michael Kaufmann
a77f890462 Merge branch 'master' of github.com:Froxlor/Froxlor 2019-11-15 07:20:38 +01:00
Michael Kaufmann
3cc5352c01 implement EmailForwarders.listing(); fixes #754
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-15 07:20:16 +01:00
Michael Kaufmann
d01d470119 Merge pull request #755 from danielrona/patch-1
enabled autofocus for 2fa_code
2019-11-14 12:58:18 +01:00
Daniel
a97ce74cc8 enabled autofocus for 2fa_code 2019-11-14 12:31:29 +01:00
Michael Kaufmann
fe7bfcc7c2 fix update of hosting plans via interface; fixes #753
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-13 15:28:08 +01:00
Michael Kaufmann
cff0ac72d0 optimize varchar fields in admin/customer table; fixes #752
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-13 08:57:53 +01:00
Michael Kaufmann
e8dcb29b69 keep searching code in ssl_certificates if something was searched and no results were returned, thx to Ithariel
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-12 12:53:38 +01:00
Michael Kaufmann
2b3b68efa3 remove testing code
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-12 08:17:54 +01:00
Michael Kaufmann
d937029bf7 implement [ApiModule].listing() in frontend-module as sorting/limiting/searching is now possible via API call (partly untested)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-10 18:35:32 +01:00
Michael Kaufmann
1955b5dd32 add task to remove certificate from acme.sh when removed in froxlor; fix issue when mode of certificate generation was not reset to 'issue' and kept trying to 'renew' instead
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-10 18:34:02 +01:00
Michael Kaufmann
c2a9880616 add new Api-Module 'SysLog' to query froxlor logs; set default value for api_allowed to the value of api.enabled setting when adding new customer via frontend to behave like Customers.add() API method
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-09 11:37:45 +01:00
Michael Kaufmann
dfedc478f7 check for given customer loginname/id before anything happens in Mysqls.add/update/delete when called as admin; fixes #749
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-07 15:53:30 +01:00
Michael Kaufmann
6efe500cee validate that the admin/reseller has customers in SubDomains.listing(); return all domain fields for admins/resellers in SubDomains.listing()
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-05 11:21:49 +01:00
Michael Kaufmann
9c3549c604 lowercase domain-names in AcmeSh implementation to avoid https://github.com/Neilpang/acme.sh/issues/2556
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-04 11:39:06 +01:00
Michael Kaufmann
50755f4399 set phpunit to fixed 8.4.1 in favor of https://github.com/sebastianbergmann/phpunit/issues/3793 to not break jenkins testing for now
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-02 13:26:38 +01:00
Michael Kaufmann
ef11ad8da7 fix broke count sql-queries
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-02 11:12:49 +01:00
Michael Kaufmann
1b2c186c07 introduce search, limit, offset and orderby possibilities for (almost) all API listing() functions; added listingCount() function in preparation to replace the old UI\Paging class later on
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-02 10:58:52 +01:00
Michael Kaufmann
b162324ff0 fix renew-check of let's encrypt implementation, set version to 0.10.5 for bugfix release; fixes #747
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-01 14:19:06 +01:00
Michael Kaufmann
6cd061d74c set version to 0.10.4 for upcoming maintenance release; minor code formatting + adjustments
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-01 11:16:13 +01:00
Michael Kaufmann
53b7420dc9 fix stripping of escape-sequences in api-endpoint; fixes #746
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-11-01 07:39:28 +01:00
Michael Kaufmann
aa85c648a3 check for renewal of certificates not only if there's a task to regenerate vhosts but everytime the letsencrypt cronjob runs (which is basically obsolete due to the integration into the tasks cron but perfect for checking renewal dates
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-31 21:37:54 +01:00
Michael Kaufmann
35e228ff09 Merge pull request #745 from pquerner/unittests/564
Add UnitTests for #679
2019-10-30 13:01:02 +01:00
Pascal
62236da496 changed method name 2019-10-30 12:50:16 +01:00
Pascal
e1cc896b6c add unit tests for Validate::is_ipv6 2019-10-30 12:39:56 +01:00
Pascal
36595baa65 Merge remote-tracking branch 'Froxlor/master' 2019-10-30 12:14:39 +01:00
Michael Kaufmann
ec3fd1d105 Create SECURITY.md 2019-10-30 11:00:08 +01:00
Michael Kaufmann
e39dcfbfe2 Update FUNDING.yml 2019-10-30 10:50:20 +01:00
Michael Kaufmann
ef6254b307 Merge pull request #679 from pquerner/#564
Allow CIDR and Netmask in mysql_host_access; fixes #564
2019-10-30 10:40:26 +01:00
Michael Kaufmann
44bf211ab5 Merge pull request #743 from kionez/fix_split_path_info
Correct fastcgi_split_path_info; fixes #744
2019-10-29 16:09:44 +01:00
kionez
b0e920104f Fix fastcgi_split_path_info as https://www.nginx.com/resources/wiki/start/topics/examples/phpfcgi/ 2019-10-29 16:00:14 +01:00
kionez
299e201142 Fix fastcgi_split_path_info 2019-10-29 15:47:28 +01:00
Michael Kaufmann
46982ad2dc validate that a customer gets the default ftp account created even if the admin/reseller has no more resource for ftp accounts; fixes #741
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-29 07:52:00 +01:00
Michael Kaufmann
c0e07fd659 fix undefined variable in hosting-plans frontend, fixes #742
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-28 20:06:14 +01:00
Pascal
5c11eecbd7 remove code for checking ipv6 mapped ipv4 notation 2019-10-28 17:27:39 +01:00
Pascal
9689afc759 change method signature of \Froxlor\Validate\Validate::validate_ip2 2019-10-28 16:58:34 +01:00
Pascal
d76f4108e5 dont need $result if we're expecting an exception 2019-10-28 16:40:22 +01:00
Pascal
9c4d619840 remove inner if statement
check ipv6 when cidr>netmask flag is set
2019-10-28 16:32:52 +01:00
Pascal
7774e7606d dont check notated ips again 2019-10-28 16:29:53 +01:00
Pascal
2ed0cad27b #564:
cidr notation can only be 1 through 32
2019-10-28 16:27:54 +01:00
Pascal
686c2ae534 fix comparison 2019-10-28 16:00:43 +01:00
Pascal
faf3abe800 introduce new parameter to allow automatic convert cidr notation to netmask notation 2019-10-28 15:33:26 +01:00
Pascal
220b493a1b better readability 2019-10-28 14:16:27 +01:00
Pascal
e8d67f9711 check if ipv6 first 2019-10-28 14:07:31 +01:00
Pascal
83e932b068 switch join with implode 2019-10-28 13:26:32 +01:00
Pascal
84d1be538e block ipv6 addresses in cidr notation (mysql can't handle it) 2019-10-28 13:25:34 +01:00
Pascal
c97cdb1c0e make it more readable 2019-10-28 13:15:48 +01:00
Pascal
ffefe85fb4 Merge branch 'master' into #564 2019-10-28 12:18:55 +01:00
Pascal
27341ca490 Merge remote-tracking branch 'Froxlor/master' 2019-10-28 12:17:51 +01:00
Michael Kaufmann
822bb2bd4d fixed deletion of default-ftp-user possible via API (not through the interface though); refs #741
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-27 16:02:32 +01:00
Michael Kaufmann
88ee76e4c9 setting version to 0.10.3 for upcoming release
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2019-10-25 14:48:13 +02:00
Michael Kaufmann
90d921ebb5 preserve downward compatibility for 0.10.1 updaters regarding specialsettings for ssl-enabled domains; fixes #739
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2019-10-24 18:14:51 +02:00
Michael Kaufmann
7b162c4bd0 added tls-settings per domain for admins with change_serversettings-flag set; fixes #519
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2019-10-22 16:45:03 +02:00
Michael Kaufmann
32e2d48aed fallback to /tmp/froxlor.log if file-log is activated but no file given or not writeable; fixes #737
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2019-10-22 15:06:41 +02:00
Michael Kaufmann
1fdc524171 correct permissions
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2019-10-19 11:08:55 +02:00
Michael Kaufmann
4704798379 setting version to 0.10.2 for upcoming maintenance release
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2019-10-18 13:39:23 +02:00
Michael Kaufmann
e5c1e8350d set default_theme value in settings-array to 'Sparkle' as it is in install/froxlor.sql; improve language strings for adding php-configurations and fpm-versions
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2019-10-17 18:40:53 +02:00
Michael Kaufmann
f0b36c03ad fix registration and termination date to flip between empty-value and 0000-00-00, thx to dxd
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2019-10-17 09:35:33 +02:00
Michael Kaufmann
79056f20ee display API in the list of features the customer is allowed to use; display total diskspace used by customer (web, mail and mysql) on customers dashboard, fixes #733
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2019-10-16 12:44:23 +02:00
Michael Kaufmann
5d6aa4d2bb Merge pull request #732 from TimoStramann/patch-1
fixing typo
2019-10-16 06:32:13 +02:00
Timo Stramann
f803276ca2 fixing typo
wrong variable name
2019-10-16 00:11:30 +02:00
Michael Kaufmann
5cf2d32e8a reverse parameter for Domains.add() into so users have to explicitly pass the parameter if they do NOT want the default ssl-ip to be used if left empty, so it behaves like the non-ssl ipandport parameter - if left empty, the system default is being used, thx J-BBB
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2019-10-15 14:35:42 +02:00
Michael Kaufmann
9430f77c2e Setting system.leapiversion exists and just needs to be updated, no added
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-15 07:22:41 +02:00
Michael Kaufmann
302fe994b7 adjust ip/port settings for downward compatibility when adding new ssl-specialsettings related settings
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-14 14:26:13 +02:00
Michael Kaufmann
9b122bc003 order tasks by type descending to create bind and webserver configs at the end of the run; cleanUp configs files after creation of certificates to minimize downtime, thx to SCD for testing
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-14 13:56:55 +02:00
Michael Kaufmann
9410356bc7 fix output of acme command when upgrading
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-14 10:12:26 +02:00
Michael Kaufmann
5d5cc3dda3 fix array to string conversion
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-13 22:49:03 +02:00
Michael Kaufmann
a7ccb7007f add Unit-test for DomainZones.listing()
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-13 14:47:39 +02:00
Michael Kaufmann
5680c88da0 implement DomainZones.listing() to actually return custom stored dns entries for a given domain, fixes #731
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-13 14:40:04 +02:00
Michael Kaufmann
cf01a587c7 fix typo in updater
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-12 14:53:13 +02:00
Michael Kaufmann
b6367e1be1 forgot to add the ssl-default-vhostconf-domain fields in ipsandports
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-12 14:39:58 +02:00
Michael Kaufmann
93aa8bff1e add default-ssl-vhost settings and optionally allow including of non-ssl default-vhost settings, fixes #727
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-12 14:34:18 +02:00
Michael Kaufmann
15fa035dc4 check for minimum required php version in autoupdater
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-12 14:04:43 +02:00
Michael Kaufmann
057f4aaa10 Passing the and parameters in reverse order to implode has been deprecated since PHP 7.4
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-12 10:22:11 +02:00
Michael Kaufmann
f588927bc5 check for existence of certificate files created by acme.sh
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-12 08:17:04 +02:00
Michael Kaufmann
03d2a76dd0 clean up language and code for dropped let's encrypt ACMEv1 support
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-11 20:53:34 +02:00
Michael Kaufmann
0d0e557715 force Let's Encrypt ACMEv2 API, fixed #728
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-11 18:17:05 +02:00
Michael Kaufmann
fb54b887f2 remove unneeded apihelp-page code in admin/customer_index; set explicit version to api-doc URL; check for acme.sh cronjob and uninstall it, as froxlor manages that itself
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-10 16:42:32 +02:00
Pascal
836b6f2fdb Merge remote-tracking branch 'upstream/master' 2019-05-10 02:54:33 +02:00
Pascal
f297058461 #564
fix wording
add validation for cidr syntax
add automatic transform of cidr to netmask for mysql
2019-05-04 00:39:12 +02:00
Pascal
0f4d8d76ae #564
fix wording
2019-05-03 23:31:31 +02:00
Pascal
12884c91a6 #564
fix #564 by allowing CIDR in mysql host validation. 
fix english and german field description accordingly
2019-05-03 22:32:57 +02:00
895 changed files with 83397 additions and 62682 deletions

View File

@@ -1,4 +0,0 @@
codecov:
notify:
require_ci_to_pass: no

19
.editorconfig Normal file
View File

@@ -0,0 +1,19 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_style = space
indent_size = 2
[docker-compose.yml]
indent_size = 4

View File

@@ -1,57 +1,31 @@
# Contributing # Contribution
Before you start working on a PR, contact us via IRC in #froxlor on Freenode or
the forum at https://forum.froxlor.org to get a clue whether someone else isn't
already working on it or if we don not want/need this certain change.
Of course, bugfixes are always welcome.
However, at this stage of the 0.9.x branch, we are not looking for new
features or refactoring, especially not the kind which requires changes to a
lot of files.
Please focus on our API based version 0.10.x (current master).
Before you start working on a PR, contact us via [Discord](https://discord.froxlor.org) or the forum at [https://forum.froxlor.org](https://forum.froxlor.org) to get a clue whether someone else isn't already working on it or if we don not want/need this certain change. Of course, bugfixes are always welcome.
Please always focus on the **main** branch of our [Github repository](https://github.com/Froxlor/Froxlor).
## Checklist ## Checklist
General rules for PRs are: General rules for PRs are:
* Please save us all some trouble and unnecessary round-trips by _testing_ your
changes.
* Please save us all some trouble and unnecessary round-trips by _testing_ your changes.
* Re-write your commit history to provide a CLEAN history! * Re-write your commit history to provide a CLEAN history!
* i.e. do not provide PRs which contain a commit that changes something, the next changes it back, a third one changes it again, only a little differently...
* i.e. do not provide PRs which contain a commit that changes something,
the next changes it back, a third one changes it again, only a little
differently...
Thanks! Thanks!
### Service changes
If you make changes to the functionality of service configurations, please make sure your implementation covers all supported services and distributions.
### Webserver changes
If you make changes to the functionality of webserver configuration, please
make sure your implementation covers all supported webservers.
### l10n ### l10n
If you add new language strings, please make sure you add the english fallback If you add new language strings, please make sure you add the english fallback strings in `lng/en.php`.
strings in
* `lng/english.lng.php` ### New settings and database-layout changes
* `install/lng/english.lng.php` (if applicable)
If you add new settings or implement database-changes, please make sure you add these to
* `install/froxlor.sql.php`
* handle the update (see [`install/updates/froxlor/update_2.x.inc.php`](https://github.com/Froxlor/Froxlor/blob/main/install/updates/froxlor/update_2.x.inc.php))
### New settings and database-layout changnes
If you add new settings or layout changes, please make sure you add these to
* `install/froxlor.sql`
* and handle the update (see `install/updates/froxlor/0.10/update_0.10.inc.php`)
* if you have any question on how update-process works, please contact us * if you have any question on how update-process works, please contact us

1
.github/FUNDING.yml vendored
View File

@@ -1,3 +1,4 @@
# These are supported funding model platforms # These are supported funding model platforms
github: d00p
custom: ['https://paypal.me/Froxlor'] custom: ['https://paypal.me/Froxlor']

View File

@@ -1,24 +1,20 @@
# Bug report vs. support request # Bug report vs. support request
If you're unsure of whether your problem is a bug or a configuration error If you're unsure of whether your problem is a bug or a configuration error
* contact us via IRC in #froxlor on freenode * contact us via IRC in #froxlor on irc.libera.chat
* or post a thread in our forum at https://forum.froxlor.org * or post a thread in our forum at https://forum.froxlor.org
As a rule of thumb: before reporting an issue As a rule of thumb: before reporting an issue
* see if it hasn't been [reported](https://github.com/Froxlor/froxlor/issues) (and possibly already been [fixed](https://github.com/Froxlor/froxlor/issues?utf8=✓&q=is:issue%20is:closed)) first * see if it hasn't been [reported](https://github.com/Froxlor/froxlor/issues) (and possibly already been [fixed](https://github.com/Froxlor/froxlor/issues?utf8=✓&q=is:issue%20is:closed)) first
* try with the git master * try with the git master
# Summary # Summary
Please provide a concise summary of the problem you're experiencing... Please provide a concise summary of the problem you're experiencing...
# System information # System information
* Froxlor version: $version/$gitSHA1 * Froxlor version: $version/$gitSHA1
* Web server: apache2/nginx/lighttpd * Web server: apache2/nginx/lighttpd
* DNS server: Bind/PowerDNS (standalone)/PowerDNS (Bind-backend) * DNS server: Bind/PowerDNS (standalone)/PowerDNS (Bind-backend)
@@ -27,37 +23,26 @@ Please provide a concise summary of the problem you're experiencing...
* FTP server: proftpd/pureftpd * FTP server: proftpd/pureftpd
* OS/Version: ... * OS/Version: ...
# Steps to reproduce # Steps to reproduce
1. 1.
2. 2.
3. 3.
# Expected behavior # Expected behavior
1. 1.
2. 2.
3. 3.
# Actual behavior # Actual behavior
1. 1.
2. 2.
3. 3.
# Log files/log entries # Log files/log entries
syslog: syslog:
<pre> <pre>
example example

40
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,40 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**As a rule of thumb: before reporting an issue**
* see if it hasn't been [reported](https://github.com/Froxlor/froxlor/issues) (and possibly already been [fixed](https://github.com/Froxlor/froxlor/issues?utf8=✓&q=is:issue%20is:closed)) first
* try with the git master
**Describe the bug**
A clear and concise description of what the bug is.
**System information**
* Froxlor version: $version/$gitSHA1
* Web server: apache2/nginx/lighttpd
* DNS server: Bind/PowerDNS (standalone)/PowerDNS (Bind-backend)
* POP/IMAP server: Courier/Dovecot
* SMTP server: postfix/exim
* FTP server: proftpd/pureftpd
* OS/Version: ...
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Logfiles**
If applicable, add log-entries to help explain your problem.
**Additional context**
Add any other context about the problem here.

View File

@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

22
.github/LICENSE_HEADER vendored Normal file
View File

@@ -0,0 +1,22 @@
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/

View File

@@ -35,4 +35,3 @@ Please describe the tests that you ran to verify your changes. Provide instructi
- [ ] My changes generate no new warnings - [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes - [ ] New and existing unit tests pass locally with my changes

14
.github/workflows/build-apidocs.yml vendored Normal file
View File

@@ -0,0 +1,14 @@
name: build-docs
on:
release:
types: [published]
jobs:
build_docs:
runs-on: ubuntu-latest
steps:
- env:
GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_TOKEN }}
run: |
gh workflow run --repo Froxlor/Documentation build-docs -f ref=${{github.ref_name}}

81
.github/workflows/build-mariadb.yml vendored Normal file
View File

@@ -0,0 +1,81 @@
name: Froxlor-CI-MariaDB
on: ['push', 'pull_request', 'create']
jobs:
froxlor:
name: Froxlor (PHP ${{ matrix.php-versions }}, MariaDB ${{ matrix.mariadb-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions: ['7.4', '8.1']
mariadb-version: [10.5, 10.4]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer:v2
extensions: mbstring, xml, ctype, pdo_mysql, mysql, curl, json, zip, session, filter, posix, openssl, fileinfo, bcmath, gmp
- name: Install tools
run: sudo apt-get install -y ant
- name: Adjust firewall
run: |
sudo ufw allow out 3306/tcp
sudo ufw allow in 3306/tcp
- name: Setup MariaDB
uses: getong/mariadb-action@v1.1
with:
mariadb version: ${{ matrix.mariadb-version }}
mysql database: 'froxlor010'
mysql root password: 'fr0xl0r.TravisCI'
- name: Wait for database
run: sleep 15
- name: Setup databases
run: |
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "CREATE USER 'froxlor010'@'%' IDENTIFIED BY 'fr0xl0r.TravisCI';"
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "GRANT ALL ON froxlor010.* TO 'froxlor010'@'%';"
php -r "echo include('install/froxlor.sql.php');" > /tmp/froxlor.sql
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI froxlor010 < /tmp/froxlor.sql
- name: Run testing
run: ant quick-build
# - name: irc push
# uses: rectalogic/notify-irc@v1
# if: github.event_name == 'push'
# with:
# channel: "#froxlor"
# server: "irc.libera.chat"
# nickname: froxlor-ci
# message: |
# ${{ github.actor }} pushed ${{ github.event.ref }} ${{ github.event.compare }}
# ${{ join(github.event.commits.*.message) }}
# - name: irc pull request
# uses: rectalogic/notify-irc@v1
# if: github.event_name == 'pull_request'
# with:
# channel: "#froxlor"
# server: "irc.libera.chat"
# nickname: froxlor-ci
# message: |
# ${{ github.actor }} opened PR ${{ github.event.pull_request.html_url }}
# - name: irc tag created
# uses: rectalogic/notify-irc@v1
# if: github.event_name == 'create' && github.event.ref_type == 'tag'
# with:
# channel: "#froxlor"
# server: "irc.libera.chat"
# nickname: froxlor-ci
# message: |
# ${{ github.actor }} tagged ${{ github.repository }} ${{ github.event.ref }}

59
.github/workflows/build-mysql.yml vendored Normal file
View File

@@ -0,0 +1,59 @@
name: Froxlor-CI-MySQL
on: ['push', 'pull_request', 'create']
jobs:
froxlor:
name: Froxlor (PHP ${{ matrix.php-versions }}, MySQL ${{ matrix.mysql-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions: ['7.4', '8.1']
mysql-version: [8.0, 5.7]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer:v2
extensions: mbstring, xml, ctype, pdo_mysql, mysql, curl, json, zip, session, filter, posix, openssl, fileinfo, bcmath, gmp
- name: Install tools
run: sudo apt-get install -y ant
- name: Adjust firewall
run: |
sudo ufw allow out 3306/tcp
sudo ufw allow in 3306/tcp
- name: Setup MySQL
uses: samin/mysql-action@v1.3
with:
mysql version: ${{ matrix.mysql-version }}
mysql database: 'froxlor010'
mysql root password: 'fr0xl0r.TravisCI'
- name: Wait for database
run: sleep 15
- name: Setup database (8.0)
if: matrix.mysql-version == '8.0'
run: |
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "CREATE USER 'froxlor010'@'%' IDENTIFIED WITH mysql_native_password BY 'fr0xl0r.TravisCI';"
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "GRANT ALL ON froxlor010.* TO 'froxlor010'@'%';"
php -r "echo include('install/froxlor.sql.php');" > /tmp/froxlor.sql
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI froxlor010 < /tmp/froxlor.sql
- name: Setup database (5.7)
if: matrix.mysql-version == '5.7'
run: |
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "CREATE USER 'froxlor010'@'%' IDENTIFIED BY 'fr0xl0r.TravisCI';"
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "GRANT ALL ON froxlor010.* TO 'froxlor010'@'%';"
php -r "echo include('install/froxlor.sql.php');" > /tmp/froxlor.sql
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI froxlor010 < /tmp/froxlor.sql
- name: Run testing
run: ant quick-build

19
.gitignore vendored
View File

@@ -1,5 +1,5 @@
install/update.log install/update.log
templates/* install/*.json
lib/userdata.inc.php lib/userdata.inc.php
lib/userdata.inc.php.bak lib/userdata.inc.php.bak
logs/* logs/*
@@ -7,14 +7,21 @@ logs/*
.buildpath .buildpath
.project .project
.settings/ .settings/
.test/
*.diff *.diff
*~ *~
.well-known .well-known
.idea .idea
*.iml *.iml
img/
!templates/Froxlor/
!templates/Sparkle/
!templates/misc/
templates/Froxlor/assets/img/logo_custom.png
vendor/ vendor/
node_modules/
fonts/
templates/*
!templates/index.html
!templates/Froxlor/
templates/Froxlor/assets/mix-manifest.json
templates/Froxlor/assets/css/
templates/Froxlor/assets/js/
templates/Froxlor/assets/webfonts/
!templates/misc/

View File

@@ -1,67 +0,0 @@
language: php
dist: bionic
services:
- docker
php:
- 7.3
branches:
only:
- master
- namespaces
matrix:
include:
- php: 7.3
env: "DOCKER_MYSQL_TYPE=mysql DOCKER_MYSQL_VERSION=5.6"
- php: 7.3
env: "DOCKER_MYSQL_TYPE=mysql DOCKER_MYSQL_VERSION=5.7"
- php: 7.3
env: "DOCKER_MYSQL_TYPE=mysql DOCKER_MYSQL_VERSION=8.0 STARTCMD='mysqld --default-authentication-plugin=mysql_native_password'"
- php: 7.3
env: "DOCKER_MYSQL_TYPE=mariadb DOCKER_MYSQL_VERSION=10.3"
- php: 7.3
env: "DOCKER_MYSQL_TYPE=mariadb DOCKER_MYSQL_VERSION=10.4"
addons:
apt:
update: true
before_install:
- export MYSQL_DATABASE=froxlor010
- docker run -d --name mysql -e MYSQL_ROOT_PASSWORD=fr0xl0r.TravisCI -e MYSQL_DATABASE=$MYSQL_DATABASE -p 3306:3306 $DOCKER_MYSQL_TYPE:$DOCKER_MYSQL_VERSION $STARTCMD
- sudo apt-get install -y ant
- >
export tries=0;
export max_tries=20;
while [[ true ]]; do
tries=$((tries + 1));
echo "waiting for database server to start up... [$tries]";
sleep 5;
# Now see that today's table is there, which would indicate that the cron job ran.
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -s -e 'SHOW VARIABLES LIKE "%version%";'
look_exit=$?;
if [[ "$look_exit" = "0" ]]; then echo "Database server successfully started"; break; fi;
if [[ "$tries" -ge "$max_tries" ]]; then echo "Database server did not start in time"; exit 1; break; fi;
done;
install:
- mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "CREATE DATABASE IF NOT EXISTS froxlor010;"
- mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "CREATE USER 'froxlor010'@'%' IDENTIFIED BY 'fr0xl0r.TravisCI';"
- mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "GRANT ALL ON froxlor010.* TO 'froxlor010'@'%';"
- mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI froxlor010 < install/froxlor.sql
script:
- ant phpunit
after_success:
- bash <(curl -s https://codecov.io/bash) -f "build/logs/clover.xml"
notifications:
irc: "irc.freenode.org#froxlor"
webhooks:
urls:
- https://webhooks.gitter.im/e/bdf91d1c3f745e51f796
on_success: always
on_failure: always
on_start: never

140
2fa.php
View File

@@ -1,32 +1,46 @@
<?php <?php
if (! defined('AREA')) {
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/
if (!defined('AREA')) {
header("Location: index.php"); header("Location: index.php");
exit(); exit();
} }
use Froxlor\Database\Database; use Froxlor\Database\Database;
use Froxlor\FroxlorLogger;
use Froxlor\FroxlorTwoFactorAuth;
use Froxlor\Settings; use Froxlor\Settings;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Response;
use Froxlor\PhpHelper;
use Froxlor\User;
if (Settings::Get('2fa.enabled') != '1') { if (Settings::Get('2fa.enabled') != '1') {
\Froxlor\UI\Response::dynamic_error("2FA not activated"); Response::dynamicError('2fa.2fa_not_activated');
} }
/**
* This file is part of the Froxlor project.
* Copyright (c) 2018 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> (2018-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
* @since 0.10.0
*
*/
// This file is being included in admin_index and customer_index // This file is being included in admin_index and customer_index
// and therefore does not need to require lib/init.php // and therefore does not need to require lib/init.php
if (AREA == 'admin') { if (AREA == 'admin') {
@@ -38,53 +52,103 @@ if (AREA == 'admin') {
} }
$success_message = ""; $success_message = "";
$tfa = new \Froxlor\FroxlorTwoFactorAuth('Froxlor'); $tfa = new FroxlorTwoFactorAuth('Froxlor ' . Settings::Get('system.hostname'));
// do the delete and then just show a success-message // do the delete and then just show a success-message
if ($action == 'delete') { if ($action == 'delete') {
Database::pexecute($upd_stmt, array( Database::pexecute($upd_stmt, [
't2fa' => 0, 't2fa' => 0,
'd2fa' => "", 'd2fa' => "",
'id' => $uid 'id' => $uid
)); ]);
\Froxlor\UI\Response::standard_success($lng['2fa']['2fa_removed']); Response::standardSuccess('2fa.2fa_removed');
} elseif ($action == 'add') { } elseif ($action == 'preadd') {
$type = isset($_POST['type_2fa']) ? $_POST['type_2fa'] : '0'; $type = isset($_POST['type_2fa']) ? $_POST['type_2fa'] : '0';
if ($type == 0 || $type == 1) {
$data = ""; $data = "";
} if ($type > 0) {
if ($type == 2) {
// generate secret for TOTP // generate secret for TOTP
$data = $tfa->createSecret(); $data = $tfa->createSecret();
$userinfo['type_2fa'] = $type;
$userinfo['data_2fa'] = $data;
$userinfo['2fa_unsaved'] = true;
// if type = email, send a code there for confirmation
if ($type == 1) {
$code = $tfa->getCode($data);
$_mailerror = false;
$mailerr_msg = "";
$replace_arr = [
'CODE' => $code
];
$mail_body = html_entity_decode(PhpHelper::replaceVariables(lng('mails.2fa.mailbody'), $replace_arr));
try {
$mail->Subject = lng('mails.2fa.subject');
$mail->AltBody = $mail_body;
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
$mail->AddAddress($userinfo['email'], User::getCorrectUserSalutation($userinfo));
$mail->Send();
} catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
$mailerr_msg = $e->getMessage();
$_mailerror = true;
} }
Database::pexecute($upd_stmt, array(
if ($_mailerror) {
Response::dynamicError($mailerr_msg);
}
}
UI::twig()->addGlobal('userinfo', $userinfo);
} else {
Response::dynamicError('Select one of the possible values for 2FA');
}
} elseif ($action == 'add') {
$type = isset($_POST['type_2fa']) ? $_POST['type_2fa'] : '0';
$data = isset($_POST['data_2fa']) ? $_POST['data_2fa'] : '';
$code = isset($_POST['codevalidation']) ? $_POST['codevalidation'] : '';
// validate
$result = $tfa->verifyCode($data, $code, 3);
if ($result) {
if ($type == 0 || $type == 1) {
// no fixed secret for email validation, the validation code will be set on the fly
$data = "";
}
Database::pexecute($upd_stmt, [
't2fa' => $type, 't2fa' => $type,
'd2fa' => $data, 'd2fa' => $data,
'id' => $uid 'id' => $uid
)); ]);
\Froxlor\UI\Response::standard_success(sprintf($lng['2fa']['2fa_added'], $filename, $s)); Response::standardSuccess('2fa.2fa_added', $filename);
}
Response::dynamicError('Invalid/wrong code');
} }
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed 2fa::overview"); $log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed 2fa::overview");
$type_select_values = [];
$ga_qrcode = '';
if ($userinfo['type_2fa'] == '0') { if ($userinfo['type_2fa'] == '0') {
// available types // available types
$type_select_values = array( $type_select_values = [
0 => '-', 0 => '-',
1 => 'E-Mail', 1 => 'E-Mail',
2 => 'Authenticator' 2 => 'Authenticator'
); ];
asort($type_select_values); asort($type_select_values);
$type_select = "";
foreach ($type_select_values as $_val => $_type) {
$type_select .= \Froxlor\UI\HTML::makeoption($_type, $_val);
}
} elseif ($userinfo['type_2fa'] == '1') { } elseif ($userinfo['type_2fa'] == '1') {
// email 2fa enabled // email 2fa enabled
} elseif ($userinfo['type_2fa'] == '2') { } elseif ($userinfo['type_2fa'] == '2') {
// authenticator 2fa enabled // authenticator 2fa enabled
$ga_qrcode = $tfa->getQRCodeImageAsDataUri($userinfo['loginname'], $userinfo['data_2fa']); $ga_qrcode = $tfa->getQRCodeImageAsDataUri($userinfo['loginname'], $userinfo['data_2fa']);
} }
eval("echo \"" . \Froxlor\UI\Template::getTemplate("2fa/overview", true) . "\";");
UI::view('user/2fa.html.twig', [
'type_select_values' => $type_select_values,
'ga_qrcode' => $ga_qrcode
]);

View File

@@ -1,5 +1,6 @@
[![Build Status](https://travis-ci.com/Froxlor/Froxlor.svg?branch=master)](https://travis-ci.com/Froxlor/Froxlor) [![Froxlor-CI](https://github.com/Froxlor/Froxlor/actions/workflows/build-mariadb.yml/badge.svg?branch=main)](https://github.com/Froxlor/Froxlor/actions/workflows/build-mariadb.yml)
[![Gitter](https://badges.gitter.im/Froxlor/community.svg)](https://gitter.im/Froxlor/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Froxlor-CI](https://github.com/Froxlor/Froxlor/actions/workflows/build-mysql.yml/badge.svg?branch=main)](https://github.com/Froxlor/Froxlor/actions/workflows/build-mysql.yml)
[![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.froxlor.org)
# Froxlor # Froxlor
@@ -9,27 +10,34 @@ Developed by experienced server administrators, this panel simplifies the effort
## Installation ## Installation
### Fast install ### Fast install
1. Ensure that your webserver serves /var/www 1. Ensure that your webserver serves /var/www/html
2. Extract froxlor into /var/www 2. Extract froxlor into /var/www/html
3. Point your browser to http://[ip-of-webserver]/froxlor 3. Point your browser to http://[ip-of-webserver]/froxlor
4. Follow the installer 4. Follow the installer
5. Login as administrator 5. Login as administrator
6. Adjust "System > Settings" according to your needs 6. Have fun!
7. Choose your distribution under "System > Configuration"
8. Follow the steps for your services If you have chosen to do the configuration by hand during the installation, you have to complete some more steps:
9. Have fun!
1. Adjust "System > Settings" according to your needs
2. Choose your distribution under "System > Configuration"
3. Follow the steps for your services
### Detailed installation ### Detailed installation
https://github.com/Froxlor/Froxlor/wiki/Install-froxlor-from-tarball https://docs.froxlor.org/latest/general/installation/
## Help ## Help
You may find help in the following places: You may find help in the following places:
### Discord
The froxlor community discord server can be found here: https://discord.froxlor.org
### IRC ### IRC
froxlor may be found on freenode.net, channel #froxlor: froxlor may be found on libera.chat, channel #froxlor:
irc://chat.freenode.net/froxlor irc://irc.libera.chat/froxlor
### Forum ### Forum
@@ -37,30 +45,37 @@ The community is located on https://forum.froxlor.org/
### Wiki ### Wiki
More documentation may be found in the froxlor - wiki: More documentation may be found in the froxlor - documentation:
https://github.com/Froxlor/Froxlor/wiki https://docs.froxlor.org/
## License ## License
May be found in COPYING May be found in [COPYING](COPYING)
## Downloads ## Downloads
### Tarball ### Tarball
https://files.froxlor.org/releases/froxlor-latest.tar.gz [MD5](https://files.froxlor.org/releases/froxlor-latest.tar.gz.md5) [SHA1](https://files.froxlor.org/releases/froxlor-latest.tar.gz.sha1) https://files.froxlor.org/releases/froxlor-latest.tar.gz [MD5](https://files.froxlor.org/releases/froxlor-latest.tar.gz.md5) [SHA1](https://files.froxlor.org/releases/froxlor-latest.tar.gz.sha1)
### Debian repository ### Debian / Ubutnu repository
[HowTo](https://github.com/Froxlor/Froxlor/wiki/Install-froxlor-on-debian) [HowTo](https://docs.froxlor.org/latest/general/installation/apt-package.html)
/etc/apt/sources.list.d/froxlor.list #### Debian
> deb http://debian.froxlor.org {stretch|buster} main
### Gentoo repository ```
apt-get -y install apt-transport-https lsb-release ca-certificates curl
curl -sSLo /usr/share/keyrings/deb.froxlor.org-froxlor.gpg https://deb.froxlor.org/froxlor.gpg
echo sh -c '"deb [signed-by=/usr/share/keyrings/deb.froxlor.org-froxlor.gpg] https://deb.froxlor.org/debian $(lsb_release -sc) main" > /etc/apt/sources.list.d/froxlor.list'
```
[HowTo](https://github.com/Froxlor/Froxlor/wiki/Install-froxlor-on-gentoo) #### Ubuntu
https://files.froxlor.org/gentoo/repositories.xml ```
apt-get -y install apt-transport-https lsb-release ca-certificates curl
curl -sSLo /usr/share/keyrings/deb.froxlor.org-froxlor.gpg https://deb.froxlor.org/froxlor.gpg
echo sh -c '"deb [signed-by=/usr/share/keyrings/deb.froxlor.org-froxlor.gpg] https://deb.froxlor.org/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/froxlor.list'
```
## Contributing ## Contributing

47
SECURITY.md Normal file
View File

@@ -0,0 +1,47 @@
# froxlor's Security Policy
Welcome and thanks for taking interest in [froxlor](https://www.froxlor.org)!
We are mostly interested in reports by actual froxlor users but all high quality contributions are welcome.
Please try your best to describe a clear and realistic impact for your report and please don't open any public issues on GitHub or social media, we're doing our best to respond through huntr as quickly as we can.
With that, good luck hacking us ;)
## Supported versions
- ️✅ **2.x** (`main` git-branch)
- ❌ 0.10.x (`0.10.x` git-branch)
- ❌ 0.9.x (`0.9.x`git-branch)
## Qualifying Vulnerabilities
### Vulnerabilities we really care about
- SQL injection bugs
- server-side code execution bugs
- cross-site scripting vulnerabilities
- cross-site request forgery vulnerabilities
- authentication and authorization flaws
- sensitive information disclosure
### Vulnerabilities we accept
Only reproducable issues on a default/clean setup from the latest stable release of a supported version will be accepted.
## Non-Qualifying Vulnerabilities
- Reports from automated tools or scanners
- Theoretical attacks without proof of exploitability
- Attacks that are the result of a third party library should be reported to the library maintainers
- Social engineering
- Reflected file download
- Physical attacks
- Weak SSL/TLS/SSH algorithms or protocols
- Attacks involving physical access to a users device, or involving a device or network thats already seriously compromised (eg man-in-the-middle).
- The user attacks themselves
- anything in `/doc`
- anything in `/tests`
## Reporting a Vulnerability
If you think you have found a vulnerability in froxlor, please head over to [https://huntr.dev/repos/froxlor/froxlor](https://huntr.dev/repos/froxlor/froxlor) and use the reporting possibilities there as we are funding the prize-pot for froxlor on this platform. Also, please give us appropriate time to fix the issue and build update-packages before publishing anything into the wild. Alternatively you can send us an email to [team@froxlor.org](team@froxlor.org).

0
actions/admin/index.html Normal file
View File

View File

@@ -2,273 +2,342 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Language
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
return array(
'groups' => array( return [
'panel' => array( 'groups' => [
'title' => $lng['admin']['panelsettings'], 'panel' => [
'fields' => array( 'title' => lng('admin.panelsettings'),
'panel_standardlanguage' => array( 'icon' => 'fa-solid fa-chalkboard-user',
'label' => array( 'fields' => [
'title' => $lng['login']['language'], 'panel_standardlanguage' => [
'description' => $lng['serversettings']['language']['description'] 'label' => [
), 'title' => lng('login.language'),
'description' => lng('serversettings.language.description')
],
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'standardlanguage', 'varname' => 'standardlanguage',
'type' => 'option', 'type' => 'select',
'default' => 'English', 'default' => 'en',
'option_mode' => 'one', 'option_options_method' => [
'option_options_method' => array( '\\Froxlor\\Language',
'\\Froxlor\\User',
'getLanguages' 'getLanguages'
), ],
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'panel_default_theme' => array( 'panel_default_theme' => [
'label' => array( 'label' => [
'title' => $lng['panel']['theme'], 'title' => lng('panel.theme'),
'description' => $lng['serversettings']['default_theme'] 'description' => lng('serversettings.default_theme')
), ],
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'default_theme', 'varname' => 'default_theme',
'type' => 'option', 'type' => 'select',
'default' => 'Froxlor', 'default' => 'Froxlor',
'option_mode' => 'one', 'option_options_method' => [
'option_options_method' => array( '\\Froxlor\\UI\\Panel\\UI',
'\\Froxlor\\UI\\Template',
'getThemes' 'getThemes'
), ],
'save_method' => 'storeSettingDefaultTheme' 'save_method' => 'storeSettingDefaultTheme'
), ],
'panel_allow_theme_change_customer' => array( 'panel_allow_theme_change_customer' => [
'label' => $lng['serversettings']['panel_allow_theme_change_customer'], 'label' => lng('serversettings.panel_allow_theme_change_customer'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'allow_theme_change_customer', 'varname' => 'allow_theme_change_customer',
'type' => 'bool', 'type' => 'checkbox',
'default' => true, 'default' => true,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'panel_allow_theme_change_admin' => array( 'panel_allow_theme_change_admin' => [
'label' => $lng['serversettings']['panel_allow_theme_change_admin'], 'label' => lng('serversettings.panel_allow_theme_change_admin'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'allow_theme_change_admin', 'varname' => 'allow_theme_change_admin',
'type' => 'bool', 'type' => 'checkbox',
'default' => true, 'default' => true,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'panel_natsorting' => array( 'panel_natsorting' => [
'label' => $lng['serversettings']['natsorting'], 'label' => lng('serversettings.natsorting'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'natsorting', 'varname' => 'natsorting',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'panel_no_robots' => array( ],
'label' => $lng['serversettings']['no_robots'], 'panel_paging' => [
'settinggroup' => 'panel', 'label' => lng('serversettings.paging'),
'varname' => 'no_robots',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField'
),
'panel_paging' => array(
'label' => $lng['serversettings']['paging'],
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'paging', 'varname' => 'paging',
'type' => 'int', 'type' => 'number',
'int_min' => 0, 'min' => 0,
'default' => 0, 'default' => 0,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'panel_pathedit' => array( 'panel_pathedit' => [
'label' => $lng['serversettings']['pathedit'], 'label' => lng('serversettings.pathedit'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'pathedit', 'varname' => 'pathedit',
'type' => 'option', 'type' => 'select',
'default' => 'Manual', 'default' => 'Manual',
'option_mode' => 'one', 'select_var' => [
'option_options' => array( 'Manual' => lng('serversettings.manual'),
'Manual' => $lng['serversettings']['manual'], 'Dropdown' => lng('serversettings.dropdown')
'Dropdown' => $lng['serversettings']['dropdown'] ],
),
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'panel_adminmail' => array( 'panel_adminmail' => [
'label' => $lng['serversettings']['adminmail'], 'label' => lng('serversettings.adminmail'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'adminmail', 'varname' => 'adminmail',
'type' => 'string', 'type' => 'email',
'string_type' => 'mail', 'string_emptyallowed' => true,
'string_emptyallowed' => false,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'panel_adminmail_defname' => array( 'panel_adminmail_defname' => [
'label' => $lng['serversettings']['adminmail_defname'], 'label' => lng('serversettings.adminmail_defname'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'adminmail_defname', 'varname' => 'adminmail_defname',
'type' => 'string', 'type' => 'text',
'default' => 'Froxlor Administrator', 'default' => 'Froxlor Administrator',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'panel_adminmail_return' => array( 'panel_adminmail_return' => [
'label' => $lng['serversettings']['adminmail_return'], 'label' => lng('serversettings.adminmail_return'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'adminmail_return', 'varname' => 'adminmail_return',
'type' => 'string', 'type' => 'email',
'string_type' => 'mail',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'panel_decimal_places' => array( ],
'label' => $lng['serversettings']['decimal_places'], 'panel_decimal_places' => [
'label' => lng('serversettings.decimal_places'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'decimal_places', 'varname' => 'decimal_places',
'type' => 'int', 'type' => 'number',
'int_min' => 0, 'min' => 0,
'int_max' => 15, 'max' => 15,
'default' => 4, 'default' => 4,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'panel_phpmyadmin_url' => array( ],
'label' => $lng['serversettings']['phpmyadmin_url'], 'panel_phpmyadmin_url' => [
'label' => lng('serversettings.phpmyadmin_url'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'phpmyadmin_url', 'varname' => 'phpmyadmin_url',
'type' => 'string', 'type' => 'url',
'string_type' => 'url',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'panel_webmail_url' => array( 'panel_webmail_url' => [
'label' => $lng['serversettings']['webmail_url'], 'label' => lng('serversettings.webmail_url'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'webmail_url', 'varname' => 'webmail_url',
'type' => 'string', 'type' => 'url',
'string_type' => 'url',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'panel_webftp_url' => array( 'panel_webftp_url' => [
'label' => $lng['serversettings']['webftp_url'], 'label' => lng('serversettings.webftp_url'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'webftp_url', 'varname' => 'webftp_url',
'type' => 'string', 'type' => 'url',
'string_type' => 'url',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'admin_show_version_login' => array( 'admin_show_version_login' => [
'label' => $lng['admin']['show_version_login'], 'label' => lng('admin.show_version_login'),
'settinggroup' => 'admin', 'settinggroup' => 'admin',
'varname' => 'show_version_login', 'varname' => 'show_version_login',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'admin_show_version_footer' => array( ],
'label' => $lng['admin']['show_version_footer'], 'admin_show_version_footer' => [
'label' => lng('admin.show_version_footer'),
'settinggroup' => 'admin', 'settinggroup' => 'admin',
'varname' => 'show_version_footer', 'varname' => 'show_version_footer',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'admin_show_news_feed' => array( 'admin_show_news_feed' => [
'label' => $lng['admin']['show_news_feed'], 'label' => lng('admin.show_news_feed'),
'settinggroup' => 'admin', 'settinggroup' => 'admin',
'varname' => 'show_news_feed', 'varname' => 'show_news_feed',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'customer_show_news_feed' => array( 'customer_show_news_feed' => [
'label' => $lng['admin']['customer_show_news_feed'], 'label' => lng('admin.customer_show_news_feed'),
'settinggroup' => 'customer', 'settinggroup' => 'customer',
'varname' => 'show_news_feed', 'varname' => 'show_news_feed',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'customer_news_feed_url' => array( 'customer_news_feed_url' => [
'label' => $lng['admin']['customer_news_feed_url'], 'label' => lng('admin.customer_news_feed_url'),
'settinggroup' => 'customer', 'settinggroup' => 'customer',
'varname' => 'news_feed_url', 'varname' => 'news_feed_url',
'type' => 'string', 'type' => 'url',
'string_type' => 'url',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'panel_allow_domain_change_admin' => array( 'panel_allow_domain_change_admin' => [
'label' => $lng['serversettings']['panel_allow_domain_change_admin'], 'label' => lng('serversettings.panel_allow_domain_change_admin'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'allow_domain_change_admin', 'varname' => 'allow_domain_change_admin',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'panel_allow_domain_change_customer' => array( ],
'label' => $lng['serversettings']['panel_allow_domain_change_customer'], 'panel_allow_domain_change_customer' => [
'label' => lng('serversettings.panel_allow_domain_change_customer'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'allow_domain_change_customer', 'varname' => 'allow_domain_change_customer',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'panel_phpconfigs_hidestdsubdomain' => array( ],
'label' => $lng['serversettings']['panel_phpconfigs_hidestdsubdomain'], 'panel_phpconfigs_hidesubdomains' => [
'label' => lng('serversettings.panel_phpconfigs_hidesubdomains'),
'settinggroup' => 'panel',
'varname' => 'phpconfigs_hidesubdomains',
'type' => 'checkbox',
'default' => true,
'save_method' => 'storeSettingField',
'advanced_mode' => true
],
'panel_phpconfigs_hidestdsubdomain' => [
'label' => lng('serversettings.panel_phpconfigs_hidestdsubdomain'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'phpconfigs_hidestdsubdomain', 'varname' => 'phpconfigs_hidestdsubdomain',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'panel_customer_hide_options' => array( ],
'label' => $lng['serversettings']['panel_customer_hide_options'], 'panel_customer_hide_options' => [
'label' => lng('serversettings.panel_customer_hide_options'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'customer_hide_options', 'varname' => 'customer_hide_options',
'type' => 'option', 'type' => 'select',
'default' => '', 'default' => '',
'option_mode' => 'multiple', 'select_mode' => 'multiple',
'option_emptyallowed' => true, 'option_emptyallowed' => true,
'option_options' => array( 'select_var' => [
'email' => $lng['menue']['email']['email'], 'email' => lng('menue.email.email'),
'mysql' => $lng['menue']['mysql']['mysql'], 'mysql' => lng('menue.mysql.mysql'),
'domains' => $lng['menue']['domains']['domains'], 'domains' => lng('menue.domains.domains'),
'ftp' => $lng['menue']['ftp']['ftp'], 'ftp' => lng('menue.ftp.ftp'),
'extras' => $lng['menue']['extras']['extras'], 'extras' => lng('menue.extras.extras'),
'extras.directoryprotection' => $lng['menue']['extras']['extras'] . " / " . $lng['menue']['extras']['directoryprotection'], 'extras.directoryprotection' => lng('menue.extras.extras') . " / " . lng('menue.extras.directoryprotection'),
'extras.pathoptions' => $lng['menue']['extras']['extras'] . " / " . $lng['menue']['extras']['pathoptions'], 'extras.pathoptions' => lng('menue.extras.extras') . " / " . lng('menue.extras.pathoptions'),
'extras.logger' => $lng['menue']['extras']['extras'] . " / " . $lng['menue']['logger']['logger'], 'extras.logger' => lng('menue.extras.extras') . " / " . lng('menue.logger.logger'),
'extras.backup' => $lng['menue']['extras']['extras'] . " / " . $lng['menue']['extras']['backup'], 'extras.backup' => lng('menue.extras.extras') . " / " . lng('menue.extras.backup'),
'traffic' => $lng['menue']['traffic']['traffic'], 'traffic' => lng('menue.traffic.traffic'),
'traffic.http' => $lng['menue']['traffic']['traffic'] . " / HTTP", 'traffic.http' => lng('menue.traffic.traffic') . " / HTTP",
'traffic.ftp' => $lng['menue']['traffic']['traffic'] . " / FTP", 'traffic.ftp' => lng('menue.traffic.traffic') . " / FTP",
'traffic.mail' => $lng['menue']['traffic']['traffic'] . " / Mail" 'traffic.mail' => lng('menue.traffic.traffic') . " / Mail"
), ],
'save_method' => 'storeSettingField',
'advanced_mode' => true
],
'panel_imprint_url' => [
'label' => lng('serversettings.imprint_url'),
'settinggroup' => 'panel',
'varname' => 'imprint_url',
'type' => 'url',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
) ],
) 'panel_terms_url' => [
) 'label' => lng('serversettings.terms_url'),
) 'settinggroup' => 'panel',
); 'varname' => 'terms_url',
'type' => 'url',
?> 'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField'
],
'panel_privacy_url' => [
'label' => lng('serversettings.privacy_url'),
'settinggroup' => 'panel',
'varname' => 'privacy_url',
'type' => 'url',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField'
],
'panel_logo_overridetheme' => [
'label' => lng('serversettings.logo_overridetheme'),
'settinggroup' => 'panel',
'varname' => 'logo_overridetheme',
'type' => 'checkbox',
'default' => false,
'save_method' => 'storeSettingField'
],
'panel_logo_overridecustom' => [
'label' => lng('serversettings.logo_overridecustom'),
'settinggroup' => 'panel',
'varname' => 'logo_overridecustom',
'type' => 'checkbox',
'default' => false,
'save_method' => 'storeSettingField'
],
'panel_logo_image_header' => [
'label' => lng('serversettings.logo_image_header'),
'settinggroup' => 'panel',
'varname' => 'logo_image_header',
'type' => 'image',
'accept' => 'image/jpeg, image/jpg, image/png, image/gif',
'image_name' => 'logo_header',
'default' => '',
'save_method' => 'storeSettingImage'
],
'panel_logo_image_login' => [
'label' => lng('serversettings.logo_image_login'),
'settinggroup' => 'panel',
'varname' => 'logo_image_login',
'type' => 'image',
'accept' => 'image/jpeg, image/jpg, image/png, image/gif',
'image_name' => 'logo_login',
'default' => '',
'save_method' => 'storeSettingImage'
]
]
]
]
];

View File

@@ -2,212 +2,236 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Settings
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
return array(
'groups' => array( return [
'accounts' => array( 'groups' => [
'title' => $lng['admin']['accountsettings'], 'accounts' => [
'fields' => array( 'title' => lng('admin.accountsettings'),
'session_sessiontimeout' => array( 'icon' => 'fa-solid fa-users-gear',
'label' => $lng['serversettings']['session_timeout'], 'fields' => [
'session_sessiontimeout' => [
'label' => lng('serversettings.session_timeout'),
'settinggroup' => 'session', 'settinggroup' => 'session',
'varname' => 'sessiontimeout', 'varname' => 'sessiontimeout',
'type' => 'int', 'type' => 'number',
'min' => 60,
'default' => 600, 'default' => 600,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'session_allow_multiple_login' => array( 'session_allow_multiple_login' => [
'label' => $lng['serversettings']['session_allow_multiple_login'], 'label' => lng('serversettings.session_allow_multiple_login'),
'settinggroup' => 'session', 'settinggroup' => 'session',
'varname' => 'allow_multiple_login', 'varname' => 'allow_multiple_login',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'login_domain_login' => array( 'login_domain_login' => [
'label' => $lng['serversettings']['login_domain_login'], 'label' => lng('serversettings.login_domain_login'),
'settinggroup' => 'login', 'settinggroup' => 'login',
'varname' => 'domain_login', 'varname' => 'domain_login',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'login_maxloginattempts' => array( 'login_maxloginattempts' => [
'label' => $lng['serversettings']['maxloginattempts'], 'label' => lng('serversettings.maxloginattempts'),
'settinggroup' => 'login', 'settinggroup' => 'login',
'varname' => 'maxloginattempts', 'varname' => 'maxloginattempts',
'type' => 'int', 'type' => 'number',
'min' => 1,
'default' => 3, 'default' => 3,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'login_deactivatetime' => array( 'login_deactivatetime' => [
'label' => $lng['serversettings']['deactivatetime'], 'label' => lng('serversettings.deactivatetime'),
'settinggroup' => 'login', 'settinggroup' => 'login',
'varname' => 'deactivatetime', 'varname' => 'deactivatetime',
'type' => 'int', 'type' => 'number',
'min' => 0,
'default' => 900, 'default' => 900,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'2fa_enabled' => array( '2fa_enabled' => [
'label' => $lng['2fa']['2fa_enabled'], 'label' => lng('2fa.2fa_enabled'),
'settinggroup' => '2fa', 'settinggroup' => '2fa',
'varname' => 'enabled', 'varname' => 'enabled',
'type' => 'bool', 'type' => 'checkbox',
'default' => true, 'default' => true,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'panel_password_min_length' => array( 'panel_password_min_length' => [
'label' => $lng['serversettings']['panel_password_min_length'], 'label' => lng('serversettings.panel_password_min_length'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'password_min_length', 'varname' => 'password_min_length',
'type' => 'int', 'type' => 'number',
'min' => 0,
'default' => 0, 'default' => 0,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'panel_password_alpha_lower' => array( 'panel_password_alpha_lower' => [
'label' => $lng['serversettings']['panel_password_alpha_lower'], 'label' => lng('serversettings.panel_password_alpha_lower'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'password_alpha_lower', 'varname' => 'password_alpha_lower',
'type' => 'bool', 'type' => 'checkbox',
'default' => true, 'default' => true,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'panel_password_alpha_upper' => array( 'panel_password_alpha_upper' => [
'label' => $lng['serversettings']['panel_password_alpha_upper'], 'label' => lng('serversettings.panel_password_alpha_upper'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'password_alpha_upper', 'varname' => 'password_alpha_upper',
'type' => 'bool', 'type' => 'checkbox',
'default' => true, 'default' => true,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'panel_password_numeric' => array( 'panel_password_numeric' => [
'label' => $lng['serversettings']['panel_password_numeric'], 'label' => lng('serversettings.panel_password_numeric'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'password_numeric', 'varname' => 'password_numeric',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'panel_password_special_char_required' => array( 'panel_password_special_char_required' => [
'label' => $lng['serversettings']['panel_password_special_char_required'], 'label' => lng('serversettings.panel_password_special_char_required'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'password_special_char_required', 'varname' => 'password_special_char_required',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'panel_password_special_char' => array( 'panel_password_special_char' => [
'label' => $lng['serversettings']['panel_password_special_char'], 'label' => lng('serversettings.panel_password_special_char'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'password_special_char', 'varname' => 'password_special_char',
'type' => 'string', 'type' => 'text',
'default' => '!?<>§$%+#=@', 'default' => '!?<>§$%+#=@',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'panel_password_regex' => array( 'panel_password_regex' => [
'label' => $lng['serversettings']['panel_password_regex'], 'label' => lng('serversettings.panel_password_regex'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'password_regex', 'varname' => 'password_regex',
'type' => 'string', 'type' => 'text',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'customer_accountprefix' => array( ],
'label' => $lng['serversettings']['accountprefix'], 'customer_accountprefix' => [
'label' => lng('serversettings.accountprefix'),
'settinggroup' => 'customer', 'settinggroup' => 'customer',
'varname' => 'accountprefix', 'varname' => 'accountprefix',
'type' => 'string', 'type' => 'text',
'default' => '', 'default' => '',
'plausibility_check_method' => array( 'plausibility_check_method' => [
'\\Froxlor\\Validate\\Check', '\\Froxlor\\Validate\\Check',
'checkUsername' 'checkUsername'
), ],
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'customer_mysqlprefix' => array( 'customer_mysqlprefix' => [
'label' => $lng['serversettings']['mysqlprefix'], 'label' => lng('serversettings.mysqlprefix'),
'settinggroup' => 'customer', 'settinggroup' => 'customer',
'varname' => 'mysqlprefix', 'varname' => 'mysqlprefix',
'type' => 'string', 'type' => 'text',
'default' => '', 'default' => '',
'plausibility_check_method' => array( 'plausibility_check_method' => [
'\\Froxlor\\Validate\\Check', '\\Froxlor\\Validate\\Check',
'checkUsername' 'checkUsername'
), ],
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'customer_ftpprefix' => array( 'customer_ftpprefix' => [
'label' => $lng['serversettings']['ftpprefix'], 'label' => lng('serversettings.ftpprefix'),
'settinggroup' => 'customer', 'settinggroup' => 'customer',
'varname' => 'ftpprefix', 'varname' => 'ftpprefix',
'type' => 'string', 'type' => 'text',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'customer_ftpatdomain' => array( 'customer_ftpatdomain' => [
'label' => $lng['serversettings']['ftpdomain'], 'label' => lng('serversettings.ftpdomain'),
'settinggroup' => 'customer', 'settinggroup' => 'customer',
'varname' => 'ftpatdomain', 'varname' => 'ftpatdomain',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'panel_allow_preset' => array( 'panel_allow_preset' => [
'label' => $lng['serversettings']['allow_password_reset'], 'label' => lng('serversettings.allow_password_reset'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'allow_preset', 'varname' => 'allow_preset',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'dependency' => array( 'dependency' => [
'fieldname' => 'panel_allow_preset_admin', 'fieldname' => 'panel_allow_preset_admin',
'fielddata' => array( 'fielddata' => [
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'allow_preset_admin' 'varname' => 'allow_preset_admin'
), ],
'onlyif' => 0 'onlyif' => 0
) ]
), ],
'panel_allow_preset_admin' => array( 'panel_allow_preset_admin' => [
'label' => $lng['serversettings']['allow_password_reset_admin'], 'label' => lng('serversettings.allow_password_reset_admin'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'allow_preset_admin', 'varname' => 'allow_preset_admin',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'dependency' => array( 'dependency' => [
'fieldname' => 'panel_allow_preset', 'fieldname' => 'panel_allow_preset',
'fielddata' => array( 'fielddata' => [
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'allow_preset' 'varname' => 'allow_preset'
), ],
'onlyif' => 1 'onlyif' => 1
) ]
), ],
'system_backupenabled' => array( 'system_backupenabled' => [
'label' => $lng['serversettings']['backupenabled'], 'label' => lng('serversettings.backupenabled'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'backupenabled', 'varname' => 'backupenabled',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'cronmodule' => 'froxlor/backup', 'cronmodule' => 'froxlor/backup',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
) ],
) 'system_createstdsubdom_default' => [
) 'label' => lng('serversettings.createstdsubdom_default'),
) 'settinggroup' => 'system',
); 'varname' => 'createstdsubdom_default',
'type' => 'select',
'default' => '1',
'select_var' => [
'0' => lng('panel.no'),
'1' => lng('panel.yes')
],
'save_method' => 'storeSettingField'
],
]
]
]
];

View File

@@ -2,259 +2,321 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Settings
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
return array(
'groups' => array( return [
'system' => array( 'groups' => [
'title' => $lng['admin']['systemsettings'], 'system' => [
'fields' => array( 'title' => lng('admin.systemsettings'),
'system_documentroot_prefix' => array( 'icon' => 'fa-solid fa-gears',
'label' => $lng['serversettings']['documentroot_prefix'], 'fields' => [
'system_documentroot_prefix' => [
'label' => lng('serversettings.documentroot_prefix'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'documentroot_prefix', 'varname' => 'documentroot_prefix',
'type' => 'string', 'type' => 'text',
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/var/customers/webs/', 'default' => '/var/customers/webs/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'plausibility_check_method' => array( 'plausibility_check_method' => [
'\\Froxlor\\Validate\\Check', '\\Froxlor\\Validate\\Check',
'checkPathConflicts' 'checkPathConflicts'
) ],
), 'requires_reconf' => ['http']
'system_documentroot_use_default_value' => array( ],
'label' => $lng['serversettings']['documentroot_use_default_value'], 'system_documentroot_use_default_value' => [
'label' => lng('serversettings.documentroot_use_default_value'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'documentroot_use_default_value', 'varname' => 'documentroot_use_default_value',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_ipaddress' => array( 'system_ipaddress' => [
'label' => $lng['serversettings']['ipaddress'], 'label' => lng('serversettings.ipaddress'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'ipaddress', 'varname' => 'ipaddress',
'type' => 'option', 'type' => 'select',
'option_mode' => 'one', 'option_options_method' => [
'option_options_method' => array(
'\\Froxlor\\Domain\\IpAddr', '\\Froxlor\\Domain\\IpAddr',
'getIpAddresses' 'getIpAddresses'
), ],
'default' => '', 'default' => '',
'save_method' => 'storeSettingIpAddress' 'save_method' => 'storeSettingIpAddress'
), ],
'system_defaultip' => array( 'system_defaultip' => [
'label' => $lng['serversettings']['defaultip'], 'label' => lng('serversettings.defaultip'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'defaultip', 'varname' => 'defaultip',
'type' => 'option', 'type' => 'select',
'option_mode' => 'multiple', 'select_mode' => 'multiple',
'option_options_method' => array( 'option_options_method' => [
'\\Froxlor\\Domain\\IpAddr', '\\Froxlor\\Domain\\IpAddr',
'getIpPortCombinations' 'getIpPortCombinations'
), ],
'default' => '', 'default' => '',
'save_method' => 'storeSettingDefaultIp' 'save_method' => 'storeSettingDefaultIp'
), ],
'system_defaultsslip' => array( 'system_defaultsslip' => [
'label' => $lng['serversettings']['defaultsslip'], 'label' => lng('serversettings.defaultsslip'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'defaultsslip', 'varname' => 'defaultsslip',
'type' => 'option', 'type' => 'select',
'option_mode' => 'multiple', 'select_mode' => 'multiple',
'option_options_method' => array( 'option_options_method' => [
'\\Froxlor\\Domain\\IpAddr', '\\Froxlor\\Domain\\IpAddr',
'getSslIpPortCombinations' 'getSslIpPortCombinations'
), ],
'default' => '', 'default' => '',
'save_method' => 'storeSettingDefaultSslIp' 'save_method' => 'storeSettingDefaultSslIp'
), ],
'system_hostname' => array( 'system_hostname' => [
'label' => $lng['serversettings']['hostname'], 'label' => lng('serversettings.hostname'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'hostname', 'varname' => 'hostname',
'type' => 'string', 'type' => 'text',
'default' => '', 'default' => '',
'save_method' => 'storeSettingHostname', 'save_method' => 'storeSettingHostname',
'plausibility_check_method' => array( 'plausibility_check_method' => [
'\\Froxlor\\Validate\\Check', '\\Froxlor\\Validate\\Check',
'checkHostname' 'checkHostname'
) ]
), ],
'api_enabled' => array( 'api_enabled' => [
'label' => $lng['serversettings']['enable_api'], 'label' => lng('serversettings.enable_api'),
'settinggroup' => 'api', 'settinggroup' => 'api',
'varname' => 'enabled', 'varname' => 'enabled',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_validatedomain' => array( 'update_channel' => [
'label' => $lng['serversettings']['validate_domain'], 'label' => lng('serversettings.update_channel'),
'settinggroup' => 'system',
'varname' => 'update_channel',
'type' => 'select',
'default' => 'stable',
'select_var' => [
'stable' => lng('serversettings.uc_stable'),
'testing' => lng('serversettings.uc_testing')
],
'save_method' => 'storeSettingField',
'advanced_mode' => true
],
'system_validatedomain' => [
'label' => lng('serversettings.validate_domain'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'validate_domain', 'varname' => 'validate_domain',
'type' => 'bool', 'type' => 'checkbox',
'default' => true, 'default' => true,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_stdsubdomain' => array( 'system_stdsubdomain' => [
'label' => $lng['serversettings']['stdsubdomainhost'], 'label' => lng('serversettings.stdsubdomainhost'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'stdsubdomain', 'varname' => 'stdsubdomain',
'type' => 'string', 'type' => 'text',
'default' => '', 'default' => '',
'save_method' => 'storeSettingHostname' 'save_method' => 'storeSettingHostname'
), ],
'system_mysql_access_host' => array( 'system_mysql_access_host' => [
'label' => $lng['serversettings']['mysql_access_host'], 'label' => lng('serversettings.mysql_access_host'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mysql_access_host', 'varname' => 'mysql_access_host',
'type' => 'string', 'type' => 'text',
'default' => '127.0.0.1,localhost', 'default' => '127.0.0.1,localhost',
'plausibility_check_method' => array( 'plausibility_check_method' => [
'\\Froxlor\\Validate\\Check', '\\Froxlor\\Validate\\Check',
'checkMysqlAccessHost' 'checkMysqlAccessHost'
), ],
'save_method' => 'storeSettingMysqlAccessHost' 'save_method' => 'storeSettingMysqlAccessHost'
), ],
'system_nssextrausers' => array( 'system_nssextrausers' => [
'label' => $lng['serversettings']['nssextrausers'], 'label' => lng('serversettings.nssextrausers'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'nssextrausers', 'varname' => 'nssextrausers',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_index_file_extension' => array( 'system_index_file_extension' => [
'label' => $lng['serversettings']['index_file_extension'], 'label' => lng('serversettings.index_file_extension'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'index_file_extension', 'varname' => 'index_file_extension',
'type' => 'string', 'type' => 'text',
'string_regexp' => '/^[a-zA-Z0-9]{1,6}$/', 'string_regexp' => '/^[a-zA-Z0-9]{1,6}$/',
'default' => 'html', 'default' => 'html',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_store_index_file_subs' => array( ],
'label' => $lng['serversettings']['system_store_index_file_subs'], 'system_store_index_file_subs' => [
'label' => lng('serversettings.system_store_index_file_subs'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'store_index_file_subs', 'varname' => 'store_index_file_subs',
'type' => 'bool', 'type' => 'checkbox',
'default' => true, 'default' => true,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_httpuser' => array( 'system_httpuser' => [
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'httpuser', 'varname' => 'httpuser',
'type' => 'hidden', 'type' => 'hidden',
'default' => 'www-data' 'default' => 'www-data'
), ],
'system_httpgroup' => array( 'system_httpgroup' => [
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'httpgroup', 'varname' => 'httpgroup',
'type' => 'hidden', 'type' => 'hidden',
'default' => 'www-data' 'default' => 'www-data'
), ],
'system_report_enable' => array( 'system_report_enable' => [
'label' => $lng['serversettings']['report']['report'], 'label' => lng('serversettings.report.report'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'report_enable', 'varname' => 'report_enable',
'type' => 'bool', 'type' => 'checkbox',
'default' => true, 'default' => true,
'cronmodule' => 'froxlor/reports', 'cronmodule' => 'froxlor/reports',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_report_webmax' => array( 'system_report_webmax' => [
'label' => $lng['serversettings']['report']['webmax'], 'label' => lng('serversettings.report.webmax'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'report_webmax', 'varname' => 'report_webmax',
'type' => 'int', 'type' => 'number',
'int_min' => 0, 'min' => 0,
'int_max' => 150, 'max' => 150,
'default' => 90, 'default' => 90,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_report_trafficmax' => array( 'system_report_trafficmax' => [
'label' => $lng['serversettings']['report']['trafficmax'], 'label' => lng('serversettings.report.trafficmax'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'report_trafficmax', 'varname' => 'report_trafficmax',
'type' => 'int', 'type' => 'number',
'int_min' => 0, 'min' => 0,
'int_max' => 150, 'max' => 150,
'default' => 90, 'default' => 90,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_mail_use_smtp' => [
'system_mail_use_smtp' => array( 'label' => lng('serversettings.mail_use_smtp'),
'label' => $lng['serversettings']['mail_use_smtp'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mail_use_smtp', 'varname' => 'mail_use_smtp',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_mail_smtp_host' => array( 'system_mail_smtp_host' => [
'label' => $lng['serversettings']['mail_smtp_host'], 'label' => lng('serversettings.mail_smtp_host'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mail_smtp_host', 'varname' => 'mail_smtp_host',
'type' => 'string', 'type' => 'text',
'default' => 'localhost', 'default' => 'localhost',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_mail_smtp_port' => array( 'system_mail_smtp_port' => [
'label' => $lng['serversettings']['mail_smtp_port'], 'label' => lng('serversettings.mail_smtp_port'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mail_smtp_port', 'varname' => 'mail_smtp_port',
'type' => 'int', 'type' => 'number',
'int_min' => 1, 'min' => 1,
'int_max' => 65535, 'max' => 65535,
'default' => 25, 'default' => 25,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_mail_smtp_usetls' => array( 'system_mail_smtp_usetls' => [
'label' => $lng['serversettings']['mail_smtp_usetls'], 'label' => lng('serversettings.mail_smtp_usetls'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mail_smtp_usetls', 'varname' => 'mail_smtp_usetls',
'type' => 'bool', 'type' => 'checkbox',
'default' => true, 'default' => true,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_mail_smtp_auth' => array( 'system_mail_smtp_auth' => [
'label' => $lng['serversettings']['mail_smtp_auth'], 'label' => lng('serversettings.mail_smtp_auth'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mail_smtp_auth', 'varname' => 'mail_smtp_auth',
'type' => 'bool', 'type' => 'checkbox',
'default' => true, 'default' => true,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_mail_smtp_user' => array( 'system_mail_smtp_user' => [
'label' => $lng['serversettings']['mail_smtp_user'], 'label' => lng('serversettings.mail_smtp_user'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mail_smtp_user', 'varname' => 'mail_smtp_user',
'type' => 'string', 'type' => 'text',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_mail_smtp_passwd' => array( 'system_mail_smtp_passwd' => [
'label' => $lng['serversettings']['mail_smtp_passwd'], 'label' => lng('serversettings.mail_smtp_passwd'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mail_smtp_passwd', 'varname' => 'mail_smtp_passwd',
'type' => 'hiddenString', 'type' => 'password',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
) ],
) 'system_apply_specialsettings_default' => [
) 'label' => lng('serversettings.apply_specialsettings_default'),
) 'settinggroup' => 'system',
); 'varname' => 'apply_specialsettings_default',
'type' => 'checkbox',
'default' => true,
'save_method' => 'storeSettingField',
'advanced_mode' => true
],
'system_apply_phpconfigs_default' => [
'label' => lng('serversettings.apply_phpconfigs_default'),
'settinggroup' => 'system',
'varname' => 'apply_phpconfigs_default',
'type' => 'checkbox',
'default' => true,
'save_method' => 'storeSettingField',
'advanced_mode' => true
],
'system_domaindefaultalias' => [
'label' => lng('admin.domaindefaultalias'),
'settinggroup' => 'system',
'varname' => 'domaindefaultalias',
'type' => 'select',
'default' => '0',
'select_var' => [
'0' => lng('domains.serveraliasoption_wildcard'),
'1' => lng('domains.serveraliasoption_www'),
'2' => lng('domains.serveraliasoption_none')
],
'save_method' => 'storeSettingField',
'advanced_mode' => true
],
'hide_incompatible_settings' => [
'label' => lng('serversettings.hide_incompatible_settings'),
'settinggroup' => 'system',
'varname' => 'hide_incompatible_settings',
'type' => 'checkbox',
'default' => true,
'save_method' => 'storeSettingField',
'advanced_mode' => true
],
]
]
]
];

View File

@@ -2,246 +2,296 @@
/** /**
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
* Copyright (c) 2016 the Froxlor Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Froxlor team <team@froxlor.org> (2016-) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @package \Froxlor\Settings * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
return array(
'groups' => array( use Froxlor\Settings;
'froxlorvhost' => array(
'title' => $lng['admin']['froxlorvhost'] . (call_user_func(array('\Froxlor\Settings\FroxlorVhostSettings', 'hasVhostContainerEnabled')) == false ? $lng['admin']['novhostcontainer'] : ''), return [
'fields' => array( 'groups' => [
'froxlorvhost' => [
'title' => lng('admin.froxlorvhost') . (call_user_func([
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
]) == false ? lng('admin.novhostcontainer') : ''),
'icon' => 'fa-solid fa-wrench',
'fields' => [
/** /**
* Webserver-Vhost * Webserver-Vhost
*/ */
'system_froxlordirectlyviahostname' => array( 'system_froxlordirectlyviahostname' => [
'label' => $lng['serversettings']['froxlordirectlyviahostname'], 'label' => lng('serversettings.froxlordirectlyviahostname'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'froxlordirectlyviahostname', 'varname' => 'froxlordirectlyviahostname',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => true,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_froxloraliases' => array( 'system_froxloraliases' => [
'label' => $lng['serversettings']['froxloraliases'], 'label' => lng('serversettings.froxloraliases'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'froxloraliases', 'varname' => 'froxloraliases',
'type' => 'string', 'type' => 'text',
'string_regexp' => '/^(([a-z0-9\-\._]+, ?)*[a-z0-9\-\._]+)?$/i', 'string_regexp' => '/^(([a-z0-9\-\._]+, ?)*[a-z0-9\-\._]+)?$/i',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
],
/** /**
* SSL / Let's Encrypt * SSL / Let's Encrypt
*/ */
'system_le_froxlor_enabled' => array( 'system_le_froxlor_enabled' => [
'label' => $lng['serversettings']['le_froxlor_enabled'], 'label' => lng('serversettings.le_froxlor_enabled'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'le_froxlor_enabled', 'varname' => 'le_froxlor_enabled',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingClearCertificates', 'save_method' => 'storeSettingClearCertificates',
'visible' => \Froxlor\Settings::Get('system.leenabled') && call_user_func(array( 'visible' => Settings::Get('system.leenabled') && call_user_func([
'\Froxlor\Settings\FroxlorVhostSettings', '\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled' 'hasVhostContainerEnabled'
), true) ], true),
), 'requires_reconf' => ['http']
'system_le_froxlor_redirect' => array( ],
'label' => $lng['serversettings']['le_froxlor_redirect'], 'system_le_froxlor_redirect' => [
'label' => lng('serversettings.le_froxlor_redirect'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'le_froxlor_redirect', 'varname' => 'le_froxlor_redirect',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.use_ssl') && call_user_func(array( 'visible' => Settings::Get('system.use_ssl') && call_user_func([
'\Froxlor\Settings\FroxlorVhostSettings', '\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled' 'hasVhostContainerEnabled'
), true) ], true)
), ],
'system_hsts_maxage' => array( 'system_hsts_maxage' => [
'label' => $lng['admin']['domain_hsts_maxage'], 'label' => lng('admin.domain_hsts_maxage'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'hsts_maxage', 'varname' => 'hsts_maxage',
'type' => 'int', 'type' => 'number',
'int_min' => 0, 'min' => 0,
'int_max' => 94608000, // 3-years 'max' => 94608000, // 3-years
'default' => 0, 'default' => 10368000,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.use_ssl') && call_user_func(array( 'visible' => Settings::Get('system.use_ssl') && call_user_func([
'\Froxlor\Settings\FroxlorVhostSettings', '\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled' 'hasVhostContainerEnabled'
), true) ], true),
), 'advanced_mode' => true
'system_hsts_incsub' => array( ],
'label' => $lng['admin']['domain_hsts_incsub'], 'system_hsts_incsub' => [
'label' => lng('admin.domain_hsts_incsub'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'hsts_incsub', 'varname' => 'hsts_incsub',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.use_ssl') && call_user_func(array( 'visible' => Settings::Get('system.use_ssl') && call_user_func([
'\Froxlor\Settings\FroxlorVhostSettings', '\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled' 'hasVhostContainerEnabled'
), true) ], true),
), 'advanced_mode' => true
'system_hsts_preload' => array( ],
'label' => $lng['admin']['domain_hsts_preload'], 'system_hsts_preload' => [
'label' => lng('admin.domain_hsts_preload'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'hsts_preload', 'varname' => 'hsts_preload',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.use_ssl') && call_user_func(array( 'visible' => Settings::Get('system.use_ssl') && call_user_func([
'\Froxlor\Settings\FroxlorVhostSettings', '\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled' 'hasVhostContainerEnabled'
), true) ], true),
), 'advanced_mode' => true
],
'system_honorcipherorder' => [
'label' => lng('admin.domain_honorcipherorder'),
'settinggroup' => 'system',
'varname' => 'honorcipherorder',
'type' => 'checkbox',
'default' => false,
'save_method' => 'storeSettingField',
'visible' => Settings::Get('system.use_ssl') && call_user_func([
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
], true),
'advanced_mode' => true
],
'system_sessiontickets' => [
'label' => lng('admin.domain_sessiontickets'),
'settinggroup' => 'system',
'varname' => 'sessiontickets',
'type' => 'checkbox',
'default' => true,
'save_method' => 'storeSettingField',
'visible' => Settings::Get('system.use_ssl') && call_user_func([
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
], true),
'advanced_mode' => true
],
/** /**
* FCGID * FCGID
*/ */
'system_mod_fcgid_enabled_ownvhost' => array( 'system_mod_fcgid_enabled_ownvhost' => [
'label' => $lng['serversettings']['mod_fcgid_ownvhost'], 'label' => lng('serversettings.mod_fcgid_ownvhost'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mod_fcgid_ownvhost', 'varname' => 'mod_fcgid_ownvhost',
'type' => 'bool', 'type' => 'checkbox',
'default' => true, 'default' => true,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array( 'websrv_avail' => [
'apache2' 'apache2'
), ],
'visible' => \Froxlor\Settings::Get('system.mod_fcgid') && call_user_func(array( 'visible' => Settings::Get('system.mod_fcgid') && call_user_func([
'\Froxlor\Settings\FroxlorVhostSettings', '\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled' 'hasVhostContainerEnabled'
)) ]),
), 'requires_reconf' => ['system:fcgid']
'system_mod_fcgid_httpuser' => array( ],
'label' => $lng['admin']['mod_fcgid_user'], 'system_mod_fcgid_httpuser' => [
'label' => lng('admin.mod_fcgid_user'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mod_fcgid_httpuser', 'varname' => 'mod_fcgid_httpuser',
'type' => 'string', 'type' => 'text',
'default' => 'froxlorlocal', 'default' => 'froxlorlocal',
'save_method' => 'storeSettingWebserverFcgidFpmUser', 'save_method' => 'storeSettingWebserverFcgidFpmUser',
'websrv_avail' => array( 'websrv_avail' => [
'apache2' 'apache2'
), ],
'visible' => \Froxlor\Settings::Get('system.mod_fcgid') && call_user_func(array( 'visible' => Settings::Get('system.mod_fcgid') && call_user_func([
'\Froxlor\Settings\FroxlorVhostSettings', '\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled' 'hasVhostContainerEnabled'
)) ]),
), 'requires_reconf' => ['system:fcgid']
'system_mod_fcgid_httpgroup' => array( ],
'label' => $lng['admin']['mod_fcgid_group'], 'system_mod_fcgid_httpgroup' => [
'label' => lng('admin.mod_fcgid_group'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mod_fcgid_httpgroup', 'varname' => 'mod_fcgid_httpgroup',
'type' => 'string', 'type' => 'text',
'default' => 'froxlorlocal', 'default' => 'froxlorlocal',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array( 'websrv_avail' => [
'apache2' 'apache2'
), ],
'visible' => \Froxlor\Settings::Get('system.mod_fcgid') && call_user_func(array( 'visible' => Settings::Get('system.mod_fcgid') && call_user_func([
'\Froxlor\Settings\FroxlorVhostSettings', '\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled' 'hasVhostContainerEnabled'
)) ]),
), 'requires_reconf' => ['system:fcgid']
'system_mod_fcgid_defaultini_ownvhost' => array( ],
'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'], 'system_mod_fcgid_defaultini_ownvhost' => [
'label' => lng('serversettings.mod_fcgid.defaultini_ownvhost'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mod_fcgid_defaultini_ownvhost', 'varname' => 'mod_fcgid_defaultini_ownvhost',
'type' => 'option', 'type' => 'select',
'default' => '2', 'default' => '2',
'option_mode' => 'one', 'option_options_method' => [
'option_options_method' => array(
'\\Froxlor\\Http\\PhpConfig', '\\Froxlor\\Http\\PhpConfig',
'getPhpConfigs' 'getPhpConfigs'
), ],
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array( 'websrv_avail' => [
'apache2' 'apache2'
), ],
'visible' => \Froxlor\Settings::Get('system.mod_fcgid') && call_user_func(array( 'visible' => Settings::Get('system.mod_fcgid') && call_user_func([
'\Froxlor\Settings\FroxlorVhostSettings', '\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled' 'hasVhostContainerEnabled'
)) ])
), ],
/** /**
* php-fpm * php-fpm
*/ */
'system_phpfpm_enabled_ownvhost' => array( 'system_phpfpm_enabled_ownvhost' => [
'label' => $lng['phpfpm']['ownvhost'], 'label' => lng('phpfpm.ownvhost'),
'settinggroup' => 'phpfpm', 'settinggroup' => 'phpfpm',
'varname' => 'enabled_ownvhost', 'varname' => 'enabled_ownvhost',
'type' => 'bool', 'type' => 'checkbox',
'default' => true, 'default' => true,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('phpfpm.enabled') && call_user_func(array( 'visible' => Settings::Get('phpfpm.enabled') && call_user_func([
'\Froxlor\Settings\FroxlorVhostSettings', '\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled' 'hasVhostContainerEnabled'
)) ]),
), 'requires_reconf' => ['system:php-fpm']
'system_phpfpm_httpuser' => array( ],
'label' => $lng['phpfpm']['vhost_httpuser'], 'system_phpfpm_httpuser' => [
'label' => lng('phpfpm.vhost_httpuser'),
'settinggroup' => 'phpfpm', 'settinggroup' => 'phpfpm',
'varname' => 'vhost_httpuser', 'varname' => 'vhost_httpuser',
'type' => 'string', 'type' => 'text',
'default' => 'froxlorlocal', 'default' => 'froxlorlocal',
'save_method' => 'storeSettingWebserverFcgidFpmUser', 'save_method' => 'storeSettingWebserverFcgidFpmUser',
'visible' => \Froxlor\Settings::Get('phpfpm.enabled') && call_user_func(array( 'visible' => Settings::Get('phpfpm.enabled') && call_user_func([
'\Froxlor\Settings\FroxlorVhostSettings', '\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled' 'hasVhostContainerEnabled'
)) ]),
), 'requires_reconf' => ['system:php-fpm']
'system_phpfpm_httpgroup' => array( ],
'label' => $lng['phpfpm']['vhost_httpgroup'], 'system_phpfpm_httpgroup' => [
'label' => lng('phpfpm.vhost_httpgroup'),
'settinggroup' => 'phpfpm', 'settinggroup' => 'phpfpm',
'varname' => 'vhost_httpgroup', 'varname' => 'vhost_httpgroup',
'type' => 'string', 'type' => 'text',
'default' => 'froxlorlocal', 'default' => 'froxlorlocal',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('phpfpm.enabled') && call_user_func(array( 'visible' => Settings::Get('phpfpm.enabled') && call_user_func([
'\Froxlor\Settings\FroxlorVhostSettings', '\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled' 'hasVhostContainerEnabled'
)) ]),
), 'requires_reconf' => ['system:php-fpm']
'system_phpfpm_defaultini_ownvhost' => array( ],
'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'], 'system_phpfpm_defaultini_ownvhost' => [
'label' => lng('serversettings.mod_fcgid.defaultini_ownvhost'),
'settinggroup' => 'phpfpm', 'settinggroup' => 'phpfpm',
'varname' => 'vhost_defaultini', 'varname' => 'vhost_defaultini',
'type' => 'option', 'type' => 'select',
'default' => '2', 'default' => '2',
'option_mode' => 'one', 'option_options_method' => [
'option_options_method' => array(
'\\Froxlor\\Http\\PhpConfig', '\\Froxlor\\Http\\PhpConfig',
'getPhpConfigs' 'getPhpConfigs'
), ],
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('phpfpm.enabled') && call_user_func(array( 'visible' => Settings::Get('phpfpm.enabled') && call_user_func([
'\Froxlor\Settings\FroxlorVhostSettings', '\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled' 'hasVhostContainerEnabled'
)) ])
), ],
/** /**
* DNS * DNS
*/ */
'system_dns_createhostnameentry' => array( 'system_dns_createhostnameentry' => [
'label' => $lng['serversettings']['dns_createhostnameentry'], 'label' => lng('serversettings.dns_createhostnameentry'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'dns_createhostnameentry', 'varname' => 'dns_createhostnameentry',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.bind_enable') 'visible' => Settings::Get('system.bind_enable')
) ]
) ]
) ]
) ]
); ];

View File

@@ -2,65 +2,70 @@
/** /**
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
* Copyright (c) 2014 the Froxlor Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Froxlor team <team@froxlor.org> (2010-) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @package Settings * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
return array(
'groups' => array( return [
'crond' => array( 'groups' => [
'title' => $lng['admin']['cronsettings'], 'crond' => [
'fields' => array( 'title' => lng('admin.cronsettings'),
'system_cronconfig' => array( 'icon' => 'fa-solid fa-clock-rotate-left',
'label' => $lng['serversettings']['system_cronconfig'], 'advanced_mode' => true,
'fields' => [
'system_cronconfig' => [
'label' => lng('serversettings.system_cronconfig'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'cronconfig', 'varname' => 'cronconfig',
'type' => 'string', 'type' => 'text',
'string_type' => 'file', 'string_type' => 'file',
'default' => '/etc/cron.d/froxlor', 'default' => '/etc/cron.d/froxlor',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_croncmdline' => array( 'system_croncmdline' => [
'label' => $lng['serversettings']['system_croncmdline'], 'label' => lng('serversettings.system_croncmdline'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'croncmdline', 'varname' => 'croncmdline',
'type' => 'string', 'type' => 'text',
'string_regexp' => '/^[a-z0-9\/\._\- ]+$/i',
'default' => '/usr/bin/nice -n 5 /usr/bin/php -q', 'default' => '/usr/bin/nice -n 5 /usr/bin/php -q',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_crondreload' => array( 'system_crondreload' => [
'label' => $lng['serversettings']['system_crondreload'], 'label' => lng('serversettings.system_crondreload'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'crondreload', 'varname' => 'crondreload',
'type' => 'string', 'type' => 'text',
'string_regexp' => '/^[a-z0-9\/\._\- ]+$/i',
'default' => '/etc/init.d/cron reload', 'default' => '/etc/init.d/cron reload',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_cron_allowautoupdate' => array( 'system_cron_allowautoupdate' => [
'label' => $lng['serversettings']['system_cron_allowautoupdate'], 'label' => lng('serversettings.system_cron_allowautoupdate'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'cron_allowautoupdate', 'varname' => 'cron_allowautoupdate',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ]
'system_debug_cron' => array( ]
'label' => $lng['serversettings']['cron']['debug'], ]
'settinggroup' => 'system', ]
'varname' => 'debug_cron', ];
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
)
)
)
)
);

View File

@@ -2,203 +2,218 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package \Froxlor\Settings
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
return array(
'groups' => array( use Froxlor\Settings;
'webserver' => array(
'title' => $lng['admin']['webserversettings'], return [
'fields' => array( 'groups' => [
'system_webserver' => array( 'webserver' => [
'label' => $lng['admin']['webserver'], 'title' => lng('admin.webserversettings'),
'icon' => 'fa-solid fa-server',
'fields' => [
'system_webserver' => [
'label' => lng('admin.webserver'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'webserver', 'varname' => 'webserver',
'type' => 'option', 'type' => 'select',
'default' => 'apache2', 'default' => 'apache2',
'option_mode' => 'one', 'select_var' => [
'option_options' => array(
'apache2' => 'Apache 2', 'apache2' => 'Apache 2',
'lighttpd' => 'ligHTTPd', 'lighttpd' => 'ligHTTPd',
'nginx' => 'Nginx' 'nginx' => 'Nginx'
), ],
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'plausibility_check_method' => array( 'plausibility_check_method' => [
'\\Froxlor\\Validate\\Check', '\\Froxlor\\Validate\\Check',
'checkPhpInterfaceSetting' 'checkPhpInterfaceSetting'
), ],
'overview_option' => true 'requires_reconf' => ['http']
), ],
'system_apache_24' => array( 'system_apache_24' => [
'label' => $lng['serversettings']['apache_24'], 'label' => lng('serversettings.apache_24'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'apache24', 'varname' => 'apache24',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array( 'websrv_avail' => [
'apache2' 'apache2'
) ]
), ],
'system_apache_itksupport' => array( 'system_apache_itksupport' => [
'label' => $lng['serversettings']['apache_itksupport'], 'label' => lng('serversettings.apache_itksupport'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'apacheitksupport', 'varname' => 'apacheitksupport',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'visible' => (\Froxlor\Settings::Get('system.mod_fcgid') == 0 && \Froxlor\Settings::Get('phpfpm.enabled') == 0), 'visible' => (Settings::Get('system.mod_fcgid') == 0 && Settings::Get('phpfpm.enabled') == 0),
'websrv_avail' => array( 'websrv_avail' => [
'apache2' 'apache2'
) ],
), 'advanced_mode' => true
'system_http2_support' => array( ],
'label' => $lng['serversettings']['http2_support'], 'system_http2_support' => [
'label' => lng('serversettings.http2_support'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'http2_support', 'varname' => 'http2_support',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array( 'websrv_avail' => [
'apache2', 'apache2',
'nginx' 'nginx'
), ],
'visible' => \Froxlor\Settings::Get('system.use_ssl') 'visible' => Settings::Get('system.use_ssl')
), ],
'system_dhparams_file' => array( 'system_dhparams_file' => [
'label' => $lng['serversettings']['dhparams_file'], 'label' => lng('serversettings.dhparams_file'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'dhparams_file', 'varname' => 'dhparams_file',
'type' => 'string', 'type' => 'text',
'string_type' => 'file', 'string_type' => 'file',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.use_ssl') 'visible' => Settings::Get('system.use_ssl'),
), 'advanced_mode' => true
'system_httpuser' => array( ],
'label' => $lng['admin']['webserver_user'], 'system_httpuser' => [
'label' => lng('admin.webserver_user'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'httpuser', 'varname' => 'httpuser',
'type' => 'string', 'type' => 'text',
'default' => 'www-data', 'default' => 'www-data',
'save_method' => 'storeSettingWebserverFcgidFpmUser' 'save_method' => 'storeSettingWebserverFcgidFpmUser'
), ],
'system_httpgroup' => array( 'system_httpgroup' => [
'label' => $lng['admin']['webserver_group'], 'label' => lng('admin.webserver_group'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'httpgroup', 'varname' => 'httpgroup',
'type' => 'string', 'type' => 'text',
'default' => 'www-data', 'default' => 'www-data',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_apacheconf_vhost' => array( 'system_apacheconf_vhost' => [
'label' => $lng['serversettings']['apacheconf_vhost'], 'label' => lng('serversettings.apacheconf_vhost'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'apacheconf_vhost', 'varname' => 'apacheconf_vhost',
'type' => 'string', 'type' => 'text',
'string_type' => 'filedir', 'string_type' => 'filedir',
'default' => '/etc/apache2/sites-enabled/', 'default' => '/etc/apache2/sites-enabled/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'requires_reconf' => ['http']
'system_apacheconf_diroptions' => array( ],
'label' => $lng['serversettings']['apacheconf_diroptions'], 'system_apacheconf_diroptions' => [
'label' => lng('serversettings.apacheconf_diroptions'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'apacheconf_diroptions', 'varname' => 'apacheconf_diroptions',
'type' => 'string', 'type' => 'text',
'string_type' => 'filedir', 'string_type' => 'filedir',
'default' => '/etc/apache2/sites-enabled/', 'default' => '/etc/apache2/sites-enabled/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'requires_reconf' => ['http']
'system_apacheconf_htpasswddir' => array( ],
'label' => $lng['serversettings']['apacheconf_htpasswddir'], 'system_apacheconf_htpasswddir' => [
'label' => lng('serversettings.apacheconf_htpasswddir'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'apacheconf_htpasswddir', 'varname' => 'apacheconf_htpasswddir',
'type' => 'string', 'type' => 'text',
'string_type' => 'confdir', 'string_type' => 'confdir',
'default' => '/etc/apache2/htpasswd/', 'default' => '/etc/apache2/htpasswd/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_logfiles_directory' => array( 'system_logfiles_directory' => [
'label' => $lng['serversettings']['logfiles_directory'], 'label' => lng('serversettings.logfiles_directory'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'logfiles_directory', 'varname' => 'logfiles_directory',
'type' => 'string', 'type' => 'text',
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/var/customers/logs/', 'default' => '/var/customers/logs/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'requires_reconf' => ['http']
'system_logfiles_script' => array( ],
'label' => $lng['serversettings']['logfiles_script'], 'system_logfiles_script' => [
'label' => lng('serversettings.logfiles_script'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'logfiles_script', 'varname' => 'logfiles_script',
'type' => 'string', 'type' => 'text',
'string_type' => '',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array( 'websrv_avail' => [
'apache2' 'apache2'
) ],
), 'advanced_mode' => true
'system_logfiles_piped' => array( ],
'label' => $lng['serversettings']['logfiles_piped'], 'system_logfiles_piped' => [
'label' => lng('serversettings.logfiles_piped'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'logfiles_piped', 'varname' => 'logfiles_piped',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array( 'websrv_avail' => [
'apache2' 'apache2'
) ],
), 'advanced_mode' => true
'system_logfiles_format' => array( ],
'label' => $lng['serversettings']['logfiles_format'], 'system_logfiles_format' => [
'label' => lng('serversettings.logfiles_format'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'logfiles_format', 'varname' => 'logfiles_format',
'type' => 'string', 'type' => 'text',
'default' => '', 'default' => '',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array( 'websrv_avail' => [
'apache2', 'apache2',
'nginx' 'nginx'
) ],
), 'visible' => Settings::Get('system.traffictool') != 'webalizer',
'system_logfiles_type' => array( 'advanced_mode' => true
'label' => $lng['serversettings']['logfiles_type'], ],
'system_logfiles_type' => [
'label' => lng('serversettings.logfiles_type'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'logfiles_type', 'varname' => 'logfiles_type',
'type' => 'option', 'type' => 'select',
'default' => '1', 'default' => '1',
'option_mode' => 'one', 'select_var' => [
'option_options' => array(
'1' => 'combined', '1' => 'combined',
'2' => 'vhost_combined' '2' => 'vhost_combined'
), ],
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array( 'websrv_avail' => [
'apache2' 'apache2'
) ]
), ],
'system_errorlog_level' => array( 'system_errorlog_level' => [
'label' => $lng['serversettings']['errorlog_level'], 'label' => lng('serversettings.errorlog_level'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'errorlog_level', 'varname' => 'errorlog_level',
'type' => 'option', 'type' => 'select',
'default' => (\Froxlor\Settings::Get('system.webserver') == 'nginx' ? 'error' : 'warn'), 'default' => (Settings::Get('system.webserver') == 'nginx' ? 'error' : 'warn'),
'option_mode' => 'one', 'select_var' => [
'option_options' => array(
'emerg' => 'emerg', 'emerg' => 'emerg',
'alert' => 'alert', 'alert' => 'alert',
'crit' => 'crit', 'crit' => 'crit',
@@ -207,174 +222,203 @@ return array(
'notice' => 'notice', 'notice' => 'notice',
'info' => 'info', 'info' => 'info',
'debug' => 'debug' 'debug' => 'debug'
), ],
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array( 'websrv_avail' => [
'apache2', 'apache2',
'nginx' 'nginx'
) ]
), ],
'system_customersslpath' => array( 'system_customersslpath' => [
'label' => $lng['serversettings']['customerssl_directory'], 'label' => lng('serversettings.customerssl_directory'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'customer_ssl_path', 'varname' => 'customer_ssl_path',
'type' => 'string', 'type' => 'text',
'string_type' => 'confdir', 'string_type' => 'confdir',
'default' => '/etc/ssl/froxlor-custom/', 'default' => '/etc/ssl/froxlor-custom/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_phpappendopenbasedir' => array( 'system_phpappendopenbasedir' => [
'label' => $lng['serversettings']['phpappendopenbasedir'], 'label' => lng('serversettings.phpappendopenbasedir'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'phpappendopenbasedir', 'varname' => 'phpappendopenbasedir',
'type' => 'string', 'type' => 'text',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_deactivateddocroot' => array( ],
'label' => $lng['serversettings']['deactivateddocroot'], 'system_deactivateddocroot' => [
'label' => lng('serversettings.deactivateddocroot'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'deactivateddocroot', 'varname' => 'deactivateddocroot',
'type' => 'string', 'type' => 'text',
'string_type' => 'dir', 'string_type' => 'dir',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'requires_reconf' => ['http']
'system_default_vhostconf' => array( ],
'label' => $lng['serversettings']['default_vhostconf'], 'system_default_vhostconf' => [
'label' => lng('serversettings.default_vhostconf'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'default_vhostconf', 'varname' => 'default_vhostconf',
'type' => 'text', 'type' => 'textarea',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_apache_globaldiropt' => array( ],
'label' => $lng['serversettings']['apache_globaldiropt'], 'system_default_sslvhostconf' => [
'label' => lng('serversettings.default_sslvhostconf'),
'settinggroup' => 'system',
'varname' => 'default_sslvhostconf',
'type' => 'textarea',
'default' => '',
'save_method' => 'storeSettingField',
'visible' => Settings::Get('system.use_ssl') == 1,
'advanced_mode' => true
],
'system_include_default_vhostconf' => [
'label' => lng('serversettings.includedefault_sslvhostconf'),
'settinggroup' => 'system',
'varname' => 'include_default_vhostconf',
'type' => 'checkbox',
'default' => false,
'save_method' => 'storeSettingField',
'advanced_mode' => true
],
'system_apache_globaldiropt' => [
'label' => lng('serversettings.apache_globaldiropt'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'apacheglobaldiropt', 'varname' => 'apacheglobaldiropt',
'type' => 'text', 'type' => 'textarea',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'visible' => (\Froxlor\Settings::Get('system.mod_fcgid') == 0 && \Froxlor\Settings::Get('phpfpm.enabled') == 0), 'visible' => (Settings::Get('system.mod_fcgid') == 0 && Settings::Get('phpfpm.enabled') == 0),
'websrv_avail' => array( 'websrv_avail' => [
'apache2' 'apache2'
) ],
), 'advanced_mode' => true
'system_apachereload_command' => array( ],
'label' => $lng['serversettings']['apachereload_command'], 'system_apachereload_command' => [
'label' => lng('serversettings.apachereload_command'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'apachereload_command', 'varname' => 'apachereload_command',
'type' => 'string', 'type' => 'text',
'string_regexp' => '/^[a-z0-9\/\._\- ]+$/i',
'default' => '/etc/init.d/apache2 reload', 'default' => '/etc/init.d/apache2 reload',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_phpreload_command' => array( 'system_phpreload_command' => [
'label' => $lng['serversettings']['phpreload_command'], 'label' => lng('serversettings.phpreload_command'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'phpreload_command', 'varname' => 'phpreload_command',
'type' => 'string', 'type' => 'text',
'string_regexp' => '/^[a-z0-9\/\._\- ]+$/i',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array( 'websrv_avail' => [
'nginx' 'nginx'
) ]
), ],
'system_nginx_php_backend' => array( 'system_nginx_php_backend' => [
'label' => $lng['serversettings']['nginx_php_backend'], 'label' => lng('serversettings.nginx_php_backend'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'nginx_php_backend', 'varname' => 'nginx_php_backend',
'type' => 'string', 'type' => 'text',
'default' => '127.0.0.1:8888', 'default' => '127.0.0.1:8888',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array( 'websrv_avail' => [
'nginx' 'nginx'
) ]
), ],
'nginx_fastcgiparams' => array( 'nginx_fastcgiparams' => [
'label' => $lng['serversettings']['nginx_fastcgiparams'], 'label' => lng('serversettings.nginx_fastcgiparams'),
'settinggroup' => 'nginx', 'settinggroup' => 'nginx',
'varname' => 'fastcgiparams', 'varname' => 'fastcgiparams',
'type' => 'string', 'type' => 'text',
'string_type' => 'file', 'string_type' => 'file',
'default' => '/etc/nginx/fastcgi_params', 'default' => '/etc/nginx/fastcgi_params',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array( 'websrv_avail' => [
'nginx' 'nginx'
) ]
), ],
'defaultwebsrverrhandler_enabled' => array( 'defaultwebsrverrhandler_enabled' => [
'label' => $lng['serversettings']['defaultwebsrverrhandler_enabled'], 'label' => lng('serversettings.defaultwebsrverrhandler_enabled'),
'settinggroup' => 'defaultwebsrverrhandler', 'settinggroup' => 'defaultwebsrverrhandler',
'varname' => 'enabled', 'varname' => 'enabled',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'defaultwebsrverrhandler_err401' => array( ],
'label' => $lng['serversettings']['defaultwebsrverrhandler_err401'], 'defaultwebsrverrhandler_err401' => [
'label' => lng('serversettings.defaultwebsrverrhandler_err401'),
'settinggroup' => 'defaultwebsrverrhandler', 'settinggroup' => 'defaultwebsrverrhandler',
'varname' => 'err401', 'varname' => 'err401',
'type' => 'string', 'type' => 'text',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array( 'websrv_avail' => [
'apache2', 'apache2',
'nginx' 'nginx'
) ],
), 'advanced_mode' => true
'defaultwebsrverrhandler_err403' => array( ],
'label' => $lng['serversettings']['defaultwebsrverrhandler_err403'], 'defaultwebsrverrhandler_err403' => [
'label' => lng('serversettings.defaultwebsrverrhandler_err403'),
'settinggroup' => 'defaultwebsrverrhandler', 'settinggroup' => 'defaultwebsrverrhandler',
'varname' => 'err403', 'varname' => 'err403',
'type' => 'string', 'type' => 'text',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array( 'websrv_avail' => [
'apache2', 'apache2',
'nginx' 'nginx'
) ],
), 'advanced_mode' => true
'defaultwebsrverrhandler_err404' => array( ],
'label' => $lng['serversettings']['defaultwebsrverrhandler_err404'], 'defaultwebsrverrhandler_err404' => [
'label' => lng('serversettings.defaultwebsrverrhandler_err404'),
'settinggroup' => 'defaultwebsrverrhandler', 'settinggroup' => 'defaultwebsrverrhandler',
'varname' => 'err404', 'varname' => 'err404',
'type' => 'string', 'type' => 'text',
'default' => '',
'save_method' => 'storeSettingField'
),
'defaultwebsrverrhandler_err500' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_err500'],
'settinggroup' => 'defaultwebsrverrhandler',
'varname' => 'err500',
'type' => 'string',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array( 'advanced_mode' => true
],
'defaultwebsrverrhandler_err500' => [
'label' => lng('serversettings.defaultwebsrverrhandler_err500'),
'settinggroup' => 'defaultwebsrverrhandler',
'varname' => 'err500',
'type' => 'text',
'default' => '',
'save_method' => 'storeSettingField',
'websrv_avail' => [
'apache2', 'apache2',
'nginx' 'nginx'
) ],
), 'advanced_mode' => true
'customredirect_enabled' => array( ],
'label' => $lng['serversettings']['customredirect_enabled'], 'customredirect_enabled' => [
'label' => lng('serversettings.customredirect_enabled'),
'settinggroup' => 'customredirect', 'settinggroup' => 'customredirect',
'varname' => 'enabled', 'varname' => 'enabled',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'customredirect_default' => array( 'customredirect_default' => [
'label' => $lng['serversettings']['customredirect_default'], 'label' => lng('serversettings.customredirect_default'),
'settinggroup' => 'customredirect', 'settinggroup' => 'customredirect',
'varname' => 'default', 'varname' => 'default',
'type' => 'option', 'type' => 'select',
'default' => '1', 'default' => '1',
'option_mode' => 'one', 'option_options_method' => ['\\Froxlor\\Domain\\Domain', 'getRedirectCodes'],
'option_options_method' => array('\\Froxlor\\Domain\\Domain', 'getRedirectCodes'),
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
) ]
) ]
) ]
) ]
); ];

View File

@@ -2,218 +2,245 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package \Froxlor\Settings
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
return array(
'groups' => array( use Froxlor\Froxlor;
'ssl' => array( use Froxlor\Settings;
'title' => $lng['admin']['sslsettings'],
'fields' => array( return [
'system_ssl_enabled' => array( 'groups' => [
'label' => $lng['serversettings']['ssl']['use_ssl'], 'ssl' => [
'title' => lng('admin.sslsettings'),
'icon' => 'fa-solid fa-shield',
'fields' => [
'system_ssl_enabled' => [
'label' => lng('serversettings.ssl.use_ssl'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'use_ssl', 'varname' => 'use_ssl',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'overview_option' => true 'overview_option' => true,
), 'requires_reconf' => ['http']
'system_ssl_protocols' => array( ],
'label' => $lng['serversettings']['ssl']['ssl_protocols'], 'system_ssl_protocols' => [
'label' => lng('serversettings.ssl.ssl_protocols'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'ssl_protocols', 'varname' => 'ssl_protocols',
'type' => 'option', 'type' => 'select',
'default' => 'TLSv1,TLSv1.2', 'default' => 'TLSv1.2',
'option_mode' => 'multiple', 'select_mode' => 'multiple',
'option_options' => array( 'select_var' => [
'TLSv1' => 'TLSv1', 'TLSv1' => 'TLSv1',
'TLSv1.1' => 'TLSv1.1', 'TLSv1.1' => 'TLSv1.1',
'TLSv1.2' => 'TLSv1.2', 'TLSv1.2' => 'TLSv1.2',
'TLSv1.3' => 'TLSv1.3' 'TLSv1.3' => 'TLSv1.3'
), ],
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_ssl_cipher_list' => array( 'system_ssl_cipher_list' => [
'label' => $lng['serversettings']['ssl']['ssl_cipher_list'], 'label' => lng('serversettings.ssl.ssl_cipher_list'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'ssl_cipher_list', 'varname' => 'ssl_cipher_list',
'type' => 'string', 'type' => 'text',
'string_emptyallowed' => false, 'string_emptyallowed' => false,
'default' => 'ECDH+AESGCM:ECDH+AES256:!aNULL:!MD5:!DSS:!DH:!AES128', 'default' => 'ECDH+AESGCM:ECDH+AES256:!aNULL:!MD5:!DSS:!DH:!AES128',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_tlsv13_cipher_list' => array( ],
'label' => $lng['serversettings']['ssl']['tlsv13_cipher_list'], 'system_tlsv13_cipher_list' => [
'label' => lng('serversettings.ssl.tlsv13_cipher_list'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'tlsv13_cipher_list', 'varname' => 'tlsv13_cipher_list',
'type' => 'string', 'type' => 'text',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'visible' => \Froxlor\Settings::Get('system.webserver') == "apache2" && \Froxlor\Settings::Get('system.apache24') == 1, 'visible' => Settings::Get('system.webserver') == "apache2" && Settings::Get('system.apache24') == 1,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_ssl_cert_file' => array( ],
'label' => $lng['serversettings']['ssl']['ssl_cert_file'], 'system_ssl_cert_file' => [
'label' => lng('serversettings.ssl.ssl_cert_file'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'ssl_cert_file', 'varname' => 'ssl_cert_file',
'type' => 'string', 'type' => 'text',
'string_type' => 'file', 'string_type' => 'file',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '/etc/apache2/apache2.pem', 'default' => '/etc/ssl/froxlor_selfsigned.pem',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_ssl_key_file' => array( 'system_ssl_key_file' => [
'label' => $lng['serversettings']['ssl']['ssl_key_file'], 'label' => lng('serversettings.ssl.ssl_key_file'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'ssl_key_file', 'varname' => 'ssl_key_file',
'type' => 'string', 'type' => 'text',
'string_type' => 'file', 'string_type' => 'file',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '/etc/apache2/apache2.key', 'default' => '/etc/ssl/froxlor_selfsigned.key',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_ssl_cert_chainfile' => array( 'system_ssl_cert_chainfile' => [
'label' => $lng['admin']['ipsandports']['ssl_cert_chainfile'], 'label' => lng('admin.ipsandports.ssl_cert_chainfile'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'ssl_cert_chainfile', 'varname' => 'ssl_cert_chainfile',
'type' => 'string', 'type' => 'text',
'string_type' => 'file', 'string_type' => 'file',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_ssl_ca_file' => array( 'system_ssl_ca_file' => [
'label' => $lng['serversettings']['ssl']['ssl_ca_file'], 'label' => lng('serversettings.ssl.ssl_ca_file'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'ssl_ca_file', 'varname' => 'ssl_ca_file',
'type' => 'string', 'type' => 'text',
'string_type' => 'file', 'string_type' => 'file',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_apache24_ocsp_cache_path' => array( 'system_apache24_ocsp_cache_path' => [
'label' => $lng['serversettings']['ssl']['apache24_ocsp_cache_path'], 'label' => lng('serversettings.ssl.apache24_ocsp_cache_path'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'apache24_ocsp_cache_path', 'varname' => 'apache24_ocsp_cache_path',
'type' => 'string', 'type' => 'text',
'string_type' => 'string',
'string_emptyallowed' => false, 'string_emptyallowed' => false,
'default' => 'shmcb:/var/run/apache2/ocsp-stapling.cache(131072)', 'default' => 'shmcb:/var/run/apache2/ocsp-stapling.cache(131072)',
'visible' => \Froxlor\Settings::Get('system.webserver') == "apache2" && \Froxlor\Settings::Get('system.apache24') == 1, 'visible' => Settings::Get('system.webserver') == "apache2" && Settings::Get('system.apache24') == 1,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_leenabled' => array( ],
'label' => $lng['serversettings']['leenabled'], 'system_sessionticketsenabled' => [
'label' => lng('admin.domain_sessionticketsenabled'),
'settinggroup' => 'system',
'varname' => 'sessionticketsenabled',
'type' => 'checkbox',
'default' => true,
'save_method' => 'storeSettingField',
'visible' => Settings::Get('system.use_ssl') && (Settings::Get('system.webserver') == "nginx" || (Settings::Get('system.webserver') == "apache2" && Settings::Get('system.apache24') == 1)),
'advanced_mode' => true
],
'system_leenabled' => [
'label' => lng('serversettings.leenabled'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'leenabled', 'varname' => 'leenabled',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'cronmodule' => 'froxlor/letsencrypt', 'cronmodule' => 'froxlor/letsencrypt',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'requires_reconf' => ['http']
'system_letsencryptacmeconf' => array( ],
'label' => $lng['serversettings']['letsencryptacmeconf'], 'system_acmeshpath' => [
'label' => lng('serversettings.acmeshpath'),
'settinggroup' => 'system',
'varname' => 'acmeshpath',
'type' => 'text',
'string_type' => 'file',
'default' => '/root/.acme.sh/acme.sh',
'save_method' => 'storeSettingField',
'advanced_mode' => true
],
'system_letsencryptacmeconf' => [
'label' => lng('serversettings.letsencryptacmeconf'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'letsencryptacmeconf', 'varname' => 'letsencryptacmeconf',
'type' => 'string', 'type' => 'text',
'string_type' => 'file', 'string_type' => 'file',
'default' => '/etc/apache2/conf-enabled/acme.conf', 'default' => '/etc/apache2/conf-enabled/acme.conf',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'requires_reconf' => ['http']
'system_leapiversion' => array( ],
'label' => $lng['serversettings']['leapiversion'], 'system_letsencryptca' => [
'settinggroup' => 'system', 'label' => lng('serversettings.letsencryptca'),
'varname' => 'leapiversion',
'type' => 'option',
'default' => '2',
'option_mode' => 'one',
'option_options' => array(
'1' => 'ACME v1',
'2' => 'ACME v2'
),
'save_method' => 'storeSettingField'
),
'system_letsencryptca' => array(
'label' => $lng['serversettings']['letsencryptca'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'letsencryptca', 'varname' => 'letsencryptca',
'type' => 'option', 'type' => 'select',
'default' => 'testing', 'default' => 'letsencrypt',
'option_mode' => 'one', 'select_var' => [
'option_options' => array( 'letsencrypt_test' => 'Let\'s Encrypt (Test / Staging)',
'testing' => 'https://acme-staging' . (\Froxlor\Settings::Get('system.leapiversion') == '2' ? '-v02' : '') . '.api.letsencrypt.org (Test)', 'letsencrypt' => 'Let\'s Encrypt (Live)',
'production' => 'https://acme-v0' . \Froxlor\Settings::Get('system.leapiversion') . '.api.letsencrypt.org (Live)' 'buypass_test' => 'Buypass (Test / Staging)',
), 'buypass' => 'Buypass (Live)',
'zerossl' => 'ZeroSSL (Live)'
],
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_letsencryptchallengepath' => array( 'system_letsencryptchallengepath' => [
'label' => $lng['serversettings']['letsencryptchallengepath'], 'label' => lng('serversettings.letsencryptchallengepath'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'letsencryptchallengepath', 'varname' => 'letsencryptchallengepath',
'type' => 'string', 'type' => 'text',
'string_emptyallowed' => false, 'string_emptyallowed' => false,
'default' => \Froxlor\Froxlor::getInstallDir(), 'default' => Froxlor::getInstallDir(),
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true,
'system_letsencryptkeysize' => array( 'requires_reconf' => ['http']
'label' => $lng['serversettings']['letsencryptkeysize'], ],
'system_letsencryptkeysize' => [
'label' => lng('serversettings.letsencryptkeysize'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'letsencryptkeysize', 'varname' => 'letsencryptkeysize',
'type' => 'option', 'type' => 'select',
'default' => '2048', 'default' => '2048',
'option_mode' => 'one', 'select_var' => [
'option_options' => array(
'2048' => '2048', '2048' => '2048',
'3072' => '3072', '3072' => '3072',
'4096' => '4096', '4096' => '4096',
'8192' => '8192' '8192' => '8192'
), ],
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_leecc' => array( 'system_leecc' => [
'label' => $lng['serversettings']['letsencryptecc'], 'label' => lng('serversettings.letsencryptecc'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'leecc', 'varname' => 'leecc',
'type' => 'option', 'type' => 'select',
'default' => '0', 'default' => '0',
'option_mode' => 'one', 'select_var' => [
'option_options' => array(
'0' => '-', '0' => '-',
'256' => 'ec-256', '256' => 'ec-256',
'384' => 'ec-384' '384' => 'ec-384'
), ],
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_letsencryptreuseold' => array( ],
'label' => $lng['serversettings']['letsencryptreuseold'], 'system_letsencryptreuseold' => [
'label' => lng('serversettings.letsencryptreuseold'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'letsencryptreuseold', 'varname' => 'letsencryptreuseold',
'type' => 'bool', 'type' => 'checkbox',
'default' => true,
'save_method' => 'storeSettingField',
'advanced_mode' => true
],
'system_le_domain_dnscheck' => [
'label' => lng('serversettings.le_domain_dnscheck'),
'settinggroup' => 'system',
'varname' => 'le_domain_dnscheck',
'type' => 'checkbox',
'default' => true, 'default' => true,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ]
'system_disable_le_selfcheck' => array( ]
'label' => $lng['serversettings']['disable_le_selfcheck'], ]
'settinggroup' => 'system', ]
'varname' => 'disable_le_selfcheck', ];
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
)
)
)
)
);

View File

@@ -4,125 +4,142 @@
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Froxlor team <team@froxlor.org> (2010-) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @package Settings * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
return array(
'groups' => array( return [
'fcgid' => array( 'groups' => [
'title' => $lng['admin']['fcgid_settings'], 'fcgid' => [
'websrv_avail' => array( 'title' => lng('admin.fcgid_settings'),
'icon' => 'fa-brands fa-php',
'websrv_avail' => [
'apache2', 'apache2',
'lighttpd' 'lighttpd'
), ],
'fields' => array( 'fields' => [
'system_mod_fcgid_enabled' => array( 'system_mod_fcgid_enabled' => [
'label' => $lng['serversettings']['mod_fcgid'], 'label' => lng('serversettings.mod_fcgid'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mod_fcgid', 'varname' => 'mod_fcgid',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'plausibility_check_method' => array( 'plausibility_check_method' => [
'\\Froxlor\\Validate\\Check', '\\Froxlor\\Validate\\Check',
'checkFcgidPhpFpm' 'checkFcgidPhpFpm'
), ],
'overview_option' => true 'overview_option' => true,
), 'requires_reconf' => ['http', 'system:fcgid']
'system_mod_fcgid_configdir' => array( ],
'label' => $lng['serversettings']['mod_fcgid']['configdir'], 'system_mod_fcgid_configdir' => [
'label' => lng('serversettings.mod_fcgid.configdir'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mod_fcgid_configdir', 'varname' => 'mod_fcgid_configdir',
'type' => 'string', 'type' => 'text',
'string_type' => 'confdir', 'string_type' => 'confdir',
'default' => '/var/www/php-fcgi-scripts/', 'default' => '/var/www/php-fcgi-scripts/',
'plausibility_check_method' => array( 'plausibility_check_method' => [
'\\Froxlor\\Validate\\Check', '\\Froxlor\\Validate\\Check',
'checkPathConflicts' 'checkPathConflicts'
), ],
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'requires_reconf' => ['system:fcgid']
'system_mod_fcgid_tmpdir' => array( ],
'label' => $lng['serversettings']['mod_fcgid']['tmpdir'], 'system_mod_fcgid_tmpdir' => [
'label' => lng('serversettings.mod_fcgid.tmpdir'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mod_fcgid_tmpdir', 'varname' => 'mod_fcgid_tmpdir',
'type' => 'string', 'type' => 'text',
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/var/customers/tmp/', 'default' => '/var/customers/tmp/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'requires_reconf' => ['http']
'system_mod_fcgid_peardir' => array( ],
'label' => $lng['serversettings']['mod_fcgid']['peardir'], 'system_mod_fcgid_peardir' => [
'label' => lng('serversettings.mod_fcgid.peardir'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mod_fcgid_peardir', 'varname' => 'mod_fcgid_peardir',
'type' => 'string', 'type' => 'text',
'string_type' => 'dir', 'string_type' => 'dir',
'string_delimiter' => ':', 'string_delimiter' => ':',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '/usr/share/php/:/usr/share/php5/', 'default' => '/usr/share/php/:/usr/share/php5/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_mod_fcgid_wrapper' => array( ],
'label' => $lng['serversettings']['mod_fcgid']['wrapper'], 'system_mod_fcgid_wrapper' => [
'label' => lng('serversettings.mod_fcgid.wrapper'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mod_fcgid_wrapper', 'varname' => 'mod_fcgid_wrapper',
'type' => 'option', 'type' => 'select',
'option_options' => array( 'select_var' => [
0 => 'ScriptAlias', 0 => 'ScriptAlias',
1 => 'FcgidWrapper' 1 => 'FcgidWrapper'
), ],
'default' => 1, 'default' => 1,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array( 'websrv_avail' => [
'apache2' 'apache2'
) ],
), 'advanced_mode' => true
'system_mod_fcgid_starter' => array( ],
'label' => $lng['serversettings']['mod_fcgid']['starter'], 'system_mod_fcgid_starter' => [
'label' => lng('serversettings.mod_fcgid.starter'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mod_fcgid_starter', 'varname' => 'mod_fcgid_starter',
'type' => 'int', 'type' => 'number',
'min' => 0,
'default' => 0, 'default' => 0,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_mod_fcgid_maxrequests' => array( ],
'label' => $lng['serversettings']['mod_fcgid']['maxrequests'], 'system_mod_fcgid_maxrequests' => [
'label' => lng('serversettings.mod_fcgid.maxrequests'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mod_fcgid_maxrequests', 'varname' => 'mod_fcgid_maxrequests',
'type' => 'int', 'type' => 'number',
'default' => 250, 'default' => 250,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_mod_fcgid_defaultini' => array( ],
'label' => $lng['serversettings']['mod_fcgid']['defaultini'], 'system_mod_fcgid_defaultini' => [
'label' => lng('serversettings.mod_fcgid.defaultini'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mod_fcgid_defaultini', 'varname' => 'mod_fcgid_defaultini',
'type' => 'option', 'type' => 'select',
'default' => '1', 'default' => '1',
'option_mode' => 'one', 'option_options_method' => [
'option_options_method' => array(
'\\Froxlor\\Http\\PhpConfig', '\\Froxlor\\Http\\PhpConfig',
'getPhpConfigs'), 'getPhpConfigs'
],
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_mod_fcgid_idle_timeout' => array( 'system_mod_fcgid_idle_timeout' => [
'label' => $lng['serversettings']['mod_fcgid']['idle_timeout'], 'label' => lng('serversettings.mod_fcgid.idle_timeout'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mod_fcgid_idle_timeout', 'varname' => 'mod_fcgid_idle_timeout',
'type' => 'int', 'type' => 'number',
'default' => 30, 'default' => 30,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
) 'advanced_mode' => true
) ]
) ]
) ]
); ]
];
?>

View File

@@ -4,138 +4,158 @@
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Froxlor team <team@froxlor.org> (2010-) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @package \Froxlor\Settings * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
return array(
'groups' => array( use Froxlor\Settings;
'phpfpm' => array(
'title' => $lng['admin']['phpfpm_settings'], return [
'fields' => array( 'groups' => [
'system_phpfpm_enabled' => array( 'phpfpm' => [
'label' => $lng['serversettings']['phpfpm'], 'title' => lng('admin.phpfpm_settings'),
'icon' => 'fa-brands fa-php',
'fields' => [
'system_phpfpm_enabled' => [
'label' => lng('serversettings.phpfpm'),
'settinggroup' => 'phpfpm', 'settinggroup' => 'phpfpm',
'varname' => 'enabled', 'varname' => 'enabled',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'plausibility_check_method' => array( 'plausibility_check_method' => [
'\\Froxlor\\Validate\\Check', '\\Froxlor\\Validate\\Check',
'checkFcgidPhpFpm' 'checkFcgidPhpFpm'
), ],
'overview_option' => true 'overview_option' => true,
), 'requires_reconf' => ['http', 'system:php-fpm']
'system_phpfpm_defaultini' => array( ],
'label' => $lng['serversettings']['mod_fcgid']['defaultini'], 'system_phpfpm_defaultini' => [
'label' => lng('serversettings.mod_fcgid.defaultini'),
'settinggroup' => 'phpfpm', 'settinggroup' => 'phpfpm',
'varname' => 'defaultini', 'varname' => 'defaultini',
'type' => 'option', 'type' => 'select',
'default' => '1', 'default' => '1',
'option_mode' => 'one', 'option_options_method' => [
'option_options_method' => array(
'\\Froxlor\\Http\\PhpConfig', '\\Froxlor\\Http\\PhpConfig',
'getPhpConfigs' 'getPhpConfigs'
), ],
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_phpfpm_aliasconfigdir' => array( 'system_phpfpm_aliasconfigdir' => [
'label' => $lng['serversettings']['phpfpm_settings']['aliasconfigdir'], 'label' => lng('serversettings.phpfpm_settings.aliasconfigdir'),
'settinggroup' => 'phpfpm', 'settinggroup' => 'phpfpm',
'varname' => 'aliasconfigdir', 'varname' => 'aliasconfigdir',
'type' => 'string', 'type' => 'text',
'string_type' => 'confdir', 'string_type' => 'confdir',
'default' => '/var/www/php-fpm/', 'default' => '/var/www/php-fpm/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_phpfpm_tmpdir' => array( ],
'label' => $lng['serversettings']['mod_fcgid']['tmpdir'], 'system_phpfpm_tmpdir' => [
'label' => lng('serversettings.mod_fcgid.tmpdir'),
'settinggroup' => 'phpfpm', 'settinggroup' => 'phpfpm',
'varname' => 'tmpdir', 'varname' => 'tmpdir',
'type' => 'string', 'type' => 'text',
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/var/customers/tmp/', 'default' => '/var/customers/tmp/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_phpfpm_peardir' => array( 'system_phpfpm_peardir' => [
'label' => $lng['serversettings']['mod_fcgid']['peardir'], 'label' => lng('serversettings.mod_fcgid.peardir'),
'settinggroup' => 'phpfpm', 'settinggroup' => 'phpfpm',
'varname' => 'peardir', 'varname' => 'peardir',
'type' => 'string', 'type' => 'text',
'string_type' => 'dir', 'string_type' => 'dir',
'string_delimiter' => ':', 'string_delimiter' => ':',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '/usr/share/php/:/usr/share/php5/', 'default' => '/usr/share/php/:/usr/share/php5/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_phpfpm_envpath' => array( ],
'label' => $lng['serversettings']['phpfpm_settings']['envpath'], 'system_phpfpm_envpath' => [
'label' => lng('serversettings.phpfpm_settings.envpath'),
'settinggroup' => 'phpfpm', 'settinggroup' => 'phpfpm',
'varname' => 'envpath', 'varname' => 'envpath',
'type' => 'string', 'type' => 'text',
'string_type' => 'dir', 'string_type' => 'dir',
'string_delimiter' => ':', 'string_delimiter' => ':',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '/usr/local/bin:/usr/bin:/bin', 'default' => '/usr/local/bin:/usr/bin:/bin',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_phpfpm_fastcgi_ipcdir' => array( ],
'label' => $lng['serversettings']['phpfpm_settings']['ipcdir'], 'system_phpfpm_fastcgi_ipcdir' => [
'label' => lng('serversettings.phpfpm_settings.ipcdir'),
'settinggroup' => 'phpfpm', 'settinggroup' => 'phpfpm',
'varname' => 'fastcgi_ipcdir', 'varname' => 'fastcgi_ipcdir',
'type' => 'string', 'type' => 'text',
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/var/lib/apache2/fastcgi/', 'default' => '/var/lib/apache2/fastcgi/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_phpfpm_use_mod_proxy' => array( ],
'label' => $lng['phpfpm']['use_mod_proxy'], 'system_phpfpm_use_mod_proxy' => [
'label' => lng('phpfpm.use_mod_proxy'),
'settinggroup' => 'phpfpm', 'settinggroup' => 'phpfpm',
'varname' => 'use_mod_proxy', 'varname' => 'use_mod_proxy',
'type' => 'bool', 'type' => 'checkbox',
'default' => true, 'default' => true,
'visible' => \Froxlor\Settings::Get('system.apache24'), 'visible' => Settings::Get('system.apache24'),
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_phpfpm_ini_flags' => array( 'system_phpfpm_ini_flags' => [
'label' => $lng['phpfpm']['ini_flags'], 'label' => lng('phpfpm.ini_flags'),
'settinggroup' => 'phpfpm', 'settinggroup' => 'phpfpm',
'varname' => 'ini_flags', 'varname' => 'ini_flags',
'type' => 'text', 'type' => 'textarea',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_phpfpm_ini_values' => array( ],
'label' => $lng['phpfpm']['ini_values'], 'system_phpfpm_ini_values' => [
'label' => lng('phpfpm.ini_values'),
'settinggroup' => 'phpfpm', 'settinggroup' => 'phpfpm',
'varname' => 'ini_values', 'varname' => 'ini_values',
'type' => 'text', 'type' => 'textarea',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_phpfpm_ini_admin_flags' => array( ],
'label' => $lng['phpfpm']['ini_admin_flags'], 'system_phpfpm_ini_admin_flags' => [
'label' => lng('phpfpm.ini_admin_flags'),
'settinggroup' => 'phpfpm', 'settinggroup' => 'phpfpm',
'varname' => 'ini_admin_flags', 'varname' => 'ini_admin_flags',
'type' => 'text', 'type' => 'textarea',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_phpfpm_ini_admin_values' => array( ],
'label' => $lng['phpfpm']['ini_admin_values'], 'system_phpfpm_ini_admin_values' => [
'label' => lng('phpfpm.ini_admin_values'),
'settinggroup' => 'phpfpm', 'settinggroup' => 'phpfpm',
'varname' => 'ini_admin_values', 'varname' => 'ini_admin_values',
'type' => 'text', 'type' => 'textarea',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
) 'advanced_mode' => true
) ]
) ]
) ]
); ]
];

View File

@@ -4,69 +4,77 @@
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Froxlor team <team@froxlor.org> (2010-) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @package Settings * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
return array(
'groups' => array( return [
'perl' => array( 'groups' => [
'title' => $lng['admin']['perl_settings'], 'perl' => [
'fields' => array( 'title' => lng('admin.perl_settings'),
'perl_path' => array( 'icon' => 'fa-solid fa-code',
'label' => $lng['serversettings']['perl_path'], 'fields' => [
'perl_path' => [
'label' => lng('serversettings.perl_path'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'perl_path', 'varname' => 'perl_path',
'type' => 'string', 'type' => 'text',
'default' => '/usr/bin/perl', 'default' => '/usr/bin/perl',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array( 'websrv_avail' => [
'lighttpd' 'lighttpd'
) ]
), ],
'system_perl_suexecworkaround' => array( 'system_perl_suexecworkaround' => [
'label' => $lng['serversettings']['perl']['suexecworkaround'], 'label' => lng('serversettings.perl.suexecworkaround'),
'settinggroup' => 'perl', 'settinggroup' => 'perl',
'varname' => 'suexecworkaround', 'varname' => 'suexecworkaround',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array( 'websrv_avail' => [
'apache2' 'apache2'
) ]
), ],
'system_perl_suexeccgipath' => array( 'system_perl_suexeccgipath' => [
'label' => $lng['serversettings']['perl']['suexeccgipath'], 'label' => lng('serversettings.perl.suexeccgipath'),
'settinggroup' => 'perl', 'settinggroup' => 'perl',
'varname' => 'suexecpath', 'varname' => 'suexecpath',
'type' => 'string', 'type' => 'text',
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/var/www/cgi-bin/', 'default' => '/var/www/cgi-bin/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array( 'websrv_avail' => [
'apache2' 'apache2'
) ]
), ],
'perl_server' => array( 'perl_server' => [
'label' => $lng['serversettings']['perl_server'], 'label' => lng('serversettings.perl_server'),
'settinggroup' => 'serversettings', 'settinggroup' => 'serversettings',
'varname' => 'perl_server', 'varname' => 'perl_server',
'type' => 'string', 'type' => 'text',
'default' => 'unix:/var/run/nginx/cgiwrap-dispatch.sock', 'default' => 'unix:/var/run/nginx/cgiwrap-dispatch.sock',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array( 'websrv_avail' => [
'nginx' 'nginx'
) ]
) ]
) ]
) ]
) ]
); ];
?>

View File

@@ -2,86 +2,115 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Settings
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
return array(
'groups' => array( use Froxlor\Settings;
'statistics' => array(
'title' => $lng['admin']['statisticsettings'], return [
'fields' => array( 'groups' => [
'system_webalizer_quiet' => array( 'statistics' => [
'label' => $lng['serversettings']['webalizer_quiet'], 'title' => lng('admin.statisticsettings'),
'icon' => 'fa-solid fa-chart-area',
'fields' => [
'system_traffictool' => [
'label' => lng('serversettings.traffictool.toolselect'),
'settinggroup' => 'system',
'varname' => 'traffictool',
'type' => 'select',
'default' => 'goaccess',
'select_var' => [
'webalizer' => lng('serversettings.traffictool.webalizer'),
'awstats' => lng('serversettings.traffictool.awstats'),
'goaccess' => lng('serversettings.traffictool.goaccess')
],
'save_method' => 'storeSettingUpdateTrafficTool',
'requires_reconf' => ['system']
],
'system_webalizer_quiet' => [
'label' => lng('serversettings.webalizer_quiet'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'webalizer_quiet', 'varname' => 'webalizer_quiet',
'type' => 'option', 'type' => 'select',
'default' => 2, 'default' => 2,
'option_mode' => 'one', 'select_var' => [
'option_options' => array( 0 => lng('admin.webalizer.normal'),
0 => $lng['admin']['webalizer']['normal'], 1 => lng('admin.webalizer.quiet'),
1 => $lng['admin']['webalizer']['quiet'], 2 => lng('admin.webalizer.veryquiet')
2 => $lng['admin']['webalizer']['veryquiet'] ],
), 'save_method' => 'storeSettingField',
'save_method' => 'storeSettingField' 'visible' => Settings::Get('system.traffictool') == 'webalizer'
), ],
'system_awstats_enabled' => array( 'system_awstats_path' => [
'label' => $lng['serversettings']['awstats_enabled'], 'label' => lng('serversettings.awstats_path'),
'settinggroup' => 'system',
'varname' => 'awstats_enabled',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
),
'system_awstats_path' => array(
'label' => $lng['serversettings']['awstats_path'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'awstats_path', 'varname' => 'awstats_path',
'type' => 'string', 'type' => 'text',
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/usr/bin/', 'default' => '/usr/share/awstats/tools/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'visible' => Settings::Get('system.traffictool') == 'awstats'
'system_awstats_awstatspath' => array( ],
'label' => $lng['serversettings']['awstats_awstatspath'], 'system_awstats_awstatspath' => [
'label' => lng('serversettings.awstats_awstatspath'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'awstats_awstatspath', 'varname' => 'awstats_awstatspath',
'type' => 'string', 'type' => 'text',
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/usr/bin/', 'default' => '/usr/lib/cgi-bin/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'visible' => Settings::Get('system.traffictool') == 'awstats'
'system_awstats_conf' => array( ],
'label' => $lng['serversettings']['awstats_conf'], 'system_awstats_conf' => [
'label' => lng('serversettings.awstats_conf'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'awstats_conf', 'varname' => 'awstats_conf',
'type' => 'string', 'type' => 'text',
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/etc/awstats/', 'default' => '/etc/awstats/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'visible' => Settings::Get('system.traffictool') == 'awstats',
'system_awstats_icons' => array( 'requires_reconf' => ['system:awstats']
'label' => $lng['serversettings']['awstats_icons'], ],
'system_awstats_icons' => [
'label' => lng('serversettings.awstats_icons'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'awstats_icons', 'varname' => 'awstats_icons',
'type' => 'string', 'type' => 'text',
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/usr/share/awstats/icon/', 'default' => '/usr/share/awstats/icon/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
) 'visible' => Settings::Get('system.traffictool') == 'awstats'
) ],
) 'system_awstats_logformat' => [
) 'label' => lng('serversettings.awstats.logformat'),
); 'settinggroup' => 'system',
'varname' => 'awstats_logformat',
?> 'type' => 'text',
'default' => '1',
'save_method' => 'storeSettingField',
'visible' => Settings::Get('system.traffictool') == 'awstats',
'advanced_mode' => true
]
]
]
]
];

View File

@@ -2,153 +2,168 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Settings
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
return array(
'groups' => array( return [
'mail' => array( 'groups' => [
'title' => $lng['admin']['mailserversettings'], 'mail' => [
'fields' => array( 'title' => lng('admin.mailserversettings'),
'system_vmail_uid' => array( 'icon' => 'fa-solid fa-envelope',
'label' => $lng['serversettings']['vmail_uid'], 'fields' => [
'system_vmail_uid' => [
'label' => lng('serversettings.vmail_uid'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'vmail_uid', 'varname' => 'vmail_uid',
'type' => 'int', 'type' => 'number',
'default' => 2000, 'default' => 2000,
'int_min' => 1, 'min' => 2,
'int_max' => 65535, 'max' => 65535,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true,
'system_vmail_gid' => array( 'requires_reconf' => ['smtp']
'label' => $lng['serversettings']['vmail_gid'], ],
'system_vmail_gid' => [
'label' => lng('serversettings.vmail_gid'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'vmail_gid', 'varname' => 'vmail_gid',
'type' => 'int', 'type' => 'number',
'default' => 2000, 'default' => 2000,
'int_min' => 1, 'min' => 2,
'int_max' => 65535, 'max' => 65535,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true,
'system_vmail_homedir' => array( 'requires_reconf' => ['smtp']
'label' => $lng['serversettings']['vmail_homedir'], ],
'system_vmail_homedir' => [
'label' => lng('serversettings.vmail_homedir'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'vmail_homedir', 'varname' => 'vmail_homedir',
'type' => 'string', 'type' => 'text',
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/var/customers/mail/', 'default' => '/var/customers/mail/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'requires_reconf' => ['smtp']
'system_vmail_maildirname' => array( ],
'label' => $lng['serversettings']['vmail_maildirname'], 'system_vmail_maildirname' => [
'label' => lng('serversettings.vmail_maildirname'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'vmail_maildirname', 'varname' => 'vmail_maildirname',
'type' => 'string', 'type' => 'text',
'string_type' => 'dir', 'string_type' => 'dir',
'default' => 'Maildir', 'default' => 'Maildir',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'panel_sendalternativemail' => array( ],
'label' => $lng['serversettings']['sendalternativemail'], 'panel_sendalternativemail' => [
'label' => lng('serversettings.sendalternativemail'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'sendalternativemail', 'varname' => 'sendalternativemail',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_mail_quota_enabled' => array( 'system_mail_quota_enabled' => [
'label' => $lng['serversettings']['mail_quota_enabled'], 'label' => lng('serversettings.mail_quota_enabled'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mail_quota_enabled', 'varname' => 'mail_quota_enabled',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_mail_quota' => array( 'system_mail_quota' => [
'label' => $lng['serversettings']['mail_quota'], 'label' => lng('serversettings.mail_quota'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mail_quota', 'varname' => 'mail_quota',
'type' => 'int', 'type' => 'number',
'default' => 100, 'default' => 100,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_catchall_enabled' => array( 'system_catchall_enabled' => [
'label' => $lng['serversettings']['catchall_enabled'], 'label' => lng('serversettings.catchall_enabled'),
'settinggroup' => 'catchall', 'settinggroup' => 'catchall',
'varname' => 'catchall_enabled', 'varname' => 'catchall_enabled',
'type' => 'bool', 'type' => 'checkbox',
'default' => true, 'default' => true,
'save_method' => 'storeSettingResetCatchall' 'save_method' => 'storeSettingResetCatchall'
), ],
'system_mailtraffic_enabled' => array( 'system_mailtraffic_enabled' => [
'label' => $lng['serversettings']['mailtraffic_enabled'], 'label' => lng('serversettings.mailtraffic_enabled'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mailtraffic_enabled', 'varname' => 'mailtraffic_enabled',
'type' => 'bool', 'type' => 'checkbox',
'default' => true, 'default' => true,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_mdaserver' => array( ],
'label' => $lng['serversettings']['mdaserver'], 'system_mdaserver' => [
'label' => lng('serversettings.mdaserver'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mdaserver', 'varname' => 'mdaserver',
'type' => 'option', 'type' => 'select',
'option_mode' => 'one',
'default' => 'dovecot', 'default' => 'dovecot',
'option_options' => array( 'select_var' => [
'courier' => 'Courier', 'courier' => 'Courier',
'dovecot' => 'Dovecot' 'dovecot' => 'Dovecot'
), ],
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_mdalog' => array( ],
'label' => $lng['serversettings']['mdalog'], 'system_mdalog' => [
'label' => lng('serversettings.mdalog'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mdalog', 'varname' => 'mdalog',
'type' => 'string', 'type' => 'text',
'string_type' => 'file', 'string_type' => 'file',
'default' => '/var/log/mail.log', 'default' => '/var/log/mail.log',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_mtaserver' => array( ],
'label' => $lng['serversettings']['mtaserver'], 'system_mtaserver' => [
'label' => lng('serversettings.mtaserver'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mtaserver', 'varname' => 'mtaserver',
'type' => 'option', 'type' => 'select',
'option_mode' => 'one',
'default' => 'postfix', 'default' => 'postfix',
'option_options' => array( 'select_var' => [
'exim4' => 'Exim4', 'exim4' => 'Exim4',
'postfix' => 'Postfix' 'postfix' => 'Postfix'
), ],
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_mtalog' => array( ],
'label' => $lng['serversettings']['mtalog'], 'system_mtalog' => [
'label' => lng('serversettings.mtalog'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mtalog', 'varname' => 'mtalog',
'type' => 'string', 'type' => 'text',
'string_type' => 'file', 'string_type' => 'file',
'default' => '/var/log/mail.log', 'default' => '/var/log/mail.log',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
) 'advanced_mode' => true
) ]
) ]
) ]
); ]
];
?>

View File

@@ -2,41 +2,46 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Settings
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
return array(
'groups' => array( return [
'ftpserver' => array( 'groups' => [
'title' => $lng['admin']['ftpserversettings'], 'ftpserver' => [
'fields' => array( 'title' => lng('admin.ftpserversettings'),
'ftpserver' => array( 'icon' => 'fa-solid fa-arrow-right-arrow-left',
'label' => $lng['admin']['ftpserver'], 'fields' => [
'ftpserver' => [
'label' => lng('admin.ftpserver'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'ftpserver', 'varname' => 'ftpserver',
'type' => 'option', 'type' => 'select',
'default' => 'proftpd', 'default' => 'proftpd',
'option_mode' => 'one', 'select_var' => [
'option_options' => array(
'proftpd' => 'Proftpd', 'proftpd' => 'Proftpd',
'pureftpd' => 'Pureftpd' 'pureftpd' => 'Pureftpd'
), ],
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
) ]
) ]
) ]
) ]
); ];
?>

View File

@@ -2,138 +2,177 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Settings
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
return array(
'groups' => array( use Froxlor\Settings;
'nameserver' => array(
'title' => $lng['admin']['nameserversettings'], return [
'fields' => array( 'groups' => [
'nameserver_enable' => array( 'nameserver' => [
'label' => $lng['serversettings']['bindenable'], 'title' => lng('admin.nameserversettings'),
'icon' => 'fa-solid fa-globe',
'fields' => [
'nameserver_enable' => [
'label' => lng('serversettings.bindenable'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'bind_enable', 'varname' => 'bind_enable',
'type' => 'bool', 'type' => 'checkbox',
'default' => true, 'default' => true,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'overview_option' => true 'overview_option' => true,
), 'requires_reconf' => ['dns']
'system_dnsenabled' => array( ],
'label' => $lng['serversettings']['dnseditorenable'], 'system_dnsenabled' => [
'label' => lng('serversettings.dnseditorenable'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'dnsenabled', 'varname' => 'dnsenabled',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_dns_server' => array( 'system_dns_server' => [
'label' => $lng['serversettings']['dns_server'], 'label' => lng('serversettings.dns_server'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'dns_server', 'varname' => 'dns_server',
'type' => 'option', 'type' => 'select',
'default' => 'Bind', 'default' => 'Bind',
'option_mode' => 'one', 'select_var' => [
'option_options' => array(
'Bind' => 'Bind9', 'Bind' => 'Bind9',
'PowerDNS' => 'PowerDNS' 'PowerDNS' => 'PowerDNS'
), ],
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'requires_reconf' => ['dns']
'system_bindconf_directory' => array( ],
'label' => $lng['serversettings']['bindconf_directory'], 'system_bindconf_directory' => [
'label' => lng('serversettings.bindconf_directory'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'bindconf_directory', 'varname' => 'bindconf_directory',
'type' => 'string', 'type' => 'text',
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/etc/bind/', 'default' => '/etc/bind/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'visible' => Settings::Get('system.dns_server') == 'Bind',
'system_bindreload_command' => array( 'requires_reconf' => ['dns:bind']
'label' => $lng['serversettings']['bindreload_command'], ],
'system_bindreload_command' => [
'label' => lng('serversettings.bindreload_command'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'bindreload_command', 'varname' => 'bindreload_command',
'type' => 'string', 'type' => 'text',
'string_regexp' => '/^[a-z0-9\/\._\- ]+$/i',
'default' => '/etc/init.d/bind9 reload', 'default' => '/etc/init.d/bind9 reload',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_nameservers' => array( 'system_nameservers' => [
'label' => $lng['serversettings']['nameservers'], 'label' => lng('serversettings.nameservers'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'nameservers', 'varname' => 'nameservers',
'type' => 'string', 'type' => 'text',
'string_regexp' => '/^(([a-z0-9\-\._]+, ?)*[a-z0-9\-\._]+)?$/i', 'string_regexp' => '/^(([a-z0-9\-\._]+, ?)*[a-z0-9\-\._]+)?$/i',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingFieldInsertBindTask' 'save_method' => 'storeSettingFieldInsertBindTask'
), ],
'system_mxservers' => array( 'system_mxservers' => [
'label' => $lng['serversettings']['mxservers'], 'label' => lng('serversettings.mxservers'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mxservers', 'varname' => 'mxservers',
'type' => 'string', 'type' => 'text',
'string_regexp' => '/^(([0-9]+ [a-z0-9\-\._]+, ?)*[0-9]+ [a-z0-9\-\._]+)?$/i', 'string_regexp' => '/^(([0-9]+ [a-z0-9\-\._]+, ?)*[0-9]+ [a-z0-9\-\._]+)?$/i',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_axfrservers' => array( 'system_axfrservers' => [
'label' => $lng['serversettings']['axfrservers'], 'label' => lng('serversettings.axfrservers'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'axfrservers', 'varname' => 'axfrservers',
'type' => 'string', 'type' => 'text',
'string_type' => 'validate_ip_incl_private', 'string_type' => 'validate_ip_incl_private',
'string_delimiter' => ',', 'string_delimiter' => ',',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_dns_createmailentry' => array( 'system_powerdns_mode' => [
'label' => $lng['serversettings']['mail_also_with_mxservers'], 'label' => lng('serversettings.powerdns_mode'),
'settinggroup' => 'system',
'varname' => 'powerdns_mode',
'type' => 'select',
'default' => 'Native',
'select_var' => [
'Native' => 'Native',
'Master' => 'Master'
],
'save_method' => 'storeSettingField',
'advanced_mode' => true,
'visible' => Settings::Get('system.dns_server') == 'PowerDNS',
],
'system_dns_createmailentry' => [
'label' => lng('serversettings.mail_also_with_mxservers'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'dns_createmailentry', 'varname' => 'dns_createmailentry',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_dns_createcaaentry' => array( 'system_dns_createcaaentry' => [
'label' => $lng['serversettings']['caa_entry'], 'label' => lng('serversettings.caa_entry'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'dns_createcaaentry', 'varname' => 'dns_createcaaentry',
'type' => 'bool', 'type' => 'checkbox',
'default' => true, 'default' => true,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'caa_caa_entry' => array( ],
'label' => $lng['serversettings']['caa_entry_custom'], 'caa_caa_entry' => [
'label' => lng('serversettings.caa_entry_custom'),
'settinggroup' => 'caa', 'settinggroup' => 'caa',
'varname' => 'caa_entry', 'varname' => 'caa_entry',
'type' => 'text', 'type' => 'textarea',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_defaultttl' => array( ],
'label' => $lng['serversettings']['defaultttl'], 'system_defaultttl' => [
'label' => lng('serversettings.defaultttl'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'defaultttl', 'varname' => 'defaultttl',
'type' => 'int', 'type' => 'number',
'default' => 604800, /* 1 week */ 'default' => 604800, /* 1 week */
'int_min' => 3600, /* 1 hour */ 'min' => 3600, /* 1 hour */
'int_max' => 2147483647, /* integer max */ 'max' => 2147483647, /* integer max */
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
) ],
) 'system_soaemail' => [
) 'label' => lng('serversettings.soaemail'),
) 'settinggroup' => 'system',
); 'varname' => 'soaemail',
'type' => 'email',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField'
]
]
]
]
];

View File

@@ -2,88 +2,92 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Settings
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
return array(
'groups' => array( return [
'logging' => array( 'groups' => [
'title' => $lng['admin']['loggersettings'], 'logging' => [
'fields' => array( 'title' => lng('admin.loggersettings'),
'logger_enabled' => array( 'icon' => 'fa-solid fa-file-lines',
'label' => $lng['serversettings']['logger']['enable'], 'fields' => [
'logger_enabled' => [
'label' => lng('serversettings.logger.enable'),
'settinggroup' => 'logger', 'settinggroup' => 'logger',
'varname' => 'enabled', 'varname' => 'enabled',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'overview_option' => true 'overview_option' => true
), ],
'logger_severity' => array( 'logger_severity' => [
'label' => $lng['serversettings']['logger']['severity'], 'label' => lng('serversettings.logger.severity'),
'settinggroup' => 'logger', 'settinggroup' => 'logger',
'varname' => 'severity', 'varname' => 'severity',
'type' => 'option', 'type' => 'select',
'default' => 1, 'default' => 1,
'option_mode' => 'one', 'select_var' => [
'option_options' => array( 1 => lng('admin.logger.normal'),
1 => $lng['admin']['logger']['normal'], 2 => lng('admin.logger.paranoid')
2 => $lng['admin']['logger']['paranoid'] ],
),
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'logger_logtypes' => array( 'logger_logtypes' => [
'label' => $lng['serversettings']['logger']['types'], 'label' => lng('serversettings.logger.types'),
'settinggroup' => 'logger', 'settinggroup' => 'logger',
'varname' => 'logtypes', 'varname' => 'logtypes',
'type' => 'option', 'type' => 'select',
'default' => 'syslog,mysql', 'default' => 'syslog,mysql',
'option_mode' => 'multiple', 'select_mode' => 'multiple',
'option_options' => array( 'select_var' => [
'syslog' => 'syslog', 'syslog' => 'syslog',
'file' => 'file', 'file' => 'file',
'mysql' => 'mysql' 'mysql' => 'mysql'
), ],
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'logger_logfile' => array( 'logger_logfile' => [
'label' => $lng['serversettings']['logger']['logfile'], 'label' => lng('serversettings.logger.logfile'),
'settinggroup' => 'logger', 'settinggroup' => 'logger',
'varname' => 'logfile', 'varname' => 'logfile',
'type' => 'string', 'type' => 'text',
'string_type' => 'file', 'string_type' => 'file',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'logger_log_cron' => array( 'logger_log_cron' => [
'label' => $lng['serversettings']['logger']['logcron'], 'label' => lng('serversettings.logger.logcron'),
'settinggroup' => 'logger', 'settinggroup' => 'logger',
'varname' => 'log_cron', 'varname' => 'log_cron',
'type' => 'option', 'type' => 'select',
'default' => 0, 'default' => 0,
'option_mode' => 'one', 'select_var' => [
'option_options' => array( 0 => lng('serversettings.logger.logcronoption.never'),
0 => $lng['serversettings']['logger']['logcronoption']['never'], 1 => lng('serversettings.logger.logcronoption.once'),
1 => $lng['serversettings']['logger']['logcronoption']['once'], 2 => lng('serversettings.logger.logcronoption.always')
2 => $lng['serversettings']['logger']['logcronoption']['always'] ],
),
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
) ]
) ]
) ]
) ]
); ];
?>

View File

@@ -2,124 +2,144 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package \Froxlor\Settings
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
return array(
'groups' => array( use Froxlor\Settings;
'dkim' => array(
'title' => $lng['admin']['dkimsettings'], return [
'fields' => array( 'groups' => [
'dkim_enabled' => array( 'dkim' => [
'label' => $lng['dkim']['use_dkim'], 'title' => lng('admin.dkimsettings'),
'icon' => 'fa-solid fa-fingerprint',
'fields' => [
'dkim_enabled' => [
'label' => lng('dkim.use_dkim'),
'settinggroup' => 'dkim', 'settinggroup' => 'dkim',
'varname' => 'use_dkim', 'varname' => 'use_dkim',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingFieldInsertBindTask', 'save_method' => 'storeSettingFieldInsertBindTask',
'overview_option' => true 'overview_option' => true
), ],
'dkim_prefix' => array( 'dkim_prefix' => [
'label' => $lng['dkim']['dkim_prefix'], 'label' => lng('dkim.dkim_prefix'),
'settinggroup' => 'dkim', 'settinggroup' => 'dkim',
'varname' => 'dkim_prefix', 'varname' => 'dkim_prefix',
'type' => 'string', 'type' => 'text',
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/etc/postfix/dkim/', 'default' => '/etc/postfix/dkim/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'dkim_domains' => array( 'dkim_privkeysuffix' => [
'label' => $lng['dkim']['dkim_domains'], 'label' => lng('dkim.privkeysuffix'),
'settinggroup' => 'dkim',
'varname' => 'privkeysuffix',
'type' => 'text',
'string_regexp' => '/^[a-z0-9\._]+$/i',
'default' => '.priv',
'save_method' => 'storeSettingField',
'advanced_mode' => true
],
'dkim_domains' => [
'label' => lng('dkim.dkim_domains'),
'settinggroup' => 'dkim', 'settinggroup' => 'dkim',
'varname' => 'dkim_domains', 'varname' => 'dkim_domains',
'type' => 'string', 'type' => 'text',
'string_regexp' => '/^[a-z0-9\._]+$/i', 'string_regexp' => '/^[a-z0-9\._]+$/i',
'default' => 'domains', 'default' => 'domains',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'dkim_dkimkeys' => array( 'dkim_dkimkeys' => [
'label' => $lng['dkim']['dkim_dkimkeys'], 'label' => lng('dkim.dkim_dkimkeys'),
'settinggroup' => 'dkim', 'settinggroup' => 'dkim',
'varname' => 'dkim_dkimkeys', 'varname' => 'dkim_dkimkeys',
'type' => 'string', 'type' => 'text',
'string_regexp' => '/^[a-z0-9\._]+$/i', 'string_regexp' => '/^[a-z0-9\._]+$/i',
'default' => 'dkim-keys.conf', 'default' => 'dkim-keys.conf',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'dkim_algorithm' => array( 'dkim_algorithm' => [
'label' => $lng['dkim']['dkim_algorithm'], 'label' => lng('dkim.dkim_algorithm'),
'settinggroup' => 'dkim', 'settinggroup' => 'dkim',
'varname' => 'dkim_algorithm', 'varname' => 'dkim_algorithm',
'type' => 'option', 'type' => 'select',
'default' => 'all', 'default' => 'all',
'option_mode' => 'multiple', 'select_mode' => 'multiple',
'option_options' => array( 'select_var' => [
'all' => 'All', 'all' => 'All',
'sha1' => 'SHA1', 'sha1' => 'SHA1',
'sha256' => 'SHA256' 'sha256' => 'SHA256'
), ],
'save_method' => 'storeSettingFieldInsertBindTask' 'save_method' => 'storeSettingFieldInsertBindTask',
), 'advanced_mode' => true
'dkim_servicetype' => array( ],
'label' => $lng['dkim']['dkim_servicetype'], 'dkim_servicetype' => [
'label' => lng('dkim.dkim_servicetype'),
'settinggroup' => 'dkim', 'settinggroup' => 'dkim',
'varname' => 'dkim_servicetype', 'varname' => 'dkim_servicetype',
'type' => 'option', 'type' => 'select',
'default' => '0', 'default' => '0',
'option_mode' => 'one', 'select_var' => [
'option_options' => array(
'0' => 'All', '0' => 'All',
'1' => 'E-Mail' '1' => 'E-Mail'
), ],
'save_method' => 'storeSettingFieldInsertBindTask' 'save_method' => 'storeSettingFieldInsertBindTask',
), 'advanced_mode' => true
'dkim_keylength' => array( ],
'label' => array( 'dkim_keylength' => [
'title' => $lng['dkim']['dkim_keylength']['title'], 'label' => [
'description' => sprintf($lng['dkim']['dkim_keylength']['description'], \Froxlor\Settings::Get('dkim.dkim_prefix')) 'title' => lng('dkim.dkim_keylength.title'),
), 'description' => lng('dkim.dkim_keylength.description', [Settings::Get('dkim.dkim_prefix')])
],
'settinggroup' => 'dkim', 'settinggroup' => 'dkim',
'varname' => 'dkim_keylength', 'varname' => 'dkim_keylength',
'type' => 'option', 'type' => 'select',
'default' => '1024', 'default' => '1024',
'option_mode' => 'one', 'select_var' => [
'option_options' => array(
'1024' => '1024 Bit', '1024' => '1024 Bit',
'2048' => '2048 Bit' '2048' => '2048 Bit'
), ],
'save_method' => 'storeSettingFieldInsertBindTask' 'save_method' => 'storeSettingFieldInsertBindTask'
), ],
'dkim_notes' => array( 'dkim_notes' => [
'label' => $lng['dkim']['dkim_notes'], 'label' => lng('dkim.dkim_notes'),
'settinggroup' => 'dkim', 'settinggroup' => 'dkim',
'varname' => 'dkim_notes', 'varname' => 'dkim_notes',
'type' => 'string', 'type' => 'text',
'string_regexp' => '/^[a-z0-9\._]+$/i', 'string_regexp' => '/^[a-z0-9\._]+$/i',
'default' => '', 'default' => '',
'save_method' => 'storeSettingFieldInsertBindTask' 'save_method' => 'storeSettingFieldInsertBindTask',
), 'advanced_mode' => true
'dkimrestart_command' => array( ],
'label' => $lng['dkim']['dkimrestart_command'], 'dkimrestart_command' => [
'label' => lng('dkim.dkimrestart_command'),
'settinggroup' => 'dkim', 'settinggroup' => 'dkim',
'varname' => 'dkimrestart_command', 'varname' => 'dkimrestart_command',
'type' => 'string', 'type' => 'text',
'string_regexp' => '/^[a-z0-9\/\._\- ]+$/i',
'default' => '/etc/init.d/dkim-filter restart', 'default' => '/etc/init.d/dkim-filter restart',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
) ]
) ]
) ]
) ]
); ];
?>

View File

@@ -4,41 +4,49 @@
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Froxlor team <team@froxlor.org> (2010-) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @package Settings * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
return array(
'groups' => array( return [
'spf' => array( 'groups' => [
'title' => $lng['admin']['spfsettings'], 'spf' => [
'fields' => array( 'title' => lng('admin.spfsettings'),
'spf_enabled' => array( 'icon' => 'fa-solid fa-clipboard-check',
'label' => $lng['spf']['use_spf'], 'fields' => [
'use_spf' => [
'label' => lng('spf.use_spf'),
'settinggroup' => 'spf', 'settinggroup' => 'spf',
'varname' => 'use_spf', 'varname' => 'use_spf',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'overview_option' => true 'overview_option' => true
), ],
'spf_entry' => array( 'spf_entry' => [
'label' => $lng['spf']['spf_entry'], 'label' => lng('spf.spf_entry'),
'settinggroup' => 'spf', 'settinggroup' => 'spf',
'varname' => 'spf_entry', 'varname' => 'spf_entry',
'type' => 'string', 'type' => 'text',
'default' => '"v=spf1 a mx -all"', 'default' => '"v=spf1 a mx -all"',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
) ]
) ]
) ]
) ]
); ];
?>

View File

@@ -2,88 +2,115 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Settings
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
return array(
'groups' => array( use Froxlor\Settings;
'security' => array(
'title' => $lng['admin']['security_settings'], return [
'fields' => array( 'groups' => [
'panel_unix_names' => array( 'security' => [
'label' => $lng['serversettings']['unix_names'], 'title' => lng('admin.security_settings'),
'icon' => 'fa-solid fa-user-lock',
'fields' => [
'panel_unix_names' => [
'label' => lng('serversettings.unix_names'),
'settinggroup' => 'panel', 'settinggroup' => 'panel',
'varname' => 'unix_names', 'varname' => 'unix_names',
'type' => 'bool', 'type' => 'checkbox',
'default' => true, 'default' => true,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_mailpwcleartext' => array( 'system_mailpwcleartext' => [
'label' => $lng['serversettings']['mailpwcleartext'], 'label' => lng('serversettings.mailpwcleartext'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mailpwcleartext', 'varname' => 'mailpwcleartext',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_passwordcryptfunc' => array( ],
'label' => $lng['serversettings']['passwordcryptfunc'], 'system_passwordcryptfunc' => [
'label' => lng('serversettings.passwordcryptfunc'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'passwordcryptfunc', 'varname' => 'passwordcryptfunc',
'type' => 'option', 'type' => 'select',
'default' => 0, 'default' => PASSWORD_DEFAULT,
'option_mode' => 'one', 'option_options_method' => [
'option_options_method' => array(
'\\Froxlor\\System\\Crypt', '\\Froxlor\\System\\Crypt',
'getAvailablePasswordHashes' 'getAvailablePasswordHashes'
), ],
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_allow_error_report_admin' => array( ],
'label' => $lng['serversettings']['allow_error_report_admin'], 'system_allow_error_report_admin' => [
'label' => lng('serversettings.allow_error_report_admin'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'allow_error_report_admin', 'varname' => 'allow_error_report_admin',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_allow_error_report_customer' => array( 'system_allow_error_report_customer' => [
'label' => $lng['serversettings']['allow_error_report_customer'], 'label' => lng('serversettings.allow_error_report_customer'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'allow_error_report_customer', 'varname' => 'allow_error_report_customer',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'system_allow_customer_shell' => array( 'system_allow_customer_shell' => [
'label' => $lng['serversettings']['allow_allow_customer_shell'], 'label' => lng('serversettings.allow_allow_customer_shell'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'allow_customer_shell', 'varname' => 'allow_customer_shell',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
), 'advanced_mode' => true
'system_available_shells' => array( ],
'label' => $lng['serversettings']['available_shells'], 'system_available_shells' => [
'label' => lng('serversettings.available_shells'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'available_shells', 'varname' => 'available_shells',
'type' => 'string', 'type' => 'text',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField',
) 'advanced_mode' => true
) ],
) 'system_froxlorusergroup' => [
) 'label' => lng('serversettings.froxlorusergroup'),
); 'settinggroup' => 'system',
'varname' => 'froxlorusergroup',
'type' => 'text',
'default' => '',
'save_method' => 'storeSettingField',
'plausibility_check_method' => [
'\\Froxlor\\Validate\\Check',
'checkLocalGroup'
],
'visible' => Settings::Get('system.nssextrausers'),
'advanced_mode' => true
],
]
]
]
];

View File

@@ -1,59 +1,69 @@
<?php <?php
/** /**
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
* Copyright (c) 2011- the Froxlor Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Froxlor team <team@froxlor.org> (2011-) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @package Settings * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
return array(
'groups' => array( return [
'diskquota' => array( 'groups' => [
'title' => $lng['diskquota'], 'diskquota' => [
'fields' => array( 'title' => lng('diskquota'),
'diskquota_enabled' => array( 'icon' => 'fa-solid fa-sliders',
'label' => $lng['serversettings']['diskquota_enabled'], 'advanced_mode' => true,
'fields' => [
'diskquota_enabled' => [
'label' => lng('serversettings.diskquota_enabled'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'diskquota_enabled', 'varname' => 'diskquota_enabled',
'type' => 'bool', 'type' => 'checkbox',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'overview_option' => true 'overview_option' => true
), ],
'diskquota_repquota_path' => array( 'diskquota_repquota_path' => [
'label' => $lng['serversettings']['diskquota_repquota_path']['description'], 'label' => lng('serversettings.diskquota_repquota_path.description'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'diskquota_repquota_path', 'varname' => 'diskquota_repquota_path',
'type' => 'string', 'type' => 'text',
'default' => '/usr/sbin/repquota', 'default' => '/usr/sbin/repquota',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'diskquota_quotatool_path' => array( 'diskquota_quotatool_path' => [
'label' => $lng['serversettings']['diskquota_quotatool_path']['description'], 'label' => lng('serversettings.diskquota_quotatool_path.description'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'diskquota_quotatool_path', 'varname' => 'diskquota_quotatool_path',
'type' => 'string', 'type' => 'text',
'default' => '/usr/bin/quotatool', 'default' => '/usr/bin/quotatool',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ],
'diskquota_customer_partition' => array( 'diskquota_customer_partition' => [
'label' => $lng['serversettings']['diskquota_customer_partition']['description'], 'label' => lng('serversettings.diskquota_customer_partition.description'),
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'diskquota_customer_partition', 'varname' => 'diskquota_customer_partition',
'type' => 'string', 'type' => 'text',
'default' => '/dev/root', 'default' => '/dev/root',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
) ]
) ]
) ]
) ]
); ];
?>

View File

0
actions/index.html Normal file
View File

View File

@@ -2,340 +2,195 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Panel
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'admin');
require './lib/init.php';
const AREA = 'admin';
require __DIR__ . '/lib/init.php';
use Froxlor\Api\Commands\Admins;
use Froxlor\CurrentUser;
use Froxlor\Database\Database; use Froxlor\Database\Database;
use Froxlor\FroxlorLogger;
use Froxlor\PhpHelper;
use Froxlor\Settings; use Froxlor\Settings;
use Froxlor\Api\Commands\Admins as Admins; use Froxlor\UI\Collection;
use Froxlor\UI\HTML;
use Froxlor\UI\Listing;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
if (isset($_POST['id'])) { $id = (int)Request::any('id');
$id = intval($_POST['id']);
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
if (($page == 'admins' || $page == 'overview') && $userinfo['change_serversettings'] == '1') {
if ($action == '') { if ($action == '') {
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_admins");
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_admins");
$fields = array(
'loginname' => $lng['login']['username'],
'name' => $lng['customer']['name'],
'diskspace' => $lng['customer']['diskspace'],
'diskspace_used' => $lng['customer']['diskspace'] . ' (' . $lng['panel']['used'] . ')',
'traffic' => $lng['customer']['traffic'],
'traffic_used' => $lng['customer']['traffic'] . ' (' . $lng['panel']['used'] . ')',
'deactivated' => $lng['admin']['deactivated']
);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_ADMINS, $fields);
$admins = '';
$result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_ADMINS . "` " . $paging->getSqlWhere(false) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
$numrows_admins = Database::num_rows();
$paging->setEntries($numrows_admins);
$sortcode = $paging->getHtmlSortCode($lng, true);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$i = 0;
$count = 0;
$dec_places = Settings::Get('panel.decimal_places');
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
if ($paging->checkDisplay($i)) {
$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);
$row['diskspace'] = round($row['diskspace'] / 1024, $dec_places);
// percent-values for progressbar
// For Disk usage
if ($row['diskspace'] > 0) {
$disk_percent = round(($row['diskspace_used'] * 100) / $row['diskspace'], 0);
$disk_doublepercent = round($disk_percent * 2, 2);
} else {
$disk_percent = 0;
$disk_doublepercent = 0;
}
// For Traffic usage
if ($row['traffic'] > 0) {
$traffic_percent = round(($row['traffic_used'] * 100) / $row['traffic'], 0);
$traffic_doublepercent = round($traffic_percent * 2, 2);
} else {
$traffic_percent = 0;
$traffic_doublepercent = 0;
}
// fix progress-bars if value is >100%
if ($disk_percent > 100) {
$disk_percent = 100;
}
if ($traffic_percent > 100) {
$traffic_percent = 100;
}
$row = \Froxlor\PhpHelper::strReplaceArray('-1', 'UL', $row, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps subdomains');
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
$row['custom_notes'] = ($row['custom_notes'] != '') ? nl2br($row['custom_notes']) : '';
eval("\$admins.=\"" . \Froxlor\UI\Template::getTemplate("admins/admins_admin") . "\";");
$count ++;
}
$i ++;
}
$admincount = $numrows_admins;
eval("echo \"" . \Froxlor\UI\Template::getTemplate("admins/admins") . "\";");
} elseif ($action == 'su') {
try { try {
$json_result = Admins::getLocal($userinfo, array( $admin_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.admins.php';
'id' => $id $collection = (new Collection(Admins::class, $userinfo))
))->get(); ->withPagination($admin_list_data['admin_list']['columns'], $admin_list_data['admin_list']['default_sorting']);
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
}
UI::view('user/table.html.twig', [
'listing' => Listing::format($collection, $admin_list_data, 'admin_list'),
'actions_links' => [
[
'href' => $linker->getLink(['section' => 'admins', 'page' => $page, 'action' => 'add']),
'label' => lng('admin.admin_add')
]
]
]);
} elseif ($action == 'su') {
try {
$json_result = Admins::getLocal($userinfo, [
'id' => $id
])->get();
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
$destination_admin = $result['loginname']; $destination_admin = $result['loginname'];
if ($destination_admin != '' && $result['adminid'] != $userinfo['userid']) { if ($destination_admin != '' && $result['adminid'] != $userinfo['userid']) {
$result_stmt = Database::prepare(" $result['switched_user'] = CurrentUser::getData();
SELECT * FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = :userid $result['adminsession'] = 1;
"); $result['userid'] = $result['adminid'];
$result = Database::pexecute_first($result_stmt, array( CurrentUser::setData($result);
'userid' => $userinfo['userid']
));
$s = md5(uniqid(microtime(), 1)); $log->logAction(
$ins_stmt = Database::prepare(" FroxlorLogger::ADM_ACTION,
INSERT INTO `" . TABLE_PANEL_SESSIONS . "` SET LOG_INFO,
`hash` = :hash, `userid` = :userid, `ipaddress` = :ip, "switched adminuser and is now '" . $destination_admin . "'"
`useragent` = :ua, `lastactivity` = :la,
`language` = :lang, `adminsession` = '1'
");
$ins_data = array(
'hash' => $s,
'userid' => $id,
'ip' => $result['ipaddress'],
'ua' => $result['useragent'],
'la' => time(),
'lang' => $result['language']
); );
Database::pexecute($ins_stmt, $ins_data); Response::redirectTo('admin_index.php');
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "switched adminuser and is now '" . $destination_admin . "'");
\Froxlor\UI\Response::redirectTo('admin_index.php', array(
's' => $s
));
} else { } else {
\Froxlor\UI\Response::redirectTo('index.php', array( Response::redirectTo('index.php', [
'action' => 'login' 'action' => 'login'
)); ]);
} }
} elseif ($action == 'delete' && $id != 0) { } elseif ($action == 'delete' && $id != 0) {
try { try {
$json_result = Admins::getLocal($userinfo, array( $json_result = Admins::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
if ($result['loginname'] != '') { if ($result['loginname'] != '') {
if ($result['adminid'] == $userinfo['userid']) { if ($result['adminid'] == $userinfo['userid']) {
\Froxlor\UI\Response::standard_error('youcantdeleteyourself'); Response::standardError('youcantdeleteyourself');
} }
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
Admins::getLocal($userinfo, array( Admins::getLocal($userinfo, [
'id' => $id 'id' => $id
))->delete(); ])->delete();
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
\Froxlor\UI\HTML::askYesNo('admin_admin_reallydelete', $filename, array( HTML::askYesNo('admin_admin_reallydelete', $filename, [
'id' => $id, 'id' => $id,
'page' => $page, 'page' => $page,
'action' => $action 'action' => $action
), $result['loginname']); ], $result['loginname']);
} }
} }
} elseif ($action == 'add') { } elseif ($action == 'add') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { try {
Admins::getLocal($userinfo, $_POST)->add(); Admins::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
$ipaddress = [];
$language_options = ''; $ipaddress[-1] = lng('admin.allips');
foreach ($languages as $language_file => $language_name) {
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $userinfo['language'], true);
}
$ipaddress = \Froxlor\UI\HTML::makeoption($lng['admin']['allips'], "-1");
$ipsandports_stmt = Database::query(" $ipsandports_stmt = Database::query("
SELECT `id`, `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` GROUP BY `ip` ORDER BY `ip` ASC SELECT `id`, `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` GROUP BY `ip` ORDER BY `ip` ASC
"); ");
while ($row = $ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row = $ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
$ipaddress .= \Froxlor\UI\HTML::makeoption($row['ip'], $row['id']); $ipaddress[$row['id']] = $row['ip'];
} }
$customers_ul = \Froxlor\UI\HTML::makecheckbox('customers_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$diskspace_ul = \Froxlor\UI\HTML::makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$traffic_ul = \Froxlor\UI\HTML::makecheckbox('traffic_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$domains_ul = \Froxlor\UI\HTML::makecheckbox('domains_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$subdomains_ul = \Froxlor\UI\HTML::makecheckbox('subdomains_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$emails_ul = \Froxlor\UI\HTML::makecheckbox('emails_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$email_accounts_ul = \Froxlor\UI\HTML::makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$email_forwarders_ul = \Froxlor\UI\HTML::makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$email_quota_ul = \Froxlor\UI\HTML::makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$ftps_ul = \Froxlor\UI\HTML::makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$mysqls_ul = \Froxlor\UI\HTML::makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$admin_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/admin/formfield.admin_add.php'; $admin_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/admin/formfield.admin_add.php';
$admin_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($admin_add_data);
$title = $admin_add_data['admin_add']['title']; UI::view('user/form.html.twig', [
$image = $admin_add_data['admin_add']['image']; 'formaction' => $linker->getLink(['section' => 'admins']),
'formdata' => $admin_add_data['admin_add']
eval("echo \"" . \Froxlor\UI\Template::getTemplate("admins/admins_add") . "\";"); ]);
} }
} elseif ($action == 'edit' && $id != 0) { } elseif ($action == 'edit' && $id != 0) {
try { try {
$json_result = Admins::getLocal($userinfo, array( $json_result = Admins::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
if ($result['loginname'] != '') { if ($result['loginname'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { try {
Admins::getLocal($userinfo, $_POST)->update(); Admins::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
$dec_places = Settings::Get('panel.decimal_places'); $dec_places = Settings::Get('panel.decimal_places');
$result['traffic'] = round($result['traffic'] / (1024 * 1024), $dec_places); $result['traffic'] = round($result['traffic'] / (1024 * 1024), $dec_places);
$result['diskspace'] = round($result['diskspace'] / 1024, $dec_places); $result['diskspace'] = round($result['diskspace'] / 1024, $dec_places);
$result['email'] = $idna_convert->decode($result['email']); $result['email'] = $idna_convert->decode($result['email']);
$customers_ul = \Froxlor\UI\HTML::makecheckbox('customers_ul', $lng['customer']['unlimited'], '-1', false, $result['customers'], true, true); $ipaddress = [];
if ($result['customers'] == '-1') { $ipaddress[-1] = lng('admin.allips');
$result['customers'] = '';
}
$diskspace_ul = \Froxlor\UI\HTML::makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, $result['diskspace'], true, true);
if ($result['diskspace'] == '-1') {
$result['diskspace'] = '';
}
$traffic_ul = \Froxlor\UI\HTML::makecheckbox('traffic_ul', $lng['customer']['unlimited'], '-1', false, $result['traffic'], true, true);
if ($result['traffic'] == '-1') {
$result['traffic'] = '';
}
$domains_ul = \Froxlor\UI\HTML::makecheckbox('domains_ul', $lng['customer']['unlimited'], '-1', false, $result['domains'], true, true);
if ($result['domains'] == '-1') {
$result['domains'] = '';
}
$subdomains_ul = \Froxlor\UI\HTML::makecheckbox('subdomains_ul', $lng['customer']['unlimited'], '-1', false, $result['subdomains'], true, true);
if ($result['subdomains'] == '-1') {
$result['subdomains'] = '';
}
$emails_ul = \Froxlor\UI\HTML::makecheckbox('emails_ul', $lng['customer']['unlimited'], '-1', false, $result['emails'], true, true);
if ($result['emails'] == '-1') {
$result['emails'] = '';
}
$email_accounts_ul = \Froxlor\UI\HTML::makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, $result['email_accounts'], true, true);
if ($result['email_accounts'] == '-1') {
$result['email_accounts'] = '';
}
$email_forwarders_ul = \Froxlor\UI\HTML::makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, $result['email_forwarders'], true, true);
if ($result['email_forwarders'] == '-1') {
$result['email_forwarders'] = '';
}
$email_quota_ul = \Froxlor\UI\HTML::makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, $result['email_quota'], true, true);
if ($result['email_quota'] == '-1') {
$result['email_quota'] = '';
}
$ftps_ul = \Froxlor\UI\HTML::makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, $result['ftps'], true, true);
if ($result['ftps'] == '-1') {
$result['ftps'] = '';
}
$mysqls_ul = \Froxlor\UI\HTML::makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, $result['mysqls'], true, true);
if ($result['mysqls'] == '-1') {
$result['mysqls'] = '';
}
$language_options = '';
foreach ($languages as $language_file => $language_name) {
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $result['def_language'], true);
}
$ipaddress = \Froxlor\UI\HTML::makeoption($lng['admin']['allips'], "-1", $result['ip']);
$ipsandports_stmt = Database::query(" $ipsandports_stmt = Database::query("
SELECT `id`, `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` GROUP BY `id`, `ip` 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)) { while ($row = $ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
$ipaddress .= \Froxlor\UI\HTML::makeoption($row['ip'], $row['id'], $result['ip']); $ipaddress[$row['id']] = $row['ip'];
} }
$result = \Froxlor\PhpHelper::htmlentitiesArray($result); $result = PhpHelper::htmlentitiesArray($result);
$admin_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/admin/formfield.admin_edit.php'; $admin_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/admin/formfield.admin_edit.php';
$admin_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($admin_edit_data);
$title = $admin_edit_data['admin_edit']['title']; UI::view('user/form.html.twig', [
$image = $admin_edit_data['admin_edit']['image']; 'formaction' => $linker->getLink(['section' => 'admins', 'id' => $id]),
'formdata' => $admin_edit_data['admin_edit'],
eval("echo \"" . \Froxlor\UI\Template::getTemplate("admins/admins_edit") . "\";"); 'editid' => $id
]);
} }
} }
} }

View File

@@ -1,440 +1,234 @@
<?php <?php
/* /**
* +----------------------------------------------------------------------+ * This file is part of the Froxlor project.
* | APC | * Copyright (c) 2010 the Froxlor Team (see authors).
* +----------------------------------------------------------------------+
* | 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. * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* Based on https://github.com/krakjoe/apcu/blob/master/apc.php * This program is distributed in the hope that it will be useful,
* Implemented into Froxlor: Janos Muzsi <muzsij@hypernics.hu> * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @author Janos Muzsi <muzsij@hypernics.hu>
* @author Ralf Becker <beckerr@php.net>
* @author Rasmus Lerdorf <rasmus@php.net>
* @author Ilia Alshanetsky <ilia@prohost.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*
* Based on https://github.com/krakjoe/apcu/blob/master/apc.php, which is
* licensed under the PHP licence (version 3.01), which can be viewed
* online at https://www.php.net/license/3_01.txt
*/ */
define('AREA', 'admin');
require './lib/init.php'; use Froxlor\FroxlorLogger;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Response;
use Froxlor\UI\HTML;
const AREA = 'admin';
require __DIR__ . '/lib/init.php';
$horizontal_bar_size = 950; // 1280px window width $horizontal_bar_size = 950; // 1280px window width
if ($action == 'delete' && function_exists('apcu_clear_cache') && $userinfo['change_serversettings'] == '1') { if ($action == 'delete' && function_exists('apcu_clear_cache') && $userinfo['change_serversettings'] == '1') {
if ($_POST['send'] == 'send') {
apcu_clear_cache(); apcu_clear_cache();
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "cleared APCu cache"); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_INFO, "cleared APCu cache");
header('Location: ' . $linker->getLink(array( header('Location: ' . $linker->getLink([
'section' => 'apcuinfo', 'section' => 'apcuinfo',
'page' => 'showinfo' 'page' => 'showinfo'
))); ]));
exit(); exit();
} else {
HTML::askYesNo('cache_reallydelete', $filename, [
'page' => $page,
'action' => 'delete',
], '', [
'section' => 'apcuinfo',
'page' => 'showinfo'
]);
}
} }
if (! function_exists('apcu_cache_info') || ! function_exists('apcu_sma_info')) { if (!function_exists('apcu_cache_info') || !function_exists('apcu_sma_info')) {
\Froxlor\UI\Response::standard_error($lng['error']['no_apcuinfo']); Response::standardError(lng('error.no_apcuinfo'));
} }
if ($page == 'showinfo') { if ($page == 'showinfo' && $userinfo['change_serversettings'] == '1') {
$cache = apcu_cache_info(); $cache = apcu_cache_info();
$mem = apcu_sma_info(); $mem = apcu_sma_info();
$time = time(); $time = time();
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_apcuinfo"); $log->logAction(FroxlorLogger::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 // check for possible empty values that are used in the templates
if (! isset($cache['file_upload_progress'])) { if (!isset($cache['file_upload_progress'])) {
$cache['file_upload_progress'] = $lng['logger']['unknown']; $cache['file_upload_progress'] = lng('logger.unknown');
} }
if (! isset($cache['num_expunges'])) { if (!isset($cache['num_expunges'])) {
$cache['num_expunges'] = $lng['logger']['unknown']; $cache['num_expunges'] = lng('logger.unknown');
} }
$runtimelines = ''; $overview = [
'mem_size' => $mem['num_seg'] * $mem['seg_size'],
'mem_avail' => $mem['avail_mem'],
'mem_used' => ($mem['num_seg'] * $mem['seg_size']) - $mem['avail_mem'],
'seg_size' => bsize($mem['seg_size']),
'num_hits' => $cache['num_hits'],
'num_misses' => $cache['num_misses'],
'num_inserts' => $cache['num_inserts'],
'req_rate_user' => sprintf("%.2f",
$cache['num_hits'] ? (($cache['num_hits'] + $cache['num_misses']) / ($time - $cache['start_time'])) : 0),
'hit_rate_user' => sprintf("%.2f",
$cache['num_hits'] ? (($cache['num_hits']) / ($time - $cache['start_time'])) : 0),
'miss_rate_user' => sprintf("%.2f",
$cache['num_misses'] ? (($cache['num_misses']) / ($time - $cache['start_time'])) : 0),
'insert_rate_user' => sprintf("%.2f",
$cache['num_inserts'] ? (($cache['num_inserts']) / ($time - $cache['start_time'])) : 0),
'apcversion' => phpversion('apcu'),
'phpversion' => phpversion(),
'number_vars' => $cache['num_entries'],
'size_vars' => bsize($cache['mem_size']),
'num_hits_and_misses' => 0 >= ($cache['num_hits'] + $cache['num_misses']) ? 1 : ($cache['num_hits'] + $cache['num_misses']),
'file_upload_progress' => $cache['file_upload_progress'],
'num_expunges' => $cache['num_expunges'],
'host' => (function_exists('gethostname')
? gethostname()
: (php_uname('n')
?: (empty($_SERVER['SERVER_NAME'])
? $_SERVER['HOST_NAME']
: $_SERVER['SERVER_NAME']
)
)
),
'server' => $_SERVER['SERVER_SOFTWARE'] ?: '',
'start_time' => $cache['start_time'],
'uptime' => duration($cache['start_time'])
];
$overview['mem_used_percentage'] = number_format(($overview['mem_used'] / $overview['mem_avail']) * 100, 1);
$overview['num_hits_percentage'] = number_format(($overview['num_hits'] / $overview['num_hits_and_misses']) * 100,
1);
$overview['num_misses_percentage'] = number_format(($overview['num_misses'] / $overview['num_hits_and_misses']) * 100,
1);
$overview['readable'] = [
'mem_size' => bsize($overview['mem_size']),
'mem_avail' => bsize($overview['mem_avail']),
'mem_used' => bsize($overview['mem_used']),
'num_hits' => number_format($overview['num_hits']),
'num_misses' => number_format($overview['num_misses']),
'number_vars' => number_format($overview['number_vars']),
];
$overview['runtimelines'] = [];
foreach (ini_get_all('apcu') as $name => $v) { foreach (ini_get_all('apcu') as $name => $v) {
$value = $v['local_value']; $value = $v['local_value'];
eval("\$runtimelines.=\"" . \Froxlor\UI\Template::getTemplate("settings/apcuinfo/runtime_line") . "\";"); $overview['runtimelines'][$name] = $value;
} }
$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 // Fragementation: (freeseg - 1) / total_seg
$nseg = $freeseg = $fragsize = $freetotal = 0; $nseg = $freeseg = $fragsize = $freetotal = 0;
for ($i = 0; $i < $mem['num_seg']; $i ++) { for ($i = 0; $i < $mem['num_seg']; $i++) {
$ptr = 0; $ptr = 0;
foreach ($mem['block_lists'][$i] as $block) { foreach ($mem['block_lists'][$i] as $block) {
if ($block['offset'] != $ptr) { if ($block['offset'] != $ptr) {
++ $nseg; ++$nseg;
} }
$ptr = $block['offset'] + $block['size']; $ptr = $block['offset'] + $block['size'];
/* Only consider blocks <5M for the fragmentation % */ /* Only consider blocks <5M for the fragmentation % */
if ($block['size'] < (5 * 1024 * 1024)) if ($block['size'] < (5 * 1024 * 1024)) {
$fragsize += $block['size']; $fragsize += $block['size'];
}
$freetotal += $block['size']; $freetotal += $block['size'];
} }
$freeseg += count($mem['block_lists'][$i]); $freeseg += count($mem['block_lists'][$i]);
} }
$overview['fragmentation'] = [];
if ($freeseg > 1) { if ($freeseg > 1) {
$frag = sprintf("%.2f%% (%s out of %s in %d fragments)", ($fragsize / $freetotal) * 100, bsize($fragsize), bsize($freetotal), $freeseg); $overview['fragmentation']['used_percentage'] = number_format(($fragsize / $freetotal) * 100, 1);
$overview['fragmentation']['used_bytes'] = $fragsize;
$overview['fragmentation']['total_bytes'] = $freetotal;
$overview['fragmentation']['num_frags'] = $freeseg;
$overview['fragmentation']['readable'] = [
'used_bytes' => bsize($fragsize),
'total_bytes' => bsize($freetotal),
'num_frags' => number_format($freeseg)
];
} else { } else {
$frag = "0%"; $overview['fragmentation'] = 0;
} }
foreach (ini_get_all('apcu') as $name => $v) { UI::view('settings/apcuinfo.html.twig', [
$value = $v['local_value']; 'apcuinfo' => $overview
} ]);
$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=\"" . \Froxlor\UI\Template::getTemplate("settings/apcuinfo/img_line") . "\";");
$img_src = $linker->getLink(array(
'section' => 'apcuinfo',
'page' => 'img2',
'action' => mt_rand(0, 1000000)
));
eval("\$img_src2=\"" . \Froxlor\UI\Template::getTemplate("settings/apcuinfo/img_line") . "\";");
$img_src = $linker->getLink(array(
'section' => 'apcuinfo',
'page' => 'img3',
'action' => mt_rand(0, 1000000)
));
eval("\$img_src3=\"" . \Froxlor\UI\Template::getTemplate("settings/apcuinfo/img_line") . "\";");
}
eval("echo \"" . \Froxlor\UI\Template::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 // pretty printer for byte values
// function bsize($size)
function bsize($s)
{ {
foreach (array( $i = 0;
'', $val = ['b', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
'K', while (($size / 1024) > 1) {
'M', $size /= 1024;
'G' ++$i;
) as $i => $k) {
if ($s < 1024)
break;
$s /= 1024;
} }
return sprintf("%5.1f %sBytes", $s, $k); return sprintf(
'%.2f%s%s',
$size,
'',
$val[$i]
);
} }
function duration($ts) function duration($ts)
{ {
global $time; global $time;
$years = (int) ((($time - $ts) / (7 * 86400)) / 52.177457); $years = (int)((($time - $ts) / (7 * 86400)) / 52.177457);
$rem = (int) (($time - $ts) - ($years * 52.177457 * 7 * 86400)); $rem = (int)(($time - $ts) - ($years * 52.177457 * 7 * 86400));
$weeks = (int) (($rem) / (7 * 86400)); $weeks = (int)(($rem) / (7 * 86400));
$days = (int) (($rem) / 86400) - $weeks * 7; $days = (int)(($rem) / 86400) - $weeks * 7;
$hours = (int) (($rem) / 3600) - $days * 24 - $weeks * 7 * 24; $hours = (int)(($rem) / 3600) - $days * 24 - $weeks * 7 * 24;
$mins = (int) (($rem) / 60) - $hours * 60 - $days * 24 * 60 - $weeks * 7 * 24 * 60; $mins = (int)(($rem) / 60) - $hours * 60 - $days * 24 * 60 - $weeks * 7 * 24 * 60;
$str = ''; $str = '';
if ($years == 1) if ($years == 1) {
$str .= "$years year, "; $str .= "$years year, ";
if ($years > 1) }
if ($years > 1) {
$str .= "$years years, "; $str .= "$years years, ";
if ($weeks == 1) }
if ($weeks == 1) {
$str .= "$weeks week, "; $str .= "$weeks week, ";
if ($weeks > 1) }
if ($weeks > 1) {
$str .= "$weeks weeks, "; $str .= "$weeks weeks, ";
if ($days == 1) }
if ($days == 1) {
$str .= "$days day,"; $str .= "$days day,";
if ($days > 1) }
if ($days > 1) {
$str .= "$days days,"; $str .= "$days days,";
if ($hours == 1) }
if ($hours == 1) {
$str .= " $hours hour and"; $str .= " $hours hour and";
if ($hours > 1) }
if ($hours > 1) {
$str .= " $hours hours and"; $str .= " $hours hours and";
if ($mins == 1) }
if ($mins == 1) {
$str .= " 1 minute"; $str .= " 1 minute";
else } else {
$str .= " $mins minutes"; $str .= " $mins minutes";
}
return $str; 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);
}
}
}

View File

@@ -2,216 +2,197 @@
/** /**
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
* Copyright (c) 2016 the Froxlor Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Michael Kaufmann <mkaufmann@nutime.de> * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Frontend
* *
* @since 0.9.35 * You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
* *
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'admin');
require './lib/init.php';
const AREA = 'admin';
require __DIR__ . '/lib/init.php';
use Froxlor\Froxlor;
use Froxlor\FroxlorLogger;
use Froxlor\Http\HttpClient; use Froxlor\Http\HttpClient;
use Froxlor\Install\AutoUpdate;
use Froxlor\Settings;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Response;
// define update-uri if ($page != 'error') {
define('UPDATE_URI', "https://version.froxlor.org/Froxlor/api/" . $version); // check for webupdate to be enabled
define('RELEASE_URI', "https://autoupdate.froxlor.org/froxlor-{version}.zip"); if (Settings::Config('enable_webupdate') != true) {
define('CHECKSUM_URI', "https://autoupdate.froxlor.org/froxlor-{version}.zip.sha256"); Response::redirectTo($filename, [
// check for archive-stuff
if (! extension_loaded('zip')) {
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s,
'page' => 'error', 'page' => 'error',
'errno' => 2 'errno' => 11
)); ]);
}
} }
// display initial version check // display initial version check
if ($page == 'overview') { if ($page == 'overview') {
// log our actions // log our actions
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "checking auto-update"); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "checking auto-update");
// check for new version // check for new version
try { try {
$latestversion = HttpClient::urlGet(UPDATE_URI, true, 3); $result = AutoUpdate::checkVersion();
} catch (\Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error("Version-check currently unavailable, please try again later"); Response::dynamicError($e->getMessage());
} }
$latestversion = explode('|', $latestversion);
if (is_array($latestversion) && count($latestversion) >= 1) { if ($result == 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
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s,
'page' => 'error',
'errno' => 3
));
} elseif (\Froxlor\Froxlor::versionCompare2($version, $_version) == - 1) {
// there is a newer version - yay
$isnewerversion = 1;
} else {
// nothing new
$isnewerversion = 0;
}
// anzeige über version-status mit ggfls. formular // anzeige über version-status mit ggfls. formular
// zum update schritt #1 -> download // zum update schritt #1 -> download
if ($isnewerversion == 1) { $text = lng('admin.newerversionavailable') . ' ' . lng('admin.newerversiondetails', [AutoUpdate::getFromResult('version'), Froxlor::VERSION]);
$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 . '" />'; $upd_formfield = [
$yesfile = $filename . '?s=' . $s . '&amp;page=getdownload'; 'updates' => [
eval("echo \"" . \Froxlor\UI\Template::getTemplate("misc/question_yesno", true) . "\";"); 'title' => lng('update.update'),
exit(); 'image' => 'fa-solid fa-download',
} elseif ($isnewerversion == 0) { 'sections' => [
// all good 'section_autoupd' => [
\Froxlor\UI\Response::standard_success('noupdatesavail'); 'fields' => [
'newversion' => ['type' => 'hidden', 'value' => AutoUpdate::getFromResult('version')]
]
]
],
'buttons' => [
[
'class' => 'btn-outline-secondary',
'label' => lng('panel.cancel'),
'type' => 'reset'
],
[
'label' => lng('update.proceed')
]
]
]
];
UI::view('user/form-note.html.twig', [
'formaction' => $linker->getLink(['section' => 'autoupdate', 'page' => 'getdownload']),
'formdata' => $upd_formfield['updates'],
// alert
'type' => 'warning',
'alert_msg' => $text
]);
} else if ($result < 0 || $result > 1) {
// remote errors
if ($result < 0) {
Response::dynamicError(AutoUpdate::getLastError());
} else { } else {
\Froxlor\UI\Response::standard_error('customized_version'); Response::redirectTo($filename, [
'page' => 'error',
'errno' => $result
]);
} }
} else {
// no new version
Response::standardSuccess('update.noupdatesavail', (Settings::Get('system.update_channel') == 'testing' ? lng('serversettings.uc_testing') . ' ' : ''));
} }
} // download the new archive } // download the new archive
elseif ($page == 'getdownload') { elseif ($page == 'getdownload') {
// retrieve the new version from the form // retrieve the new version from the form
$newversion = isset($_POST['newversion']) ? $_POST['newversion'] : null; $newversion = isset($_POST['newversion']) ? $_POST['newversion'] : null;
$result = 6;
// valid? // valid?
if ($newversion !== null) { if ($newversion !== null) {
$result = AutoUpdate::downloadZip($newversion);
// define files to get if (!is_numeric($result)) {
$toLoad = str_replace('{version}', $newversion, RELEASE_URI);
$toCheck = str_replace('{version}', $newversion, CHECKSUM_URI);
// check for local destination folder
if (! is_dir(\Froxlor\Froxlor::getInstallDir() . '/updates/')) {
mkdir(\Froxlor\Froxlor::getInstallDir() . '/updates/');
}
// name archive
$localArchive = \Froxlor\Froxlor::getInstallDir() . '/updates/' . basename($toLoad);
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "Downloading " . $toLoad . " to " . $localArchive);
// remove old archive
if (file_exists($localArchive)) {
@unlink($localArchive);
}
// get archive data
try {
HttpClient::fileGet($toLoad, $localArchive);
} catch (Exception $e) {
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s,
'page' => 'error',
'errno' => 4
));
}
// validate the integrity of the downloaded file
$_shouldsum = HttpClient::urlGet($toCheck);
if (! empty($_shouldsum)) {
$_t = explode(" ", $_shouldsum);
$shouldsum = $_t[0];
} else {
$shouldsum = null;
}
$filesum = hash_file('sha256', $localArchive);
if ($filesum != $shouldsum) {
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s,
'page' => 'error',
'errno' => 9
));
}
// to the next step // to the next step
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
's' => $s,
'page' => 'extract', 'page' => 'extract',
'archive' => basename($localArchive) 'archive' => $result
)); ]);
} }
\Froxlor\UI\Response::redirectTo($filename, array( }
's' => $s, Response::redirectTo($filename, [
'page' => 'error', 'page' => 'error',
'errno' => 6 'errno' => $result
)); ]);
} // extract and install new version } // extract and install new version
elseif ($page == 'extract') { elseif ($page == 'extract') {
$toExtract = isset($_GET['archive']) ? $_GET['archive'] : null;
$localArchive = \Froxlor\Froxlor::getInstallDir() . '/updates/' . $toExtract;
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
// decompress from zip $toExtract = isset($_POST['archive']) ? $_POST['archive'] : null;
$zip = new ZipArchive(); $localArchive = Froxlor::getInstallDir() . '/updates/' . $toExtract;
$res = $zip->open($localArchive); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "Extracting " . $localArchive . " to " . Froxlor::getInstallDir());
if ($res === true) { $result = AutoUpdate::extractZip($localArchive);
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "Extracting " . $localArchive . " to " . \Froxlor\Froxlor::getInstallDir()); if ($result > 0) {
$zip->extractTo(\Froxlor\Froxlor::getInstallDir());
$zip->close();
// success - remove unused archive
@unlink($localArchive);
// wait a bit before we redirect to be sure
sleep(2);
} else {
// error // error
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
's' => $s,
'page' => 'error', 'page' => 'error',
'errno' => 8 'errno' => $result
)); ]);
}
// redirect to update-page
Response::redirectTo('admin_updates.php');
} else {
$toExtract = isset($_GET['archive']) ? $_GET['archive'] : null;
$localArchive = Froxlor::getInstallDir() . '/updates/' . $toExtract;
} }
// redirect to update-page? if (!file_exists($localArchive)) {
\Froxlor\UI\Response::redirectTo('admin_updates.php', array( Response::redirectTo($filename, [
's' => $s
));
}
if (! file_exists($localArchive)) {
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s,
'page' => 'error', 'page' => 'error',
'errno' => 7 'errno' => 7
)); ]);
} }
$text = 'Extract downloaded archive "' . $toExtract . '"?'; $text = lng('admin.extractdownloadedzip', [$toExtract]);
$hiddenparams = '';
$yesfile = $filename . '?s=' . $s . '&amp;page=extract&amp;archive=' . $toExtract; $upd_formfield = [
eval("echo \"" . \Froxlor\UI\Template::getTemplate("misc/question_yesno", true) . "\";"); 'updates' => [
'title' => lng('update.update'),
'image' => 'fa-solid fa-download',
'sections' => [
'section_autoupd' => [
'fields' => [
'archive' => ['type' => 'hidden', 'value' => $toExtract]
]
]
],
'buttons' => [
[
'class' => 'btn-outline-secondary',
'label' => lng('panel.cancel'),
'type' => 'reset'
],
[
'label' => lng('update.proceed')
]
]
]
];
UI::view('user/form-note.html.twig', [
'formaction' => $linker->getLink(['section' => 'autoupdate', 'page' => 'extract']),
'formdata' => $upd_formfield['updates'],
// alert
'type' => 'warning',
'alert_msg' => $text
]);
} // display error } // display error
elseif ($page == 'error') { elseif ($page == 'error') {
// retrieve error-number via url-parameter // retrieve error-number via url-parameter
$errno = isset($_GET['errno']) ? (int) $_GET['errno'] : 0; $errno = isset($_GET['errno']) ? (int)$_GET['errno'] : 0;
// 2 = no Zlib // 2 = no Zlib
// 3 = custom version detected // 3 = custom version detected
@@ -221,5 +202,11 @@ elseif ($page == 'error') {
// 7 = local archive does not exist // 7 = local archive does not exist
// 8 = could not extract archive // 8 = could not extract archive
// 9 = checksum mismatch // 9 = checksum mismatch
\Froxlor\UI\Response::standard_error('autoupdate_' . $errno); // 10 = <php-7.4
// 11 = enable_webupdate = false
$errmsg = 'autoupdate_' . $errno;
if ($errno == 3) {
$errmsg = 'customized_version';
}
Response::standardError($errmsg);
} }

View File

@@ -4,263 +4,178 @@
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Froxlor team <team@froxlor.org> (2010-) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @package Panel * GNU General Public License for more details.
* *
* @since 0.9.34 * You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'admin');
require './lib/init.php';
const AREA = 'admin';
require __DIR__ . '/lib/init.php';
use Froxlor\Config\ConfigParser;
use Froxlor\FileDir;
use Froxlor\Froxlor;
use Froxlor\Settings; use Froxlor\Settings;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
if ($userinfo['change_serversettings'] == '1') { if ($userinfo['change_serversettings'] == '1') {
if ($action == 'setconfigured') { if ($action == 'setconfigured') {
Settings::Set('panel.is_configured', '1', true); Settings::Set('panel.is_configured', '1', true);
\Froxlor\UI\Response::redirectTo('admin_configfiles.php', array( Response::redirectTo('admin_configfiles.php');
's' => $s
));
} }
$customer_tmpdir = '/tmp/';
if (Settings::Get('system.mod_fcgid') == '1' && Settings::Get('system.mod_fcgid_tmpdir') != '') {
$customer_tmpdir = Settings::Get('system.mod_fcgid_tmpdir');
} elseif (Settings::Get('phpfpm.enabled') == '1' && Settings::Get('phpfpm.tmpdir') != '') {
$customer_tmpdir = Settings::Get('phpfpm.tmpdir');
}
// try to convert namserver hosts to ip's
$ns_ips = "";
if (Settings::Get('system.nameservers') != '') {
$nameservers = explode(',', Settings::Get('system.nameservers'));
foreach ($nameservers as $nameserver) {
$nameserver = trim($nameserver);
$nameserver_ips = \Froxlor\PhpHelper::gethostbynamel6($nameserver);
if (is_array($nameserver_ips) && count($nameserver_ips) > 0) {
$ns_ips .= implode(",", $nameserver_ips);
}
}
}
$replace_arr = Array(
'<SQL_UNPRIVILEGED_USER>' => $sql['user'],
'<SQL_UNPRIVILEGED_PASSWORD>' => 'FROXLOR_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'),
'<NAMESERVERS_IP>' => $ns_ips,
'<AXFRSERVERS>' => Settings::Get('system.axfrservers'),
'<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>' => \Froxlor\FileDir::makeCorrectDir($customer_tmpdir),
'<BASE_PATH>' => \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir()),
'<BIND_CONFIG_PATH>' => \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.bindconf_directory')),
'<WEBSERVER_RELOAD_CMD>' => Settings::Get('system.apachereload_command'),
'<CUSTOMER_LOGS>' => \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.logfiles_directory')),
'<FPM_IPCDIR>' => \Froxlor\FileDir::makeCorrectDir(Settings::Get('phpfpm.fastcgi_ipcdir')),
'<WEBSERVER_GROUP>' => Settings::Get('system.httpgroup')
);
// get distro from URL param // get distro from URL param
$distribution = (isset($_GET['distribution']) && $_GET['distribution'] != 'choose') ? $_GET['distribution'] : ""; $distribution = Request::any('distribution');
$service = (isset($_GET['service']) && $_GET['service'] != 'choose') ? $_GET['service'] : ""; $reselect = Request::any('reselect', 0);
$daemon = (isset($_GET['daemon']) && $_GET['daemon'] != 'choose') ? $_GET['daemon'] : "";
$distributions_select = "";
$services_select = "";
$daemons_select = "";
$configfiles = ""; // check for possible setting
$services = ""; if (empty($distribution)) {
$daemons = ""; $distribution = Settings::Get('system.distribution') ?? "";
}
if ($reselect == 1) {
$distribution = '';
}
$config_dir = \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir() . '/lib/configfiles/'); $distributions_select = [];
if ($distribution != "") { $services = [];
$config_dir = FileDir::makeCorrectDir(Froxlor::getInstallDir() . '/lib/configfiles/');
if (! file_exists($config_dir . '/' . $distribution . ".xml")) { if (!empty($distribution)) {
trigger_error("Unknown distribution, are you playing around with the URL?"); if (!file_exists($config_dir . '/' . $distribution . ".xml")) {
exit(); Response::dynamicError("Unknown distribution");
}
// update setting if different
if ($distribution != Settings::Get('system.distribution')) {
Settings::Set('system.distribution', $distribution);
} }
// create configparser object // create configparser object
$configfiles = new \Froxlor\Config\ConfigParser($config_dir . '/' . $distribution . ".xml"); $configfiles = new ConfigParser($config_dir . '/' . $distribution . ".xml");
// get distro-info // get distro-info
$dist_display = getCompleteDistroName($configfiles); $dist_display = $configfiles->getCompleteDistroName();
// get all the services from the distro // get all the services from the distro
$services = $configfiles->getServices(); $services = $configfiles->getServices();
if ($service != "") {
if (! isset($services[$service])) {
trigger_error("Unknown service, are you playing around with the URL?");
exit();
}
$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 .= \Froxlor\UI\HTML::makeoption($title, $di);
}
}
} else { } else {
foreach ($services as $si => $sd) {
$services_select .= \Froxlor\UI\HTML::makeoption($sd->title, $si);
}
}
} else {
// show list of available distro's // show list of available distro's
$distros = glob($config_dir . '*.xml'); $distros = glob($config_dir . '*.xml');
// tmp array
$distributions_select_data = array();
// read in all the distros // read in all the distros
foreach ($distros as $_distribution) { foreach ($distros as $_distribution) {
// get configparser object // get configparser object
$dist = new \Froxlor\Config\ConfigParser($_distribution); $dist = new ConfigParser($_distribution);
// get distro-info
$dist_display = getCompleteDistroName($dist);
// store in tmp array // store in tmp array
$distributions_select_data[$dist_display] = str_replace(".xml", "", strtolower(basename($_distribution))); $distributions_select[str_replace(".xml", "", strtolower(basename($_distribution)))] = $dist->getCompleteDistroName();
} }
// sort by distribution name // sort by distribution name
ksort($distributions_select_data); asort($distributions_select);
foreach ($distributions_select_data as $dist_display => $dist_index) {
// create select-box-option
$distributions_select .= \Froxlor\UI\HTML::makeoption($dist_display, $dist_index);
}
} }
if ($distribution != "" && $service != "" && $daemon != "") { if ($distribution != "" && isset($_POST['finish'])) {
unset($_POST['finish']);
$params = $_POST;
$params['distro'] = $distribution;
$params['system'] = [];
foreach ($_POST['system'] as $sysdaemon) {
$params['system'][] = $sysdaemon;
}
$params_content = json_encode($params);
$params_filename = FileDir::makeCorrectFile(Froxlor::getInstallDir() . 'install/' . Froxlor::genSessionId() . '.json');
file_put_contents($params_filename, $params_content);
if (! isset($daemons[$daemon])) { UI::twigBuffer('settings/configuration-final.html.twig', [
trigger_error("Unknown daemon, are you playing around with the URL?"); 'distribution' => $distribution,
exit(); // alert
} 'type' => 'info',
'alert_msg' => lng('admin.configfiles.finishnote'),
$confarr = $daemons[$daemon]->getConfig(); 'basedir' => Froxlor::getInstallDir(),
'params_filename' => $params_filename
$configpage = ''; ]);
$distro_editor = $configfiles->distributionEditor;
$commands_pre = "";
$commands_file = "";
$commands_post = "";
$lasttype = '';
$commands = '';
foreach ($confarr as $_action) {
if ($lasttype != '' && $lasttype != $_action['type']) {
$commands = trim($commands);
$numbrows = count(explode("\n", $commands));
eval("\$configpage.=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_commands") . "\";");
$lasttype = '';
$commands = '';
}
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);
}
}
}
$realname = $_action['name'];
$commands = trim($commands_pre);
if ($commands != "") {
$numbrows = count(explode("\n", $commands));
eval("\$commands_pre=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_commands") . "\";");
}
$commands = trim($commands_post);
if ($commands != "") {
$numbrows = count(explode("\n", $commands));
eval("\$commands_post=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_commands") . "\";");
}
eval("\$configpage.=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_subfileblock") . "\";");
$commands = '';
$commands_pre = '';
$commands_post = '';
break;
}
}
$commands = trim($commands);
if ($commands != '') {
$numbrows = count(explode("\n", $commands));
eval("\$configpage.=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_commands") . "\";");
}
eval("echo \"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles") . "\";");
} else { } else {
$basedir = \Froxlor\Froxlor::getInstallDir(); if (!empty($distribution)) {
eval("echo \"" . \Froxlor\UI\Template::getTemplate("configfiles/wizard") . "\";"); // show available services to configure
$fields = $services;
$link_params = ['section' => 'configfiles', 'distribution' => $distribution];
UI::twigBuffer('settings/configuration.html.twig', [
'action' => $linker->getLink($link_params),
'fields' => $fields,
'distribution' => $distribution
]);
} else {
// @fixme check set distribution from settings
$cfg_formfield = [
'config' => [
'title' => lng('admin.configfiles.serverconfiguration'),
'image' => 'fa-solid fa-wrench',
'description' => lng('admin.configfiles.description'),
'sections' => [
'section_config' => [
'fields' => [
'distribution' => [
'type' => 'select',
'select_var' => $distributions_select,
'label' => lng('admin.configfiles.distribution'),
'selected' => Settings::Get('system.distribution') ?? ''
]
]
]
],
'buttons' => [
[
'class' => 'btn-outline-secondary',
'label' => lng('panel.cancel'),
'type' => 'reset'
],
[
'label' => lng('update.proceed')
]
]
]
];
UI::twigBuffer('user/form-note.html.twig', [
'formaction' => $linker->getLink(['section' => 'configfiles']),
'formdata' => $cfg_formfield['config'],
'actions_links' => (int)Settings::Get('panel.is_configured') == 0 ? [
[
'href' => $linker->getLink([
'section' => 'configfiles',
'page' => 'overview',
'action' => 'setconfigured'
]),
'label' => lng('panel.ihave_configured'),
'class' => 'btn-outline-warning',
'icon' => 'fa-solid fa-circle-check'
]
] : [],
// alert
'type' => 'warning',
'alert_msg' => lng('panel.settings_before_configuration') . ((int)Settings::Get('panel.is_configured') == 1 ? '<br><br>' . lng('panel.system_is_configured') : '')
]);
} }
}
UI::twigOutputBuffer();
} else { } else {
\Froxlor\UI\Response::redirectTo('admin_index.php', array( Response::redirectTo('admin_index.php');
's' => $s
));
}
// 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=\"" . \Froxlor\UI\Template::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;
} }

View File

@@ -4,86 +4,67 @@
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Froxlor team <team@froxlor.org> (2010-) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @package Panel * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'admin');
require './lib/init.php';
use Froxlor\Database\Database; const AREA = 'admin';
use Froxlor\Api\Commands\Cronjobs as Cronjobs; require __DIR__ . '/lib/init.php';
if (isset($_POST['id'])) { use Froxlor\Api\Commands\Cronjobs;
$id = intval($_POST['id']); use Froxlor\FroxlorLogger;
} elseif (isset($_GET['id'])) { use Froxlor\UI\Collection;
$id = intval($_GET['id']); use Froxlor\UI\Listing;
} use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
if ($page == 'cronjobs' || $page == 'overview') { $id = (int)Request::any('id');
if (($page == 'cronjobs' || $page == 'overview') && $userinfo['change_serversettings'] == '1') {
if ($action == '') { if ($action == '') {
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'viewed admin_cronjobs'); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'viewed admin_cronjobs');
$fields = array( try {
'c.lastrun' => $lng['cron']['lastrun'], $cron_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.cronjobs.php';
'c.interval' => $lng['cron']['interval'], $collection = (new Collection(Cronjobs::class, $userinfo))
'c.isactive' => $lng['cron']['isactive'] ->withPagination($cron_list_data['cron_list']['columns'], $cron_list_data['cron_list']['default_sorting']);
); } catch (Exception $e) {
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_CRONRUNS, $fields); Response::dynamicError($e->getMessage());
$crons = '';
$result_stmt = Database::prepare("SELECT `c`.* FROM `" . TABLE_PANEL_CRONRUNS . "` `c` ORDER BY `module` ASC, `cronfile` ASC");
Database::pexecute($result_stmt);
$paging->setEntries(Database::num_rows());
$sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$i = 0;
$count = 0;
$cmod = '';
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
if ($cmod != $row['module']) {
$_mod = explode("/", $row['module']);
$module = ucfirst($_mod[1]);
eval("\$crons.=\"" . \Froxlor\UI\Template::getTemplate('cronjobs/cronjobs_cronjobmodule') . "\";");
$cmod = $row['module'];
}
if ($paging->checkDisplay($i)) {
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
$row['lastrun'] = date('d.m.Y H:i', $row['lastrun']);
$row['isactive'] = ((int) $row['isactive'] == 1) ? $lng['panel']['yes'] : $lng['panel']['no'];
$description = $lng['crondesc'][$row['desc_lng_key']];
eval("\$crons.=\"" . \Froxlor\UI\Template::getTemplate('cronjobs/cronjobs_cronjob') . "\";");
$count ++;
} }
$i ++; UI::view('user/table-note.html.twig', [
} 'listing' => Listing::format($collection, $cron_list_data, 'cron_list'),
// alert-box
eval("echo \"" . \Froxlor\UI\Template::getTemplate('cronjobs/cronjobs') . "\";"); 'type' => 'warning',
'alert_msg' => lng('cron.changewarning')
]);
} elseif ($action == 'new') { } elseif ($action == 'new') {
/* /*
* @TODO later * @TODO later
*/ */
} elseif ($action == 'edit' && $id != 0) { } elseif ($action == 'edit' && $id != 0) {
try { try {
$json_result = Cronjobs::getLocal($userinfo, array( $json_result = Cronjobs::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
if ($result['cronfile'] != '') { if ($result['cronfile'] != '') {
@@ -91,38 +72,19 @@ if ($page == 'cronjobs' || $page == 'overview') {
try { try {
Cronjobs::getLocal($userinfo, $_POST)->update(); Cronjobs::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
// interval
$interval_nfo = explode(' ', $result['interval']);
$interval_value = $interval_nfo[0];
$interval_interval = '';
$interval_interval .= \Froxlor\UI\HTML::makeoption($lng['cronmgmt']['minutes'], 'MINUTE', $interval_nfo[1]);
$interval_interval .= \Froxlor\UI\HTML::makeoption($lng['cronmgmt']['hours'], 'HOUR', $interval_nfo[1]);
$interval_interval .= \Froxlor\UI\HTML::makeoption($lng['cronmgmt']['days'], 'DAY', $interval_nfo[1]);
$interval_interval .= \Froxlor\UI\HTML::makeoption($lng['cronmgmt']['weeks'], 'WEEK', $interval_nfo[1]);
$interval_interval .= \Froxlor\UI\HTML::makeoption($lng['cronmgmt']['months'], 'MONTH', $interval_nfo[1]);
// end of interval
$change_cronfile = false;
if (substr($result['module'], 0, strpos($result['module'], '/')) != 'froxlor') {
$change_cronfile = true;
}
$cronjobs_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/cronjobs/formfield.cronjobs_edit.php'; $cronjobs_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/cronjobs/formfield.cronjobs_edit.php';
$cronjobs_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($cronjobs_edit_data);
$title = $cronjobs_edit_data['cronjobs_edit']['title']; UI::view('user/form.html.twig', [
$image = $cronjobs_edit_data['cronjobs_edit']['image']; 'formaction' => $linker->getLink(['section' => 'cronjobs', 'id' => $id]),
'formdata' => $cronjobs_edit_data['cronjobs_edit'],
eval("echo \"" . \Froxlor\UI\Template::getTemplate('cronjobs/cronjob_edit') . "\";"); 'editid' => $id
]);
} }
} }
} elseif ($action == 'delete' && $id != 0) { } elseif ($action == 'delete' && $id != 0) {

View File

@@ -2,495 +2,330 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Panel
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'admin');
require './lib/init.php';
const AREA = 'admin';
require __DIR__ . '/lib/init.php';
use Froxlor\Api\Commands\Admins;
use Froxlor\Api\Commands\Customers;
use Froxlor\Api\Commands\MysqlServer;
use Froxlor\CurrentUser;
use Froxlor\Database\Database; use Froxlor\Database\Database;
use Froxlor\Froxlor;
use Froxlor\FroxlorLogger;
use Froxlor\PhpHelper;
use Froxlor\Settings; use Froxlor\Settings;
use Froxlor\Api\Commands\Customers as Customers; use Froxlor\UI\Collection;
use Froxlor\UI\HTML;
use Froxlor\UI\Listing;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
if (isset($_POST['id'])) { $id = (int)Request::any('id');
$id = intval($_POST['id']);
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
if ($page == 'customers' && $userinfo['customers'] != '0') { if (($page == 'customers' || $page == 'overview') && $userinfo['customers'] != '0') {
if ($action == '') { if ($action == '') {
// clear request data $log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_customers");
unset($_SESSION['requestData']);
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_customers"); try {
$fields = array( $customer_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.customers.php';
'c.loginname' => $lng['login']['username'], $collection = (new Collection(Customers::class, $userinfo, ['show_usages' => true]))
'a.loginname' => $lng['admin']['admin'], ->withPagination($customer_list_data['customer_list']['columns'], $customer_list_data['customer_list']['default_sorting']);
'c.name' => $lng['customer']['name'], if ($userinfo['change_serversettings']) {
'c.email' => $lng['customer']['email'], $collection->has('admin', Admins::class, 'adminid', 'adminid');
'c.firstname' => $lng['customer']['firstname'],
'c.company' => $lng['customer']['company'],
'c.diskspace' => $lng['customer']['diskspace'],
'c.diskspace_used' => $lng['customer']['diskspace'] . ' (' . $lng['panel']['used'] . ')',
'c.traffic' => $lng['customer']['traffic'],
'c.traffic_used' => $lng['customer']['traffic'] . ' (' . $lng['panel']['used'] . ')'
);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_CUSTOMERS, $fields);
$customers = '';
$result_stmt = Database::prepare("
SELECT `c`.*, `a`.`loginname` AS `adminname`
FROM `" . TABLE_PANEL_CUSTOMERS . "` `c`, `" . TABLE_PANEL_ADMINS . "` `a`
WHERE " . ($userinfo['customers_see_all'] ? '' : " `c`.`adminid` = :adminid AND ") . "
`c`.`adminid` = `a`.`adminid` " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
Database::pexecute($result_stmt, array(
'adminid' => $userinfo['adminid']
));
$num_rows = Database::num_rows();
$paging->setEntries($num_rows);
$sortcode = $paging->getHtmlSortCode($lng, true);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$i = 0;
$count = 0;
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
if ($paging->checkDisplay($i)) {
$domains_stmt = Database::prepare("
SELECT COUNT(`id`) AS `domains`
FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `customerid` = :cid
AND `parentdomainid` = '0'
AND `id`<> :stdd");
Database::pexecute($domains_stmt, array(
'cid' => $row['customerid'],
'stdd' => $row['standardsubdomain']
));
$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']
));
if ($usages)
{
$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);
} else {
$row['webspace_used'] = 0;
$row['mailspace_used'] = 0;
$row['dbspace_used'] = 0;
} }
$row['traffic_used'] = round($row['traffic_used'] / (1024 * 1024), $dec_places); } catch (Exception $e) {
$row['traffic'] = round($row['traffic'] / (1024 * 1024), $dec_places); Response::dynamicError($e->getMessage());
$row['diskspace_used'] = round($row['diskspace_used'] / 1024, $dec_places);
$row['diskspace'] = round($row['diskspace'] / 1024, $dec_places);
$last_login = ((int) $row['lastlogin_succ'] == 0) ? $lng['panel']['neverloggedin'] : date('d.m.Y', $row['lastlogin_succ']);
/**
* percent-values for progressbar
*/
// For Disk usage
if ($row['diskspace'] > 0) {
$disk_percent = round(($row['diskspace_used'] * 100) / $row['diskspace'], 0);
$disk_doublepercent = round($disk_percent * 2, 2);
} else {
$disk_percent = 0;
$disk_doublepercent = 0;
} }
if ($row['traffic'] > 0) { $actions_links = false;
$traffic_percent = round(($row['traffic_used'] * 100) / $row['traffic'], 0); if (CurrentUser::canAddResource('customers')) {
$traffic_doublepercent = round($traffic_percent * 2, 2); $actions_links = [
} else { [
$traffic_percent = 0; 'href' => $linker->getLink(['section' => 'customers', 'page' => $page, 'action' => 'add']),
$traffic_doublepercent = 0; 'label' => lng('admin.customer_add')
]
];
} }
$islocked = 0; UI::view('user/table.html.twig', [
if ($row['loginfail_count'] >= Settings::Get('login.maxloginattempts') && $row['lastlogin_fail'] > (time() - Settings::Get('login.deactivatetime'))) { 'listing' => Listing::format($collection, $customer_list_data, 'customer_list'),
$islocked = 1; 'actions_links' => $actions_links
} ]);
$row = \Froxlor\PhpHelper::strReplaceArray('-1', 'UL', $row, 'diskspace traffic mysqls emails email_accounts email_forwarders ftps subdomains');
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
// fix progress-bars if value is >100%
if ($disk_percent > 100) {
$disk_percent = 100;
}
if ($traffic_percent > 100) {
$traffic_percent = 100;
}
$row['custom_notes'] = ($row['custom_notes'] != '') ? nl2br($row['custom_notes']) : '';
eval("\$customers.=\"" . \Froxlor\UI\Template::getTemplate("customers/customers_customer") . "\";");
$count ++;
}
$i ++;
}
$customercount = $num_rows;
eval("echo \"" . \Froxlor\UI\Template::getTemplate("customers/customers") . "\";");
} elseif ($action == 'su' && $id != 0) { } elseif ($action == 'su' && $id != 0) {
try { try {
$json_result = Customers::getLocal($userinfo, array( $json_result = Customers::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
$destination_user = $result['loginname']; $destination_user = $result['loginname'];
if ($destination_user != '') { if ($destination_user != '') {
if ($result['deactivated'] == '1') { if ($result['deactivated'] == '1') {
\Froxlor\UI\Response::standard_error("usercurrentlydeactivated", $destination_user); Response::standardError("usercurrentlydeactivated", $destination_user);
} }
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :id
AND `hash` = :hash");
$result = Database::pexecute_first($result_stmt, array(
'id' => $userinfo['userid'],
'hash' => $s
));
$s = md5(uniqid(microtime(), 1)); $result['switched_user'] = CurrentUser::getData();
$insert = Database::prepare(" $result['adminsession'] = 0;
INSERT INTO `" . TABLE_PANEL_SESSIONS . "` SET $result['userid'] = $result['customerid'];
`hash` = :hash, CurrentUser::setData($result);
`userid` = :id,
`ipaddress` = :ip, $log->logAction(FroxlorLogger::ADM_ACTION, LOG_INFO, "switched user and is now '" . $destination_user . "'");
`useragent` = :ua,
`lastactivity` = :lastact,
`language` = :lang,
`adminsession` = '0'");
Database::pexecute($insert, array(
'hash' => $s,
'id' => $id,
'ip' => $result['ipaddress'],
'ua' => $result['useragent'],
'lastact' => time(),
'lang' => $result['language']
));
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "switched user and is now '" . $destination_user . "'");
$target = (isset($_GET['target']) ? $_GET['target'] : 'index'); $target = (isset($_GET['target']) ? $_GET['target'] : 'index');
$redirect = "customer_" . $target . ".php"; $redirect = "customer_" . $target . ".php";
if (! file_exists(\Froxlor\Froxlor::getInstallDir() . "/" . $redirect)) { if (!file_exists(Froxlor::getInstallDir() . "/" . $redirect)) {
$redirect = "customer_index.php"; $redirect = "customer_index.php";
} }
\Froxlor\UI\Response::redirectTo($redirect, array( Response::redirectTo($redirect, null, true);
's' => $s
), true);
} else { } else {
\Froxlor\UI\Response::redirectTo('index.php', array( Response::redirectTo('index.php', [
'action' => 'login' 'action' => 'login'
)); ]);
} }
} elseif ($action == 'unlock' && $id != 0) { } elseif ($action == 'unlock' && $id != 0) {
try { try {
$json_result = Customers::getLocal($userinfo, array( $json_result = Customers::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { try {
$json_result = Customers::getLocal($userinfo, array( $json_result = Customers::getLocal($userinfo, [
'id' => $id 'id' => $id
))->unlock(); ])->unlock();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
\Froxlor\UI\HTML::askYesNo('customer_reallyunlock', $filename, array( HTML::askYesNo('customer_reallyunlock', $filename, [
'id' => $id, 'id' => $id,
'page' => $page, 'page' => $page,
'action' => $action 'action' => $action
), $result['loginname']); ], $result['loginname']);
} }
} elseif ($action == 'delete' && $id != 0) { } elseif ($action == 'delete' && $id != 0) {
try { try {
$json_result = Customers::getLocal($userinfo, array( $json_result = Customers::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { try {
$json_result = Customers::getLocal($userinfo, array( $json_result = Customers::getLocal($userinfo, [
'id' => $id, 'id' => $id,
'delete_userfiles' => (isset($_POST['delete_userfiles']) ? (int) $_POST['delete_userfiles'] : 0) 'delete_userfiles' => (isset($_POST['delete_userfiles']) ? (int)$_POST['delete_userfiles'] : 0)
))->delete(); ])->delete();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
\Froxlor\UI\HTML::askYesNoWithCheckbox('admin_customer_reallydelete', 'admin_customer_alsoremovefiles', $filename, array( HTML::askYesNoWithCheckbox('admin_customer_reallydelete', 'admin_customer_alsoremovefiles', $filename, [
'id' => $id, 'id' => $id,
'page' => $page, 'page' => $page,
'action' => $action 'action' => $action
), $result['loginname']); ], $result['loginname']);
} }
} elseif ($action == 'add') { } elseif ($action == 'add') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { try {
Customers::getLocal($userinfo, $_POST)->add(); Customers::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
$language_options = ''; $mysql_servers = [];
try {
foreach ($languages as $language_file => $language_name) { $result_json = MysqlServer::getLocal($userinfo)->listing();
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, Settings::Get('panel.standardlanguage'), true); $result_decoded = json_decode($result_json, true)['data']['list'];
foreach ($result_decoded as $dbserver => $dbdata) {
$mysql_servers[] = [
'label' => $dbdata['caption'],
'value' => $dbserver
];
}
} catch (Exception $e) {
/* just none */
} }
$diskspace_ul = \Froxlor\UI\HTML::makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $phpconfigs = [];
$traffic_ul = \Froxlor\UI\HTML::makecheckbox('traffic_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$subdomains_ul = \Froxlor\UI\HTML::makecheckbox('subdomains_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$emails_ul = \Froxlor\UI\HTML::makecheckbox('emails_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$email_accounts_ul = \Froxlor\UI\HTML::makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$email_forwarders_ul = \Froxlor\UI\HTML::makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$email_quota_ul = \Froxlor\UI\HTML::makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$ftps_ul = \Froxlor\UI\HTML::makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$mysqls_ul = \Froxlor\UI\HTML::makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$gender_options = \Froxlor\UI\HTML::makeoption($lng['gender']['undef'], 0, true, true, true);
$gender_options .= \Froxlor\UI\HTML::makeoption($lng['gender']['male'], 1, null, true, true);
$gender_options .= \Froxlor\UI\HTML::makeoption($lng['gender']['female'], 2, null, true, true);
$phpconfigs = array();
$configs = Database::query(" $configs = Database::query("
SELECT c.*, fc.description as interpreter SELECT c.*, fc.description as interpreter
FROM `" . TABLE_PANEL_PHPCONFIGS . "` c FROM `" . TABLE_PANEL_PHPCONFIGS . "` c
LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fc ON fc.id = c.fpmsettingid LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fc ON fc.id = c.fpmsettingid
"); ");
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) { while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
if ((int) Settings::Get('phpfpm.enabled') == 1) { if ((int)Settings::Get('phpfpm.enabled') == 1) {
$phpconfigs[] = array( $phpconfigs[] = [
'label' => $row['description'] . " [" . $row['interpreter'] . "]<br />", 'label' => $row['description'] . " [" . $row['interpreter'] . "]",
'value' => $row['id'] 'value' => $row['id']
); ];
} else { } else {
$phpconfigs[] = array( $phpconfigs[] = [
'label' => $row['description'] . "<br />", 'label' => $row['description'],
'value' => $row['id'] 'value' => $row['id']
); ];
} }
} }
// hosting plans // hosting plans
$hosting_plans = ""; $hosting_plans = [];
$plans = Database::query(" $plans = Database::query("
SELECT * SELECT *
FROM `" . TABLE_PANEL_PLANS . "` FROM `" . TABLE_PANEL_PLANS . "`
ORDER BY name ASC ORDER BY name ASC
"); ");
if (Database::num_rows() > 0) { $hosting_plans = [
$hosting_plans .= \Froxlor\UI\HTML::makeoption("---", 0, 0, true, true); 0 => "---"
} ];
while ($row = $plans->fetch(PDO::FETCH_ASSOC)) { while ($row = $plans->fetch(PDO::FETCH_ASSOC)) {
$hosting_plans .= \Froxlor\UI\HTML::makeoption($row['name'], $row['id'], 0, true, true); $hosting_plans[$row['id']] = $row['name'];
} }
$customer_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_add.php'; $customer_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_add.php';
$customer_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($customer_add_data);
$title = $customer_add_data['customer_add']['title']; UI::view('user/form.html.twig', [
$image = $customer_add_data['customer_add']['image']; 'formaction' => $linker->getLink(['section' => 'customers']),
'formdata' => $customer_add_data['customer_add']
eval("echo \"" . \Froxlor\UI\Template::getTemplate("customers/customers_add") . "\";"); ]);
} }
} elseif ($action == 'edit' && $id != 0) { } elseif ($action == 'edit' && $id != 0) {
try { try {
$json_result = Customers::getLocal($userinfo, array( $json_result = Customers::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
/*
* information for moving customer
*/
$available_admins_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_ADMINS . "`
WHERE (`customers` = '-1' OR `customers` > `customers_used`)");
Database::pexecute($available_admins_stmt);
$admin_select = \Froxlor\UI\HTML::makeoption("-----", 0, true, true, true);
$admin_select_cnt = 0;
while ($available_admin = $available_admins_stmt->fetch()) {
$admin_select .= \Froxlor\UI\HTML::makeoption($available_admin['name'] . " (" . $available_admin['loginname'] . ")", $available_admin['adminid'], null, true, true);
$admin_select_cnt ++;
}
/*
* end of moving customer stuff
*/
if ($result['loginname'] != '') { if ($result['loginname'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { try {
Customers::getLocal($userinfo, $_POST)->update(); Customers::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
$language_options = '';
foreach ($languages as $language_file => $language_name) {
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $result['def_language'], true);
}
$dec_places = Settings::Get('panel.decimal_places'); $dec_places = Settings::Get('panel.decimal_places');
$result['traffic'] = round($result['traffic'] / (1024 * 1024), $dec_places); $result['traffic'] = round($result['traffic'] / (1024 * 1024), $dec_places);
$result['diskspace'] = round($result['diskspace'] / 1024, $dec_places); $result['diskspace'] = round($result['diskspace'] / 1024, $dec_places);
$result['email'] = $idna_convert->decode($result['email']); $result['email'] = $idna_convert->decode($result['email']);
$diskspace_ul = \Froxlor\UI\HTML::makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, $result['diskspace'], true, true); $result = PhpHelper::htmlentitiesArray($result);
if ($result['diskspace'] == '-1') {
$result['diskspace'] = ''; $mysql_servers = [];
try {
$result_json = MysqlServer::getLocal($userinfo)->listing();
$result_decoded = json_decode($result_json, true)['data']['list'];
foreach ($result_decoded as $dbserver => $dbdata) {
$mysql_servers[] = [
'label' => $dbdata['caption'],
'value' => $dbserver
];
}
} catch (Exception $e) {
/* just none */
} }
$traffic_ul = \Froxlor\UI\HTML::makecheckbox('traffic_ul', $lng['customer']['unlimited'], '-1', false, $result['traffic'], true, true); $phpconfigs = [];
if ($result['traffic'] == '-1') {
$result['traffic'] = '';
}
$subdomains_ul = \Froxlor\UI\HTML::makecheckbox('subdomains_ul', $lng['customer']['unlimited'], '-1', false, $result['subdomains'], true, true);
if ($result['subdomains'] == '-1') {
$result['subdomains'] = '';
}
$emails_ul = \Froxlor\UI\HTML::makecheckbox('emails_ul', $lng['customer']['unlimited'], '-1', false, $result['emails'], true, true);
if ($result['emails'] == '-1') {
$result['emails'] = '';
}
$email_accounts_ul = \Froxlor\UI\HTML::makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, $result['email_accounts'], true, true);
if ($result['email_accounts'] == '-1') {
$result['email_accounts'] = '';
}
$email_forwarders_ul = \Froxlor\UI\HTML::makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, $result['email_forwarders'], true, true);
if ($result['email_forwarders'] == '-1') {
$result['email_forwarders'] = '';
}
$email_quota_ul = \Froxlor\UI\HTML::makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, $result['email_quota'], true, true);
if ($result['email_quota'] == '-1') {
$result['email_quota'] = '';
}
$ftps_ul = \Froxlor\UI\HTML::makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, $result['ftps'], true, true);
if ($result['ftps'] == '-1') {
$result['ftps'] = '';
}
$mysqls_ul = \Froxlor\UI\HTML::makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, $result['mysqls'], true, true);
if ($result['mysqls'] == '-1') {
$result['mysqls'] = '';
}
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
$gender_options = \Froxlor\UI\HTML::makeoption($lng['gender']['undef'], 0, ($result['gender'] == '0' ? true : false), true, true);
$gender_options .= \Froxlor\UI\HTML::makeoption($lng['gender']['male'], 1, ($result['gender'] == '1' ? true : false), true, true);
$gender_options .= \Froxlor\UI\HTML::makeoption($lng['gender']['female'], 2, ($result['gender'] == '2' ? true : false), true, true);
$phpconfigs = array();
$configs = Database::query(" $configs = Database::query("
SELECT c.*, fc.description as interpreter SELECT c.*, fc.description as interpreter
FROM `" . TABLE_PANEL_PHPCONFIGS . "` c FROM `" . TABLE_PANEL_PHPCONFIGS . "` c
LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fc ON fc.id = c.fpmsettingid LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fc ON fc.id = c.fpmsettingid
"); ");
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) { while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
if ((int) Settings::Get('phpfpm.enabled') == 1) { if ((int)Settings::Get('phpfpm.enabled') == 1) {
$phpconfigs[] = array( $phpconfigs[] = [
'label' => $row['description'] . " [" . $row['interpreter'] . "]<br />", 'label' => $row['description'] . " [" . $row['interpreter'] . "]",
'value' => $row['id'] 'value' => $row['id']
); ];
} else { } else {
$phpconfigs[] = array( $phpconfigs[] = [
'label' => $row['description'] . "<br />", 'label' => $row['description'],
'value' => $row['id'] 'value' => $row['id']
); ];
} }
} }
// hosting plans // hosting plans
$hosting_plans = "";
$plans = Database::query(" $plans = Database::query("
SELECT * SELECT *
FROM `" . TABLE_PANEL_PLANS . "` FROM `" . TABLE_PANEL_PLANS . "`
ORDER BY name ASC ORDER BY name ASC
"); ");
if (Database::num_rows() > 0) { $hosting_plans = [
$hosting_plans .= \Froxlor\UI\HTML::makeoption("---", 0, 0, true, true); 0 => "---"
} ];
while ($row = $plans->fetch(PDO::FETCH_ASSOC)) { while ($row = $plans->fetch(PDO::FETCH_ASSOC)) {
$hosting_plans .= \Froxlor\UI\HTML::makeoption($row['name'], $row['id'], 0, true, true); $hosting_plans[$row['id']] = $row['name'];
}
$available_admins_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_ADMINS . "`
WHERE (`customers` = '-1' OR `customers` > `customers_used`)
AND adminid <> :currentadmin
");
Database::pexecute($available_admins_stmt, ['currentadmin' => $result['adminid']]);
$admin_select = [
0 => "---"
];
while ($available_admin = $available_admins_stmt->fetch()) {
$admin_select[$available_admin['adminid']] = $available_admin['name'] . " (" . $available_admin['loginname'] . ")";
} }
$customer_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_edit.php'; $customer_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_edit.php';
$customer_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($customer_edit_data);
$title = $customer_edit_data['customer_edit']['title']; UI::view('user/form.html.twig', [
$image = $customer_edit_data['customer_edit']['image']; 'formaction' => $linker->getLink(['section' => 'customers', 'id' => $id]),
'formdata' => $customer_edit_data['customer_edit'],
eval("echo \"" . \Froxlor\UI\Template::getTemplate("customers/customers_edit") . "\";"); 'editid' => $id
]);
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -2,98 +2,119 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Panel
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'admin');
require './lib/init.php';
use Froxlor\Database\Database; const AREA = 'admin';
use Froxlor\Settings; require __DIR__ . '/lib/init.php';
use Froxlor\Api\Commands\Froxlor as Froxlor;
use Froxlor\Api\Commands\Admins as Admins; use Froxlor\Api\Commands\Admins as Admins;
use Froxlor\Api\Commands\Froxlor as Froxlor;
use Froxlor\CurrentUser;
use Froxlor\Database\Database;
use Froxlor\FroxlorLogger;
use Froxlor\Settings;
use Froxlor\System\Cronjob;
use Froxlor\System\Crypt;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
use Froxlor\Validate\Validate;
use Froxlor\Language;
$id = (int)Request::any('id');
if ($action == 'logout') { if ($action == 'logout') {
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "logged out");
unset($_SESSION['userinfo']);
CurrentUser::setData();
session_destroy();
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "logged out"); Response::redirectTo('index.php');
} elseif ($action == 'suback') {
$params = array( if (is_array(CurrentUser::getField('switched_user'))) {
'adminid' => (int) $userinfo['adminid'] $result = CurrentUser::getData();
); $result = $result['switched_user'];
CurrentUser::setData($result);
if (Settings::Get('session.allow_multiple_login') == '1') { $target = (isset($_GET['target']) ? $_GET['target'] : 'index');
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` $redirect = "admin_" . $target . ".php";
WHERE `userid` = :adminid if (!file_exists(\Froxlor\Froxlor::getInstallDir() . "/" . $redirect)) {
AND `adminsession` = '1' $redirect = "admin_index.php";
AND `hash` = :hash"); }
$params['hash'] = $s; Response::redirectTo($redirect, null, true);
} else { } else {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` Response::dynamicError("Cannot change back - You've never switched to another user :-)");
WHERE `userid` = :adminid
AND `adminsession` = '1'");
} }
Database::pexecute($stmt, $params);
\Froxlor\UI\Response::redirectTo('index.php');
}
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
} }
if ($page == 'overview') { if ($page == 'overview') {
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_index");
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_index"); $params = [];
if ($userinfo['customers_see_all'] == '0') {
$params = [
'adminid' => $userinfo['adminid']
];
}
$overview_stmt = Database::prepare("SELECT COUNT(*) AS `number_customers`, $overview_stmt = Database::prepare("SELECT COUNT(*) AS `number_customers`,
SUM(case when `diskspace` > 0 then `diskspace` else 0 end) AS `diskspace_assigned`,
SUM(`diskspace_used`) AS `diskspace_used`, SUM(`diskspace_used`) AS `diskspace_used`,
SUM(case when `mysqls` > 0 then `mysqls` else 0 end) AS `mysqls_assigned`,
SUM(`mysqls_used`) AS `mysqls_used`, SUM(`mysqls_used`) AS `mysqls_used`,
SUM(case when `emails` > 0 then `emails` else 0 end) AS `emails_assigned`,
SUM(`emails_used`) AS `emails_used`, SUM(`emails_used`) AS `emails_used`,
SUM(case when `email_accounts` > 0 then `email_accounts` else 0 end) AS `email_accounts_assigned`,
SUM(`email_accounts_used`) AS `email_accounts_used`, SUM(`email_accounts_used`) AS `email_accounts_used`,
SUM(case when `email_forwarders` > 0 then `email_forwarders` else 0 end) AS `email_forwarders_assigned`,
SUM(`email_forwarders_used`) AS `email_forwarders_used`, SUM(`email_forwarders_used`) AS `email_forwarders_used`,
SUM(case when `email_quota` > 0 then `email_quota` else 0 end) AS `email_quota_assigned`,
SUM(`email_quota_used`) AS `email_quota_used`, SUM(`email_quota_used`) AS `email_quota_used`,
SUM(case when `ftps` > 0 then `ftps` else 0 end) AS `ftps_assigned`,
SUM(`ftps_used`) AS `ftps_used`, SUM(`ftps_used`) AS `ftps_used`,
SUM(case when `subdomains` > 0 then `subdomains` else 0 end) AS `subdomains_assigned`,
SUM(`subdomains_used`) AS `subdomains_used`, SUM(`subdomains_used`) AS `subdomains_used`,
SUM(case when `traffic` > 0 then `traffic` else 0 end) AS `traffic_assigned`,
SUM(`traffic_used`) AS `traffic_used` SUM(`traffic_used`) AS `traffic_used`
FROM `" . TABLE_PANEL_CUSTOMERS . "`" . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = :adminid ")); FROM `" . TABLE_PANEL_CUSTOMERS . "`" . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = :adminid "));
$overview = Database::pexecute_first($overview_stmt, array( $overview = Database::pexecute_first($overview_stmt, $params);
'adminid' => $userinfo['adminid']
));
$dec_places = Settings::Get('panel.decimal_places'); $userinfo['diskspace_bytes'] = ($userinfo['diskspace'] > -1) ? $userinfo['diskspace'] * 1024 : -1;
$overview['traffic_used'] = round($overview['traffic_used'] / (1024 * 1024), $dec_places); $overview['diskspace_bytes'] = $overview['diskspace_assigned'] * 1024;
$overview['diskspace_used'] = round($overview['diskspace_used'] / 1024, $dec_places); $overview['diskspace_bytes_used'] = $overview['diskspace_used'] * 1024;
$userinfo['traffic_bytes'] = ($userinfo['traffic'] > -1) ? $userinfo['traffic'] * 1024 : -1;
$overview['traffic_bytes'] = $overview['traffic_assigned'] * 1024;
$overview['traffic_bytes_used'] = $overview['traffic_used'] * 1024;
$number_domains_stmt = Database::prepare(" $number_domains_stmt = Database::prepare("
SELECT COUNT(*) AS `number_domains` FROM `" . TABLE_PANEL_DOMAINS . "` SELECT COUNT(*) AS `number_domains` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `parentdomainid`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :adminid")); WHERE `parentdomainid`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :adminid"));
$number_domains = Database::pexecute_first($number_domains_stmt, array( $number_domains = Database::pexecute_first($number_domains_stmt, $params);
'adminid' => $userinfo['adminid']
));
$overview['number_domains'] = $number_domains['number_domains']; $overview['number_domains'] = $number_domains['number_domains'];
$phpversion = phpversion();
$mysqlserverversion = Database::getAttribute(PDO::ATTR_SERVER_VERSION);
$webserverinterface = strtoupper(@php_sapi_name());
if ((isset($_GET['lookfornewversion']) && $_GET['lookfornewversion'] == 'yes') || (isset($lookfornewversion) && $lookfornewversion == 'yes')) { if ((isset($_GET['lookfornewversion']) && $_GET['lookfornewversion'] == 'yes') || (isset($lookfornewversion) && $lookfornewversion == 'yes')) {
try { try {
$json_result = Froxlor::getLocal($userinfo)->checkUpdate(); $json_result = Froxlor::getLocal($userinfo)->checkUpdate();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
@@ -103,29 +124,20 @@ if ($page == 'overview') {
$lookfornewversion_addinfo = $result['additional_info']; $lookfornewversion_addinfo = $result['additional_info'];
$isnewerversion = $result['isnewerversion']; $isnewerversion = $result['isnewerversion'];
} else { } else {
$lookfornewversion_lable = $lng['admin']['lookfornewversion']['clickhere']; $lookfornewversion_lable = lng('admin.lookfornewversion.clickhere');
$lookfornewversion_link = htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes'); $lookfornewversion_link = htmlspecialchars($filename . '?page=' . urlencode($page) . '&lookfornewversion=yes');
$lookfornewversion_message = ''; $lookfornewversion_message = '';
$lookfornewversion_addinfo = ''; $lookfornewversion_addinfo = '';
$isnewerversion = 0; $isnewerversion = 0;
} }
$dec_places = Settings::Get('panel.decimal_places'); $cron_last_runs = Cronjob::getCronjobsLastRun();
$userinfo['diskspace'] = round($userinfo['diskspace'] / 1024, $dec_places); $outstanding_tasks = Cronjob::getOutstandingTasks();
$userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, $dec_places);
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $dec_places);
$userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), $dec_places);
$userinfo = \Froxlor\PhpHelper::strReplaceArray('-1', $lng['customer']['unlimited'], $userinfo, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps subdomains');
$userinfo['custom_notes'] = ($userinfo['custom_notes'] != '') ? nl2br($userinfo['custom_notes']) : ''; // additional sys-infos
$cron_last_runs = \Froxlor\System\Cronjob::getCronjobsLastRun();
$outstanding_tasks = \Froxlor\System\Cronjob::getOutstandingTasks();
$system_hostname = gethostname();
$meminfo = explode("\n", @file_get_contents("/proc/meminfo")); $meminfo = explode("\n", @file_get_contents("/proc/meminfo"));
$memory = ""; $memory = "";
for ($i = 0; $i < sizeof($meminfo); ++ $i) { for ($i = 0; $i < count($meminfo); ++$i) {
if (substr($meminfo[$i], 0, 3) === "Mem") { if (substr($meminfo[$i], 0, 3) === "Mem") {
$memory .= $meminfo[$i] . PHP_EOL; $memory .= $meminfo[$i] . PHP_EOL;
} }
@@ -136,25 +148,21 @@ if ($page == 'overview') {
$load = number_format($loadArray[0], 2, '.', '') . " / " . number_format($loadArray[1], 2, '.', '') . " / " . number_format($loadArray[2], 2, '.', ''); $load = number_format($loadArray[0], 2, '.', '') . " / " . number_format($loadArray[1], 2, '.', '') . " / " . number_format($loadArray[2], 2, '.', '');
} else { } else {
$load = @file_get_contents('/proc/loadavg'); $load = @file_get_contents('/proc/loadavg');
if (!$load) {
if (! $load) { $load = lng('admin.noloadavailable');
$load = $lng['admin']['noloadavailable'];
} }
} }
$kernel = '';
if (function_exists('posix_uname')) { if (function_exists('posix_uname')) {
$showkernel = 1;
$kernel_nfo = posix_uname(); $kernel_nfo = posix_uname();
$kernel = $kernel_nfo['release'] . ' (' . $kernel_nfo['machine'] . ')'; $kernel = $kernel_nfo['release'] . ' (' . $kernel_nfo['machine'] . ')';
} else {
$showkernel = 0;
$kernel = '';
} }
// Try to get the uptime // Try to get the uptime
// First: With exec (let's hope it's enabled for the Froxlor - vHost) // First: With exec (let's hope it's enabled for the Froxlor - vHost)
$uptime_array = explode(" ", @file_get_contents("/proc/uptime")); $uptime_array = explode(" ", @file_get_contents("/proc/uptime"));
$uptime = '';
if (is_array($uptime_array) && isset($uptime_array[0]) && is_numeric($uptime_array[0])) { if (is_array($uptime_array) && isset($uptime_array[0]) && is_numeric($uptime_array[0])) {
// Some calculatioon to get a nicly formatted display // Some calculatioon to get a nicly formatted display
$seconds = round($uptime_array[0], 0); $seconds = round($uptime_array[0], 0);
@@ -165,230 +173,136 @@ if ($page == 'overview') {
$minutes = floor($minutes - ($days * 24 * 60) - ($hours * 60)); $minutes = floor($minutes - ($days * 24 * 60) - ($hours * 60));
$seconds = floor($seconds - ($days * 24 * 60 * 60) - ($hours * 60 * 60) - ($minutes * 60)); $seconds = floor($seconds - ($days * 24 * 60 * 60) - ($hours * 60 * 60) - ($minutes * 60));
$uptime = "{$days}d, {$hours}h, {$minutes}m, {$seconds}s"; $uptime = "{$days}d, {$hours}h, {$minutes}m, {$seconds}s";
// Just cleanup // Just cleanup
unset($uptime_array, $seconds, $minutes, $hours, $days); unset($uptime_array, $seconds, $minutes, $hours, $days);
} else {
// Nothing of the above worked, show an error :/
$uptime = '';
} }
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/index") . "\";"); $sysinfo = [
'webserver' => $_SERVER['SERVER_SOFTWARE'] ?? 'unknown',
'phpversion' => phpversion(),
'mysqlserverversion' => Database::getAttribute(PDO::ATTR_SERVER_VERSION),
'phpsapi' => strtoupper(@php_sapi_name()),
'hostname' => gethostname(),
'memory' => $memory,
'load' => $load,
'kernel' => $kernel,
'uptime' => $uptime
];
UI::twig()->addGlobal('userinfo', $userinfo);
UI::view('user/index.html.twig', [
'sysinfo' => $sysinfo,
'overview' => $overview,
'outstanding_tasks' => $outstanding_tasks,
'cron_last_runs' => $cron_last_runs
]);
} elseif ($page == 'change_password') { } elseif ($page == 'change_password') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$old_password = \Froxlor\Validate\Validate::validate($_POST['old_password'], 'old password'); $old_password = Validate::validate($_POST['old_password'], 'old password');
if (! \Froxlor\System\Crypt::validatePasswordLogin($userinfo, $old_password, TABLE_PANEL_ADMINS, 'adminid')) { if (!Crypt::validatePasswordLogin($userinfo, $old_password, TABLE_PANEL_ADMINS, 'adminid')) {
\Froxlor\UI\Response::standard_error('oldpasswordnotcorrect'); Response::standardError('oldpasswordnotcorrect');
} }
$new_password = \Froxlor\Validate\Validate::validate($_POST['new_password'], 'new password'); try {
$new_password_confirm = \Froxlor\Validate\Validate::validate($_POST['new_password_confirm'], 'new password confirm'); $new_password = Crypt::validatePassword($_POST['new_password'], 'new password');
$new_password_confirm = Crypt::validatePassword($_POST['new_password_confirm'], 'new password confirm');
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
}
if ($old_password == '') { if ($old_password == '') {
\Froxlor\UI\Response::standard_error(array( Response::standardError([
'stringisempty', 'stringisempty',
'oldpassword' 'changepassword.old_password'
)); ]);
} elseif ($new_password == '') { } elseif ($new_password == '') {
\Froxlor\UI\Response::standard_error(array( Response::standardError([
'stringisempty', 'stringisempty',
'newpassword' 'changepassword.new_password'
)); ]);
} elseif ($new_password_confirm == '') { } elseif ($new_password_confirm == '') {
\Froxlor\UI\Response::standard_error(array( Response::standardError([
'stringisempty', 'stringisempty',
'newpasswordconfirm' 'changepassword.new_password_confirm'
)); ]);
} elseif ($new_password != $new_password_confirm) { } elseif ($new_password != $new_password_confirm) {
\Froxlor\UI\Response::standard_error('newpasswordconfirmerror'); Response::standardError('newpasswordconfirmerror');
} else { } else {
try { try {
Admins::getLocal($userinfo, array( Admins::getLocal($userinfo, [
'id' => $userinfo['adminid'], 'id' => $userinfo['adminid'],
'admin_password' => $new_password 'admin_password' => $new_password
))->update(); ])->update();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'changed password'); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'changed password');
\Froxlor\UI\Response::redirectTo($filename, Array( Response::redirectTo($filename);
's' => $s
));
} }
} else { } else {
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/change_password") . "\";"); UI::view('user/change_password.html.twig');
} }
} elseif ($page == 'change_language') { } elseif ($page == 'change_language') {
$languages = Language::getLanguages();
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$def_language = \Froxlor\Validate\Validate::validate($_POST['def_language'], 'default language'); $def_language = Validate::validate($_POST['def_language'], 'default language');
if (isset($languages[$def_language])) { if (isset($languages[$def_language])) {
try { try {
Admins::getLocal($userinfo, array( Admins::getLocal($userinfo, [
'id' => $userinfo['adminid'], 'id' => $userinfo['adminid'],
'def_language' => $def_language 'def_language' => $def_language
))->update(); ])->update();
CurrentUser::setField('language', $def_language);
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
// also update current session
$lng_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_SESSIONS . "`
SET `language`= :lng
WHERE `hash`= :hash");
Database::pexecute($lng_stmt, array(
'lng' => $def_language,
'hash' => $s
));
} }
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "changed his/her default language to '" . $def_language . "'"); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "changed his/her default language to '" . $def_language . "'");
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename);
's' => $s
));
} else { } else {
$language_options = '';
$default_lang = Settings::Get('panel.standardlanguage'); $default_lang = Settings::Get('panel.standardlanguage');
if ($userinfo['def_language'] != '') { if ($userinfo['def_language'] != '') {
$default_lang = $userinfo['def_language']; $default_lang = $userinfo['def_language'];
} }
foreach ($languages as $language_file => $language_name) { UI::view('user/change_language.html.twig', [
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $default_lang, true); 'languages' => $languages,
} 'default_lang' => $default_lang
]);
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/change_language") . "\";");
} }
} elseif ($page == 'change_theme') { } elseif ($page == 'change_theme') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$theme = \Froxlor\Validate\Validate::validate($_POST['theme'], 'theme'); $theme = Validate::validate($_POST['theme'], 'theme');
try { try {
Admins::getLocal($userinfo, array( Admins::getLocal($userinfo, [
'id' => $userinfo['adminid'], 'id' => $userinfo['adminid'],
'theme' => $theme 'theme' => $theme
))->update(); ])->update();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
// also update current session $log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "changed his/her theme to '" . $theme . "'");
$theme_stmt = Database::prepare(" Response::redirectTo($filename);
UPDATE `" . TABLE_PANEL_SESSIONS . "`
SET `theme`= :theme
WHERE `hash`= :hash");
Database::pexecute($theme_stmt, array(
'theme' => $theme,
'hash' => $s
));
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "changed his/her theme to '" . $theme . "'");
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} else { } else {
$theme_options = '';
$default_theme = Settings::Get('panel.default_theme'); $default_theme = Settings::Get('panel.default_theme');
if ($userinfo['theme'] != '') { if ($userinfo['theme'] != '') {
$default_theme = $userinfo['theme']; $default_theme = $userinfo['theme'];
} }
$themes_avail = \Froxlor\UI\Template::getThemes(); $themes_avail = UI::getThemes();
foreach ($themes_avail as $t => $d) {
$theme_options .= \Froxlor\UI\HTML::makeoption($d, $t, $default_theme, true);
}
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/change_theme") . "\";"); UI::view('user/change_theme.html.twig', [
'themes' => $themes_avail,
'default_theme' => $default_theme
]);
} }
} elseif ($page == 'send_error_report' && Settings::Get('system.allow_error_report_admin') == '1') { } elseif ($page == 'send_error_report' && Settings::Get('system.allow_error_report_admin') == '1') {
require_once __DIR__ . '/error_report.php';
// only show this if we really have an exception to report
if (isset($_GET['errorid']) && $_GET['errorid'] != '') {
$errid = $_GET['errorid'];
// read error file
$err_dir = \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir() . "/logs/");
$err_file = \Froxlor\FileDir::makeCorrectFile($err_dir . "/" . $errid . "_sql-error.log");
if (file_exists($err_file)) {
$error_content = file_get_contents($err_file);
$error = explode("|", $error_content);
$_error = array(
'code' => str_replace("\n", "", substr($error[1], 5)),
'message' => str_replace("\n", "", substr($error[2], 4)),
'file' => str_replace("\n", "", substr($error[3], 5 + strlen(\Froxlor\Froxlor::getInstallDir()))),
'line' => str_replace("\n", "", substr($error[4], 5)),
'trace' => str_replace(\Froxlor\Froxlor::getInstallDir(), "", substr($error[5], 6))
);
// build mail-content
$mail_body = "Dear froxlor-team,\n\n";
$mail_body .= "the following error has been reported by a user:\n\n";
$mail_body .= "-------------------------------------------------------------\n";
$mail_body .= $_error['code'] . ' ' . $_error['message'] . "\n\n";
$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";
$mail_body .= "DB-version: " . $dbversion . "\n\n";
$mail_body .= "End of report";
$mail_html = nl2br($mail_body);
// send actual report to dev-team
if (isset($_POST['send']) && $_POST['send'] == 'send') {
// send mail and say thanks
$_mailerror = false;
try {
$mail->Subject = '[Froxlor] Error report by user';
$mail->AltBody = $mail_body;
$mail->MsgHTML($mail_html);
$mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team');
$mail->Send();
} catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
$mailerr_msg = $e->getMessage();
$_mailerror = true;
}
if ($_mailerror) {
// error when reporting an error...LOLFUQ
\Froxlor\UI\Response::standard_error('send_report_error', $mailerr_msg);
}
// finally remove error from fs
@unlink($err_file);
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
}
// show a nice summary of the error-report
// before actually sending anything
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/send_error_report") . "\";");
} else {
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
}
} else {
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
}
} elseif ($page == 'apikeys' && Settings::Get('api.enabled') == 1) { } elseif ($page == 'apikeys' && Settings::Get('api.enabled') == 1) {
require_once __DIR__ . '/api_keys.php'; require_once __DIR__ . '/api_keys.php';
} elseif ($page == 'apihelp' && Settings::Get('api.enabled') == 1) {
require_once __DIR__ . '/apihelp.php';
} elseif ($page == '2fa' && Settings::Get('2fa.enabled') == 1) { } elseif ($page == '2fa' && Settings::Get('2fa.enabled') == 1) {
require_once __DIR__ . '/2fa.php'; require_once __DIR__ . '/2fa.php';
} }

View File

@@ -2,103 +2,92 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Panel
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'admin');
require './lib/init.php';
use Froxlor\Database\Database; const AREA = 'admin';
use Froxlor\Settings; require __DIR__ . '/lib/init.php';
use Froxlor\Api\Commands\IpsAndPorts as IpsAndPorts;
if (isset($_POST['id'])) { use Froxlor\Api\Commands\IpsAndPorts;
$id = intval($_POST['id']); use Froxlor\FroxlorLogger;
} elseif (isset($_GET['id'])) { use Froxlor\PhpHelper;
$id = intval($_GET['id']); use Froxlor\UI\Collection;
} use Froxlor\UI\HTML;
use Froxlor\UI\Listing;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
if ($page == 'ipsandports' || $page == 'overview') { $id = (int)Request::any('id');
// 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 (($page == 'ipsandports' || $page == 'overview') && $userinfo['change_serversettings'] == '1') {
if ($action == '') { if ($action == '') {
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_ipsandports");
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_ipsandports"); try {
$fields = array( $ipsandports_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.ipsandports.php';
'ip' => $lng['admin']['ipsandports']['ip'], $collection = (new Collection(IpsAndPorts::class, $userinfo))
'port' => $lng['admin']['ipsandports']['port'] ->withPagination($ipsandports_list_data['ipsandports_list']['columns'], $ipsandports_list_data['ipsandports_list']['default_sorting']);
); } catch (Exception $e) {
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_IPSANDPORTS, $fields); Response::dynamicError($e->getMessage());
$ipsandports = ''; }
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` " . $paging->getSqlWhere(false) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
Database::pexecute($result_stmt);
$paging->setEntries(Database::num_rows());
$sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$i = 0;
$count = 0;
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { UI::view('user/table.html.twig', [
'listing' => Listing::format($collection, $ipsandports_list_data, 'ipsandports_list'),
if ($paging->checkDisplay($i)) { 'actions_links' => [
$row = \Froxlor\PhpHelper::htmlentitiesArray($row); [
if (filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { 'href' => $linker->getLink(['section' => 'ipsandports', 'page' => $page, 'action' => 'add']),
$row['ip'] = '[' . $row['ip'] . ']'; 'label' => lng('admin.ipsandports.add')
} ]
eval("\$ipsandports.=\"" . \Froxlor\UI\Template::getTemplate("ipsandports/ipsandports_ipandport") . "\";"); ]
$count ++; ]);
}
$i ++;
}
eval("echo \"" . \Froxlor\UI\Template::getTemplate("ipsandports/ipsandports") . "\";");
} elseif ($action == 'delete' && $id != 0) { } elseif ($action == 'delete' && $id != 0) {
try { try {
$json_result = IpsAndPorts::getLocal($userinfo, array( $json_result = IpsAndPorts::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
if (isset($result['id']) && $result['id'] == $id) { if (isset($result['id']) && $result['id'] == $id) {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { try {
IpsAndPorts::getLocal($userinfo, array( IpsAndPorts::getLocal($userinfo, [
'id' => $id 'id' => $id
))->delete(); ])->delete();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
\Froxlor\UI\HTML::askYesNo('admin_ip_reallydelete', $filename, array( HTML::askYesNo('admin_ip_reallydelete', $filename, [
'id' => $id, 'id' => $id,
'page' => $page, 'page' => $page,
'action' => $action 'action' => $action
), $result['ip'] . ':' . $result['port']); ], $result['ip'] . ':' . $result['port']);
} }
} }
} elseif ($action == 'add') { } elseif ($action == 'add') {
@@ -106,56 +95,59 @@ if ($page == 'ipsandports' || $page == 'overview') {
try { try {
IpsAndPorts::getLocal($userinfo, $_POST)->add(); IpsAndPorts::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
$ipsandports_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/ipsandports/formfield.ipsandports_add.php'; $ipsandports_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/ipsandports/formfield.ipsandports_add.php';
$ipsandports_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($ipsandports_add_data);
$title = $ipsandports_add_data['ipsandports_add']['title']; UI::view('user/form.html.twig', [
$image = $ipsandports_add_data['ipsandports_add']['image']; 'formaction' => $linker->getLink(['section' => 'ipsandports']),
'formdata' => $ipsandports_add_data['ipsandports_add']
eval("echo \"" . \Froxlor\UI\Template::getTemplate("ipsandports/ipsandports_add") . "\";"); ]);
} }
} elseif ($action == 'edit' && $id != 0) { } elseif ($action == 'edit' && $id != 0) {
try { try {
$json_result = IpsAndPorts::getLocal($userinfo, array( $json_result = IpsAndPorts::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
if ($result['ip'] != '') { if ($result['ip'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { try {
IpsAndPorts::getLocal($userinfo, $_POST)->update(); IpsAndPorts::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
$result = PhpHelper::htmlentitiesArray($result);
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
$ipsandports_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/ipsandports/formfield.ipsandports_edit.php'; $ipsandports_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/ipsandports/formfield.ipsandports_edit.php';
$ipsandports_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($ipsandports_edit_data);
$title = $ipsandports_edit_data['ipsandports_edit']['title']; UI::view('user/form.html.twig', [
$image = $ipsandports_edit_data['ipsandports_edit']['image']; 'formaction' => $linker->getLink(['section' => 'ipsandports', 'id' => $id]),
'formdata' => $ipsandports_edit_data['ipsandports_edit'],
eval("echo \"" . \Froxlor\UI\Template::getTemplate("ipsandports/ipsandports_edit") . "\";"); 'editid' => $id
]);
} }
} }
} elseif ($action == 'jqCheckIP') {
$ip = $_POST['ip'] ?? "";
if ((filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) || filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) && filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE | FILTER_FLAG_NO_PRIV_RANGE) == false) {
// returns notice if private network detected so we can display it
echo json_encode(lng('admin.ipsandports.ipnote'));
} else {
echo 0;
}
exit();
} }
} }

View File

@@ -2,130 +2,75 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Panel
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'admin');
require './lib/init.php';
use Froxlor\Database\Database; const AREA = 'admin';
require __DIR__ . '/lib/init.php';
use Froxlor\Api\Commands\SysLog;
use Froxlor\UI\Collection;
use Froxlor\UI\HTML;
use Froxlor\UI\Listing;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Response;
if ($page == 'log' && $userinfo['change_serversettings'] == '1') { if ($page == 'log' && $userinfo['change_serversettings'] == '1') {
if ($action == '') { if ($action == '') {
$fields = array( try {
'date' => $lng['logger']['date'], $syslog_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/tablelisting.syslog.php';
'type' => $lng['logger']['type'], $collection = (new Collection(SysLog::class, $userinfo))
'user' => $lng['logger']['user'], ->withPagination($syslog_list_data['syslog_list']['columns'], $syslog_list_data['syslog_list']['default_sorting']);
'text' => $lng['logger']['action'] } catch (Exception $e) {
); Response::dynamicError($e->getMessage());
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_LOG, $fields, null, null, 0, 'desc', 30);
$query = 'SELECT * FROM `' . TABLE_PANEL_LOG . '` ' . $paging->getSqlWhere(false) . ' ' . $paging->getSqlOrderBy();
$result_stmt = Database::query($query . ' ' . $paging->getSqlLimit());
$result_cnt_stmt = Database::query($query);
$logs_count = $result_cnt_stmt->rowCount();
$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') { UI::view('user/table.html.twig', [
krsort($clog); 'listing' => Listing::format($collection, $syslog_list_data, 'syslog_list'),
} else { 'actions_links' => [
ksort($clog); [
} 'href' => $linker->getLink(['section' => 'logger', 'page' => 'log', 'action' => 'truncate']),
'label' => lng('logger.truncate'),
$i = 0; 'icon' => 'fa-solid fa-recycle',
$count = 0; 'class' => 'btn-warning'
$log_count = 0; ]
$log = ''; ]
foreach ($clog as $action => $logrows) { ]);
$_action = 0;
foreach ($logrows as $row) {
// if ($paging->checkDisplay($i)) {
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
$row['date'] = date("d.m.y H:i:s", $row['date']);
if ($_action != $action) {
switch ($action) {
case \Froxlor\FroxlorLogger::USR_ACTION:
$_action = $lng['admin']['customer'];
break;
case \Froxlor\FroxlorLogger::RES_ACTION:
$_action = $lng['logger']['reseller'];
break;
case \Froxlor\FroxlorLogger::ADM_ACTION:
$_action = $lng['logger']['admin'];
break;
case \Froxlor\FroxlorLogger::CRON_ACTION:
$_action = $lng['logger']['cron'];
break;
case \Froxlor\FroxlorLogger::LOGIN_ACTION:
$_action = $lng['logger']['login'];
break;
case \Froxlor\FroxlorLogger::LOG_ERROR:
$_action = $lng['logger']['intern'];
break;
default:
$_action = $lng['logger']['unknown'];
break;
}
$row['action'] = $_action;
eval("\$log.=\"" . \Froxlor\UI\Template::getTemplate('logger/logger_action') . "\";");
}
$log_count ++;
$row['type'] = \Froxlor\FroxlorLogger::getInstanceOf()->getLogLevelDesc($row['type']);
eval("\$log.=\"" . \Froxlor\UI\Template::getTemplate('logger/logger_log') . "\";");
$count ++;
$_action = $action;
// }
$i ++;
}
$i ++;
}
eval("echo \"" . \Froxlor\UI\Template::getTemplate('logger/logger') . "\";");
} elseif ($action == 'truncate') { } elseif ($action == 'truncate') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$truncatedate = time() - (60 * 10); try {
$trunc_stmt = Database::prepare(" SysLog::getLocal($userinfo, [
DELETE FROM `" . TABLE_PANEL_LOG . "` WHERE `date` < :trunc"); 'min_to_keep' => 10
Database::pexecute($trunc_stmt, array( ])->delete();
'trunc' => $truncatedate } catch (Exception $e) {
)); Response::dynamicError($e->getMessage());
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, 'truncated the system-log (mysql)'); }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
\Froxlor\UI\HTML::askYesNo('logger_reallytruncate', $filename, array( HTML::askYesNo('logger_reallytruncate', $filename, [
'page' => $page, 'page' => $page,
'action' => $action 'action' => $action
), TABLE_PANEL_LOG); ], TABLE_PANEL_LOG);
} }
} }
} }

View File

@@ -2,126 +2,149 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Panel
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'admin');
require './lib/init.php'; const AREA = 'admin';
require __DIR__ . '/lib/init.php';
use Froxlor\Database\Database; use Froxlor\Database\Database;
use Froxlor\FroxlorLogger;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
use Froxlor\User;
if (isset($_POST['id'])) { $id = (int)Request::any('id');
$id = intval($_POST['id']);
} elseif (isset($_GET['id'])) { $note_type = null;
$id = intval($_GET['id']); $note_msg = null;
}
if ($page == 'message') { if ($page == 'message') {
if ($action == '') { if ($action == '') {
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'viewed panel_message'); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'viewed panel_message');
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
if ($_POST['receipient'] == 0 && $userinfo['customers_see_all'] == '1') { if ($_POST['recipient'] == 0 && $userinfo['customers_see_all'] == '1') {
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'sending messages to admins'); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'sending messages to admins');
$result = Database::query('SELECT `name`, `email` FROM `' . TABLE_PANEL_ADMINS . "`"); $result = Database::query('SELECT `name`, `email` FROM `' . TABLE_PANEL_ADMINS . "`");
} elseif ($_POST['receipient'] == 1) { } elseif ($_POST['recipient'] == 1) {
if ($userinfo['customers_see_all'] == '1') { if ($userinfo['customers_see_all'] == '1') {
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'sending messages to ALL customers'); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'sending messages to ALL customers');
$result = Database::query('SELECT `firstname`, `name`, `company`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "`"); $result = Database::query('SELECT `firstname`, `name`, `company`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "`");
} else { } else {
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'sending messages to customers'); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'sending messages to customers');
$result = Database::prepare(' $result = Database::prepare('
SELECT `firstname`, `name`, `company`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "` SELECT `firstname`, `name`, `company`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "`
WHERE `adminid` = :adminid"); WHERE `adminid` = :adminid");
Database::pexecute($result, array( Database::pexecute($result, [
'adminid' => $userinfo['adminid'] 'adminid' => $userinfo['adminid']
)); ]);
} }
} else { } else {
\Froxlor\UI\Response::standard_error('noreceipientsgiven'); Response::standardError('norecipientsgiven');
} }
$subject = $_POST['subject']; $subject = $_POST['subject'];
$message = wordwrap($_POST['message'], 70); $message = wordwrap($_POST['message'], 70);
if (! empty($message)) { if (!empty($message)) {
$mailcounter = 0; $mailcounter = 0;
$mail->Body = $message; $mail->Body = $message;
$mail->Subject = $subject; $mail->Subject = $subject;
while ($row = $result->fetch(PDO::FETCH_ASSOC)) { while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$row['firstname'] = isset($row['firstname']) ? $row['firstname'] : ''; $row['firstname'] = isset($row['firstname']) ? $row['firstname'] : '';
$row['company'] = isset($row['company']) ? $row['company'] : ''; $row['company'] = isset($row['company']) ? $row['company'] : '';
$mail->AddAddress($row['email'], \Froxlor\User::getCorrectUserSalutation(array( $mail->AddAddress($row['email'], User::getCorrectUserSalutation([
'firstname' => $row['firstname'], 'firstname' => $row['firstname'],
'name' => $row['name'], 'name' => $row['name'],
'company' => $row['company'] 'company' => $row['company']
))); ]));
$mail->From = $userinfo['email']; $mail->From = $userinfo['email'];
$mail->FromName = (isset($userinfo['firstname']) ? $userinfo['firstname'] . ' ' : '') . $userinfo['name']; $mail->FromName = (isset($userinfo['firstname']) ? $userinfo['firstname'] . ' ' : '') . $userinfo['name'];
if (! $mail->Send()) { if (!$mail->Send()) {
if ($mail->ErrorInfo != '') { if ($mail->ErrorInfo != '') {
$mailerr_msg = $mail->ErrorInfo; $mailerr_msg = $mail->ErrorInfo;
} else { } else {
$mailerr_msg = $row['email']; $mailerr_msg = $row['email'];
} }
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_ERR, 'Error sending mail: ' . $mailerr_msg); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_ERR, 'Error sending mail: ' . $mailerr_msg);
\Froxlor\UI\Response::standard_error('errorsendingmail', $row['email']); Response::standardError('errorsendingmail', $row['email']);
} }
$mailcounter ++; $mailcounter++;
$mail->ClearAddresses(); $mail->ClearAddresses();
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page,
's' => $s,
'action' => 'showsuccess', 'action' => 'showsuccess',
'sentitems' => $mailcounter 'sentitems' => $mailcounter
)); ]);
} else { } else {
\Froxlor\UI\Response::standard_error('nomessagetosend'); Response::standardError('nomessagetosend');
} }
} }
} } elseif ($action == 'showsuccess') {
$sentitems = isset($_GET['sentitems']) ? (int)$_GET['sentitems'] : 0;
if ($action == 'showsuccess') {
$success = 1;
$sentitems = isset($_GET['sentitems']) ? (int) $_GET['sentitems'] : 0;
if ($sentitems == 0) { if ($sentitems == 0) {
$successmessage = $lng['message']['noreceipients']; $note_type = 'info';
$note_msg = lng('message.norecipients');
} else { } else {
$successmessage = str_replace('%s', $sentitems, $lng['message']['success']); $note_type = 'success';
$note_msg = str_replace('%s', $sentitems, lng('message.success'));
} }
} else {
$success = 0;
$sentitems = 0;
$successmessage = '';
} }
$action = ''; $recipients = [];
$receipients = '';
if ($userinfo['customers_see_all'] == '1') { if ($userinfo['customers_see_all'] == '1') {
$receipients .= \Froxlor\UI\HTML::makeoption($lng['panel']['reseller'], 0); $recipients[0] = lng('panel.reseller');
} }
$recipients[1] = lng('panel.customer');
$receipients .= \Froxlor\UI\HTML::makeoption($lng['panel']['customer'], 1); $messages_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/messages/formfield.messages_add.php';
eval("echo \"" . \Froxlor\UI\Template::getTemplate('message/message') . "\";");
UI::view('user/form-note.html.twig', [
'formaction' => $linker->getLink(['section' => 'message']),
'formdata' => $messages_add_data['messages_add'],
'actions_links' => [
[
'href' => $linker->getLink([
'section' => 'settings',
'page' => 'overview',
'part' => 'system',
'em' => 'system_mail_use_smtp'
]),
'label' => lng('admin.smtpsettings'),
'icon' => 'fa-solid fa-gears',
'class' => 'btn-outline-secondary'
]
],
// alert-box
'type' => $note_type,
'alert_msg' => $note_msg
]);
} }

144
admin_mysqlserver.php Normal file
View File

@@ -0,0 +1,144 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/
const AREA = 'admin';
require __DIR__ . '/lib/init.php';
use Froxlor\Api\Commands\MysqlServer;
use Froxlor\FroxlorLogger;
use Froxlor\PhpHelper;
use Froxlor\UI\Collection;
use Froxlor\UI\HTML;
use Froxlor\UI\Listing;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
$id = (int)Request::any('id');
if (($page == 'mysqlserver' || $page == 'overview') && $userinfo['change_serversettings'] == '1') {
if ($action == '') {
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_mysqlserver");
try {
$mysqlserver_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.mysqlserver.php';
$collection = (new Collection(MysqlServer::class, $userinfo))
->withPagination($mysqlserver_list_data['mysqlserver_list']['columns'], $mysqlserver_list_data['mysqlserver_list']['default_sorting']);
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
}
UI::view('user/table.html.twig', [
'listing' => Listing::format($collection, $mysqlserver_list_data, 'mysqlserver_list'),
'actions_links' => [
[
'href' => $linker->getLink(['section' => 'mysqlserver', 'page' => $page, 'action' => 'add']),
'label' => lng('admin.mysqlserver.add')
]
]
]);
} elseif ($action == 'delete' && $id != 0) {
try {
$json_result = MysqlServer::getLocal($userinfo, [
'id' => $id
])->get();
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if (isset($result['id']) && $result['id'] == $id) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
MysqlServer::getLocal($userinfo, [
'id' => $id
])->delete();
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
}
Response::redirectTo($filename, [
'page' => $page
]);
} else {
HTML::askYesNo('admin_mysqlserver_reallydelete', $filename, [
'id' => $id,
'page' => $page,
'action' => $action
], $result['caption'] . ' (' . $result['host'] . ')');
}
}
} elseif ($action == 'add') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
MysqlServer::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
}
Response::redirectTo($filename, [
'page' => $page
]);
} else {
$mysqlserver_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/mysqlserver/formfield.mysqlserver_add.php';
UI::view('user/form.html.twig', [
'formaction' => $linker->getLink(['section' => 'mysqlserver']),
'formdata' => $mysqlserver_add_data['mysqlserver_add']
]);
}
} elseif ($action == 'edit' && $id >= 0) {
try {
$json_result = MysqlServer::getLocal($userinfo, [
'id' => $id
])->get();
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if (isset($result['id']) && $result['id'] == $id) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
MysqlServer::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
}
Response::redirectTo($filename, [
'page' => $page
]);
} else {
$result = PhpHelper::htmlentitiesArray($result);
$mysqlserver_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/mysqlserver/formfield.mysqlserver_edit.php';
UI::view('user/form.html.twig', [
'formaction' => $linker->getLink(['section' => 'mysqlserver', 'id' => $id]),
'formdata' => $mysqlserver_edit_data['mysqlserver_edit'],
'editid' => $id
]);
}
}
}
}

View File

@@ -4,153 +4,305 @@
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Janos Muzsi <muzsij@hypernics.hu> (2016) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Panel
* *
* Based on https://github.com/amnuts/opcache-gui * You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
* *
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @author Janos Muzsi <muzsij@hypernics.hu>
* @author Andrew Collington <andy@amnuts.com>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*
* Based on https://github.com/amnuts/opcache-gui, which is
* licensed under the MIT licence, which can be viewed
* online at https://acollington.mit-license.org/
*/ */
define('AREA', 'admin');
require './lib/init.php'; const AREA = 'admin';
require __DIR__ . '/lib/init.php';
use Froxlor\FroxlorLogger;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Response;
use Froxlor\UI\HTML;
if ($action == 'reset' && function_exists('opcache_reset') && $userinfo['change_serversettings'] == '1') { if ($action == 'reset' && function_exists('opcache_reset') && $userinfo['change_serversettings'] == '1') {
if ($_POST['send'] == 'send') {
opcache_reset(); opcache_reset();
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "reseted OPcache"); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_INFO, "reset OPcache");
header('Location: ' . $linker->getLink(array( header('Location: ' . $linker->getLink([
'section' => 'opcacheinfo', 'section' => 'opcacheinfo',
'page' => 'showinfo' 'page' => 'showinfo'
))); ]));
exit(); exit();
} else {
HTML::askYesNo('cache_reallydelete', $filename, [
'page' => $page,
'action' => 'reset',
], '', [
'section' => 'opcacheinfo',
'page' => 'showinfo'
]);
}
} }
if (! function_exists('opcache_get_configuration')) { if (!function_exists('opcache_get_configuration')) {
\Froxlor\UI\Response::standard_error($lng['error']['no_opcacheinfo']); Response::standardError(lng('error.no_opcacheinfo'));
} }
if ($page == 'showinfo') { if ($page == 'showinfo' && $userinfo['change_serversettings'] == '1') {
$opcache_info = opcache_get_configuration();
$opcache_status = opcache_get_status(false);
$time = time(); $time = time();
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed OPcache info"); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed OPcache info");
$runtimelines = ''; $optimizationLevels = [
if (isset($opcache_info['directives']) && is_array($opcache_info['directives'])) { 1 << 0 => 'CSE, STRING construction',
foreach ($opcache_info['directives'] as $name => $value) { 1 << 1 => 'Constant conversion and jumps',
$linkname = str_replace('_', '-', $name); 1 << 2 => '++, +=, series of jumps',
if ($name == 'opcache.optimization_level' && is_integer($value)) { 1 << 3 => 'INIT_FCALL_BY_NAME -> DO_FCALL',
$value = '0x' . dechex($value); 1 << 4 => 'CFG based optimization',
} 1 << 5 => 'DFA based optimization',
if ($name == 'opcache.memory_consumption' && is_integer($value) && $value % (1024 * 1024) == 0) { 1 << 6 => 'CALL GRAPH optimization',
$value = $value / (1024 * 1024); 1 << 7 => 'SCCP (constant propagation)',
} 1 << 8 => 'TMP VAR usage',
if ($value === null || $value === '') { 1 << 9 => 'NOP removal',
$value = $lng['opcacheinfo']['novalue']; 1 << 10 => 'Merge equal constants',
} 1 << 11 => 'Adjust used stack',
if ($value === true) { 1 << 12 => 'Remove unused variables',
$value = $lng['opcacheinfo']['true']; 1 << 13 => 'DCE (dead code elimination)',
} 1 << 14 => '(unsafe) Collect constants',
if ($value === false) { 1 << 15 => 'Inline functions'
$value = $lng['opcacheinfo']['false']; ];
}
if (is_integer($value)) { $jitModes = [
$value = number_format($value, 0, '.', ' '); [
} 'flag' => 'CPU-specific optimization',
$name = str_replace('_', ' ', $name); 'value' => [
eval("\$runtimelines.=\"" . \Froxlor\UI\Template::getTemplate("settings/opcacheinfo/runtime_line") . "\";"); 'Disable CPU-specific optimization',
} 'Enable use of AVX, if the CPU supports it'
]
],
[
'flag' => 'Register allocation',
'value' => [
'Do not perform register allocation',
'Perform block-local register allocation',
'Perform global register allocation'
]
],
[
'flag' => 'Trigger',
'value' => [
'Compile all functions on script load',
'Compile functions on first execution',
'Profile functions on first request and compile the hottest functions afterwards',
'Profile on the fly and compile hot functions',
'Currently unused',
'Use tracing JIT. Profile on the fly and compile traces for hot code segments'
]
],
[
'flag' => 'Optimization level',
'value' => [
'No JIT',
'Minimal JIT (call standard VM handlers)',
'Inline VM handlers',
'Use type inference',
'Use call graph',
'Optimize whole script'
]
]
];
$jitModeMapping = [
'tracing' => 1254,
'on' => 1254,
'function' => 1205
];
$status = opcache_get_status(false);
$config = opcache_get_configuration();
$missingConfig = array_diff_key(ini_get_all('zend opcache', false), $config['directives']);
if (!empty($missingConfig)) {
$config['directives'] = array_merge($config['directives'], $missingConfig);
} }
$cachehits = @$opcache_status['opcache_statistics']['hits'] ?: 0; $files = [];
$cachemiss = @$opcache_status['opcache_statistics']['misses'] ?: 0; if (!empty($status['scripts'])) {
$blacklistmiss = @$opcache_status['opcache_statistics']['blacklist_misses'] ?: 0; uasort($status['scripts'], static function ($a, $b) {
$cachetotal = $cachehits + $cachemiss + $blacklistmiss; return $a['hits'] <=> $b['hits'];
});
foreach ($status['scripts'] as &$file) {
$file['full_path'] = str_replace('\\', '/', $file['full_path']);
$file['readable'] = [
'hits' => number_format($file['hits']),
'memory_consumption' => bsize($file['memory_consumption'])
];
}
$files = array_values($status['scripts']);
}
$general = array( if ($config['directives']['opcache.file_cache_only'] || !empty($status['file_cache_only'])) {
'version' => (isset($opcache_info['version']['opcache_product_name']) ? $opcache_info['version']['opcache_product_name'] . ' ' : '') . $opcache_info['version']['version'], $overview = false;
'phpversion' => phpversion(), } else {
'start_time' => @$opcache_status['opcache_statistics']['start_time'] ? date('Y-m-d H:i:s', $opcache_status['opcache_statistics']['start_time']) : '', $status['opcache_statistics']['start_time'] = $status['opcache_statistics']['start_time'] ?? 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'], $status['opcache_statistics']['last_restart_time'] = $status['opcache_statistics']['last_restart_time'] ?? time();
'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; $overview = array_merge(
$usedmemstr = bsize($usedmem); $status['memory_usage'],
$freemem = @$opcache_status['memory_usage']['free_memory'] ?: 0; $status['opcache_statistics'],
$freememstr = bsize($freemem); [
$totalmem = $usedmem + $freemem; 'total_memory' => $config['directives']['opcache.memory_consumption'],
$wastedmem = @$opcache_status['memory_usage']['wasted_memory'] ?: 0; 'used_memory_percentage' => round(100 * (
$wastedmemstr = bsize($wastedmem); ($status['memory_usage']['used_memory'] + $status['memory_usage']['wasted_memory'])
if ($totalmem) { / $config['directives']['opcache.memory_consumption']
$memory = array( )),
'total' => bsize($totalmem), 'hit_rate_percentage' => round($status['opcache_statistics']['opcache_hit_rate']),
'used' => $usedmemstr . ($totalmem > 0 ? sprintf(" (%.1f %%)", $usedmem / ($totalmem) * 100) : ''), 'used_key_percentage' => round(100 * ($status['opcache_statistics']['num_cached_keys']
'free' => $freememstr . ($totalmem > 0 ? sprintf(" (%.1f %%)", $freemem / ($totalmem) * 100) : ''), / $status['opcache_statistics']['max_cached_keys']
'wasted' => $wastedmemstr . ($totalmem > 0 ? sprintf(" (%.1f %%)", $wastedmem / ($totalmem) * 100) : '') )),
'wasted_percentage' => round($status['memory_usage']['current_wasted_percentage'], 2),
'readable' => [
'total_memory' => bsize($config['directives']['opcache.memory_consumption']),
'used_memory' => bsize($status['memory_usage']['used_memory']),
'free_memory' => bsize($status['memory_usage']['free_memory']),
'wasted_memory' => bsize($status['memory_usage']['wasted_memory']),
'num_cached_scripts' => number_format($status['opcache_statistics']['num_cached_scripts']),
'hits' => number_format($status['opcache_statistics']['hits']),
'misses' => number_format($status['opcache_statistics']['misses']),
'blacklist_miss' => number_format($status['opcache_statistics']['blacklist_misses']),
'num_cached_keys' => number_format($status['opcache_statistics']['num_cached_keys']),
'max_cached_keys' => number_format($status['opcache_statistics']['max_cached_keys']),
'interned' => null,
'start_time' => (new DateTimeImmutable("@{$status['opcache_statistics']['start_time']}"))
->setTimezone(new DateTimeZone(date_default_timezone_get()))
->format('Y-m-d H:i:s'),
'last_restart_time' => ($status['opcache_statistics']['last_restart_time'] == 0
? 'never'
: (new DateTimeImmutable("@{$status['opcache_statistics']['last_restart_time']}"))
->setTimezone(new DateTimeZone(date_default_timezone_get()))
->format('Y-m-d H:i:s')
)
]
]
); );
} }
if (isset($opcache_status['interned_strings_usage'])) { $preload = [];
$usedstring = @$opcache_status['interned_strings_usage']['used_memory'] ?: 0; if (!empty($status['preload_statistics']['scripts'])) {
$usedstringstr = bsize($usedstring); $preload = $status['preload_statistics']['scripts'];
$freestring = @$opcache_status['interned_strings_usage']['free_memory'] ?: 0; sort($preload, SORT_STRING);
$freestringstr = bsize($freestring); if ($overview) {
$totalstring = $usedstring + $freestring; $overview['preload_memory'] = $status['preload_statistics']['memory_consumption'];
$stringbuffer = array( $overview['readable']['preload_memory'] = bsize($status['preload_statistics']['memory_consumption']);
'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, '.', ' ') if (!empty($status['interned_strings_usage'])) {
$overview['readable']['interned'] = [
'buffer_size' => bsize($status['interned_strings_usage']['buffer_size']),
'strings_used_memory' => bsize($status['interned_strings_usage']['used_memory']),
'strings_free_memory' => bsize($status['interned_strings_usage']['free_memory']),
'number_of_strings' => number_format($status['interned_strings_usage']['number_of_strings'])
];
}
if ($overview && !empty($status['jit'])) {
$overview['jit_buffer_used_percentage'] = ($status['jit']['buffer_size']
? round(100 * (($status['jit']['buffer_size'] - $status['jit']['buffer_free']) / $status['jit']['buffer_size']))
: 0
); );
$overview['readable'] = array_merge($overview['readable'], [
'jit_buffer_size' => bsize($status['jit']['buffer_size']),
'jit_buffer_free' => bsize($status['jit']['buffer_free'])
]);
} }
$usedkey = @$opcache_status['opcache_statistics']['num_cached_keys'] ?: 0; $directives = [];
$usedkeystr = number_format($usedkey, 0, '.', ' '); ksort($config['directives']);
$totalkey = @$opcache_status['opcache_statistics']['max_cached_keys'] ?: 0; foreach ($config['directives'] as $k => $v) {
$wastedkey = $usedkey - (@$opcache_status['opcache_statistics']['num_cached_scripts'] ?: 0); if (in_array($k, ['opcache.max_file_size', 'opcache.memory_consumption', 'opcache.jit_buffer_size']) && $v) {
if (isset($opcache_status['opcache_statistics'])) { $v = bsize($v) . " ({$v})";
$keystat = array( } elseif ($k === 'opcache.optimization_level') {
'total' => number_format($totalkey, 0, '.', ' '), $levels = [];
'used' => $usedkeystr . ($totalkey > 0 ? sprintf(" (%.1f %%)", $usedkey / ($totalkey) * 100) : ''), foreach ($optimizationLevels as $level => $info) {
'wasted' => number_format($wastedkey, 0, '.', ' ') . ($totalkey > 0 ? sprintf(" (%.1f %%)", $wastedkey / ($totalkey) * 100) : '') if ($level & $v) {
$levels[] = "{$info} [{$level}]";
}
}
$v = $levels ?: 'none';
} elseif ($k === 'opcache.jit') {
if ($v === '1') {
$v = 'on';
}
if (isset($jitModeMapping[$v]) || is_numeric($v)) {
$levels = [];
foreach (str_split((string)($jitModeMapping[$v] ?? $v)) as $type => $level) {
$levels[] = "{$level}: {$jitModes[$type]['value'][$level]} ({$jitModes[$type]['flag']})";
}
$v = [$v, $levels];
} elseif (empty($v) || strtolower($v) === 'off') {
$v = 'Off';
}
}
$directives[] = [
'k' => $k,
'v' => $v
];
}
$version = array_merge(
$config['version'],
[
'php' => phpversion(),
'server' => $_SERVER['SERVER_SOFTWARE'] ?: '',
'host' => (function_exists('gethostname')
? gethostname()
: (php_uname('n')
?: (empty($_SERVER['SERVER_NAME'])
? $_SERVER['HOST_NAME']
: $_SERVER['SERVER_NAME']
)
)
)
]
); );
}
$blacklistlines = ''; UI::view('settings/opcacheinfo.html.twig', [
if (isset($opcache_info['blacklist']) && is_array($opcache_info['blacklist'])) { 'opcacheinfo' => [
foreach ($opcache_info['blacklist'] as $value) { 'version' => $version,
eval("\$blacklistlines.=\"" . \Froxlor\UI\Template::getTemplate("settings/opcacheinfo/blacklist_line") . "\";"); 'overview' => $overview,
} 'files' => $files,
} 'preload' => $preload,
'directives' => $directives,
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/opcacheinfo/showinfo") . "\";"); 'blacklist' => $config['blacklist'],
'functions' => get_extension_funcs('Zend OPcache')
]
]);
} }
function bsize($s) function bsize($size)
{ {
foreach (array( $i = 0;
'', $val = ['b', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
'K', while (($size / 1024) > 1) {
'M', $size /= 1024;
'G' ++$i;
) as $i => $k) {
if ($s < 1024)
break;
$s /= 1024;
} }
return sprintf("%5.1f %sBytes", $s, $k); return sprintf(
'%.2f%s%s',
$size,
'',
$val[$i]
);
} }

View File

@@ -2,333 +2,296 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Panel
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'admin');
require './lib/init.php';
const AREA = 'admin';
require __DIR__ . '/lib/init.php';
use Froxlor\Api\Commands\FpmDaemons;
use Froxlor\Api\Commands\PhpSettings;
use Froxlor\Database\Database; use Froxlor\Database\Database;
use Froxlor\Api\Commands\PhpSettings as PhpSettings; use Froxlor\Froxlor;
use Froxlor\Api\Commands\FpmDaemons as FpmDaemons; use Froxlor\UI\Collection;
use Froxlor\UI\HTML;
use Froxlor\UI\Listing;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
if (isset($_POST['id'])) { $id = (int)Request::any('id');
$id = intval($_POST['id']);
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
if ($page == 'overview') { if ($page == 'overview') {
if ($action == '') { if ($action == '') {
try { try {
$json_result = PhpSettings::getLocal($userinfo, array( $phpconf_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.phpconfigs.php';
'with_subdomains' => true $collection = (new Collection(PhpSettings::class, $userinfo, ['with_subdomains' => true]))
))->listing(); ->withPagination($phpconf_list_data['phpconf_list']['columns'], $phpconf_list_data['phpconf_list']['default_sorting']);
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
$tablecontent = '';
$count = 0;
if (isset($result['count']) && $result['count'] > 0) {
foreach ($result['list'] as $row) {
if (isset($row['is_default']) && $row['is_default'] == true) {
$row['description'] = "<b>" . $row['description'] . "</b>";
}
$domains = "";
$subdomains_count = count($row['subdomains']);
foreach ($row['domains'] as $configdomain) {
$domains .= $configdomain . "<br>";
}
$count ++;
if ($subdomains_count == 0 && empty($domains)) {
$domains = $lng['admin']['phpsettings']['notused'];
}
eval("\$tablecontent.=\"" . \Froxlor\UI\Template::getTemplate("phpconfig/overview_overview") . "\";");
}
} }
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/overview") . "\";"); UI::view('user/table.html.twig', [
'listing' => Listing::format($collection, $phpconf_list_data, 'phpconf_list'),
'actions_links' => (bool)$userinfo['change_serversettings'] ? [
[
'href' => $linker->getLink(['section' => 'phpsettings', 'page' => $page, 'action' => 'add']),
'label' => lng('admin.phpsettings.addnew')
]
] : []
]);
} }
if ($action == 'add') { if ($action == 'add') {
if ((int)$userinfo['change_serversettings'] == 1) {
if ((int) $userinfo['change_serversettings'] == 1) {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { try {
PhpSettings::getLocal($userinfo, $_POST)->add(); PhpSettings::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
if (file_exists(Froxlor::getInstallDir() . '/templates/misc/php/default.ini.php')) {
include Froxlor::getInstallDir() . '/templates/misc/php/default.ini.php';
$result = [
'phpsettings' => $phpini
];
} else {
// use first php-config as fallback
$result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = 1"); $result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = 1");
$result = $result_stmt->fetch(PDO::FETCH_ASSOC); $result = $result_stmt->fetch(PDO::FETCH_ASSOC);
}
$fpmconfigs = ''; $fpmconfigs = [];
$configs = Database::query("SELECT * FROM `" . TABLE_PANEL_FPMDAEMONS . "` ORDER BY `description` ASC"); $configs = Database::query("SELECT * FROM `" . TABLE_PANEL_FPMDAEMONS . "` ORDER BY `description` ASC");
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) { while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
$fpmconfigs .= \Froxlor\UI\HTML::makeoption($row['description'], $row['id'], 1, true, true); $fpmconfigs[$row['id']] = $row['description'];
} }
$pm_select = \Froxlor\UI\HTML::makeoption('static', 'static', 'static', true, true);
$pm_select .= \Froxlor\UI\HTML::makeoption('dynamic', 'dynamic', 'static', true, true);
$pm_select .= \Froxlor\UI\HTML::makeoption('ondemand', 'ondemand', 'static', true, true);
$phpconfig_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php'; $phpconfig_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php';
$phpconfig_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($phpconfig_add_data);
$title = $phpconfig_add_data['phpconfig_add']['title']; UI::view('user/form-replacers.html.twig', [
$image = $phpconfig_add_data['phpconfig_add']['image']; 'formaction' => $linker->getLink(['section' => 'phpsettings']),
'formdata' => $phpconfig_add_data['phpconfig_add'],
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/overview_add") . "\";"); 'replacers' => $phpconfig_add_data['phpconfig_replacers']
]);
} }
} else { } else {
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid'); Response::standardError('nopermissionsorinvalidid');
} }
} }
if ($action == 'delete') { if ($action == 'delete') {
try { try {
$json_result = PhpSettings::getLocal($userinfo, array( $json_result = PhpSettings::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
if ($result['id'] != 0 && $result['id'] == $id && (int) $userinfo['change_serversettings'] == 1 && $id != 1) // cannot delete the default php.config if ($result['id'] != 0 && $result['id'] == $id && (int)$userinfo['change_serversettings'] == 1 && $id != 1) // cannot delete the default php.config
{ {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { try {
PhpSettings::getLocal($userinfo, array( PhpSettings::getLocal($userinfo, [
'id' => $id 'id' => $id
))->delete(); ])->delete();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
\Froxlor\UI\HTML::askYesNo('phpsetting_reallydelete', $filename, array( HTML::askYesNo('phpsetting_reallydelete', $filename, [
'id' => $id, 'id' => $id,
'page' => $page, 'page' => $page,
'action' => $action 'action' => $action
), $result['description']); ], $result['description']);
} }
} else { } else {
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid'); Response::standardError('nopermissionsorinvalidid');
} }
} }
if ($action == 'edit') { if ($action == 'edit') {
try { try {
$json_result = PhpSettings::getLocal($userinfo, array( $json_result = PhpSettings::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
if ($result['id'] != 0 && $result['id'] == $id && (int) $userinfo['change_serversettings'] == 1) { if ($result['id'] != 0 && $result['id'] == $id && (int)$userinfo['change_serversettings'] == 1) {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { try {
PhpSettings::getLocal($userinfo, $_POST)->update(); PhpSettings::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
$fpmconfigs = [];
$fpmconfigs = '';
$configs = Database::query("SELECT * FROM `" . TABLE_PANEL_FPMDAEMONS . "` ORDER BY `description` ASC"); $configs = Database::query("SELECT * FROM `" . TABLE_PANEL_FPMDAEMONS . "` ORDER BY `description` ASC");
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) { while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
$fpmconfigs .= \Froxlor\UI\HTML::makeoption($row['description'], $row['id'], $result['fpmsettingid'], true, true); $fpmconfigs[$row['id']] = $row['description'];
} }
$pm_select = \Froxlor\UI\HTML::makeoption('static', 'static', $result['pm'], true, true);
$pm_select .= \Froxlor\UI\HTML::makeoption('dynamic', 'dynamic', $result['pm'], true, true);
$pm_select .= \Froxlor\UI\HTML::makeoption('ondemand', 'ondemand', $result['pm'], true, true);
$phpconfig_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php'; $phpconfig_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php';
$phpconfig_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($phpconfig_edit_data);
$title = $phpconfig_edit_data['phpconfig_edit']['title']; UI::view('user/form-replacers.html.twig', [
$image = $phpconfig_edit_data['phpconfig_edit']['image']; 'formaction' => $linker->getLink(['section' => 'phpsettings', 'id' => $id]),
'formdata' => $phpconfig_edit_data['phpconfig_edit'],
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/overview_edit") . "\";"); 'replacers' => $phpconfig_edit_data['phpconfig_replacers'],
'editid' => $id
]);
} }
} else { } else {
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid'); Response::standardError('nopermissionsorinvalidid');
} }
} }
} elseif ($page == 'fpmdaemons') { } elseif ($page == 'fpmdaemons') {
if ($action == '') { if ($action == '') {
try { try {
$json_result = FpmDaemons::getLocal($userinfo)->listing(); $fpmconf_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.fpmconfigs.php';
$collection = (new Collection(FpmDaemons::class, $userinfo))
->withPagination($fpmconf_list_data['fpmconf_list']['columns'], $fpmconf_list_data['fpmconf_list']['default_sorting']);
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data'];
$tablecontent = ''; UI::view('user/table.html.twig', [
$count = 0; 'listing' => Listing::format($collection, $fpmconf_list_data, 'fpmconf_list'),
if (isset($result['count']) && $result['count'] > 0) { 'actions_links' => (bool)$userinfo['change_serversettings'] ? [
foreach ($result['list'] as $row) { [
$configs = ""; 'href' => $linker->getLink(['section' => 'phpsettings', 'page' => $page, 'action' => 'add']),
foreach ($row['configs'] as $configused) { 'label' => lng('admin.fpmsettings.addnew')
$configs .= $configused . "<br>"; ]
} ] : []
$count ++; ]);
eval("\$tablecontent.=\"" . \Froxlor\UI\Template::getTemplate("phpconfig/fpmdaemons_overview") . "\";");
}
}
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/fpmdaemons") . "\";");
} }
if ($action == 'add') { if ($action == 'add') {
if ((int)$userinfo['change_serversettings'] == 1) {
if ((int) $userinfo['change_serversettings'] == 1) {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { try {
FpmDaemons::getLocal($userinfo, $_POST)->add(); FpmDaemons::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
$pm_select = \Froxlor\UI\HTML::makeoption('static', 'static', 'static', true, true);
$pm_select .= \Froxlor\UI\HTML::makeoption('dynamic', 'dynamic', 'static', true, true);
$pm_select .= \Froxlor\UI\HTML::makeoption('ondemand', 'ondemand', 'static', true, true);
$fpmconfig_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.fpmconfig_add.php'; $fpmconfig_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.fpmconfig_add.php';
$fpmconfig_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($fpmconfig_add_data);
$title = $fpmconfig_add_data['fpmconfig_add']['title']; UI::view('user/form-replacers.html.twig', [
$image = $fpmconfig_add_data['fpmconfig_add']['image']; 'formaction' => $linker->getLink(['section' => 'phpsettings', 'page' => 'fpmdaemons']),
'formdata' => $fpmconfig_add_data['fpmconfig_add'],
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/fpmconfig_add") . "\";"); 'replacers' => $fpmconfig_add_data['fpmconfig_replacers']
]);
} }
} else { } else {
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid'); Response::standardError('nopermissionsorinvalidid');
} }
} }
if ($action == 'delete') { if ($action == 'delete') {
try { try {
$json_result = FpmDaemons::getLocal($userinfo, array( $json_result = FpmDaemons::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
if ($id == 1) { if ($id == 1) {
\Froxlor\UI\Response::standard_error('cannotdeletedefaultphpconfig'); Response::standardError('cannotdeletedefaultphpconfig');
} }
if ($result['id'] != 0 && $result['id'] == $id && (int) $userinfo['change_serversettings'] == 1 && $id != 1) // cannot delete the default php.config if ($result['id'] != 0 && $result['id'] == $id && (int)$userinfo['change_serversettings'] == 1 && $id != 1) // cannot delete the default php.config
{ {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { try {
FpmDaemons::getLocal($userinfo, $_POST)->delete(); FpmDaemons::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
\Froxlor\UI\HTML::askYesNo('fpmsetting_reallydelete', $filename, array( HTML::askYesNo('fpmsetting_reallydelete', $filename, [
'id' => $id, 'id' => $id,
'page' => $page, 'page' => $page,
'action' => $action 'action' => $action
), $result['description']); ], $result['description']);
} }
} else { } else {
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid'); Response::standardError('nopermissionsorinvalidid');
} }
} }
if ($action == 'edit') { if ($action == 'edit') {
try { try {
$json_result = FpmDaemons::getLocal($userinfo, array( $json_result = FpmDaemons::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
if ($result['id'] != 0 && $result['id'] == $id && (int) $userinfo['change_serversettings'] == 1) { if ($result['id'] != 0 && $result['id'] == $id && (int)$userinfo['change_serversettings'] == 1) {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { try {
FpmDaemons::getLocal($userinfo, $_POST)->update(); FpmDaemons::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
$pm_select = \Froxlor\UI\HTML::makeoption('static', 'static', $result['pm'], true, true);
$pm_select .= \Froxlor\UI\HTML::makeoption('dynamic', 'dynamic', $result['pm'], true, true);
$pm_select .= \Froxlor\UI\HTML::makeoption('ondemand', 'ondemand', $result['pm'], true, true);
$fpmconfig_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.fpmconfig_edit.php'; $fpmconfig_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.fpmconfig_edit.php';
$fpmconfig_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($fpmconfig_edit_data);
$title = $fpmconfig_edit_data['fpmconfig_edit']['title']; UI::view('user/form-replacers.html.twig', [
$image = $fpmconfig_edit_data['fpmconfig_edit']['image']; 'formaction' => $linker->getLink(['section' => 'phpsettings', 'page' => 'fpmdaemons', 'id' => $id]),
'formdata' => $fpmconfig_edit_data['fpmconfig_edit'],
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/fpmconfig_edit") . "\";"); 'replacers' => $fpmconfig_edit_data['fpmconfig_replacers'],
'editid' => $id
]);
} }
} else { } else {
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid'); Response::standardError('nopermissionsorinvalidid');
} }
} }
} }

View File

@@ -4,184 +4,172 @@
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Froxlor team <team@froxlor.org> (2010-) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @package Panel * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'admin');
require './lib/init.php'; const AREA = 'admin';
require __DIR__ . '/lib/init.php';
use Froxlor\Api\Commands\HostingPlans; use Froxlor\Api\Commands\HostingPlans;
use Froxlor\Api\Commands\MysqlServer;
use Froxlor\Database\Database; use Froxlor\Database\Database;
use Froxlor\FroxlorLogger;
use Froxlor\PhpHelper;
use Froxlor\Settings; use Froxlor\Settings;
use Froxlor\UI\Collection;
use Froxlor\UI\HTML;
use Froxlor\UI\Listing;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
if (isset($_POST['id'])) { $id = (int)Request::any('id');
$id = intval($_POST['id']);
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
if ($page == '' || $page == 'overview') { if ($page == '' || $page == 'overview') {
if ($action == '') { if ($action == '') {
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_plans");
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_plans");
$fields = array(
'p.name' => $lng['admin']['plans']['name'],
'p.description' => $lng['admin']['plans']['description'],
'adminname' => $lng['admin']['admin'],
'p.ts' => $lng['admin']['plans']['last_update']
);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_PLANS, $fields);
$plans = '';
$result_stmt = Database::prepare("
SELECT p.*, a.loginname as adminname
FROM `" . TABLE_PANEL_PLANS . "` p, `" . TABLE_PANEL_ADMINS . "` a
WHERE " . ($userinfo['customers_see_all'] ? '' : " `p`.`adminid` = :adminid AND ") . "
`p`.`adminid` = `a`.`adminid` " . $paging->getSqlWhere(false) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
Database::pexecute($result_stmt, array(
'adminid' => $userinfo['adminid']
));
$paging->setEntries(Database::num_rows());
$sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$i = 0;
$count = 0;
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
if ($paging->checkDisplay($i)) {
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
$row['ts_format'] = date("d.m.Y H:i", $row['ts']);
eval("\$plans.=\"" . \Froxlor\UI\Template::getTemplate("plans/plans_plan") . "\";");
$count ++;
}
$i ++;
}
eval("echo \"" . \Froxlor\UI\Template::getTemplate("plans/plans") . "\";");
} elseif ($action == 'delete' && $id != 0) {
try { try {
$json_result = HostingPlans::getLocal($userinfo, array( $plan_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.plans.php';
'id' => $id $collection = (new Collection(HostingPlans::class, $userinfo))
))->get(); ->withPagination($plan_list_data['plan_list']['columns'], $plan_list_data['plan_list']['default_sorting']);
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
}
UI::view('user/table.html.twig', [
'listing' => Listing::format($collection, $plan_list_data, 'plan_list'),
'actions_links' => [
[
'href' => $linker->getLink(['section' => 'plans', 'page' => $page, 'action' => 'add']),
'label' => lng('admin.plans.add')
]
]
]);
} elseif ($action == 'delete' && $id != 0) {
try {
$json_result = HostingPlans::getLocal($userinfo, [
'id' => $id
])->get();
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
if ($result['id'] != 0 && $result['id'] == $id && (int) $userinfo['adminid'] == $result['adminid']) { if ($result['id'] != 0 && $result['id'] == $id && (int)$userinfo['adminid'] == $result['adminid']) {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { try {
HostingPlans::getLocal($userinfo, array( HostingPlans::getLocal($userinfo, [
'id' => $id 'id' => $id
))->delete(); ])->delete();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
\Froxlor\UI\HTML::askYesNo('plan_reallydelete', $filename, array( HTML::askYesNo('plan_reallydelete', $filename, [
'id' => $id, 'id' => $id,
'page' => $page, 'page' => $page,
'action' => $action 'action' => $action
), $result['name']); ], $result['name']);
} }
} else { } else {
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid'); Response::standardError('nopermissionsorinvalidid');
} }
} elseif ($action == 'add') { } elseif ($action == 'add') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { try {
HostingPlans::getLocal($userinfo, $_POST)->add(); HostingPlans::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
$mysql_servers = [];
try {
$result_json = MysqlServer::getLocal($userinfo)->listing();
$result_decoded = json_decode($result_json, true)['data']['list'];
foreach ($result_decoded as $dbserver => $dbdata) {
$mysql_servers[] = [
'label' => $dbdata['caption'],
'value' => $dbserver
];
}
} catch (Exception $e) {
/* just none */
}
$diskspace_ul = \Froxlor\UI\HTML::makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $phpconfigs = [];
$traffic_ul = \Froxlor\UI\HTML::makecheckbox('traffic_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$subdomains_ul = \Froxlor\UI\HTML::makecheckbox('subdomains_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$emails_ul = \Froxlor\UI\HTML::makecheckbox('emails_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$email_accounts_ul = \Froxlor\UI\HTML::makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$email_forwarders_ul = \Froxlor\UI\HTML::makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$email_quota_ul = \Froxlor\UI\HTML::makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$ftps_ul = \Froxlor\UI\HTML::makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$mysqls_ul = \Froxlor\UI\HTML::makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$phpconfigs = array();
$configs = Database::query(" $configs = Database::query("
SELECT c.*, fc.description as interpreter SELECT c.*, fc.description as interpreter
FROM `" . TABLE_PANEL_PHPCONFIGS . "` c FROM `" . TABLE_PANEL_PHPCONFIGS . "` c
LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fc ON fc.id = c.fpmsettingid LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fc ON fc.id = c.fpmsettingid
"); ");
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) { while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
if ((int) Settings::Get('phpfpm.enabled') == 1) { if ((int)Settings::Get('phpfpm.enabled') == 1) {
$phpconfigs[] = array( $phpconfigs[] = [
'label' => $row['description'] . " [" . $row['interpreter'] . "]<br />", 'label' => $row['description'] . " [" . $row['interpreter'] . "]",
'value' => $row['id'] 'value' => $row['id']
); ];
} else { } else {
$phpconfigs[] = array( $phpconfigs[] = [
'label' => $row['description'] . "<br />", 'label' => $row['description'],
'value' => $row['id'] 'value' => $row['id']
); ];
} }
} }
// dummy to avoid unknown variables // dummy to avoid unknown variables
$language_options = null;
$gender_options = null;
$hosting_plans = null; $hosting_plans = null;
$plans_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/plans/formfield.plans_add.php'; $plans_add_data = include_once __DIR__ . '/lib/formfields/admin/plans/formfield.plans_add.php';
$cust_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_add.php'; $cust_add_data = include_once __DIR__ . '/lib/formfields/admin/customer/formfield.customer_add.php';
// unset unneeded stuff // unset unneeded stuff
unset($cust_add_data['customer_add']['sections']['section_a']); unset($cust_add_data['customer_add']['sections']['section_a']);
unset($cust_add_data['customer_add']['sections']['section_b']); unset($cust_add_data['customer_add']['sections']['section_b']);
unset($cust_add_data['customer_add']['sections']['section_cpre']); unset($cust_add_data['customer_add']['sections']['section_cpre']);
// merge // merge
$plans_add_data['plans_add']['sections'] = array_merge($plans_add_data['plans_add']['sections'], $cust_add_data['customer_add']['sections']); $plans_add_data['plans_add']['sections'] = array_merge($plans_add_data['plans_add']['sections'], $cust_add_data['customer_add']['sections']);
$plans_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($plans_add_data);
$title = $plans_add_data['plans_add']['title']; UI::view('user/form.html.twig', [
$image = $plans_add_data['plans_add']['image']; 'formaction' => $linker->getLink(['section' => 'plans']),
'formdata' => $plans_add_data['plans_add']
eval("echo \"" . \Froxlor\UI\Template::getTemplate("plans/plans_add") . "\";"); ]);
} }
} elseif ($action == 'edit' && $id != 0) { } elseif ($action == 'edit' && $id != 0) {
try { try {
$json_result = HostingPlans::getLocal($userinfo, array( $json_result = HostingPlans::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
if ($result['name'] != '') { if ($result['name'] != '') {
$result['value'] = json_decode($result['value'], true); $result['value'] = json_decode($result['value'], true);
$result = \Froxlor\PhpHelper::htmlentitiesArray($result); $result = PhpHelper::htmlentitiesArray($result);
foreach ($result['value'] as $index => $value) { foreach ($result['value'] as $index => $value) {
$result[$index] = $value; $result[$index] = $value;
@@ -189,82 +177,46 @@ if ($page == '' || $page == 'overview') {
$result['allowed_phpconfigs'] = json_encode($result['allowed_phpconfigs']); $result['allowed_phpconfigs'] = json_encode($result['allowed_phpconfigs']);
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { try {
HostingPlans::getLocal($userinfo, array( HostingPlans::getLocal($userinfo, $_POST)->update();
'id' => $id
))->update();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
$mysql_servers = [];
$diskspace_ul = \Froxlor\UI\HTML::makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, $result['diskspace'], true, true); try {
if ($result['diskspace'] == '-1') { $result_json = MysqlServer::getLocal($userinfo)->listing();
$result['diskspace'] = ''; $result_decoded = json_decode($result_json, true)['data']['list'];
foreach ($result_decoded as $dbserver => $dbdata) {
$mysql_servers[] = [
'label' => $dbdata['caption'],
'value' => $dbserver
];
}
} catch (Exception $e) {
/* just none */
} }
$traffic_ul = \Froxlor\UI\HTML::makecheckbox('traffic_ul', $lng['customer']['unlimited'], '-1', false, $result['traffic'], true, true); $phpconfigs = [];
if ($result['traffic'] == '-1') {
$result['traffic'] = '';
}
$subdomains_ul = \Froxlor\UI\HTML::makecheckbox('subdomains_ul', $lng['customer']['unlimited'], '-1', false, $result['subdomains'], true, true);
if ($result['subdomains'] == '-1') {
$result['subdomains'] = '';
}
$emails_ul = \Froxlor\UI\HTML::makecheckbox('emails_ul', $lng['customer']['unlimited'], '-1', false, $result['emails'], true, true);
if ($result['emails'] == '-1') {
$result['emails'] = '';
}
$email_accounts_ul = \Froxlor\UI\HTML::makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, $result['email_accounts'], true, true);
if ($result['email_accounts'] == '-1') {
$result['email_accounts'] = '';
}
$email_forwarders_ul = \Froxlor\UI\HTML::makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, $result['email_forwarders'], true, true);
if ($result['email_forwarders'] == '-1') {
$result['email_forwarders'] = '';
}
$email_quota_ul = \Froxlor\UI\HTML::makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, $result['email_quota'], true, true);
if ($result['email_quota'] == '-1') {
$result['email_quota'] = '';
}
$ftps_ul = \Froxlor\UI\HTML::makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, $result['ftps'], true, true);
if ($result['ftps'] == '-1') {
$result['ftps'] = '';
}
$mysqls_ul = \Froxlor\UI\HTML::makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, $result['mysqls'], true, true);
if ($result['mysqls'] == '-1') {
$result['mysqls'] = '';
}
$phpconfigs = array();
$configs = Database::query(" $configs = Database::query("
SELECT c.*, fc.description as interpreter SELECT c.*, fc.description as interpreter
FROM `" . TABLE_PANEL_PHPCONFIGS . "` c FROM `" . TABLE_PANEL_PHPCONFIGS . "` c
LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fc ON fc.id = c.fpmsettingid LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fc ON fc.id = c.fpmsettingid
"); ");
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) { while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
if ((int) Settings::Get('phpfpm.enabled') == 1) { if ((int)Settings::Get('phpfpm.enabled') == 1) {
$phpconfigs[] = array( $phpconfigs[] = [
'label' => $row['description'] . " [" . $row['interpreter'] . "]<br />", 'label' => $row['description'] . " [" . $row['interpreter'] . "]",
'value' => $row['id'] 'value' => $row['id']
); ];
} else { } else {
$phpconfigs[] = array( $phpconfigs[] = [
'label' => $row['description'] . "<br />", 'label' => $row['description'],
'value' => $row['id'] 'value' => $row['id']
); ];
} }
} }
@@ -276,9 +228,9 @@ if ($page == '' || $page == 'overview') {
$result['documentroot'] = null; $result['documentroot'] = null;
$result['standardsubdomain'] = null; $result['standardsubdomain'] = null;
$result['deactivated'] = null; $result['deactivated'] = null;
$language_options = null; $result['def_language'] = null;
$result['firstname'] = null; $result['firstname'] = null;
$gender_options = null; $result['gender'] = null;
$result['company'] = null; $result['company'] = null;
$result['street'] = null; $result['street'] = null;
$result['zipcode'] = null; $result['zipcode'] = null;
@@ -289,34 +241,35 @@ if ($page == '' || $page == 'overview') {
$result['customernumber'] = null; $result['customernumber'] = null;
$result['custom_notes'] = null; $result['custom_notes'] = null;
$result['custom_notes_show'] = null; $result['custom_notes_show'] = null;
$result['api_allowed'] = null;
$hosting_plans = null; $hosting_plans = null;
$admin_select_cnt = null; $admin_select = [];
$admin_select = null;
$plans_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/plans/formfield.plans_edit.php'; $plans_edit_data = include_once __DIR__ . '/lib/formfields/admin/plans/formfield.plans_edit.php';
$cust_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_edit.php'; $cust_edit_data = include_once __DIR__ . '/lib/formfields/admin/customer/formfield.customer_edit.php';
// unset unneeded stuff // unset unneeded stuff
unset($cust_edit_data['customer_edit']['sections']['section_a']); unset($cust_edit_data['customer_edit']['sections']['section_a']);
unset($cust_edit_data['customer_edit']['sections']['section_b']); unset($cust_edit_data['customer_edit']['sections']['section_b']);
unset($cust_edit_data['customer_edit']['sections']['section_cpre']); unset($cust_edit_data['customer_edit']['sections']['section_cpre']);
unset($cust_edit_data['customer_edit']['sections']['section_d']);
// merge // merge
$plans_edit_data['plans_edit']['sections'] = array_merge($plans_edit_data['plans_edit']['sections'], $cust_edit_data['customer_edit']['sections']); $plans_edit_data['plans_edit']['sections'] = array_merge($plans_edit_data['plans_edit']['sections'], $cust_edit_data['customer_edit']['sections']);
$plans_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($plans_edit_data);
$title = $plans_edit_data['plans_edit']['title']; UI::view('user/form.html.twig', [
$image = $plans_edit_data['plans_edit']['image']; 'formaction' => $linker->getLink(['section' => 'plans', 'id' => $id]),
'formdata' => $plans_edit_data['plans_edit'],
eval("echo \"" . \Froxlor\UI\Template::getTemplate("plans/plans_edit") . "\";"); 'editid' => $id
]);
} }
} }
} elseif ($action == 'jqGetPlanValues') { } elseif ($action == 'jqGetPlanValues') {
$planid = isset($_POST['planid']) ? (int) $_POST['planid'] : 0; $planid = (int)Request::any('planid', 0);
try { try {
$json_result = HostingPlans::getLocal($userinfo, array( $json_result = HostingPlans::getLocal($userinfo, [
'id' => $planid 'id' => $planid
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
echo $result['value']; echo $result['value'];

View File

@@ -2,26 +2,46 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Panel
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
use Froxlor\Database\Database;
use Froxlor\Settings;
use Froxlor\Api\Commands\Froxlor;
define('AREA', 'admin'); use Froxlor\Api\Commands\Froxlor;
require './lib/init.php'; use Froxlor\Cron\TaskId;
use Froxlor\Database\Database;
use Froxlor\Database\IntegrityCheck;
use Froxlor\FroxlorLogger;
use Froxlor\PhpHelper;
use Froxlor\Settings;
use Froxlor\System\Cronjob;
use Froxlor\UI\Form;
use Froxlor\UI\HTML;
use Froxlor\UI\Listing;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
use Froxlor\User;
use PHPMailer\PHPMailer\PHPMailer;
const AREA = 'admin';
require __DIR__ . '/lib/init.php';
// get sql-root access data // get sql-root access data
Database::needRoot(true); Database::needRoot(true);
@@ -30,11 +50,10 @@ $sql_root = Database::getSqlData();
Database::needRoot(false); Database::needRoot(false);
if ($page == 'overview' && $userinfo['change_serversettings'] == '1') { if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$settings_data = \Froxlor\PhpHelper::loadConfigArrayDir('./actions/admin/settings/'); $settings_data = PhpHelper::loadConfigArrayDir('./actions/admin/settings/');
Settings::loadSettingsInto($settings_data); Settings::loadSettingsInto($settings_data);
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$_part = isset($_GET['part']) ? $_GET['part'] : ''; $_part = isset($_GET['part']) ? $_GET['part'] : '';
if ($_part == '') { if ($_part == '') {
$_part = isset($_POST['part']) ? $_POST['part'] : ''; $_part = isset($_POST['part']) ? $_POST['part'] : '';
@@ -57,163 +76,127 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
// check if the session timeout is too low #815 // check if the session timeout is too low #815
if (isset($_POST['session_sessiontimeout']) && $_POST['session_sessiontimeout'] < 60) { if (isset($_POST['session_sessiontimeout']) && $_POST['session_sessiontimeout'] < 60) {
\Froxlor\UI\Response::standard_error($lng['error']['session_timeout'], $lng['error']['session_timeout_desc']); Response::standardError(lng('error.session_timeout'), lng('error.session_timeout_desc'));
} }
if (\Froxlor\UI\Form::processFormEx($settings_data, $_POST, array( try {
if (Form::processForm($settings_data, $_POST, [
'filename' => $filename, 'filename' => $filename,
'action' => $action, 'action' => $action,
'page' => $page 'page' => $page
), $_part, $settings_all, $settings_part, $only_enabledisable)) { ], $_part, $settings_all, $settings_part, $only_enabledisable)) {
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "rebuild configfiles due to changed setting"); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_INFO, "rebuild configfiles due to changed setting");
\Froxlor\System\Cronjob::inserttask('1'); Cronjob::inserttask(TaskId::REBUILD_VHOST);
// Using nameserver, insert a task which rebuilds the server config // Using nameserver, insert a task which rebuilds the server config
\Froxlor\System\Cronjob::inserttask('4'); Cronjob::inserttask(TaskId::REBUILD_DNS);
// cron.d file // cron.d file
\Froxlor\System\Cronjob::inserttask('99'); Cronjob::inserttask(TaskId::REBUILD_CRON);
\Froxlor\UI\Response::standard_success('settingssaved', '', array( Response::standardSuccess('settingssaved', '', [
'filename' => $filename, 'filename' => $filename,
'action' => $action, 'action' => $action,
'page' => $page 'page' => $page
)); ]);
}
} catch (Exception $e) {
Response::dynamicError($e->getMessage(), $e->getCode());
} }
} else { } else {
$_part = isset($_GET['part']) ? $_GET['part'] : ''; $_part = isset($_GET['part']) ? $_GET['part'] : '';
if ($_part == '') { if ($_part == '') {
$_part = isset($_POST['part']) ? $_POST['part'] : ''; $_part = isset($_POST['part']) ? $_POST['part'] : '';
} }
$fields = \Froxlor\UI\Form::buildFormEx($settings_data, $_part); $fields = Form::buildForm($settings_data, $_part);
$settings_page = ''; if ($_part == '' || $_part == 'all') {
if ($_part == '') { UI::view('settings/index.html.twig', ['fields' => $fields]);
eval("\$settings_page .= \"" . \Froxlor\UI\Template::getTemplate("settings/settings_overview") . "\";");
} else { } else {
eval("\$settings_page .= \"" . \Froxlor\UI\Template::getTemplate("settings/settings") . "\";"); $em = Request::any('em', '');
UI::view('settings/detailpart.html.twig', ['fields' => $fields, 'em' => $em]);
} }
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/settings_form_begin") . "\";");
eval("echo \$settings_page;");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/settings_form_end") . "\";");
} }
} elseif ($page == 'phpinfo' && $userinfo['change_serversettings'] == '1') { } elseif ($page == 'phpinfo' && $userinfo['change_serversettings'] == '1') {
ob_start(); ob_start();
phpinfo(); phpinfo();
$phpinfo = array( $phpinfo = [
'phpinfo' => array() 'phpinfo' => []
); ];
if (preg_match_all('#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>)?)?</tr>)#s', ob_get_clean(), $matches, PREG_SET_ORDER)) { if (preg_match_all('#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>)?)?</tr>)#s', ob_get_clean(), $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) { foreach ($matches as $match) {
$end = array_keys($phpinfo); $end = array_keys($phpinfo);
$end = end($end); $end = end($end);
if (strlen($match[1])) { if (strlen($match[1])) {
$phpinfo[$match[1]] = array(); $phpinfo[$match[1]] = [];
} elseif (isset($match[3])) { } elseif (isset($match[3])) {
$phpinfo[$end][$match[2]] = isset($match[4]) ? array( $phpinfo[$end][$match[2]] = isset($match[4]) ? [
$match[3], $match[3],
$match[4] $match[4]
) : $match[3]; ] : $match[3];
} else { } else {
$phpinfo[$end][] = $match[2]; $phpinfo[$end][] = $match[2];
} }
} }
$phpinfohtml = '';
foreach ($phpinfo as $name => $section) {
$phpinfoentries = "";
foreach ($section as $key => $val) {
if (is_array($val)) {
eval("\$phpinfoentries .= \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo/phpinfo_3") . "\";");
} elseif (is_string($key)) {
eval("\$phpinfoentries .= \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo/phpinfo_2") . "\";");
} else { } else {
eval("\$phpinfoentries .= \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo/phpinfo_1") . "\";"); Response::standardError(lng('error.no_phpinfo'));
} }
} UI::view('settings/phpinfo.html.twig', [
// first header -> show actual php version 'phpversion' => PHP_VERSION,
if (strtolower($name) == "phpinfo") { 'phpinfo' => $phpinfo
$name = "PHP " . PHP_VERSION; ]);
}
eval("\$phpinfohtml .= \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo/phpinfo_table") . "\";");
}
$phpinfo = $phpinfohtml;
} else {
\Froxlor\UI\Response::standard_error($lng['error']['no_phpinfo']);
}
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo") . "\";");
} elseif ($page == 'rebuildconfigs' && $userinfo['change_serversettings'] == '1') { } elseif ($page == 'rebuildconfigs' && $userinfo['change_serversettings'] == '1') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_INFO, "rebuild configfiles");
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "rebuild configfiles"); Cronjob::inserttask(TaskId::REBUILD_VHOST);
\Froxlor\System\Cronjob::inserttask('1'); Cronjob::inserttask(TaskId::CREATE_QUOTA);
\Froxlor\System\Cronjob::inserttask('10');
// Using nameserver, insert a task which rebuilds the server config // Using nameserver, insert a task which rebuilds the server config
\Froxlor\System\Cronjob::inserttask('4'); Cronjob::inserttask(TaskId::REBUILD_DNS);
// cron.d file // cron.d file
\Froxlor\System\Cronjob::inserttask('99'); Cronjob::inserttask(TaskId::REBUILD_CRON);
\Froxlor\UI\Response::standard_success('rebuildingconfigs', '', array( Response::standardSuccess('rebuildingconfigs', '', [
'filename' => 'admin_index.php' 'filename' => 'admin_index.php'
)); ]);
} else { } else {
\Froxlor\UI\HTML::askYesNo('admin_configs_reallyrebuild', $filename, array( HTML::askYesNo('admin_configs_reallyrebuild', $filename, [
'page' => $page 'page' => $page
)); ]);
} }
} elseif ($page == 'updatecounters' && $userinfo['change_serversettings'] == '1') { } elseif ($page == 'updatecounters' && $userinfo['change_serversettings'] == '1') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_INFO, "updated resource-counters");
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "updated resource-counters"); $updatecounters = User::updateCounters(true);
$updatecounters = \Froxlor\User::updateCounters(true); UI::view('user/resource-counter.html.twig', [
$customers = ''; 'counters' => $updatecounters
foreach ($updatecounters['customers'] as $customerid => $customer) { ]);
eval("\$customers.=\"" . \Froxlor\UI\Template::getTemplate("settings/updatecounters_row_customer") . "\";");
}
$admins = '';
foreach ($updatecounters['admins'] as $adminid => $admin) {
eval("\$admins.=\"" . \Froxlor\UI\Template::getTemplate("settings/updatecounters_row_admin") . "\";");
}
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/updatecounters") . "\";");
} else { } else {
\Froxlor\UI\HTML::askYesNo('admin_counters_reallyupdate', $filename, array( HTML::askYesNo('admin_counters_reallyupdate', $filename, [
'page' => $page 'page' => $page
)); ]);
} }
} elseif ($page == 'wipecleartextmailpws' && $userinfo['change_serversettings'] == '1') { } elseif ($page == 'wipecleartextmailpws' && $userinfo['change_serversettings'] == '1') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_WARNING, "wiped all cleartext mail passwords");
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, "wiped all cleartext mail passwords");
Database::query("UPDATE `" . TABLE_MAIL_USERS . "` SET `password` = '';"); Database::query("UPDATE `" . TABLE_MAIL_USERS . "` SET `password` = '';");
Database::query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '0' WHERE `settinggroup` = 'system' AND `varname` = 'mailpwcleartext'"); Database::query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '0' WHERE `settinggroup` = 'system' AND `varname` = 'mailpwcleartext'");
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename);
's' => $s
));
} else { } else {
\Froxlor\UI\HTML::askYesNo('admin_cleartextmailpws_reallywipe', $filename, array( HTML::askYesNo('admin_cleartextmailpws_reallywipe', $filename, [
'page' => $page 'page' => $page
)); ]);
} }
} elseif ($page == 'wipequotas' && $userinfo['change_serversettings'] == '1') { } elseif ($page == 'wipequotas' && $userinfo['change_serversettings'] == '1') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_WARNING, "wiped all mailquotas");
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, "wiped all mailquotas");
// Set the quota to 0 which means unlimited // Set the quota to 0 which means unlimited
Database::query("UPDATE `" . TABLE_MAIL_USERS . "` SET `quota` = '0';"); Database::query("UPDATE `" . TABLE_MAIL_USERS . "` SET `quota` = '0';");
Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_quota_used` = '0'"); Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_quota_used` = '0'");
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename);
's' => $s
));
} else { } else {
\Froxlor\UI\HTML::askYesNo('admin_quotas_reallywipe', $filename, array( HTML::askYesNo('admin_quotas_reallywipe', $filename, [
'page' => $page 'page' => $page
)); ]);
} }
} elseif ($page == 'enforcequotas' && $userinfo['change_serversettings'] == '1') { } elseif ($page == 'enforcequotas' && $userinfo['change_serversettings'] == '1') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
@@ -221,7 +204,6 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$result_stmt = Database::query("SELECT `quota`, `customerid` FROM `" . TABLE_MAIL_USERS . "`"); $result_stmt = Database::query("SELECT `quota`, `customerid` FROM `" . TABLE_MAIL_USERS . "`");
if (Database::num_rows() > 0) { if (Database::num_rows() > 0) {
$upd_stmt = Database::prepare(" $upd_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET
`email_quota_used` = `email_quota_used` + :diff `email_quota_used` = `email_quota_used` + :diff
@@ -230,10 +212,10 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
while ($array = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while ($array = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$difference = Settings::Get('system.mail_quota') - $array['quota']; $difference = Settings::Get('system.mail_quota') - $array['quota'];
Database::pexecute($upd_stmt, array( Database::pexecute($upd_stmt, [
'diff' => $difference, 'diff' => $difference,
'customerid' => $customerid 'customerid' => $customerid
)); ]);
} }
} }
@@ -241,43 +223,59 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$upd_stmt = Database::prepare(" $upd_stmt = Database::prepare("
UPDATE `" . TABLE_MAIL_USERS . "` SET `quota` = :quota UPDATE `" . TABLE_MAIL_USERS . "` SET `quota` = :quota
"); ");
Database::pexecute($upd_stmt, array( Database::pexecute($upd_stmt, [
'quota' => Settings::Get('system.mail_quota') 'quota' => Settings::Get('system.mail_quota')
)); ]);
// Update the Customer, if the used quota is bigger than the allowed quota // Update the Customer, if the used quota is bigger than the allowed quota
Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_quota` = `email_quota_used` WHERE `email_quota` < `email_quota_used`"); Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_quota` = `email_quota_used` WHERE `email_quota` < `email_quota_used`");
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, 'enforcing mailquota to all customers: ' . Settings::Get('system.mail_quota') . ' MB'); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_WARNING, 'enforcing mailquota to all customers: ' . Settings::Get('system.mail_quota') . ' MB');
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename);
's' => $s
));
} else { } else {
\Froxlor\UI\HTML::askYesNo('admin_quotas_reallyenforce', $filename, array( HTML::askYesNo('admin_quotas_reallyenforce', $filename, [
'page' => $page 'page' => $page
)); ]);
} }
} elseif ($page == 'integritycheck' && $userinfo['change_serversettings'] == '1') { } elseif ($page == 'integritycheck' && $userinfo['change_serversettings'] == '1') {
$integrity = new \Froxlor\Database\IntegrityCheck(); $integrity = new IntegrityCheck();
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$integrity->fixAll(); $integrity->fixAll();
} elseif (isset($_GET['action']) && $_GET['action'] == "fix") { } elseif (isset($_GET['action']) && $_GET['action'] == "fix") {
\Froxlor\UI\HTML::askYesNo('admin_integritycheck_reallyfix', $filename, array( HTML::askYesNo('admin_integritycheck_reallyfix', $filename, [
'page' => $page 'page' => $page
)); ]);
} }
$integritycheck = ''; $integritycheck = [];
foreach ($integrity->available as $id => $check) { foreach ($integrity->available as $id => $check) {
$displayid = $id + 1; $integritycheck[] = [
$result = $integrity->$check(); 'displayid' => $id + 1,
$checkdesc = $lng['integrity_check'][$check]; 'result' => $integrity->$check(),
eval("\$integritycheck.=\"" . \Froxlor\UI\Template::getTemplate("settings/integritycheck_row") . "\";"); 'checkdesc' => lng('integrity_check.' . $check)
];
} }
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/integritycheck") . "\";");
$integrity_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.integrity.php';
$collection = [
'data' => $integritycheck,
'pagination' => []
];
UI::view('user/table.html.twig', [
'listing' => Listing::formatFromArray($collection, $integrity_list_data['integrity_list'], 'integrity_list'),
'actions_links' => [
[
'href' => $linker->getLink(['section' => 'settings', 'page' => $page, 'action' => 'fix']),
'label' => lng('admin.integrityfix'),
'icon' => 'fa-solid fa-screwdriver-wrench',
'class' => 'btn-warning'
]
]
]);
} elseif ($page == 'importexport' && $userinfo['change_serversettings'] == '1') { } elseif ($page == 'importexport' && $userinfo['change_serversettings'] == '1') {
// check for json-stuff // check for json-stuff
if (! extension_loaded('json')) { if (!extension_loaded('json')) {
\Froxlor\UI\Response::standard_error('jsonextensionnotfound'); Response::standardError('jsonextensionnotfound');
} }
if (isset($_GET['action']) && $_GET['action'] == "export") { if (isset($_GET['action']) && $_GET['action'] == "export") {
@@ -286,9 +284,9 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$json_result = Froxlor::getLocal($userinfo)->exportSettings(); $json_result = Froxlor::getLocal($userinfo)->exportSettings();
$json_export = json_decode($json_result, true)['data']; $json_export = json_decode($json_result, true)['data'];
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
header('Content-disposition: attachment; filename=Froxlor_settings-' . $version . '-' . $dbversion . '_' . date('d.m.Y') . '.json'); header('Content-disposition: attachment; filename=Froxlor_settings-' . \Froxlor\Froxlor::VERSION . '-' . \Froxlor\Froxlor::DBVERSION . '_' . date('d.m.Y') . '.json');
header('Content-type: application/json'); header('Content-type: application/json');
echo $json_export; echo $json_export;
exit(); exit();
@@ -299,35 +297,55 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
if (isset($_FILES["import_file"]["tmp_name"])) { if (isset($_FILES["import_file"]["tmp_name"])) {
$imp_content = file_get_contents($_FILES["import_file"]["tmp_name"]); $imp_content = file_get_contents($_FILES["import_file"]["tmp_name"]);
try { try {
Froxlor::getLocal($userinfo, array( Froxlor::getLocal($userinfo, [
'json_str' => $imp_content 'json_str' => $imp_content
))->importSettings(); ])->importSettings();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::standard_success('settingsimported', '', array( Response::standardSuccess('settingsimported', '', [
'filename' => 'admin_settings.php' 'filename' => 'admin_settings.php'
)); ]);
} }
\Froxlor\UI\Response::dynamic_error("Upload failed"); Response::dynamicError("Upload failed");
} }
} else { } else {
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/importexport/index") . "\";"); $settings_data = include_once dirname(__FILE__) . '/lib/formfields/admin/settings/formfield.settings_import.php';
UI::view('user/form.html.twig', [
'formaction' => $linker->getLink(['section' => 'settings', 'page' => $page, 'action' => 'import']),
'formdata' => $settings_data['settings_import'],
'actions_links' => [
[
'class' => 'btn-outline-primary',
'href' => $linker->getLink(['section' => 'settings', 'page' => 'overview']),
'label' => lng('admin.configfiles.overview'),
'icon' => 'fa-solid fa-grip'
],
[
'class' => 'btn-outline-secondary',
'href' => $linker->getLink(['section' => 'settings', 'page' => $page, 'action' => 'export']),
'label' => 'Download/export ' . lng('admin.serversettings'),
'icon' => 'fa-solid fa-file-import'
]
]
]);
} }
} elseif ($page == 'testmail') { } elseif ($page == 'testmail') {
$note_type = 'info';
$note_msg = lng('admin.smtptestnote');
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$test_addr = isset($_POST['test_addr']) ? $_POST['test_addr'] : null; $test_addr = isset($_POST['test_addr']) ? $_POST['test_addr'] : null;
/** // Initialize the mailingsystem
* Initialize the mailingsystem $testmail = new PHPMailer(true);
*/
$testmail = new \PHPMailer\PHPMailer\PHPMailer(true);
$testmail->CharSet = "UTF-8"; $testmail->CharSet = "UTF-8";
if (Settings::Get('system.mail_use_smtp')) { if (Settings::Get('system.mail_use_smtp')) {
$testmail->isSMTP(); $testmail->isSMTP();
$testmail->Host = Settings::Get('system.mail_smtp_host'); $testmail->Host = Settings::Get('system.mail_smtp_host');
$testmail->SMTPAuth = Settings::Get('system.mail_smtp_auth') == '1' ? true : false; $testmail->SMTPAuth = Settings::Get('system.mail_smtp_auth') == '1';
$testmail->Username = Settings::Get('system.mail_smtp_user'); $testmail->Username = Settings::Get('system.mail_smtp_user');
$testmail->Password = Settings::Get('system.mail_smtp_passwd'); $testmail->Password = Settings::Get('system.mail_smtp_passwd');
if (Settings::Get('system.mail_smtp_usetls')) { if (Settings::Get('system.mail_smtp_usetls')) {
@@ -339,7 +357,7 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
} }
$_mailerror = false; $_mailerror = false;
if (\PHPMailer\PHPMailer\PHPMailer::ValidateAddress(Settings::Get('panel.adminmail')) !== false) { if (PHPMailer::ValidateAddress(Settings::Get('panel.adminmail')) !== false) {
// set return-to address and custom sender-name, see #76 // set return-to address and custom sender-name, see #76
$testmail->SetFrom(Settings::Get('panel.adminmail'), Settings::Get('panel.adminmail_defname')); $testmail->SetFrom(Settings::Get('panel.adminmail'), Settings::Get('panel.adminmail_defname'));
if (Settings::Get('panel.adminmail_return') != '') { if (Settings::Get('panel.adminmail_return') != '') {
@@ -354,31 +372,56 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$testmail->AddAddress($test_addr); $testmail->AddAddress($test_addr);
$testmail->Send(); $testmail->Send();
} catch (\PHPMailer\PHPMailer\Exception $e) { } catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage(); $note_type = 'danger';
$note_msg = $e->getMessage();
$_mailerror = true; $_mailerror = true;
} catch (Exception $e) { } catch (Exception $e) {
$mailerr_msg = $e->getMessage(); $note_type = 'danger';
$note_msg = $e->getMessage();
$_mailerror = true; $_mailerror = true;
} }
if (! $_mailerror) { if (!$_mailerror) {
// success // success
$mail->ClearAddresses(); $mail->ClearAddresses();
\Froxlor\UI\Response::standard_success('testmailsent', '', array( Response::standardSuccess('testmailsent', '', [
'filename' => 'admin_settings.php', 'filename' => 'admin_settings.php',
'page' => 'testmail' 'page' => 'testmail'
)); ]);
} }
} else { } else {
// invalid sender e-mail // invalid sender e-mail
$mailerr_msg = "Invalid sender e-mail address: " . Settings::Get('panel.adminmail'); $note_type = 'warning';
$_mailerror = true; $note_msg = "Invalid sender e-mail address: " . Settings::Get('panel.adminmail');
} }
} }
$mail_smtp_user = Settings::Get('system.mail_smtp_user'); $mailtest_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/settings/formfield.settings_mailtest.php';
$mail_smtp_host = Settings::Get('system.mail_smtp_host');
$mail_smtp_port = Settings::Get('system.mail_smtp_port');
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/testmail") . "\";"); UI::view('user/form-note.html.twig', [
'formaction' => $linker->getLink(['section' => 'settings']),
'formdata' => $mailtest_add_data['mailtest'],
'actions_links' => [
[
'href' => $linker->getLink([
'section' => 'settings',
'page' => 'overview',
'part' => 'system',
'em' => 'system_mail_use_smtp'
]),
'label' => lng('admin.smtpsettings'),
'icon' => 'fa-solid fa-gears',
'class' => 'btn-outline-secondary'
]
],
// alert-box
'type' => $note_type,
'alert_msg' => $note_msg
]);
} elseif ($page == 'toggleSettingsMode') {
if ($userinfo['change_serversettings'] == '1') {
$cmode = Settings::Get('panel.settings_mode');
Settings::Set('panel.settings_mode', (int)(!(bool)$cmode));
}
Response::redirectTo($filename);
} }

View File

@@ -2,139 +2,192 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Panel
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'admin');
require './lib/init.php'; const AREA = 'admin';
require __DIR__ . '/lib/init.php';
use Froxlor\Database\Database; use Froxlor\Database\Database;
use Froxlor\FroxlorLogger;
use Froxlor\Language;
use Froxlor\PhpHelper;
use Froxlor\Settings; use Froxlor\Settings;
use Froxlor\UI\HTML;
use Froxlor\UI\Listing;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
use Froxlor\Validate\Validate;
use Froxlor\CurrentUser;
if (isset($_POST['subjectid'])) { $id = (int)Request::any('id');
$subjectid = intval($_POST['subjectid']); $subjectid = intval(Request::any('subjectid'));
$mailbodyid = intval($_POST['mailbodyid']); $mailbodyid = intval(Request::any('mailbodyid'));
} elseif (isset($_GET['subjectid'])) {
$subjectid = intval($_GET['subjectid']);
$mailbodyid = intval($_GET['mailbodyid']);
}
if (isset($_POST['id'])) { $available_templates = [
$id = intval($_POST['id']);
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
$available_templates = array(
'createcustomer', 'createcustomer',
'pop_success', 'pop_success',
'new_database_by_customer', 'new_database_by_customer',
'new_ftpaccount_by_customer', 'new_ftpaccount_by_customer',
'password_reset' 'password_reset'
); ];
// only show templates of features that are enabled #1191 // only show templates of features that are enabled #1191
if ((int) Settings::Get('system.report_enable') == 1) { if ((int)Settings::Get('system.report_enable') == 1) {
array_push($available_templates, 'trafficmaxpercent', 'diskmaxpercent'); array_push($available_templates, 'trafficmaxpercent', 'diskmaxpercent');
} }
if (Settings::Get('panel.sendalternativemail') == 1) {
array_push($available_templates, 'pop_success_alternative');
}
$file_templates = array( $file_templates = [
'index_html' 'index_html'
); ];
$languages = Language::getLanguages();
if ($action == '') { if ($action == '') {
// email templates // email templates
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_templates"); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_templates");
if (Settings::Get('panel.sendalternativemail') == 1) { $templates_array = [];
$available_templates[] = 'pop_success_alternative';
}
$templates_array = array();
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT `id`, `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` SELECT `id`, `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `templategroup`='mails' WHERE `adminid` = :adminid AND `templategroup`='mails'
ORDER BY `language`, `varname`"); ORDER BY `language`, `varname`
Database::pexecute($result_stmt, array( ");
Database::pexecute($result_stmt, [
'adminid' => $userinfo['adminid'] 'adminid' => $userinfo['adminid']
)); ]);
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$parts = array(); $parts = [];
preg_match('/^([a-z]([a-z_]+[a-z])*)_(mailbody|subject)$/', $row['varname'], $parts); preg_match('/^([a-z]([a-z_]+[a-z])*)_(mailbody|subject)$/', $row['varname'], $parts);
$templates_array[$row['language']][$parts[1]][$parts[3]] = $row['id']; $templates_array[$row['language']][$parts[1]][$parts[3]] = $row['id'];
} }
$templates = ''; $templates = [];
foreach ($templates_array as $language => $template_defs) { foreach ($templates_array as $language => $template_defs) {
foreach ($template_defs as $action => $email) { foreach ($template_defs as $action => $email) {
$subjectid = $email['subject']; $templates[] = [
$mailbodyid = $email['mailbody']; 'subjectid' => $email['subject'],
$template = $lng['admin']['templates'][$action]; 'mailbodyid' => $email['mailbody'],
eval("\$templates.=\"" . \Froxlor\UI\Template::getTemplate("templates/templates_template") . "\";"); 'template' => lng('admin.templates.' . $action),
'language' => $language
];
} }
} }
$add = false; $mail_actions_links = false;
foreach ($languages as $language_file => $language_name) { foreach ($languages as $language_file => $language_name) {
$templates_done = [];
$templates_done = array();
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `language`= :lang WHERE `adminid` = :adminid AND `language`= :lang
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'"); AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'
Database::pexecute($result_stmt, array( ");
Database::pexecute($result_stmt, [
'adminid' => $userinfo['adminid'], 'adminid' => $userinfo['adminid'],
'lang' => $language_name 'lang' => $language_name
)); ]);
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$templates_done[] = str_replace('_subject', '', $row['varname']); $templates_done[] = str_replace('_subject', '', $row['varname']);
} }
if (count(array_diff($available_templates, $templates_done)) > 0) { if (count(array_diff($available_templates, $templates_done)) > 0) {
$add = true; $mail_actions_links = [
[
'href' => $linker->getLink(['section' => 'templates', 'page' => $page, 'action' => 'add']),
'label' => lng('admin.templates.template_add')
]
];
} }
} }
$mailtpl_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.mailtemplates.php';
$collection_mail = [
'data' => $templates,
'pagination' => []
];
// filetemplates // filetemplates
$filetemplates = '';
$filetemplateadd = false;
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `templategroup`='files'"); WHERE `adminid` = :adminid AND `templategroup`='files'");
Database::pexecute($result_stmt, array( Database::pexecute($result_stmt, [
'adminid' => $userinfo['adminid'] 'adminid' => $userinfo['adminid']
)); ]);
if (Database::num_rows() != count($file_templates)) {
$filetemplateadd = true;
}
$filetemplates = [];
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
eval("\$filetemplates.=\"" . \Froxlor\UI\Template::getTemplate("templates/templates_filetemplate") . "\";"); $filetemplates[] = [
'id' => $row['id'],
'template' => lng('admin.templates.' . $row['varname'])
];
} }
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/templates") . "\";");
$file_actions_links = false;
if (Database::num_rows() != count($file_templates)) {
$file_actions_links = [
[
'href' => $linker->getLink([
'section' => 'templates',
'page' => $page,
'action' => 'add',
'files' => 'files'
]),
'label' => lng('admin.templates.template_fileadd')
]
];
}
$filetpl_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.filetemplates.php';
$collection_file = [
'data' => $filetemplates,
'pagination' => []
];
if ($mail_actions_links === false) {
$mail_actions_links = [];
}
if ($file_actions_links === false) {
$file_actions_links = [];
}
UI::view('user/table-tpl.html.twig', [
'maillisting' => Listing::formatFromArray($collection_mail, $mailtpl_list_data['mailtpl_list'], 'mailtpl_list'),
'filelisting' => Listing::formatFromArray($collection_file, $filetpl_list_data['filetpl_list'], 'filetpl_list'),
'actions_links' => array_merge($mail_actions_links, $file_actions_links)
]);
} elseif ($action == 'delete' && $subjectid != 0 && $mailbodyid != 0) { } elseif ($action == 'delete' && $subjectid != 0 && $mailbodyid != 0) {
// email templates // email templates
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` SELECT `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :id"); WHERE `adminid` = :adminid AND `id` = :id");
Database::pexecute($result_stmt, array( Database::pexecute($result_stmt, [
'adminid' => $userinfo['adminid'], 'adminid' => $userinfo['adminid'],
'id' => $subjectid 'id' => $subjectid
)); ]);
$result = $result_stmt->fetch(PDO::FETCH_ASSOC); $result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if ($result['varname'] != '') { if ($result['varname'] != '') {
@@ -143,23 +196,22 @@ if ($action == '') {
DELETE FROM `" . TABLE_PANEL_TEMPLATES . "` DELETE FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid WHERE `adminid` = :adminid
AND (`id` = :ida OR `id` = :idb)"); AND (`id` = :ida OR `id` = :idb)");
Database::pexecute($del_stmt, array( Database::pexecute($del_stmt, [
'adminid' => $userinfo['adminid'], 'adminid' => $userinfo['adminid'],
'ida' => $subjectid, 'ida' => $subjectid,
'idb' => $mailbodyid 'idb' => $mailbodyid
)); ]);
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "deleted template '" . $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])] . "'"); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_INFO, "deleted template '" . $result['language'] . ' - ' . lng('admin.templates.' . str_replace('_subject', '', $result['varname'])) . "'");
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
\Froxlor\UI\HTML::askYesNo('admin_template_reallydelete', $filename, array( HTML::askYesNo('admin_template_reallydelete', $filename, [
'subjectid' => $subjectid, 'subjectid' => $subjectid,
'mailbodyid' => $mailbodyid, 'mailbodyid' => $mailbodyid,
'page' => $page, 'page' => $page,
'action' => $action 'action' => $action
), $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])]); ], $result['language'] . ' - ' . lng('admin.templates.' . str_replace('_subject', '', $result['varname'])));
} }
} }
} elseif ($action == 'deletef' && $id != 0) { } elseif ($action == 'deletef' && $id != 0) {
@@ -167,94 +219,95 @@ if ($action == '') {
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "` SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :id"); WHERE `adminid` = :adminid AND `id` = :id");
Database::pexecute($result_stmt, array( Database::pexecute($result_stmt, [
'adminid' => $userinfo['adminid'], 'adminid' => $userinfo['adminid'],
'id' => $id 'id' => $id
)); ]);
if (Database::num_rows() > 0) { if (Database::num_rows() > 0) {
$row = $result_stmt->fetch(PDO::FETCH_ASSOC); $row = $result_stmt->fetch(PDO::FETCH_ASSOC);
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$del_stmt = Database::prepare(" $del_stmt = Database::prepare("
DELETE FROM `" . TABLE_PANEL_TEMPLATES . "` DELETE FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :id"); WHERE `adminid` = :adminid AND `id` = :id");
Database::pexecute($del_stmt, array( Database::pexecute($del_stmt, [
'adminid' => $userinfo['adminid'], 'adminid' => $userinfo['adminid'],
'id' => $id 'id' => $id
)); ]);
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "deleted template '" . $lng['admin']['templates'][$row['varname']] . "'"); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_INFO, "deleted template '" . lng('admin.templates.' . $row['varname']) . "'");
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
\Froxlor\UI\HTML::askYesNo('admin_template_reallydelete', $filename, array( HTML::askYesNo('admin_template_reallydelete', $filename, [
'id' => $id, 'id' => $id,
'page' => $page, 'page' => $page,
'action' => $action 'action' => $action
), $lng['admin']['templates'][$row['varname']]); ], lng('admin.templates.' . $row['varname']));
} }
} else { } else {
\Froxlor\UI\Response::standard_error('templatenotfound'); Response::standardError('templatenotfound');
} }
} elseif ($action == 'add') { } elseif ($action == 'add') {
if (Settings::Get('panel.sendalternativemail') == 1) {
$available_templates[] = 'pop_success_alternative';
}
if (isset($_POST['prepare']) && $_POST['prepare'] == 'prepare') { if (isset($_POST['prepare']) && $_POST['prepare'] == 'prepare') {
// email templates // email templates
$language = htmlentities(\Froxlor\Validate\Validate::validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect')); $language = htmlentities(Validate::validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect'));
$template = \Froxlor\Validate\Validate::validate($_POST['template'], 'template'); $template = Validate::validate($_POST['template'], 'template');
$lng_bak = $lng; $result_stmt = Database::prepare("
foreach ($langs['English'] as $key => $value) { SELECT COUNT(*) as def FROM `" . TABLE_PANEL_TEMPLATES . "`
include_once \Froxlor\FileDir::makeSecurePath($value['file']); WHERE `adminid` = :adminid AND `language` = :lang
} AND `templategroup` = 'mails' AND `varname` LIKE :template
if ($language != 'English') { ");
foreach ($langs[$language] as $key => $value) { $result = Database::pexecute_first($result_stmt, [
include \Froxlor\FileDir::makeSecurePath($value['file']); 'adminid' => $userinfo['adminid'],
} 'lang' => $language,
'template' => $template . '%'
]);
if ($result && $result['def'] > 0) {
Response::standardError('templatelanguagecombodefined');
} }
$subject = $lng['mails'][$template]['subject']; // set target language
$body = str_replace('\n', "\n", $lng['mails'][$template]['mailbody']); Language::setLanguage($language);
$lng = $lng_bak; $subject = lng('mails.' . $template . '.subject');
$body = str_replace('\n', "\n", lng('mails.' . $template . '.mailbody'));
// re set language to user
Language::setLanguage(CurrentUser::getField('def_language'));
$template_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/templates/formfield.template_add.php'; $template_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/templates/formfield.template_add.php';
$template_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($template_add_data);
$title = $template_add_data['template_add']['title']; UI::view('user/form-replacers.html.twig', [
$image = $template_add_data['template_add']['image']; 'formaction' => $linker->getLink(['section' => 'templates']),
'formdata' => $template_add_data['template_add'],
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/templates_add_2") . "\";"); 'replacers' => $template_add_data['template_replacers']
} elseif (isset($_POST['send']) && $_POST['send'] == 'send') { ]);
} elseif (isset($_POST['send']) && $_POST['send'] == 'send' && !isset($_POST['filesend'])) {
// email templates // email templates
$language = htmlentities(\Froxlor\Validate\Validate::validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect')); $language = htmlentities(Validate::validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect'));
$template = \Froxlor\Validate\Validate::validate($_POST['template'], 'template'); $template = Validate::validate($_POST['template'], 'template');
$subject = \Froxlor\Validate\Validate::validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate'); $subject = Validate::validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate');
$mailbody = \Froxlor\Validate\Validate::validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate'); $mailbody = Validate::validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate');
$templates = array(); $templates = [];
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `language` = :lang WHERE `adminid` = :adminid AND `language` = :lang
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'"); AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'");
Database::pexecute($result_stmt, array( Database::pexecute($result_stmt, [
'adminid' => $userinfo['adminid'], 'adminid' => $userinfo['adminid'],
'lang' => $language 'lang' => $language
)); ]);
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$templates[] = str_replace('_subject', '', $row['varname']); $templates[] = str_replace('_subject', '', $row['varname']);
} }
$templates = array_diff($available_templates, $templates); $templates = array_diff($available_templates, $templates);
if (array_search($template, $templates) === false) { if (!in_array($template, $templates)) {
\Froxlor\UI\Response::standard_error('templatenotfound'); Response::standardError('templatenotfound');
} else { } else {
$ins_stmt = Database::prepare(" $ins_stmt = Database::prepare("
INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` SET INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` SET
@@ -265,33 +318,32 @@ if ($action == '') {
`value` = :value"); `value` = :value");
// mail-subject // mail-subject
$ins_data = array( $ins_data = [
'adminid' => $userinfo['adminid'], 'adminid' => $userinfo['adminid'],
'lang' => $language, 'lang' => $language,
'var' => $template . '_subject', 'var' => $template . '_subject',
'value' => $subject 'value' => $subject
); ];
Database::pexecute($ins_stmt, $ins_data); Database::pexecute($ins_stmt, $ins_data);
// mail-body // mail-body
$ins_data = array( $ins_data = [
'adminid' => $userinfo['adminid'], 'adminid' => $userinfo['adminid'],
'lang' => $language, 'lang' => $language,
'var' => $template . '_mailbody', 'var' => $template . '_mailbody',
'value' => $mailbody 'value' => $mailbody
); ];
Database::pexecute($ins_stmt, $ins_data); Database::pexecute($ins_stmt, $ins_data);
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "added template '" . $language . ' - ' . $template . "'"); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_INFO, "added template '" . $language . ' - ' . $template . "'");
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} }
} elseif (isset($_POST['filesend']) && $_POST['filesend'] == 'filesend') { } elseif (isset($_POST['filesend']) && $_POST['filesend'] == 'filesend') {
// file templates // file templates
$template = \Froxlor\Validate\Validate::validate($_POST['template'], 'template'); $template = Validate::validate($_POST['template'], 'template');
$filecontent = \Froxlor\Validate\Validate::validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset'); $filecontent = Validate::validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset');
$ins_stmt = Database::prepare(" $ins_stmt = Database::prepare("
INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` SET INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` SET
@@ -301,35 +353,33 @@ if ($action == '') {
`varname` = :var, `varname` = :var,
`value` = :value"); `value` = :value");
$ins_data = array( $ins_data = [
'adminid' => $userinfo['adminid'], 'adminid' => $userinfo['adminid'],
'var' => $template, 'var' => $template,
'value' => $filecontent 'value' => $filecontent
); ];
Database::pexecute($ins_stmt, $ins_data); Database::pexecute($ins_stmt, $ins_data);
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "added template '" . $template . "'"); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_INFO, "added template '" . $template . "'");
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
)); } elseif (!isset($_GET['files'])) {
} elseif (! isset($_GET['files'])) {
// email templates // email templates
$add = false; $add = false;
$language_options = ''; $language_options = [];
$template_options = ''; $template_options = [];
foreach ($languages as $language_file => $language_name) { foreach ($languages as $language_file => $language_name) {
$templates = array(); $templates = [];
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `language` = :lang WHERE `adminid` = :adminid AND `language` = :lang
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'"); AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'");
Database::pexecute($result_stmt, array( Database::pexecute($result_stmt, [
'adminid' => $userinfo['adminid'], 'adminid' => $userinfo['adminid'],
'lang' => $language_name 'lang' => $language_name
)); ]);
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$templates[] = str_replace('_subject', '', $row['varname']); $templates[] = str_replace('_subject', '', $row['varname']);
@@ -337,52 +387,81 @@ if ($action == '') {
if (count(array_diff($available_templates, $templates)) > 0) { if (count(array_diff($available_templates, $templates)) > 0) {
$add = true; $add = true;
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $userinfo['language'], true, true); $language_options[$language_file] = $language_name;
$templates = array_diff($available_templates, $templates); $templates = array_diff($available_templates, $templates);
foreach ($templates as $template) { foreach ($templates as $template) {
$template_options .= \Froxlor\UI\HTML::makeoption($lng['admin']['templates'][$template], $template, NULL, true, true, $language_file) . "\n"; $template_options[$template] = lng('admin.templates.' . $template);
} }
} }
} }
if ($add) { if ($add) {
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/templates_add_1") . "\";"); UI::view('user/form.html.twig', [
'formaction' => $linker->getLink(['section' => 'templates']),
'formdata' => [
'title' => lng('admin.templates.template_add'),
'image' => 'fa-solid fa-plus',
'self_overview' => ['section' => 'templates', 'page' => 'email'],
'sections' => [
'section_a' => [
'title' => lng('admin.templates.template_add'),
'fields' => [
'language' => [
'label' => lng('login.language'),
'type' => 'select',
'select_var' => $language_options,
'selected' => $userinfo['language']
],
'template' => [
'label' => lng('admin.templates.action'),
'type' => 'select',
'select_var' => $template_options
],
'prepare' => [
'type' => 'hidden',
'value' => 'prepare'
]
]
]
]
],
'editid' => $id
]);
} else { } else {
\Froxlor\UI\Response::standard_error('alltemplatesdefined'); Response::standardError('alltemplatesdefined');
} }
} else { } else {
// filetemplates // filetemplates
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `templategroup`='files'"); WHERE `adminid` = :adminid AND `templategroup`='files'");
Database::pexecute($result_stmt, array( Database::pexecute($result_stmt, [
'adminid' => $userinfo['adminid'] 'adminid' => $userinfo['adminid']
)); ]);
if (Database::num_rows() == count($file_templates)) { if (Database::num_rows() == count($file_templates)) {
\Froxlor\UI\Response::standard_error('alltemplatesdefined'); Response::standardError('alltemplatesdefined');
} else { } else {
$templatesdefined = [];
$templatesdefined = array(); $free_templates = [];
$free_templates = '';
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$templatesdefined[] = $row['varname']; $templatesdefined[] = $row['varname'];
} }
foreach (array_diff($file_templates, $templatesdefined) as $template) { foreach (array_diff($file_templates, $templatesdefined) as $template) {
$free_templates .= \Froxlor\UI\HTML::makeoption($lng['admin']['templates'][$template], $template, '', true); $free_templates[$template] = lng('admin.templates.' . $template);
} }
$filetemplate_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/templates/formfield.filetemplate_add.php'; $filetemplate_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/templates/formfield.filetemplate_add.php';
$filetemplate_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($filetemplate_add_data);
$title = $filetemplate_add_data['filetemplate_add']['title']; UI::view('user/form-replacers.html.twig', [
$image = $filetemplate_add_data['filetemplate_add']['image']; 'formaction' => $linker->getLink(['section' => 'templates']),
'formdata' => $filetemplate_add_data['filetemplate_add'],
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/filetemplates_add") . "\";"); 'replacers' => $filetemplate_add_data['filetemplate_replacers']
]);
} }
} }
} elseif ($action == 'edit' && $subjectid != 0 && $mailbodyid != 0) { } elseif ($action == 'edit' && $subjectid != 0 && $mailbodyid != 0) {
@@ -390,68 +469,65 @@ if ($action == '') {
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT `language`, `varname`, `value` FROM `" . TABLE_PANEL_TEMPLATES . "` SELECT `language`, `varname`, `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :subjectid"); WHERE `adminid` = :adminid AND `id` = :subjectid");
Database::pexecute($result_stmt, array( Database::pexecute($result_stmt, [
'adminid' => $userinfo['adminid'], 'adminid' => $userinfo['adminid'],
'subjectid' => $subjectid 'subjectid' => $subjectid
)); ]);
$result = $result_stmt->fetch(PDO::FETCH_ASSOC); $result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if ($result['varname'] != '') { if ($result['varname'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$subject = \Froxlor\Validate\Validate::validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate'); $subject = Validate::validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate');
$mailbody = \Froxlor\Validate\Validate::validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate'); $mailbody = Validate::validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate');
$upd_stmt = Database::prepare(" $upd_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET
`value` = :value `value` = :value
WHERE `adminid` = :adminid AND `id` = :id"); WHERE `adminid` = :adminid AND `id` = :id");
// subject // subject
Database::pexecute($upd_stmt, array( Database::pexecute($upd_stmt, [
'value' => $subject, 'value' => $subject,
'adminid' => $userinfo['adminid'], 'adminid' => $userinfo['adminid'],
'id' => $subjectid 'id' => $subjectid
)); ]);
// same query but mailbody // same query but mailbody
Database::pexecute($upd_stmt, array( Database::pexecute($upd_stmt, [
'value' => $mailbody, 'value' => $mailbody,
'adminid' => $userinfo['adminid'], 'adminid' => $userinfo['adminid'],
'id' => $mailbodyid 'id' => $mailbodyid
)); ]);
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "edited template '" . $result['varname'] . "'"); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_INFO, "edited template '" . $result['varname'] . "'");
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
$result = PhpHelper::htmlentitiesArray($result);
$result = \Froxlor\PhpHelper::htmlentitiesArray($result); $template_name = lng('admin.templates.' . str_replace('_subject', '', $result['varname']));
$template = $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])];
$subject = $result['value']; $subject = $result['value'];
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT `language`, `varname`, `value` SELECT `language`, `varname`, `value`
FROM `" . TABLE_PANEL_TEMPLATES . "` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `id` = :id"); WHERE `id` = :id");
Database::pexecute($result_stmt, array( Database::pexecute($result_stmt, [
'id' => $mailbodyid 'id' => $mailbodyid
)); ]);
$result = $result_stmt->fetch(PDO::FETCH_ASSOC); $result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$template_name = str_replace('_mailbody', '', $result['varname']); $template = str_replace('_mailbody', '', $result['varname']);
// don't escape the already escaped language-string so save up before htmlentities() // don't escape the already escaped language-string so save up before htmlentities()
$language = $result['language']; $language = $result['language'];
$result = \Froxlor\PhpHelper::htmlentitiesArray($result); $result = PhpHelper::htmlentitiesArray($result);
$mailbody = $result['value']; $mailbody = $result['value'];
$template_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/templates/formfield.template_edit.php'; $template_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/templates/formfield.template_edit.php';
$template_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($template_edit_data);
$title = $template_edit_data['template_edit']['title']; UI::view('user/form-replacers.html.twig', [
$image = $template_edit_data['template_edit']['image']; 'formaction' => $linker->getLink(['section' => 'templates']),
'formdata' => $template_edit_data['template_edit'],
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/templates_edit") . "\";"); 'replacers' => $template_edit_data['template_replacers']
]);
} }
} }
} elseif ($action == 'editf' && $id != 0) { } elseif ($action == 'editf' && $id != 0) {
@@ -459,45 +535,44 @@ if ($action == '') {
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "` SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :id"); WHERE `adminid` = :adminid AND `id` = :id");
Database::pexecute($result_stmt, array( Database::pexecute($result_stmt, [
'adminid' => $userinfo['adminid'], 'adminid' => $userinfo['adminid'],
'id' => $id 'id' => $id
)); ]);
if (Database::num_rows() > 0) { if (Database::num_rows() > 0) {
$row = $result_stmt->fetch(PDO::FETCH_ASSOC); $row = $result_stmt->fetch(PDO::FETCH_ASSOC);
// filetemplates // filetemplates
if (isset($_POST['filesend']) && $_POST['filesend'] == 'filesend') { if (isset($_POST['filesend']) && $_POST['filesend'] == 'filesend') {
$filecontent = \Froxlor\Validate\Validate::validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset'); $filecontent = Validate::validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset');
$upd_stmt = Database::prepare(" $upd_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET
`value` = :value `value` = :value
WHERE `adminid` = :adminid AND `id` = :id"); WHERE `adminid` = :adminid AND `id` = :id");
Database::pexecute($upd_stmt, array( Database::pexecute($upd_stmt, [
'value' => $filecontent, 'value' => $filecontent,
'adminid' => $userinfo['adminid'], 'adminid' => $userinfo['adminid'],
'id' => $id 'id' => $id
)); ]);
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "edited template '" . $row['varname'] . "'"); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_INFO, "edited template '" . $row['varname'] . "'");
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
$row = \Froxlor\PhpHelper::htmlentitiesArray($row); $row = PhpHelper::htmlentitiesArray($row);
$filetemplate_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/templates/formfield.filetemplate_edit.php'; $filetemplate_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/templates/formfield.filetemplate_edit.php';
$filetemplate_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($filetemplate_edit_data);
$title = $filetemplate_edit_data['filetemplate_edit']['title']; UI::view('user/form-replacers.html.twig', [
$image = $filetemplate_edit_data['filetemplate_edit']['image']; 'formaction' => $linker->getLink(['section' => 'templates']),
'formdata' => $filetemplate_edit_data['filetemplate_edit'],
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/filetemplates_edit") . "\";"); 'replacers' => $filetemplate_edit_data['filetemplate_replacers'],
'editid' => $id
]);
} }
} else { } else {
\Froxlor\UI\Response::standard_error('templatenotfound'); Response::standardError('templatenotfound');
} }
} }

View File

@@ -2,134 +2,47 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Morton Jonuschat <m.jonuschat@chrome-it.de> * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @package Panel * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'admin');
require './lib/init.php';
use Froxlor\Database\Database; const AREA = 'admin';
use Froxlor\Settings; require __DIR__ . '/lib/init.php';
if (isset($_POST['id'])) { use Froxlor\Traffic\Traffic;
$id = intval($_POST['id']); use Froxlor\UI\Panel\UI;
} elseif (isset($_GET['id'])) { use Froxlor\UI\Request;
$id = intval($_GET['id']); use Froxlor\UI\Response;
}
$months = array( $range = Request::any('range', 'currentmonth');
'0' => 'empty',
'1' => 'jan',
'2' => 'feb',
'3' => 'mar',
'4' => 'apr',
'5' => 'may',
'6' => 'jun',
'7' => 'jul',
'8' => 'aug',
'9' => 'sep',
'10' => 'oct',
'11' => 'nov',
'12' => 'dec'
);
if ($page == 'overview' || $page == 'customers') { if ($page == 'overview' || $page == 'customers') {
try {
$customerview = 1; $context = Traffic::getCustomerStats($userinfo, $range);
$stats_tables = ''; } catch (Exception $e) {
$minyear_stmt = Database::query("SELECT `year` FROM `" . TABLE_PANEL_TRAFFIC . "` ORDER BY `year` ASC LIMIT 1"); if ($e->getCode() === 405) {
$minyear = $minyear_stmt->fetch(PDO::FETCH_ASSOC); Response::dynamicError(lng('traffic.nocustomers'));
}
if (! isset($minyear['year']) || $minyear['year'] == 0) { Response::dynamicError($e->getMessage());
$maxyears = 0;
} else {
$maxyears = date("Y") - $minyear['year'];
} }
for ($years = 0; $years <= $maxyears; $years ++) { // pass metrics to the view
UI::view('user/traffic.html.twig', $context);
$overview['year'] = date("Y") - $years;
$overview['type'] = $lng['traffic']['customer'];
$domain_list = '';
$totals = array(
'jan' => 0,
'feb' => 0,
'mar' => 0,
'apr' => 0,
'may' => 0,
'jun' => 0,
'jul' => 0,
'aug' => 0,
'sep' => 0,
'oct' => 0,
'nov' => 0,
'dec' => 0
);
$customer_name_list_stmt = Database::prepare("
SELECT `customerid`,`company`,`name`,`firstname`
FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE `deactivated`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :id") . "
ORDER BY name");
Database::pexecute($customer_name_list_stmt, array(
'id' => $userinfo['adminid']
));
while ($customer_name = $customer_name_list_stmt->fetch(PDO::FETCH_ASSOC)) {
$virtual_host = array(
'name' => ($customer_name['company'] == '' ? $customer_name['name'] . ", " . $customer_name['firstname'] : $customer_name['company']),
'customerid' => $customer_name['customerid'],
'jan' => '-',
'feb' => '-',
'mar' => '-',
'apr' => '-',
'may' => '-',
'jun' => '-',
'jul' => '-',
'aug' => '-',
'sep' => '-',
'oct' => '-',
'nov' => '-',
'dec' => '-'
);
$traffic_list_stmt = Database::prepare("
SELECT month, SUM(http+ftp_up+ftp_down+mail)*1024 AS traffic
FROM `" . TABLE_PANEL_TRAFFIC . "`
WHERE year = :year AND `customerid` = :id
GROUP BY month ORDER BY month");
Database::pexecute($traffic_list_stmt, array(
'year' => (date("Y") - $years),
'id' => $customer_name['customerid']
));
while ($traffic_month = $traffic_list_stmt->fetch(PDO::FETCH_ASSOC)) {
$virtual_host[$months[(int) $traffic_month['month']]] = \Froxlor\PhpHelper::sizeReadable($traffic_month['traffic'], 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
$totals[$months[(int) $traffic_month['month']]] += $traffic_month['traffic'];
}
eval("\$domain_list .= sprintf(\"%s\", \"" . \Froxlor\UI\Template::getTemplate("traffic/index_table_row") . "\");");
}
// sum up totals
$virtual_host = array(
'name' => $lng['traffic']['months']['total']
);
foreach ($totals as $month => $bytes) {
$virtual_host[$month] = ($bytes == 0 ? '-' : \Froxlor\PhpHelper::sizeReadable($bytes, 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s'));
}
$customerview = 0;
eval("\$total_list = sprintf(\"%s\", \"" . \Froxlor\UI\Template::getTemplate("traffic/index_table_row") . "\");");
eval("\$stats_tables .= sprintf(\"%s\", \"" . \Froxlor\UI\Template::getTemplate("traffic/index_table") . "\");");
}
eval("echo \"" . \Froxlor\UI\Template::getTemplate("traffic/index") . "\";");
} }

View File

@@ -4,109 +4,113 @@
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Froxlor team <team@froxlor.org> (2010-) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @package Panel * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'admin');
require './lib/init.php';
use Froxlor\Database\Database; const AREA = 'admin';
require __DIR__ . '/lib/init.php';
use Froxlor\Cron\TaskId;
use Froxlor\Froxlor;
use Froxlor\FroxlorLogger;
use Froxlor\Install\Preconfig;
use Froxlor\Install\Update;
use Froxlor\Settings; use Froxlor\Settings;
use Froxlor\System\Cronjob;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Response;
use Froxlor\User;
if ($page == 'overview') { if ($page == 'overview') {
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_updates"); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_updates");
/** if (!Froxlor::isFroxlor()) {
* this is a dirty hack but syscp 1.4.2.1 does not throw new Exception('SysCP/customized upgrades are not supported');
* have any version/dbversion in the database (don't know why)
* so we have to set them both to run a correct upgrade
*/
if (! \Froxlor\Froxlor::isFroxlor()) {
if (Settings::Get('panel.version') == null || Settings::Get('panel.version') == '') {
Settings::Set('panel.version', '1.4.2.1');
}
if (Settings::Get('system.dbversion') == null || Settings::Get('system.dbversion') == '') {
/**
* for syscp-stable (1.4.2.1) this value has to be 0
* so the required table-fields are added correctly
* and the svn-version has its value in the database
* -> bug #54
*/
$result_stmt = Database::query("
SELECT `value` FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'dbversion'");
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if (isset($result['value'])) {
Settings::Set('system.dbversion', (int) $result['value'], false);
} else {
Settings::Set('system.dbversion', 0, false);
}
}
} }
if (\Froxlor\Froxlor::hasDbUpdates() || \Froxlor\Froxlor::hasUpdates()) { if (Froxlor::hasDbUpdates() || Froxlor::hasUpdates()) {
$successful_update = false; $successful_update = false;
$message = ''; $message = '';
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
if ((isset($_POST['update_preconfig']) && isset($_POST['update_changesagreed']) && intval($_POST['update_changesagreed']) != 0) || ! isset($_POST['update_preconfig'])) { if ((isset($_POST['update_preconfig']) && isset($_POST['update_changesagreed']) && intval($_POST['update_changesagreed']) != 0) || !isset($_POST['update_preconfig'])) {
eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/update_start') . "\";"); include_once Froxlor::getInstallDir() . 'install/updatesql.php';
include_once \Froxlor\Froxlor::getInstallDir() . 'install/updatesql.php'; User::updateCounters();
Cronjob::inserttask(TaskId::REBUILD_VHOST);
@chmod(Froxlor::getInstallDir() . '/lib/userdata.inc.php', 0400);
$redirect_url = 'admin_index.php?s=' . $s; UI::view('install/update.html.twig', [
eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/update_end') . "\";"); 'checks' => Update::getUpdateTasks()
]);
\Froxlor\User::updateCounters(); exit;
\Froxlor\System\Cronjob::inserttask('1');
@chmod(\Froxlor\Froxlor::getInstallDir() . '/lib/userdata.inc.php', 0440);
$successful_update = true;
} else { } else {
$message = '<br /><strong class="red">You have to agree that you have read the update notifications.</strong>'; $message = '<br><br><strong>You have to agree that you have read the update notifications.</strong>';
} }
} }
if (! $successful_update) {
$current_version = Settings::Get('panel.version'); $current_version = Settings::Get('panel.version');
$current_db_version = Settings::Get('panel.db_version'); $current_db_version = Settings::Get('panel.db_version');
if (empty($current_db_version)) { if (empty($current_db_version)) {
$current_db_version = "0"; $current_db_version = "0";
} }
$new_version = $version; $new_version = Froxlor::VERSION;
$new_db_version = $dbversion; $new_db_version = Froxlor::DBVERSION;
$ui_text = $lng['update']['update_information']['part_a']; if (Froxlor::VERSION != $current_version) {
if ($version != $current_version) { $replacer_currentversion = $current_version;
$ui_text = str_replace('%curversion', $current_version, $ui_text); $replacer_newversion = $new_version;
$ui_text = str_replace('%newversion', $new_version, $ui_text);
} else { } else {
// show db version // show db version
$ui_text = str_replace('%curversion', $current_db_version, $ui_text); $replacer_currentversion = $current_db_version;
$ui_text = str_replace('%newversion', $new_db_version, $ui_text); $replacer_newversion = $new_db_version;
} }
$update_information = $ui_text; $ui_text = lng('update.update_information.part_a', [$replacer_newversion, $replacer_currentversion]);
$ui_text .= lng('update.update_information.part_b');
include_once \Froxlor\Froxlor::getInstallDir() . '/install/updates/preconfig.php'; $upd_formfield = [
$preconfig = getPreConfig($current_version, $current_db_version); 'updates' => [
if ($preconfig != '') { 'title' => lng('update.update'),
$update_information .= '<br />' . $preconfig . $message; 'image' => 'fa-solid fa-download',
'description' => lng('update.description'),
'sections' => [],
'buttons' => [
[
'label' => lng('update.proceed')
]
]
]
];
$preconfig = Preconfig::getPreConfig();
if (!empty($preconfig)) {
$upd_formfield['updates']['sections'] = $preconfig;
} }
$update_information .= $lng['update']['update_information']['part_b']; UI::view('user/form-note.html.twig', [
'formaction' => $linker->getLink(['section' => 'updates']),
eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/index') . "\";"); 'formdata' => $upd_formfield['updates'],
} // alert
'type' => !empty($message) ? 'danger' : 'info',
'alert_msg' => $ui_text . $message
]);
} else { } else {
$success_message = $lng['update']['noupdatesavail']; Response::standardSuccess('update.noupdatesavail', Settings::Get('system.update_channel') == 'testing' ? lng('serversettings.uc_testing') . ' ' : '');
$redirect_url = 'admin_index.php?s=' . $s;
eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/noupdatesavail') . "\";");
} }
} }

102
api.php
View File

@@ -1,74 +1,44 @@
<?php <?php
require __DIR__ . '/vendor/autoload.php';
require \Froxlor\Froxlor::getInstallDir() . '/lib/tables.inc.php';
// check whether API interface is enabled after all
if (\Froxlor\Settings::Get('api.enabled') != 1) {
// not enabled
header("Status: 404 Not found", 404);
header($_SERVER["SERVER_PROTOCOL"] . " 404 Not found", 404);
exit();
}
// we're talking json here
header("Content-Type:application/json");
// get our request
$request = @file_get_contents('php://input');
// check if present
if (empty($request)) {
json_response(400, "Invalid request");
}
// decode json request
$decoded_request = json_decode(stripslashes($request), true);
// is it valid?
if (is_null($decoded_request)) {
json_response(400, "Invalid JSON");
}
// validate content
try {
$request = \Froxlor\Api\FroxlorRPC::validateRequest($decoded_request);
// now actually do it
$cls = "\\Froxlor\\Api\\Commands\\" . $request['command']['class'];
$method = $request['command']['method'];
$apiObj = new $cls($decoded_request['header'], $request['params']);
// call the method with the params if any
echo $apiObj->$method();
} catch (Exception $e) {
json_response($e->getCode(), $e->getMessage());
}
exit();
/** /**
* output json result * This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
* *
* @param int $status * This program is free software; you can redistribute it and/or
* @param string $status_message * modify it under the terms of the GNU General Public License
* @param mixed $data * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @return void * This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
function json_response($status, $status_message = '', $data = null)
{
if (isset($_SERVER["SERVER_PROTOCOL"]) && ! empty($_SERVER["SERVER_PROTOCOL"])) {
$resheader = $_SERVER["SERVER_PROTOCOL"] . " " . $status;
if (! empty($status_message)) {
$resheader .= ' ' . str_replace("\n", " ", $status_message);
}
header($resheader);
}
$response = array();
$response['status'] = $status;
$response['status_message'] = $status_message;
$response['data'] = $data;
$json_response = json_encode($response, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT); use Froxlor\Api\Api;
echo $json_response; use Froxlor\Api\Response;
exit();
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/lib/functions.php';
require __DIR__ . '/lib/tables.inc.php';
// set error-handler
@set_error_handler([
'\\Froxlor\\Api\\Api',
'phpErrHandler'
]);
// Return response
try {
echo (new Api)->formatMiddleware(@file_get_contents('php://input'))->handle();
} catch (Exception $e) {
echo Response::jsonErrorResponse($e->getMessage(), $e->getCode());
} }

View File

@@ -1,38 +1,67 @@
<?php <?php
if (! defined('AREA')) {
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/
if (!defined('AREA')) {
header("Location: index.php"); header("Location: index.php");
exit(); exit();
} }
/**
* This file is part of the Froxlor project.
* Copyright (c) 2018 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> (2018-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
* @since 0.10.0
*
*/
use Froxlor\Database\Database; use Froxlor\Database\Database;
use Froxlor\FroxlorLogger;
use Froxlor\UI\HTML;
use Froxlor\UI\Listing;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
// redirect if this customer has no permission for API usage
if ($userinfo['adminsession'] == 0 && $userinfo['api_allowed'] == 0) {
Response::redirectTo('customer_index.php');
}
// redirect if this admin has no permission for API usage
if ($userinfo['adminsession'] == 1 && $userinfo['api_allowed'] == 0) {
Response::redirectTo('admin_index.php');
}
// This file is being included in admin_index and customer_index // This file is being included in admin_index and customer_index
// and therefore does not need to require lib/init.php // and therefore does not need to require lib/init.php
$del_stmt = Database::prepare("DELETE FROM `" . TABLE_API_KEYS . "` WHERE id = :id"); $del_stmt = Database::prepare("DELETE FROM `" . TABLE_API_KEYS . "` WHERE id = :id");
$success_message = ""; $id = (int)Request::any('id');
$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
$area = AREA;
// do the delete and then just show a success-message and the apikeys list again // do the delete and then just show a success-message and the apikeys list again
if ($action == 'delete') { if ($action == 'delete' && $id > 0) {
if ($id > 0) { HTML::askYesNo('apikey_reallydelete', $filename, [
'id' => $id,
'page' => $page,
'action' => 'deletesure'
], '', [
'section' => 'index',
'page' => $page
]);
} elseif (isset($_POST['send']) && $_POST['send'] == 'send' && $action == 'deletesure' && $id > 0) {
$chk = (AREA == 'admin' && $userinfo['customers_see_all'] == '1') ? true : false; $chk = (AREA == 'admin' && $userinfo['customers_see_all'] == '1') ? true : false;
if (AREA == 'customer') { if (AREA == 'customer') {
$chk_stmt = Database::prepare(" $chk_stmt = Database::prepare("
@@ -40,29 +69,32 @@ if ($action == 'delete') {
LEFT JOIN `" . TABLE_API_KEYS . "` ak ON ak.customerid = c.customerid LEFT JOIN `" . TABLE_API_KEYS . "` ak ON ak.customerid = c.customerid
WHERE ak.`id` = :id AND c.`customerid` = :cid WHERE ak.`id` = :id AND c.`customerid` = :cid
"); ");
$chk = Database::pexecute_first($chk_stmt, array( $chk = Database::pexecute_first($chk_stmt, [
'id' => $id, 'id' => $id,
'cid' => $userinfo['customerid'] 'cid' => $userinfo['customerid']
)); ]);
} elseif (AREA == 'admin' && $userinfo['customers_see_all'] == '0') { } elseif (AREA == 'admin' && $userinfo['customers_see_all'] == '0') {
$chk_stmt = Database::prepare(" $chk_stmt = Database::prepare("
SELECT a.adminid FROM `" . TABLE_PANEL_ADMINS . "` a SELECT a.adminid FROM `" . TABLE_PANEL_ADMINS . "` a
LEFT JOIN `" . TABLE_API_KEYS . "` ak ON ak.adminid = a.adminid LEFT JOIN `" . TABLE_API_KEYS . "` ak ON ak.adminid = a.adminid
WHERE ak.`id` = :id AND a.`adminid` = :aid WHERE ak.`id` = :id AND a.`adminid` = :aid
"); ");
$chk = Database::pexecute_first($chk_stmt, array( $chk = Database::pexecute_first($chk_stmt, [
'id' => $id, 'id' => $id,
'aid' => $userinfo['adminid'] 'aid' => $userinfo['adminid']
)); ]);
} }
if ($chk !== false) { if ($chk !== false) {
Database::pexecute($del_stmt, array( Database::pexecute($del_stmt, [
'id' => $id 'id' => $id
)); ]);
$success_message = sprintf($lng['apikeys']['apikey_removed'], $id); Response::standardSuccess('apikeys.apikey_removed', $id, [
} 'filename' => $filename,
'page' => $page
]);
} }
} elseif ($action == 'add') { } elseif ($action == 'add') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$ins_stmt = Database::prepare(" $ins_stmt = Database::prepare("
INSERT INTO `" . TABLE_API_KEYS . "` SET INSERT INTO `" . TABLE_API_KEYS . "` SET
`apikey` = :key, `secret` = :secret, `adminid` = :aid, `customerid` = :cid, `valid_until` = '-1', `allowed_from` = '' `apikey` = :key, `secret` = :secret, `adminid` = :aid, `customerid` = :cid, `valid_until` = '-1', `allowed_from` = ''
@@ -75,161 +107,80 @@ if ($action == 'delete') {
} }
$key = hash('sha256', openssl_random_pseudo_bytes(64 * 64)); $key = hash('sha256', openssl_random_pseudo_bytes(64 * 64));
$secret = hash('sha512', openssl_random_pseudo_bytes(64 * 64 * 4)); $secret = hash('sha512', openssl_random_pseudo_bytes(64 * 64 * 4));
Database::pexecute($ins_stmt, array( Database::pexecute($ins_stmt, [
'key' => $key, 'key' => $key,
'secret' => $secret, 'secret' => $secret,
'aid' => $userinfo['adminid'], 'aid' => $userinfo['adminid'],
'cid' => $cid 'cid' => $cid
)); ]);
$success_message = $lng['apikeys']['apikey_added']; Response::standardSuccess('apikeys.apikey_added', '', [
} elseif ($action == 'jqEditApiKey') { 'filename' => $filename,
$keyid = isset($_POST['id']) ? (int) $_POST['id'] : 0; 'page' => $page
$allowed_from = isset($_POST['allowed_from']) ? $_POST['allowed_from'] : ""; ]);
$valid_until = isset($_POST['valid_until']) ? (int) $_POST['valid_until'] : - 1;
// validate allowed_from
if (! empty($allowed_from)) {
$ip_list = array_map('trim', explode(",", $allowed_from));
$_check_list = $ip_list;
foreach ($_check_list as $idx => $ip) {
if (\Froxlor\Validate\Validate::validate_ip2($ip, true, 'invalidip', true, true) == false) {
unset($ip_list[$idx]);
} }
} HTML::askYesNo('apikey_reallyadd', $filename, [
$ip_list = array_map('inet_ntop', array_map('inet_pton', $ip_list)); 'id' => $id,
$allowed_from = implode(",", array_unique($ip_list)); 'page' => $page,
} 'action' => $action
], '', [
if ($valid_until <= 0 || ! is_numeric($valid_until)) { 'section' => 'index',
$valid_until = - 1; 'page' => $page
} ]);
exit;
$upd_stmt = Database::prepare("
UPDATE `" . TABLE_API_KEYS . "` SET
`valid_until` = :vu, `allowed_from` = :af
WHERE `id` = :keyid AND `adminid` = :aid AND `customerid` = :cid
");
if (AREA == 'admin') {
$cid = 0;
} elseif (AREA == 'customer') {
$cid = $userinfo['customerid'];
}
Database::pexecute($upd_stmt, array(
'keyid' => $keyid,
'af' => $allowed_from,
'vu' => $valid_until,
'aid' => $userinfo['adminid'],
'cid' => $cid
));
echo json_encode(true);
exit();
} }
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed api::api_keys"); $log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed api::api_keys");
// select all my (accessable) certificates // select all my (accessible) api-keys
$keys_stmt_query = "SELECT ak.*, c.loginname, a.loginname as adminname $keys_stmt_query = "SELECT ak.*, c.loginname, a.loginname as adminname
FROM `" . TABLE_API_KEYS . "` ak FROM `" . TABLE_API_KEYS . "` ak
LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` c ON `c`.`customerid` = `ak`.`customerid` LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` c ON `c`.`customerid` = `ak`.`customerid`
LEFT JOIN `" . TABLE_PANEL_ADMINS . "` a ON `a`.`adminid` = `ak`.`adminid` LEFT JOIN `" . TABLE_PANEL_ADMINS . "` a ON `a`.`adminid` = `ak`.`adminid`
WHERE "; WHERE ";
$qry_params = array(); $qry_params = [];
if (AREA == 'admin' && $userinfo['customers_see_all'] == '0') { if (AREA == 'admin' && $userinfo['customers_see_all'] == '0') {
// admin with only customer-specific permissions // admin with only customer-specific permissions
$keys_stmt_query .= "ak.adminid = :adminid "; $keys_stmt_query .= "ak.adminid = :adminid ";
$qry_params['adminid'] = $userinfo['adminid']; $qry_params['adminid'] = $userinfo['adminid'];
$fields = array( $fields = [
'a.loginname' => $lng['login']['username'] 'a.loginname' => lng('login.username')
); ];
} elseif (AREA == 'customer') { } elseif (AREA == 'customer') {
// customer-area // customer-area
$keys_stmt_query .= "ak.customerid = :cid "; $keys_stmt_query .= "ak.customerid = :cid ";
$qry_params['cid'] = $userinfo['customerid']; $qry_params['cid'] = $userinfo['customerid'];
$fields = array( $fields = [
'c.loginname' => $lng['login']['username'] 'c.loginname' => lng('login.username')
); ];
} else { } else {
// admin who can see all customers / reseller / admins // admin who can see all customers / reseller / admins
$keys_stmt_query .= "1 "; $keys_stmt_query .= "1 ";
$fields = array( $fields = [
'a.loginname' => $lng['login']['username'] 'a.loginname' => lng('login.username')
); ];
} }
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_API_KEYS, $fields); //$keys_stmt_query .= $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit();
$keys_stmt_query .= $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit();
$keys_stmt = Database::prepare($keys_stmt_query); $keys_stmt = Database::prepare($keys_stmt_query);
Database::pexecute($keys_stmt, $qry_params); Database::pexecute($keys_stmt, $qry_params);
$all_keys = $keys_stmt->fetchAll(PDO::FETCH_ASSOC); $all_keys = $keys_stmt->fetchAll(PDO::FETCH_ASSOC);
$apikeys = "";
if (count($all_keys) == 0) { $apikeys_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/tablelisting.apikeys.php';
$count = 0; $collection = [
$message = $lng['apikeys']['no_api_keys']; 'data' => $all_keys,
$sortcode = ""; 'pagination' => []
$searchcode = ""; ];
$pagingcode = "";
eval("\$apikeys.=\"" . \Froxlor\UI\Template::getTemplate("api_keys/keys_error", true) . "\";");
} else {
$count = count($all_keys);
$paging->setEntries($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);
foreach ($all_keys as $idx => $key) { $tpl = 'user/table.html.twig';
if ($paging->checkDisplay($idx)) {
// my own key UI::view($tpl, [
$isMyKey = false; 'listing' => Listing::formatFromArray($collection, $apikeys_list_data['apikeys_list'], 'apikeys_list'),
if ($key['adminid'] == $userinfo['adminid'] && ((AREA == 'admin' && $key['customerid'] == 0) || (AREA == 'customer' && $key['customerid'] == $userinfo['customerid']))) { 'actions_links' => (int)$userinfo['api_allowed'] == 1 ? [
// this is mine [
$isMyKey = true; 'href' => $linker->getLink(['section' => 'index', 'page' => $page, 'action' => 'add']),
} 'label' => lng('apikeys.key_add')
]
$adminCustomerLink = ""; ] : null,
if (AREA == 'admin') { ]);
if ($isMyKey) {
$adminCustomerLink = $key['adminname'];
} else {
$adminCustomerLink = '<a href="' . $linker->getLink(array(
'section' => (empty($key['customerid']) ? 'admins' : 'customers'),
'page' => (empty($key['customerid']) ? 'admins' : 'customers'),
'action' => 'su',
'id' => (empty($key['customerid']) ? $key['adminid'] : $key['customerid'])
)) . '" rel="external">' . (empty($key['customerid']) ? $key['adminname'] : $key['loginname']) . '</a>';
}
} else {
// customer do not need links
$adminCustomerLink = $key['loginname'];
}
// escape stuff
$row = \Froxlor\PhpHelper::htmlentitiesArray($key);
// shorten keys
$row['_apikey'] = substr($row['apikey'], 0, 20) . '...';
$row['_secret'] = substr($row['secret'], 0, 20) . '...';
// check whether the api key is not valid anymore
$isValid = true;
if ($row['valid_until'] >= 0) {
if ($row['valid_until'] < time()) {
$isValid = false;
}
// format
$row['valid_until'] = date('Y-m-d', $row['valid_until']);
} else {
// infinity
$row['valid_until'] = "";
}
eval("\$apikeys.=\"" . \Froxlor\UI\Template::getTemplate("api_keys/keys_key", true) . "\";");
} else {
continue;
}
}
}
eval("echo \"" . \Froxlor\UI\Template::getTemplate("api_keys/keys_list", true) . "\";");

62
bin/froxlor-cli Executable file
View File

@@ -0,0 +1,62 @@
#!/usr/bin/env php
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/
declare(strict_types=1);
use Symfony\Component\Console\Application;
use Froxlor\Cli\RunApiCommand;
use Froxlor\Cli\ConfigServices;
use Froxlor\Cli\PhpSessionclean;
use Froxlor\Cli\SwitchServerIp;
use Froxlor\Cli\UpdateCommand;
use Froxlor\Cli\InstallCommand;
use Froxlor\Cli\MasterCron;
use Froxlor\Cli\UserCommand;
use Froxlor\Froxlor;
// validate correct php version
if (version_compare("7.4.0", PHP_VERSION, ">=")) {
die('Froxlor requires at least php-7.4. Please validate that your php-cli version is suitable.');
}
// ensure that default timezone is set
if (function_exists("date_default_timezone_set") && function_exists("date_default_timezone_get")) {
@date_default_timezone_set(@date_default_timezone_get());
}
require dirname(__DIR__) . '/vendor/autoload.php';
require dirname(__DIR__) . '/lib/tables.inc.php';
$application = new Application('froxlor-cli', Froxlor::getFullVersion());
$application->add(new RunApiCommand());
$application->add(new ConfigServices());
$application->add(new PhpSessionclean());
$application->add(new SwitchServerIp());
$application->add(new UpdateCommand());
$application->add(new InstallCommand());
$application->add(new MasterCron());
$application->add(new UserCommand());
$application->run();

View File

@@ -6,21 +6,20 @@
<property name="pdepend" value="${basedir}/vendor/bin/pdepend" /> <property name="pdepend" value="${basedir}/vendor/bin/pdepend" />
<property name="phpcpd" value="${basedir}/vendor/bin/phpcpd" /> <property name="phpcpd" value="${basedir}/vendor/bin/phpcpd" />
<property name="phpcs" value="${basedir}/vendor/bin/phpcs" /> <property name="phpcs" value="${basedir}/vendor/bin/phpcs" />
<property name="phpdox" value="${basedir}/vendor/bin/phpdox" />
<property name="phploc" value="${basedir}/vendor/bin/phploc" /> <property name="phploc" value="${basedir}/vendor/bin/phploc" />
<property name="phpmd" value="${basedir}/vendor/bin/phpmd" /> <property name="phpmd" value="${basedir}/vendor/bin/phpmd" />
<property name="phpunit" value="${basedir}/vendor/bin/phpunit" /> <property name="phpunit" value="${basedir}/vendor/bin/phpunit" />
<target name="full-build" <target name="full-build"
depends="prepare,composer,static-analysis,phpunit,phpdox,-check-failure" depends="prepare,composer,static-analysis,phpunit,-check-failure"
description="Performs static analysis, runs the tests, and generates project documentation" /> description="Performs static analysis, runs the tests, and generates project documentation" />
<target name="full-build-parallel" <target name="full-build-parallel"
depends="prepare,composer,static-analysis-parallel,phpunit,phpdox,-check-failure" depends="prepare,composer,static-analysis-parallel,phpunit,-check-failure"
description="Performs static analysis (executing the tools in parallel), runs the tests, and generates project documentation" /> description="Performs static analysis (executing the tools in parallel), runs the tests, and generates project documentation" />
<target name="quick-build" <target name="quick-build"
depends="prepare,composer,lint,phpunit-no-coverage" depends="prepare,composer,lint,phpunit-no-coverage,-check-failure"
description="Performs a lint check and runs the tests (without generating code coverage reports)" /> description="Performs a lint check and runs the tests (without generating code coverage reports)" />
<target name="static-analysis" <target name="static-analysis"
@@ -49,7 +48,6 @@
<delete dir="${basedir}/build/coverage" /> <delete dir="${basedir}/build/coverage" />
<delete dir="${basedir}/build/logs" /> <delete dir="${basedir}/build/logs" />
<delete dir="${basedir}/build/pdepend" /> <delete dir="${basedir}/build/pdepend" />
<delete dir="${basedir}/build/phpdox" />
<property name="clean.done" value="true" /> <property name="clean.done" value="true" />
</target> </target>
@@ -59,7 +57,6 @@
<mkdir dir="${basedir}/build/coverage" /> <mkdir dir="${basedir}/build/coverage" />
<mkdir dir="${basedir}/build/logs" /> <mkdir dir="${basedir}/build/logs" />
<mkdir dir="${basedir}/build/pdepend" /> <mkdir dir="${basedir}/build/pdepend" />
<mkdir dir="${basedir}/build/phpdox" />
<property name="prepare.done" value="true" /> <property name="prepare.done" value="true" />
</target> </target>
@@ -257,7 +254,7 @@
<target name="phpunit-no-coverage" unless="phpunit.done" <target name="phpunit-no-coverage" unless="phpunit.done"
depends="composer" depends="composer"
description="Run unit tests with PHPUnit (without generating code coverage reports)"> description="Run unit tests with PHPUnit (without generating code coverage reports)">
<exec executable="${phpunit}" failonerror="true" <exec executable="${phpunit}" failonerror="true" resultproperty="result.phpunit"
taskname="phpunit"> taskname="phpunit">
<arg value="--configuration" /> <arg value="--configuration" />
<arg path="${basedir}/phpunit.xml" /> <arg path="${basedir}/phpunit.xml" />
@@ -269,18 +266,6 @@
<property name="phpunit.done" value="true" /> <property name="phpunit.done" value="true" />
</target> </target>
<target name="phpdox" unless="phpdox.done"
depends="phploc-ci,phpcs-ci,phpcompat-ci,phpmd-ci"
description="Generate project documentation using phpDox">
<exec executable="${phpdox}" dir="${basedir}/build"
taskname="phpdox">
<arg value="--file" />
<arg path="${basedir}/phpdox.xml" />
</exec>
<property name="phpdox.done" value="true" />
</target>
<target name="-check-failure"> <target name="-check-failure">
<fail message="PHPUnit did not finish successfully"> <fail message="PHPUnit did not finish successfully">
<condition> <condition>

2
cache/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
!.gitignore
*

View File

@@ -13,24 +13,24 @@
"name": "Michael Kaufmann", "name": "Michael Kaufmann",
"email": "team@froxlor.org", "email": "team@froxlor.org",
"role": "Lead Developer" "role": "Lead Developer"
},
{
"name": "Robert Förster",
"email": "team@froxlor.org",
"role": "Package Maintainer"
} }
], ],
"support": { "support": {
"email": "team@froxlor.org", "email": "team@froxlor.org",
"issues": "https://github.com/Froxlor/Froxlor/issues", "issues": "https://github.com/Froxlor/Froxlor/issues",
"forum": "https://forum.froxlor.org/", "forum": "https://forum.froxlor.org/",
"wiki": "https://github.com/Froxlor/Froxlor/wiki",
"irc": "irc://chat.freenode.net/froxlor",
"source": "https://github.com/Froxlor/Froxlor", "source": "https://github.com/Froxlor/Froxlor",
"docs": "https://github.com/Froxlor/Froxlor/wiki" "docs": "https://docs.froxlor.org/",
"chat": "https://discord.froxlor.org/"
}, },
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/d00p"
}
],
"require": { "require": {
"php": ">=7.0", "php": "^7.4 || ^8.0",
"ext-session": "*", "ext-session": "*",
"ext-ctype": "*", "ext-ctype": "*",
"ext-pdo": "*", "ext-pdo": "*",
@@ -43,22 +43,28 @@
"ext-curl": "*", "ext-curl": "*",
"ext-json": "*", "ext-json": "*",
"ext-openssl": "*", "ext-openssl": "*",
"ext-fileinfo": "*",
"ext-gmp": "*",
"phpmailer/phpmailer": "~6.0", "phpmailer/phpmailer": "~6.0",
"monolog/monolog": "^1.24", "monolog/monolog": "^1.24",
"robthree/twofactorauth": "^1.6", "robthree/twofactorauth": "^1.6",
"algo26-matthias/idna-convert": "^2.1" "froxlor/idna-convert-legacy": "^2.1",
"voku/anti-xss": "^4.1",
"twig/twig": "^3.3",
"erusev/parsedown": "^1.7",
"symfony/console": "^5.4"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^8", "phpunit/phpunit": "^9",
"php": ">=7.3",
"ext-pcntl": "*", "ext-pcntl": "*",
"phpcompatibility/php-compatibility": "*", "phpcompatibility/php-compatibility": "*",
"squizlabs/php_codesniffer": "*", "squizlabs/php_codesniffer": "*",
"pdepend/pdepend": "^2.5", "pdepend/pdepend": "^2.9",
"sebastian/phpcpd": "^4.1", "sebastian/phpcpd": "^6.0",
"theseer/phpdox": "^0.12.0", "phploc/phploc": "^7.0",
"phploc/phploc": "^5.0", "phpmd/phpmd": "^2.10",
"phpmd/phpmd": "^2.6" "phpunit/php-timer" : "^5",
"phpstan/phpstan": "^1.8"
}, },
"suggest": { "suggest": {
"ext-bcmath": "*", "ext-bcmath": "*",

4099
composer.lock generated

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

1893
css/jquery-ui.min.css vendored

File diff suppressed because it is too large Load Diff

View File

@@ -2,224 +2,117 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Panel
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'customer');
require './lib/init.php';
use Froxlor\Database\Database; const AREA = 'customer';
use Froxlor\Settings; require __DIR__ . '/lib/init.php';
use Froxlor\Api\Commands\SubDomains as SubDomains; use Froxlor\Api\Commands\SubDomains as SubDomains;
use Froxlor\Api\Commands\Certificates as Certificates; use Froxlor\Database\Database;
use Froxlor\Domain\Domain;
use Froxlor\FileDir;
use Froxlor\FroxlorLogger;
use Froxlor\PhpHelper;
use Froxlor\Settings;
use Froxlor\UI\Collection;
use Froxlor\UI\HTML;
use Froxlor\UI\Listing;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
use Froxlor\Validate\Validate;
use Froxlor\CurrentUser;
// redirect if this customer page is hidden via settings // redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options', 'domains')) { if (Settings::IsInList('panel.customer_hide_options', 'domains')) {
\Froxlor\UI\Response::redirectTo('customer_index.php'); Response::redirectTo('customer_index.php');
} }
if (isset($_POST['id'])) { $id = (int)Request::any('id');
$id = intval($_POST['id']);
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
if ($page == 'overview') { if ($page == 'overview' || $page == 'domains') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_domains");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("domains/domains") . "\";");
} elseif ($page == 'domains') {
if ($action == '') { if ($action == '') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_domains::domains"); $log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_domains::domains");
$fields = array(
'd.domain' => $lng['domains']['domainname']
);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_DOMAINS, $fields);
$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`.`registration_date`, `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
AND `d`.`email_only`='0'
AND `d`.`id` <> :standardsubdomain " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
Database::pexecute($domains_stmt, array(
"customerid" => $userinfo['customerid'],
"standardsubdomain" => $userinfo['standardsubdomain']
));
$paging->setEntries(Database::num_rows());
$sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$domains = '';
$parentdomains_count = 0;
$domains_count = 0;
$domain_array = array();
while ($row = $domains_stmt->fetch(PDO::FETCH_ASSOC)) { $parentdomain_id = (int)Request::any('pid', '0');
$row['domain'] = $idna_convert->decode($row['domain']);
$row['aliasdomain'] = $idna_convert->decode($row['aliasdomain']);
$row['domainalias'] = $idna_convert->decode($row['domainalias']);
if ($row['parentdomainid'] == '0' && $row['caneditdomain'] == '1') { try {
$parentdomains_count ++; $domain_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/customer/tablelisting.domains.php';
$collection = (new Collection(SubDomains::class, $userinfo))
->withPagination($domain_list_data['domain_list']['columns'], $domain_list_data['domain_list']['default_sorting']);
$parentDomainCollection = (new Collection(SubDomains::class, $userinfo, ['sql_search' => ['d.parentdomainid' => 0]]));
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
} }
/** $actions_links = false;
* check for set ssl-certs to show different state-icons if (CurrentUser::canAddResource('subdomains')) {
*/ $actions_links = [
// nothing (ssl_global) [
$row['domain_hascert'] = 0; 'href' => $linker->getLink(['section' => 'domains', 'page' => 'domains', 'action' => 'add']),
$ssl_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` WHERE `domainid` = :domainid"); 'label' => lng('domains.subdomain_add')
Database::pexecute($ssl_stmt, array( ]
"domainid" => $row['id'] ];
));
$ssl_result = $ssl_stmt->fetch(PDO::FETCH_ASSOC);
if (is_array($ssl_result) && isset($ssl_result['ssl_cert_file']) && $ssl_result['ssl_cert_file'] != '') {
// own certificate (ssl_customer_green)
$row['domain_hascert'] = 1;
} else {
// check if it's parent has one set (shared)
if ($row['parentdomainid'] != 0) {
$ssl_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` WHERE `domainid` = :domainid");
Database::pexecute($ssl_stmt, array(
"domainid" => $row['parentdomainid']
));
$ssl_result = $ssl_stmt->fetch(PDO::FETCH_ASSOC);
if (is_array($ssl_result) && isset($ssl_result['ssl_cert_file']) && $ssl_result['ssl_cert_file'] != '') {
// parent has a certificate (ssl_shared)
$row['domain_hascert'] = 2;
}
}
} }
$row['termination_date'] = str_replace("0000-00-00", "", $row['termination_date']); UI::view('user/table.html.twig', [
if ($row['termination_date'] != "") { 'listing' => Listing::format($collection, $domain_list_data, 'domain_list'),
$cdate = strtotime($row['termination_date'] . " 23:59:59"); 'actions_links' => $actions_links,
$today = time(); 'entity_info' => lng('domains.description')
]);
if ($cdate < $today) {
$row['termination_css'] = 'domain-expired';
} else {
$row['termination_css'] = 'domain-canceled';
}
}
$domains_count ++;
$domain_array[$row['domain']] = $row;
}
ksort($domain_array);
$domain_id_array = array();
foreach ($domain_array as $sortkey => $row) {
$domain_id_array[$row['id']] = $sortkey;
}
$domain_sort_array = array();
foreach ($domain_array as $sortkey => $row) {
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;
}
}
$domain_array = array();
if ($paging->sortfield == 'd.domain' && $paging->sortorder == 'asc') {
ksort($domain_sort_array);
} elseif ($paging->sortfield == 'd.domain' && $paging->sortorder == 'desc') {
krsort($domain_sort_array);
}
$i = 0;
foreach ($domain_sort_array as $sortkey => $domain_array) {
if ($paging->checkDisplay($i)) {
if (isset($domain_array[$sortkey])) {
$row = \Froxlor\PhpHelper::htmlentitiesArray($domain_array[$sortkey]);
if (Settings::Get('system.awstats_enabled') == '1') {
$statsapp = 'awstats';
} else {
$statsapp = 'webalizer';
}
eval("\$domains.=\"" . \Froxlor\UI\Template::getTemplate("domains/domains_delimiter") . "\";");
}
if ($paging->sortfield == 'd.domain' && $paging->sortorder == 'asc') {
ksort($domain_array);
} elseif ($paging->sortfield == 'd.domain' && $paging->sortorder == 'desc') {
krsort($domain_array);
}
foreach ($domain_array as $row) {
if (strpos($row['documentroot'], $userinfo['documentroot']) === 0) {
$row['documentroot'] = \Froxlor\FileDir::makeCorrectDir(str_replace($userinfo['documentroot'], "/", $row['documentroot']));
}
// get ssl-ips if activated
$show_ssledit = false;
if (Settings::Get('system.use_ssl') == '1' && \Froxlor\Domain\Domain::domainHasSslIpPort($row['id']) && $row['caneditdomain'] == '1' && $row['letsencrypt'] == 0) {
$show_ssledit = true;
}
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
eval("\$domains.=\"" . \Froxlor\UI\Template::getTemplate("domains/domains_domain") . "\";");
}
}
$i += count($domain_array);
}
eval("echo \"" . \Froxlor\UI\Template::getTemplate("domains/domainlist") . "\";");
} elseif ($action == 'delete' && $id != 0) { } elseif ($action == 'delete' && $id != 0) {
try { try {
$json_result = SubDomains::getLocal($userinfo, array( $json_result = SubDomains::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
$alias_stmt = Database::prepare("SELECT COUNT(`id`) AS `count` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `aliasdomain` = :aliasdomain"); $alias_stmt = Database::prepare("SELECT COUNT(`id`) AS `count` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `aliasdomain` = :aliasdomain");
$alias_check = Database::pexecute_first($alias_stmt, array( $alias_check = Database::pexecute_first($alias_stmt, [
"aliasdomain" => $id "aliasdomain" => $id
)); ]);
if (isset($result['parentdomainid']) && $result['parentdomainid'] != '0' && $alias_check['count'] == 0) { if (isset($result['parentdomainid']) && $result['parentdomainid'] != '0' && $alias_check['count'] == 0) {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { try {
SubDomains::getLocal($userinfo, $_POST)->delete(); SubDomains::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
\Froxlor\UI\HTML::askYesNo('domains_reallydelete', $filename, array( HTML::askYesNo('domains_reallydelete', $filename, [
'id' => $id, 'id' => $id,
'page' => $page, 'page' => $page,
'action' => $action 'action' => $action
), $idna_convert->decode($result['domain'])); ], $idna_convert->decode($result['domain']));
} }
} else { } else {
\Froxlor\UI\Response::standard_error('domains_cantdeletemaindomain'); Response::standardError('domains_cantdeletemaindomain');
} }
} elseif ($action == 'add') { } elseif ($action == 'add') {
if ($userinfo['subdomains_used'] < $userinfo['subdomains'] || $userinfo['subdomains'] == '-1') { if ($userinfo['subdomains_used'] < $userinfo['subdomains'] || $userinfo['subdomains'] == '-1') {
@@ -227,12 +120,11 @@ if ($page == 'overview') {
try { try {
SubDomains::getLocal($userinfo, $_POST)->add(); SubDomains::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
$stmt = Database::prepare("SELECT `id`, `domain`, `documentroot`, `ssl_redirect`,`isemaildomain`,`letsencrypt` FROM `" . TABLE_PANEL_DOMAINS . "` $stmt = Database::prepare("SELECT `id`, `domain`, `documentroot`, `ssl_redirect`,`isemaildomain`,`letsencrypt` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `customerid` = :customerid WHERE `customerid` = :customerid
@@ -240,16 +132,15 @@ if ($page == 'overview') {
AND `email_only` = '0' AND `email_only` = '0'
AND `caneditdomain` = '1' AND `caneditdomain` = '1'
ORDER BY `domain` ASC"); ORDER BY `domain` ASC");
Database::pexecute($stmt, array( Database::pexecute($stmt, [
"customerid" => $userinfo['customerid'] "customerid" => $userinfo['customerid']
)); ]);
$domains = ''; $domains = [];
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$domains .= \Froxlor\UI\HTML::makeoption($idna_convert->decode($row['domain']), $row['domain']); $domains[$row['domain']] = $idna_convert->decode($row['domain']);
} }
$aliasdomains = \Froxlor\UI\HTML::makeoption($lng['domains']['noaliasdomain'], 0, NULL, true); $aliasdomains[0] = lng('domains.noaliasdomain');
$domains_stmt = Database::prepare("SELECT `d`.`id`, `d`.`domain` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c` $domains_stmt = Database::prepare("SELECT `d`.`id`, `d`.`domain` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c`
WHERE `d`.`aliasdomain` IS NULL WHERE `d`.`aliasdomain` IS NULL
AND `d`.`id` <> `c`.`standardsubdomain` AND `d`.`id` <> `c`.`standardsubdomain`
@@ -258,24 +149,24 @@ if ($page == 'overview') {
AND `d`.`email_only`='0' AND `d`.`email_only`='0'
AND `d`.`customerid`= :customerid AND `d`.`customerid`= :customerid
ORDER BY `d`.`domain` ASC"); ORDER BY `d`.`domain` ASC");
Database::pexecute($domains_stmt, array( Database::pexecute($domains_stmt, [
"customerid" => $userinfo['customerid'] "customerid" => $userinfo['customerid']
)); ]);
while ($row_domain = $domains_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row_domain = $domains_stmt->fetch(PDO::FETCH_ASSOC)) {
$aliasdomains .= \Froxlor\UI\HTML::makeoption($idna_convert->decode($row_domain['domain']), $row_domain['id']); $aliasdomains[$row_domain['id']] = $idna_convert->decode($row_domain['domain']);
} }
$redirectcode = ''; $redirectcode = [];
if (Settings::Get('customredirect.enabled') == '1') { if (Settings::Get('customredirect.enabled') == '1') {
$codes = \Froxlor\Domain\Domain::getRedirectCodesArray(); $codes = Domain::getRedirectCodesArray();
foreach ($codes as $rc) { foreach ($codes as $rc) {
$redirectcode .= \Froxlor\UI\HTML::makeoption($rc['code'] . ' (' . $lng['redirect_desc'][$rc['desc']] . ')', $rc['id']); $redirectcode[$rc['id']] = $rc['code'] . ' (' . lng('redirect_desc.' . $rc['desc']) . ')';
} }
} }
// check if we at least have one ssl-ip/port, #1179 // check if we at least have one ssl-ip/port, #1179
$ssl_ipsandports = ''; $ssl_ipsandports = false;
$ssl_ip_stmt = Database::prepare(" $ssl_ip_stmt = Database::prepare("
SELECT COUNT(*) as countSSL SELECT COUNT(*) as countSSL
FROM `" . TABLE_PANEL_IPSANDPORTS . "` pip FROM `" . TABLE_PANEL_IPSANDPORTS . "` pip
@@ -284,17 +175,19 @@ if ($page == 'overview') {
"); ");
Database::pexecute($ssl_ip_stmt); Database::pexecute($ssl_ip_stmt);
$resultX = $ssl_ip_stmt->fetch(PDO::FETCH_ASSOC); $resultX = $ssl_ip_stmt->fetch(PDO::FETCH_ASSOC);
if (isset($resultX['countSSL']) && (int) $resultX['countSSL'] > 0) { if (isset($resultX['countSSL']) && (int)$resultX['countSSL'] > 0) {
$ssl_ipsandports = 'notempty'; $ssl_ipsandports = true;
} }
$openbasedir = \Froxlor\UI\HTML::makeoption($lng['domain']['docroot'], 0, NULL, true) . \Froxlor\UI\HTML::makeoption($lng['domain']['homedir'], 1, NULL, true); $openbasedir = [
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']); 0 => lng('domain.docroot'),
1 => lng('domain.homedir'),
2 => lng('domain.docparent')
];
$pathSelect = FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
$phpconfigs = ''; $phpconfigs = [];
$has_phpconfigs = false; if (isset($userinfo['allowed_phpconfigs']) && !empty($userinfo['allowed_phpconfigs'])) {
if (isset($userinfo['allowed_phpconfigs']) && ! empty($userinfo['allowed_phpconfigs'])) {
$has_phpconfigs = true;
$allowed_cfg = json_decode($userinfo['allowed_phpconfigs'], JSON_OBJECT_AS_ARRAY); $allowed_cfg = json_decode($userinfo['allowed_phpconfigs'], JSON_OBJECT_AS_ARRAY);
$phpconfigs_result_stmt = Database::query(" $phpconfigs_result_stmt = Database::query("
SELECT c.*, fc.description as interpreter SELECT c.*, fc.description as interpreter
@@ -303,49 +196,51 @@ if ($page == 'overview') {
WHERE c.id IN (" . implode(", ", $allowed_cfg) . ") WHERE c.id IN (" . implode(", ", $allowed_cfg) . ")
"); ");
while ($phpconfigs_row = $phpconfigs_result_stmt->fetch(PDO::FETCH_ASSOC)) { while ($phpconfigs_row = $phpconfigs_result_stmt->fetch(PDO::FETCH_ASSOC)) {
if ((int) Settings::Get('phpfpm.enabled') == 1) { if ((int)Settings::Get('phpfpm.enabled') == 1) {
$phpconfigs .= \Froxlor\UI\HTML::makeoption($phpconfigs_row['description'] . " [" . $phpconfigs_row['interpreter'] . "]", $phpconfigs_row['id'], Settings::Get('phpfpm.defaultini'), true, true); $phpconfigs[$phpconfigs_row['id']] = $phpconfigs_row['description'] . " [" . $phpconfigs_row['interpreter'] . "]";
} else { } else {
$phpconfigs .= \Froxlor\UI\HTML::makeoption($phpconfigs_row['description'], $phpconfigs_row['id'], Settings::Get('system.mod_fcgid_defaultini'), true, true); $phpconfigs[$phpconfigs_row['id']] = $phpconfigs_row['description'];
} }
} }
} }
$subdomain_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/domains/formfield.domains_add.php'; $subdomain_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/domains/formfield.domains_add.php';
$subdomain_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($subdomain_add_data);
$title = $subdomain_add_data['domain_add']['title']; UI::view('user/form.html.twig', [
$image = $subdomain_add_data['domain_add']['image']; 'formaction' => $linker->getLink(['section' => 'domains']),
'formdata' => $subdomain_add_data['domain_add']
eval("echo \"" . \Froxlor\UI\Template::getTemplate("domains/domains_add") . "\";"); ]);
} }
} }
} elseif ($action == 'edit' && $id != 0) { } elseif ($action == 'edit' && $id != 0) {
try { try {
$json_result = SubDomains::getLocal($userinfo, array( $json_result = SubDomains::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
if (isset($result['customerid']) && $result['customerid'] == $userinfo['customerid']) { if (isset($result['customerid']) && $result['customerid'] == $userinfo['customerid']) {
if ((int) $result['caneditdomain'] == 0) {
Response::standardError('domaincannotbeedited', $result['domain']);
}
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { try {
SubDomains::getLocal($userinfo, $_POST)->update(); SubDomains::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
$result['domain'] = $idna_convert->decode($result['domain']); $result['domain'] = $idna_convert->decode($result['domain']);
$domains = \Froxlor\UI\HTML::makeoption($lng['domains']['noaliasdomain'], 0, $result['aliasdomain'], true); $domains[0] = lng('domains.noaliasdomain');
// also check ip/port combination to be the same, #176 // also check ip/port combination to be the same, #176
$domains_stmt = Database::prepare("SELECT `d`.`id`, `d`.`domain` FROM `" . TABLE_PANEL_DOMAINS . "` `d` , `" . TABLE_PANEL_CUSTOMERS . "` `c` , `" . TABLE_DOMAINTOIP . "` `dip` $domains_stmt = Database::prepare("SELECT `d`.`id`, `d`.`domain` FROM `" . TABLE_PANEL_DOMAINS . "` `d` , `" . TABLE_PANEL_CUSTOMERS . "` `c` , `" . TABLE_DOMAINTOIP . "` `dip`
WHERE `d`.`aliasdomain` IS NULL WHERE `d`.`aliasdomain` IS NULL
@@ -360,88 +255,90 @@ if ($page == 'overview') {
WHERE `id_domain` = :id) WHERE `id_domain` = :id)
GROUP BY `d`.`id`, `d`.`domain` GROUP BY `d`.`id`, `d`.`domain`
ORDER BY `d`.`domain` ASC"); ORDER BY `d`.`domain` ASC");
Database::pexecute($domains_stmt, array( Database::pexecute($domains_stmt, [
"id" => $result['id'], "id" => $result['id'],
"customerid" => $userinfo['customerid'] "customerid" => $userinfo['customerid']
)); ]);
while ($row_domain = $domains_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row_domain = $domains_stmt->fetch(PDO::FETCH_ASSOC)) {
$domains .= \Froxlor\UI\HTML::makeoption($idna_convert->decode($row_domain['domain']), $row_domain['id'], $result['aliasdomain']); $domains[$row_domain['id']] = $idna_convert->decode($row_domain['domain']);
} }
if (preg_match('/^https?\:\/\//', $result['documentroot']) && \Froxlor\Validate\Validate::validateUrl($result['documentroot'])) { if (preg_match('/^https?\:\/\//', $result['documentroot']) && Validate::validateUrl($result['documentroot'])) {
if (Settings::Get('panel.pathedit') == 'Dropdown') { if (Settings::Get('panel.pathedit') == 'Dropdown') {
$urlvalue = $result['documentroot']; $urlvalue = $result['documentroot'];
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']); $pathSelect = FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
} else { } else {
$urlvalue = ''; $urlvalue = '';
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $result['documentroot'], true); $pathSelect = FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $result['documentroot'], true);
} }
} else { } else {
$urlvalue = ''; $urlvalue = '';
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $result['documentroot']); $pathSelect = FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $result['documentroot']);
} }
$redirectcode = ''; $redirectcode = [];
if (Settings::Get('customredirect.enabled') == '1') { if (Settings::Get('customredirect.enabled') == '1') {
$def_code = \Froxlor\Domain\Domain::getDomainRedirectId($id); $def_code = Domain::getDomainRedirectId($id);
$codes = \Froxlor\Domain\Domain::getRedirectCodesArray(); $codes = Domain::getRedirectCodesArray();
foreach ($codes as $rc) { foreach ($codes as $rc) {
$redirectcode .= \Froxlor\UI\HTML::makeoption($rc['code'] . ' (' . $lng['redirect_desc'][$rc['desc']] . ')', $rc['id'], $def_code); $redirectcode[$rc['id']] = $rc['code'] . ' (' . lng('redirect_desc.' . $rc['desc']) . ')';
} }
} }
// check if we at least have one ssl-ip/port, #1179 // check if we at least have one ssl-ip/port, #1179
$ssl_ipsandports = ''; $ssl_ipsandports = false;
$ssl_ip_stmt = Database::prepare(" $ssl_ip_stmt = Database::prepare("
SELECT COUNT(*) as countSSL SELECT COUNT(*) as countSSL
FROM `" . TABLE_PANEL_IPSANDPORTS . "` pip FROM `" . TABLE_PANEL_IPSANDPORTS . "` pip
LEFT JOIN `" . TABLE_DOMAINTOIP . "` dti ON dti.id_ipandports = pip.id LEFT JOIN `" . TABLE_DOMAINTOIP . "` dti ON dti.id_ipandports = pip.id
WHERE `dti`.`id_domain` = :id_domain AND pip.`ssl`='1' WHERE `dti`.`id_domain` = :id_domain AND pip.`ssl`='1'
"); ");
Database::pexecute($ssl_ip_stmt, array( Database::pexecute($ssl_ip_stmt, [
"id_domain" => $result['id'] "id_domain" => $result['id']
)); ]);
$resultX = $ssl_ip_stmt->fetch(PDO::FETCH_ASSOC); $resultX = $ssl_ip_stmt->fetch(PDO::FETCH_ASSOC);
if (isset($resultX['countSSL']) && (int) $resultX['countSSL'] > 0) { if (isset($resultX['countSSL']) && (int)$resultX['countSSL'] > 0) {
$ssl_ipsandports = 'notempty'; $ssl_ipsandports = true;
} }
// Fudge the result for ssl_redirect to hide the Let's Encrypt steps // Fudge the result for ssl_redirect to hide the Let's Encrypt steps
$result['temporary_ssl_redirect'] = $result['ssl_redirect']; $result['temporary_ssl_redirect'] = $result['ssl_redirect'];
$result['ssl_redirect'] = ($result['ssl_redirect'] == 0 ? 0 : 1); $result['ssl_redirect'] = ($result['ssl_redirect'] == 0 ? 0 : 1);
$openbasedir = \Froxlor\UI\HTML::makeoption($lng['domain']['docroot'], 0, $result['openbasedir_path'], true) . \Froxlor\UI\HTML::makeoption($lng['domain']['homedir'], 1, $result['openbasedir_path'], true); $openbasedir = [
0 => lng('domain.docroot'),
1 => lng('domain.homedir'),
2 => lng('domain.docparent')
];
// create serveralias options // create serveralias options
$serveraliasoptions = ""; $serveraliasoptions = [];
$_value = '2'; $serveraliasoptions_selected = '2';
if ($result['iswildcarddomain'] == '1') { if ($result['iswildcarddomain'] == '1') {
$_value = '0'; $serveraliasoptions_selected = '0';
} elseif ($result['wwwserveralias'] == '1') { } elseif ($result['wwwserveralias'] == '1') {
$_value = '1'; $serveraliasoptions_selected = '1';
} }
$serveraliasoptions .= \Froxlor\UI\HTML::makeoption($lng['domains']['serveraliasoption_wildcard'], '0', $_value, true, true); $serveraliasoptions[0] = lng('domains.serveraliasoption_wildcard');
$serveraliasoptions .= \Froxlor\UI\HTML::makeoption($lng['domains']['serveraliasoption_www'], '1', $_value, true, true); $serveraliasoptions[1] = lng('domains.serveraliasoption_www');
$serveraliasoptions .= \Froxlor\UI\HTML::makeoption($lng['domains']['serveraliasoption_none'], '2', $_value, true, true); $serveraliasoptions[2] = lng('domains.serveraliasoption_none');
$ips_stmt = Database::prepare("SELECT `p`.`ip` AS `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` `p` $ips_stmt = Database::prepare("SELECT `p`.`ip` AS `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` `p`
LEFT JOIN `" . TABLE_DOMAINTOIP . "` `dip` LEFT JOIN `" . TABLE_DOMAINTOIP . "` `dip`
ON ( `dip`.`id_ipandports` = `p`.`id` ) ON ( `dip`.`id_ipandports` = `p`.`id` )
WHERE `dip`.`id_domain` = :id_domain WHERE `dip`.`id_domain` = :id_domain
GROUP BY `p`.`ip`"); GROUP BY `p`.`ip`");
Database::pexecute($ips_stmt, array( Database::pexecute($ips_stmt, [
"id_domain" => $result['id'] "id_domain" => $result['id']
)); ]);
$result_ipandport['ip'] = ''; $domainips = [];
while ($rowip = $ips_stmt->fetch(PDO::FETCH_ASSOC)) { while ($rowip = $ips_stmt->fetch(PDO::FETCH_ASSOC)) {
$result_ipandport['ip'] .= $rowip['ip'] . "<br />"; $domainips[] = ['item' => $rowip['ip']];
} }
$phpconfigs = ''; $phpconfigs = [];
$has_phpconfigs = false; if (isset($userinfo['allowed_phpconfigs']) && !empty($userinfo['allowed_phpconfigs'])) {
if (isset($userinfo['allowed_phpconfigs']) && ! empty($userinfo['allowed_phpconfigs'])) {
$has_phpconfigs = true;
$allowed_cfg = json_decode($userinfo['allowed_phpconfigs'], JSON_OBJECT_AS_ARRAY); $allowed_cfg = json_decode($userinfo['allowed_phpconfigs'], JSON_OBJECT_AS_ARRAY);
$phpconfigs_result_stmt = Database::query(" $phpconfigs_result_stmt = Database::query("
SELECT c.*, fc.description as interpreter SELECT c.*, fc.description as interpreter
@@ -450,100 +347,40 @@ if ($page == 'overview') {
WHERE c.id IN (" . implode(", ", $allowed_cfg) . ") WHERE c.id IN (" . implode(", ", $allowed_cfg) . ")
"); ");
while ($phpconfigs_row = $phpconfigs_result_stmt->fetch(PDO::FETCH_ASSOC)) { while ($phpconfigs_row = $phpconfigs_result_stmt->fetch(PDO::FETCH_ASSOC)) {
if ((int) Settings::Get('phpfpm.enabled') == 1) { if ((int)Settings::Get('phpfpm.enabled') == 1) {
$phpconfigs .= \Froxlor\UI\HTML::makeoption($phpconfigs_row['description'] . " [" . $phpconfigs_row['interpreter'] . "]", $phpconfigs_row['id'], $result['phpsettingid'], true, true); $phpconfigs[$phpconfigs_row['id']] = $phpconfigs_row['description'] . " [" . $phpconfigs_row['interpreter'] . "]";
} else { } else {
$phpconfigs .= \Froxlor\UI\HTML::makeoption($phpconfigs_row['description'], $phpconfigs_row['id'], $result['phpsettingid'], true, true); $phpconfigs[$phpconfigs_row['id']] = $phpconfigs_row['description'];
} }
} }
} }
$alias_stmt = Database::prepare("SELECT COUNT(`id`) AS count FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `aliasdomain`= :aliasdomain"); $alias_stmt = Database::prepare("SELECT COUNT(`id`) AS count FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `aliasdomain`= :aliasdomain");
$alias_check = Database::pexecute_first($alias_stmt, array("aliasdomain" => $result['id'])); $alias_check = Database::pexecute_first($alias_stmt, [
"aliasdomain" => $result['id']
]);
$alias_check = $alias_check['count']; $alias_check = $alias_check['count'];
$domainip = $result_ipandport['ip']; $result = PhpHelper::htmlentitiesArray($result);
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
$subdomain_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/domains/formfield.domains_edit.php'; $subdomain_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/domains/formfield.domains_edit.php';
$subdomain_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($subdomain_edit_data);
$title = $subdomain_edit_data['domain_edit']['title']; UI::view('user/form.html.twig', [
$image = $subdomain_edit_data['domain_edit']['image']; 'formaction' => $linker->getLink(['section' => 'domains', 'id' => $id]),
'formdata' => $subdomain_edit_data['domain_edit'],
eval("echo \"" . \Froxlor\UI\Template::getTemplate("domains/domains_edit") . "\";"); 'editid' => $id
]);
} }
} else { } else {
\Froxlor\UI\Response::standard_error('domains_canteditdomain'); Response::standardError('domains_canteditdomain');
} }
} }
} elseif ($page == 'domainssleditor') { } elseif ($page == 'domainssleditor') {
require_once __DIR__ . '/ssl_editor.php';
if ($action == '' || $action == 'view') {
// get domain
try {
$json_result = SubDomains::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result_domain = json_decode($json_result, true)['data'];
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$do_insert = isset($_POST['do_insert']) ? (($_POST['do_insert'] == 1) ? true : false) : false;
try {
if ($do_insert) {
Certificates::getLocal($userinfo, $_POST)->add();
} else {
Certificates::getLocal($userinfo, $_POST)->update();
}
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
// back to domain overview
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => 'domains',
's' => $s
));
}
$stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "`
WHERE `domainid`= :domainid");
$result = Database::pexecute_first($stmt, array(
"domainid" => $id
));
$do_insert = false;
// if no entry can be found, behave like we have empty values
if (! is_array($result) || ! isset($result['ssl_cert_file'])) {
$result = array(
'ssl_cert_file' => '',
'ssl_key_file' => '',
'ssl_ca_file' => '',
'ssl_cert_chainfile' => ''
);
$do_insert = true;
}
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
$ssleditor_data = include_once dirname(__FILE__) . '/lib/formfields/customer/domains/formfield.domain_ssleditor.php';
$ssleditor_form = \Froxlor\UI\HtmlForm::genHTMLForm($ssleditor_data);
$title = $ssleditor_data['domain_ssleditor']['title'];
$image = $ssleditor_data['domain_ssleditor']['image'];
eval("echo \"" . \Froxlor\UI\Template::getTemplate("domains/domain_ssleditor") . "\";");
}
} elseif ($page == 'domaindnseditor' && $userinfo['dnsenabled'] == '1' && Settings::Get('system.dnsenabled') == '1') { } elseif ($page == 'domaindnseditor' && $userinfo['dnsenabled'] == '1' && Settings::Get('system.dnsenabled') == '1') {
require_once __DIR__ . '/dns_editor.php'; require_once __DIR__ . '/dns_editor.php';
} elseif ($page == 'sslcertificates') { } elseif ($page == 'sslcertificates') {
require_once __DIR__ . '/ssl_certificates.php'; require_once __DIR__ . '/ssl_certificates.php';
} elseif ($page == 'logfiles') { } elseif ($page == 'logfiles') {
require_once __DIR__ . '/logfiles_viewer.php'; require_once __DIR__ . '/logfiles_viewer.php';
} }

View File

@@ -2,177 +2,124 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Panel
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'customer');
require './lib/init.php';
use Froxlor\Database\Database; const AREA = 'customer';
use Froxlor\Settings; require __DIR__ . '/lib/init.php';
use Froxlor\Api\Commands\Emails as Emails;
use Froxlor\Api\Commands\EmailAccounts as EmailAccounts; use Froxlor\Api\Commands\EmailAccounts as EmailAccounts;
use Froxlor\Api\Commands\EmailForwarders as EmailForwarders; use Froxlor\Api\Commands\EmailForwarders as EmailForwarders;
use Froxlor\Api\Commands\Emails as Emails;
use Froxlor\Database\Database;
use Froxlor\FroxlorLogger;
use Froxlor\PhpHelper;
use Froxlor\Settings;
use Froxlor\UI\Collection;
use Froxlor\UI\HTML;
use Froxlor\UI\Listing;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
use Froxlor\Validate\Check;
use Froxlor\CurrentUser;
// redirect if this customer page is hidden via settings // redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options', 'email')) { if (Settings::IsInList('panel.customer_hide_options', 'email') || $userinfo['emails'] == 0) {
\Froxlor\UI\Response::redirectTo('customer_index.php'); Response::redirectTo('customer_index.php');
} }
if (isset($_POST['id'])) { $id = (int)Request::any('id');
$id = intval($_POST['id']);
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
if ($page == 'overview') { if ($page == 'overview' || $page == 'emails') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_email");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("email/email") . "\";");
} elseif ($page == 'emails') {
if ($action == '') { if ($action == '') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_email::emails"); $log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_email::emails");
$fields = array(
'd.domain' => $lng['domains']['domainname'],
'm.email_full' => $lng['emails']['emailaddress'],
'm.destination' => $lng['emails']['forwarders']
);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_MAIL_VIRTUAL, $fields);
$result_stmt = Database::prepare('SELECT `m`.`id`, `m`.`domainid`, `m`.`email`, `m`.`email_full`, `m`.`iscatchall`, `u`.`quota`, `m`.`destination`, `m`.`popaccountid`, `d`.`domain`, `u`.`mboxsize` FROM `' . TABLE_MAIL_VIRTUAL . '` `m`
LEFT JOIN `' . TABLE_PANEL_DOMAINS . '` `d` ON (`m`.`domainid` = `d`.`id`)
LEFT JOIN `' . TABLE_MAIL_USERS . '` `u` ON (`m`.`popaccountid` = `u`.`id`)
WHERE `m`.`customerid`= :customerid ' . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
Database::pexecute($result_stmt, array(
"customerid" => $userinfo['customerid']
));
$emailscount = Database::num_rows();
$paging->setEntries($emailscount);
$sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$emails = array();
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { try {
if (! isset($emails[$row['domain']]) || ! is_array($emails[$row['domain']])) { $email_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/customer/tablelisting.emails.php';
$emails[$row['domain']] = array(); $collection = (new Collection(Emails::class, $userinfo))
->withPagination($email_list_data['email_list']['columns'], $email_list_data['email_list']['default_sorting']);
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
} }
$emails[$row['domain']][$row['email_full']] = $row; $result_stmt = Database::prepare("
SELECT COUNT(`id`) as emaildomains
FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `customerid`= :cid AND `isemaildomain` = '1'
");
$result2 = Database::pexecute_first($result_stmt, [
"cid" => $userinfo['customerid']
]);
$emaildomains_count = $result2['emaildomains'];
$actions_links = false;
if (CurrentUser::canAddResource('emails')) {
$actions_links = [
[
'href' => $linker->getLink(['section' => 'email', 'page' => $page, 'action' => 'add']),
'label' => lng('emails.emails_add')
]
];
} }
if ($paging->sortfield == 'd.domain' && $paging->sortorder == 'desc') { UI::view('user/table.html.twig', [
krsort($emails); 'listing' => Listing::format($collection, $email_list_data, 'email_list'),
} else { 'actions_links' => $actions_links,
ksort($emails); 'entity_info' => lng('emails.description')
} ]);
$i = 0;
$count = 0;
$accounts = '';
$emails_count = 0;
$domainname = '';
foreach ($emails as $domainid => $emailaddresses) {
if ($paging->sortfield == 'm.email_full' && $paging->sortorder == 'desc') {
krsort($emailaddresses);
} else {
ksort($emailaddresses);
}
foreach ($emailaddresses as $row) {
if ($paging->checkDisplay($i)) {
if ($domainname != $idna_convert->decode($row['domain'])) {
$domainname = $idna_convert->decode($row['domain']);
eval("\$accounts.=\"" . \Froxlor\UI\Template::getTemplate("email/emails_domain") . "\";");
}
$emails_count ++;
$row['email'] = $idna_convert->decode($row['email']);
$row['email_full'] = $idna_convert->decode($row['email_full']);
$row['destination'] = explode(' ', $row['destination']);
uasort($row['destination'], 'strcasecmp');
$dest_list = $row['destination'];
foreach ($dest_list as $dest_id => $destination) {
$row['destination'][$dest_id] = $idna_convert->decode($row['destination'][$dest_id]);
if ($row['destination'][$dest_id] == $row['email_full']) {
unset($row['destination'][$dest_id]);
}
}
$destinations_count = count($row['destination']);
$row['destination'] = implode(', ', $row['destination']);
if (strlen($row['destination']) > 35) {
$row['destination'] = substr($row['destination'], 0, 32) . '... (' . $destinations_count . ')';
}
$row['mboxsize'] = \Froxlor\PhpHelper::sizeReadable($row['mboxsize'], 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
eval("\$accounts.=\"" . \Froxlor\UI\Template::getTemplate("email/emails_email") . "\";");
$count ++;
}
$i ++;
}
}
$emaildomains_count_stmt = Database::prepare("SELECT COUNT(`id`) AS `count` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `customerid`= :customerid
AND `isemaildomain`='1' ORDER BY `domain` ASC");
Database::pexecute($emaildomains_count_stmt, array(
"customerid" => $userinfo['customerid']
));
$emaildomains_count = $emaildomains_count_stmt->fetch(PDO::FETCH_ASSOC);
$emaildomains_count = $emaildomains_count['count'];
eval("echo \"" . \Froxlor\UI\Template::getTemplate("email/emails") . "\";");
} elseif ($action == 'delete' && $id != 0) { } elseif ($action == 'delete' && $id != 0) {
try { try {
$json_result = Emails::getLocal($userinfo, array( $json_result = Emails::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
if (isset($result['email']) && $result['email'] != '') { if (isset($result['email']) && $result['email'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { try {
Emails::getLocal($userinfo, array( Emails::getLocal($userinfo, [
'id' => $id 'id' => $id,
))->delete(); 'delete_userfiles' => ($_POST['delete_userfiles'] ?? 0)
])->delete();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
if ($result['popaccountid'] != '0') { if ($result['popaccountid'] != '0') {
$show_checkbox = true; $show_checkbox = true;
} else { } else {
$show_checkbox = false; $show_checkbox = false;
} }
\Froxlor\UI\HTML::askYesNoWithCheckbox('email_reallydelete', 'admin_customer_alsoremovemail', $filename, array( HTML::askYesNoWithCheckbox('email_reallydelete', 'admin_customer_alsoremovemail', $filename, [
'id' => $id, 'id' => $id,
'page' => $page, 'page' => $page,
'action' => $action 'action' => $action
), $idna_convert->decode($result['email_full']), $show_checkbox); ], $idna_convert->decode($result['email_full']), $show_checkbox);
} }
} }
} elseif ($action == 'add') { } elseif ($action == 'add') {
@@ -181,78 +128,89 @@ if ($page == 'overview') {
try { try {
$json_result = Emails::getLocal($userinfo, $_POST)->add(); $json_result = Emails::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page,
'action' => 'edit', 'action' => 'edit',
'id' => $result['id'], 'id' => $result['id']
's' => $s ]);
));
} else { } else {
$result_stmt = Database::prepare("SELECT `id`, `domain`, `customerid` FROM `" . TABLE_PANEL_DOMAINS . "` $result_stmt = Database::prepare("SELECT `id`, `domain`, `customerid` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `customerid`= :cid WHERE `customerid`= :cid
AND `isemaildomain`='1' AND `isemaildomain`='1'
ORDER BY `domain` ASC"); ORDER BY `domain_ace` ASC");
Database::pexecute($result_stmt, array( Database::pexecute($result_stmt, [
"cid" => $userinfo['customerid'] "cid" => $userinfo['customerid']
)); ]);
$domains = ''; $domains = [];
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$domains .= \Froxlor\UI\HTML::makeoption($idna_convert->decode($row['domain']), $row['domain']); $domains[$row['domain']] = $idna_convert->decode($row['domain']);
} }
// $iscatchall = \Froxlor\UI\HTML::makeyesno('iscatchall', '1', '0', '0'); if (count($domains) > 0) {
$email_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_add.php'; $email_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_add.php';
if (Settings::Get('catchall.catchall_enabled') != '1') { if (Settings::Get('catchall.catchall_enabled') != '1') {
unset($email_add_data['emails_add']['sections']['section_a']['fields']['iscatchall']); unset($email_add_data['emails_add']['sections']['section_a']['fields']['iscatchall']);
} }
UI::view('user/form.html.twig', [
$email_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($email_add_data); 'formaction' => $linker->getLink(['section' => 'email']),
'formdata' => $email_add_data['emails_add']
$title = $email_add_data['emails_add']['title']; ]);
$image = $email_add_data['emails_add']['image']; } else {
Response::standardError('emails.noemaildomainaddedyet');
eval("echo \"" . \Froxlor\UI\Template::getTemplate("email/emails_add") . "\";"); }
} }
} else { } else {
\Froxlor\UI\Response::standard_error('allresourcesused'); Response::standardError('allresourcesused');
} }
} elseif ($action == 'edit' && $id != 0) { } elseif ($action == 'edit' && $id != 0) {
try { try {
$json_result = Emails::getLocal($userinfo, array( $json_result = Emails::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
if (isset($result['email']) && $result['email'] != '') { if (isset($result['email']) && $result['email'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
Response::redirectTo($filename, [
'page' => $page
]);
}
$result['email'] = $idna_convert->decode($result['email']); $result['email'] = $idna_convert->decode($result['email']);
$result['email_full'] = $idna_convert->decode($result['email_full']); $result['email_full'] = $idna_convert->decode($result['email_full']);
$result['destination'] = explode(' ', $result['destination']); $result['destination'] = explode(' ', $result['destination']);
uasort($result['destination'], 'strcasecmp'); uasort($result['destination'], 'strcasecmp');
$forwarders = ''; $forwarders = [];
$forwarders_count = 0; $forwarders_count = 0;
foreach ($result['destination'] as $dest_id => $destination) { foreach ($result['destination'] as $dest_id => $destination) {
$destination = $idna_convert->decode($destination); $destination = $idna_convert->decode($destination);
if ($destination != $result['email_full'] && $destination != '') { if ($destination != $result['email_full'] && $destination != '') {
eval("\$forwarders.=\"" . \Froxlor\UI\Template::getTemplate("email/emails_edit_forwarder") . "\";"); $forwarders[] = [
$forwarders_count ++; 'item' => $destination,
'href' => $linker->getLink([
'section' => 'email',
'page' => 'forwarders',
'action' => 'delete',
'id' => $id,
'forwarderid' => $dest_id
]),
'label' => lng('panel.delete'),
'classes' => 'btn btn-sm btn-danger'
];
$forwarders_count++;
} }
$result['destination'][$dest_id] = $destination; $result['destination'][$dest_id] = $destination;
} }
$destinations_count = count($result['destination']); $destinations_count = count($result['destination']);
$result = \Froxlor\PhpHelper::htmlentitiesArray($result); $result = PhpHelper::htmlentitiesArray($result);
$email_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_edit.php'; $email_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_edit.php';
@@ -260,47 +218,45 @@ if ($page == 'overview') {
unset($email_edit_data['emails_edit']['sections']['section_a']['fields']['mail_catchall']); unset($email_edit_data['emails_edit']['sections']['section_a']['fields']['mail_catchall']);
} }
$email_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($email_edit_data); UI::view('user/form.html.twig', [
'formaction' => $linker->getLink(['section' => 'email']),
$title = $email_edit_data['emails_edit']['title']; 'formdata' => $email_edit_data['emails_edit'],
$image = $email_edit_data['emails_edit']['image']; 'editid' => $id
]);
eval("echo \"" . \Froxlor\UI\Template::getTemplate("email/emails_edit") . "\";");
} }
} elseif ($action == 'togglecatchall' && $id != 0) { } elseif ($action == 'togglecatchall' && $id != 0) {
try { try {
$json_result = Emails::getLocal($userinfo, array( $json_result = Emails::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
try { try {
Emails::getLocal($userinfo, array( Emails::getLocal($userinfo, [
'id' => $id, 'id' => $id,
'iscatchall' => ($result['iscatchall'] == '1' ? 0 : 1) 'iscatchall' => ($result['iscatchall'] == '1' ? 0 : 1)
))->update(); ])->update();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page,
'action' => 'edit', 'action' => 'edit',
'id' => $id, 'id' => $id
's' => $s ]);
));
} }
} elseif ($page == 'accounts') { } elseif ($page == 'accounts') {
if ($action == 'add' && $id != 0) { if ($action == 'add' && $id != 0) {
if ($userinfo['email_accounts'] == '-1' || ($userinfo['email_accounts_used'] < $userinfo['email_accounts'])) { if ($userinfo['email_accounts'] == '-1' || ($userinfo['email_accounts_used'] < $userinfo['email_accounts'])) {
try { try {
$json_result = Emails::getLocal($userinfo, array( $json_result = Emails::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
@@ -308,47 +264,63 @@ if ($page == 'overview') {
try { try {
EmailAccounts::getLocal($userinfo, $_POST)->add(); EmailAccounts::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => 'emails', 'page' => 'emails',
'action' => 'edit', 'action' => 'edit',
'id' => $id, 'id' => $id
's' => $s ]);
));
} else { } else {
if (Check::checkMailAccDeletionState($result['email_full'])) {
if (\Froxlor\Validate\Check::checkMailAccDeletionState($result['email_full'])) { Response::standardError([
\Froxlor\UI\Response::standard_error(array(
'mailaccistobedeleted' 'mailaccistobedeleted'
), $result['email_full']); ], $result['email_full']);
} }
$result['email_full'] = $idna_convert->decode($result['email_full']); $result['email_full'] = $idna_convert->decode($result['email_full']);
$result = \Froxlor\PhpHelper::htmlentitiesArray($result); $result = PhpHelper::htmlentitiesArray($result);
$quota = Settings::Get('system.mail_quota'); $quota = Settings::Get('system.mail_quota');
$account_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_addaccount.php'; $account_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_addaccount.php';
$account_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($account_add_data);
$title = $account_add_data['emails_addaccount']['title']; UI::view('user/form.html.twig', [
$image = $account_add_data['emails_addaccount']['image']; 'formaction' => $linker->getLink(['section' => 'email', 'id' => $id]),
'formdata' => $account_add_data['emails_addaccount'],
eval("echo \"" . \Froxlor\UI\Template::getTemplate("email/account_add") . "\";"); 'actions_links' => [
[
'class' => 'btn-secondary',
'href' => $linker->getLink([
'section' => 'email',
'page' => 'emails',
'action' => 'edit',
'id' => $id
]),
'label' => lng('emails.emails_edit'),
'icon' => 'fa-solid fa-pen'
],
[
'class' => 'btn-secondary',
'href' => $linker->getLink(['section' => 'email', 'page' => 'emails']),
'label' => lng('menue.email.emails'),
'icon' => 'fa-solid fa-envelope'
]
],
]);
} }
} else { } else {
\Froxlor\UI\Response::standard_error(array( Response::standardError([
'allresourcesused', 'allresourcesused',
'allocatetoomuchquota' 'allocatetoomuchquota'
), $quota); ], $quota);
} }
} elseif ($action == 'changepw' && $id != 0) { } elseif ($action == 'changepw' && $id != 0) {
try { try {
$json_result = Emails::getLocal($userinfo, array( $json_result = Emails::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
@@ -357,34 +329,51 @@ if ($page == 'overview') {
try { try {
EmailAccounts::getLocal($userinfo, $_POST)->update(); EmailAccounts::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => 'emails', 'page' => 'emails',
'action' => 'edit', 'action' => 'edit',
'id' => $id, 'id' => $id
's' => $s ]);
));
} else { } else {
$result['email_full'] = $idna_convert->decode($result['email_full']); $result['email_full'] = $idna_convert->decode($result['email_full']);
$result = \Froxlor\PhpHelper::htmlentitiesArray($result); $result = PhpHelper::htmlentitiesArray($result);
$account_changepw_data = include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_accountchangepasswd.php'; $account_changepw_data = include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_accountchangepasswd.php';
$account_changepw_form = \Froxlor\UI\HtmlForm::genHTMLForm($account_changepw_data);
$title = $account_changepw_data['emails_accountchangepasswd']['title']; UI::view('user/form.html.twig', [
$image = $account_changepw_data['emails_accountchangepasswd']['image']; 'formaction' => $linker->getLink(['section' => 'email', 'id' => $id]),
'formdata' => $account_changepw_data['emails_accountchangepasswd'],
eval("echo \"" . \Froxlor\UI\Template::getTemplate("email/account_changepw") . "\";"); 'actions_links' => [
[
'class' => 'btn-secondary',
'href' => $linker->getLink([
'section' => 'email',
'page' => 'emails',
'action' => 'edit',
'id' => $id
]),
'label' => lng('emails.emails_edit'),
'icon' => 'fa-solid fa-pen'
],
[
'class' => 'btn-secondary',
'href' => $linker->getLink(['section' => 'email', 'page' => 'emails']),
'label' => lng('menue.email.emails'),
'icon' => 'fa-solid fa-envelope'
]
],
]);
} }
} }
} elseif ($action == 'changequota' && Settings::Get('system.mail_quota_enabled') == '1' && $id != 0) { } elseif ($action == 'changequota' && Settings::Get('system.mail_quota_enabled') == '1' && $id != 0) {
try { try {
$json_result = Emails::getLocal($userinfo, array( $json_result = Emails::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
@@ -393,34 +382,51 @@ if ($page == 'overview') {
try { try {
EmailAccounts::getLocal($userinfo, $_POST)->update(); EmailAccounts::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => 'emails', 'page' => 'emails',
'action' => 'edit', 'action' => 'edit',
'id' => $id, 'id' => $id
's' => $s ]);
));
} else { } else {
$result['email_full'] = $idna_convert->decode($result['email_full']); $result['email_full'] = $idna_convert->decode($result['email_full']);
$result = \Froxlor\PhpHelper::htmlentitiesArray($result); $result = PhpHelper::htmlentitiesArray($result);
$quota_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_accountchangequota.php'; $quota_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_accountchangequota.php';
$quota_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($quota_edit_data);
$title = $quota_edit_data['emails_accountchangequota']['title']; UI::view('user/form.html.twig', [
$image = $quota_edit_data['emails_accountchangequota']['image']; 'formaction' => $linker->getLink(['section' => 'email', 'id' => $id]),
'formdata' => $quota_edit_data['emails_accountchangequota'],
eval("echo \"" . \Froxlor\UI\Template::getTemplate("email/account_changequota") . "\";"); 'actions_links' => [
[
'class' => 'btn-secondary',
'href' => $linker->getLink([
'section' => 'email',
'page' => 'emails',
'action' => 'edit',
'id' => $id
]),
'label' => lng('emails.emails_edit'),
'icon' => 'fa-solid fa-pen'
],
[
'class' => 'btn-secondary',
'href' => $linker->getLink(['section' => 'email', 'page' => 'emails']),
'label' => lng('menue.email.emails'),
'icon' => 'fa-solid fa-envelope'
]
],
]);
} }
} }
} elseif ($action == 'delete' && $id != 0) { } elseif ($action == 'delete' && $id != 0) {
try { try {
$json_result = Emails::getLocal($userinfo, array( $json_result = Emails::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
@@ -429,20 +435,19 @@ if ($page == 'overview') {
try { try {
EmailAccounts::getLocal($userinfo, $_POST)->delete(); EmailAccounts::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => 'emails', 'page' => 'emails',
'action' => 'edit', 'action' => 'edit',
'id' => $id, 'id' => $id
's' => $s ]);
));
} else { } else {
\Froxlor\UI\HTML::askYesNoWithCheckbox('email_reallydelete_account', 'admin_customer_alsoremovemail', $filename, array( HTML::askYesNoWithCheckbox('email_reallydelete_account', 'admin_customer_alsoremovemail', $filename, [
'id' => $id, 'id' => $id,
'page' => $page, 'page' => $page,
'action' => $action 'action' => $action
), $idna_convert->decode($result['email_full'])); ], $idna_convert->decode($result['email_full']));
} }
} }
} }
@@ -450,11 +455,11 @@ if ($page == 'overview') {
if ($action == 'add' && $id != 0) { if ($action == 'add' && $id != 0) {
if ($userinfo['email_forwarders_used'] < $userinfo['email_forwarders'] || $userinfo['email_forwarders'] == '-1') { if ($userinfo['email_forwarders_used'] < $userinfo['email_forwarders'] || $userinfo['email_forwarders'] == '-1') {
try { try {
$json_result = Emails::getLocal($userinfo, array( $json_result = Emails::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
@@ -463,37 +468,54 @@ if ($page == 'overview') {
try { try {
EmailForwarders::getLocal($userinfo, $_POST)->add(); EmailForwarders::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => 'emails', 'page' => 'emails',
'action' => 'edit', 'action' => 'edit',
'id' => $id, 'id' => $id
's' => $s ]);
));
} else { } else {
$result['email_full'] = $idna_convert->decode($result['email_full']); $result['email_full'] = $idna_convert->decode($result['email_full']);
$result = \Froxlor\PhpHelper::htmlentitiesArray($result); $result = PhpHelper::htmlentitiesArray($result);
$forwarder_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_addforwarder.php'; $forwarder_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_addforwarder.php';
$forwarder_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($forwarder_add_data);
$title = $forwarder_add_data['emails_addforwarder']['title']; UI::view('user/form.html.twig', [
$image = $forwarder_add_data['emails_addforwarder']['image']; 'formaction' => $linker->getLink(['section' => 'email', 'id' => $id]),
'formdata' => $forwarder_add_data['emails_addforwarder'],
eval("echo \"" . \Froxlor\UI\Template::getTemplate("email/forwarder_add") . "\";"); 'actions_links' => [
[
'class' => 'btn-secondary',
'href' => $linker->getLink([
'section' => 'email',
'page' => 'emails',
'action' => 'edit',
'id' => $id
]),
'label' => lng('emails.emails_edit'),
'icon' => 'fa-solid fa-pen'
],
[
'class' => 'btn-secondary',
'href' => $linker->getLink(['section' => 'email', 'page' => 'emails']),
'label' => lng('menue.email.emails'),
'icon' => 'fa-solid fa-envelope'
]
],
]);
} }
} }
} else { } else {
\Froxlor\UI\Response::standard_error('allresourcesused'); Response::standardError('allresourcesused');
} }
} elseif ($action == 'delete' && $id != 0) { } elseif ($action == 'delete' && $id != 0) {
try { try {
$json_result = Emails::getLocal($userinfo, array( $json_result = Emails::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
@@ -515,21 +537,20 @@ if ($page == 'overview') {
try { try {
EmailForwarders::getLocal($userinfo, $_POST)->delete(); EmailForwarders::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => 'emails', 'page' => 'emails',
'action' => 'edit', 'action' => 'edit',
'id' => $id, 'id' => $id
's' => $s ]);
));
} else { } else {
\Froxlor\UI\HTML::askYesNo('email_reallydelete_forwarder', $filename, array( HTML::askYesNo('email_reallydelete_forwarder', $filename, [
'id' => $id, 'id' => $id,
'forwarderid' => $forwarderid, 'forwarderid' => $forwarderid,
'page' => $page, 'page' => $page,
'action' => $action 'action' => $action
), $idna_convert->decode($result['email_full']) . ' -> ' . $idna_convert->decode($forwarder)); ], $idna_convert->decode($result['email_full']) . ' -> ' . $idna_convert->decode($forwarder));
} }
} }
} }

View File

@@ -2,93 +2,89 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Panel
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'customer');
require './lib/init.php';
use Froxlor\Database\Database; const AREA = 'customer';
use Froxlor\Settings; require __DIR__ . '/lib/init.php';
use Froxlor\Api\Commands\CustomerBackups as CustomerBackups;
use Froxlor\Api\Commands\DirOptions as DirOptions; use Froxlor\Api\Commands\DirOptions as DirOptions;
use Froxlor\Api\Commands\DirProtections as DirProtections; use Froxlor\Api\Commands\DirProtections as DirProtections;
use Froxlor\Api\Commands\CustomerBackups as CustomerBackups; use Froxlor\Customer\Customer;
use Froxlor\FileDir;
use Froxlor\FroxlorLogger;
use Froxlor\PhpHelper;
use Froxlor\Settings;
use Froxlor\UI\Collection;
use Froxlor\UI\HTML;
use Froxlor\UI\Listing;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
// redirect if this customer page is hidden via settings // redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options', 'extras')) { if (Settings::IsInList('panel.customer_hide_options', 'extras')) {
\Froxlor\UI\Response::redirectTo('customer_index.php'); Response::redirectTo('customer_index.php');
} }
if (isset($_POST['id'])) { $id = (int)Request::any('id');
$id = intval($_POST['id']);
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
if ($page == 'overview') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_extras");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/extras") . "\";");
} elseif ($page == 'htpasswds') {
if ($page == 'overview' || $page == 'htpasswds') {
// redirect if this customer sub-page is hidden via settings // redirect if this customer sub-page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options', 'extras.directoryprotection')) { if (Settings::IsInList('panel.customer_hide_options', 'extras.directoryprotection')) {
\Froxlor\UI\Response::redirectTo('customer_index.php'); Response::redirectTo('customer_index.php');
} }
if ($action == '') { if ($action == '') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_extras::htpasswds"); $log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_extras::htpasswds");
$fields = array( $fields = [
'username' => $lng['login']['username'], 'username' => lng('login.username'),
'path' => $lng['panel']['path'] 'path' => lng('panel.path')
); ];
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_HTPASSWDS, $fields); try {
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "` $htpasswd_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/customer/tablelisting.htpasswd.php';
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()); $collection = (new Collection(DirProtections::class, $userinfo))
Database::pexecute($result_stmt, array( ->withPagination($htpasswd_list_data['htpasswd_list']['columns'], $htpasswd_list_data['htpasswd_list']['default_sorting']);
"customerid" => $userinfo['customerid'] } catch (Exception $e) {
)); Response::dynamicError($e->getMessage());
$paging->setEntries(Database::num_rows());
$sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$i = 0;
$count = 0;
$htpasswds = '';
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
if ($paging->checkDisplay($i)) {
if (strpos($row['path'], $userinfo['documentroot']) === 0) {
$row['path'] = str_replace($userinfo['documentroot'], "/", $row['path']);
}
$row['path'] = \Froxlor\FileDir::makeCorrectDir($row['path']);
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
eval("\$htpasswds.=\"" . \Froxlor\UI\Template::getTemplate("extras/htpasswds_htpasswd") . "\";");
$count ++;
} }
$i ++; UI::view('user/table.html.twig', [
} 'listing' => Listing::format($collection, $htpasswd_list_data, 'htpasswd_list'),
'actions_links' => [
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htpasswds") . "\";"); [
'href' => $linker->getLink(['section' => 'extras', 'page' => 'htpasswds', 'action' => 'add']),
'label' => lng('extras.directoryprotection_add')
]
],
'entity_info' => lng('extras.description')
]);
} elseif ($action == 'delete' && $id != 0) { } elseif ($action == 'delete' && $id != 0) {
try { try {
$json_result = DirProtections::getLocal($userinfo, array( $json_result = DirProtections::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
@@ -97,22 +93,21 @@ if ($page == 'overview') {
try { try {
DirProtections::getLocal($userinfo, $_POST)->delete(); DirProtections::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
if (strpos($result['path'], $userinfo['documentroot']) === 0) { if (strpos($result['path'], $userinfo['documentroot']) === 0) {
$result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']); $result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']);
} }
\Froxlor\UI\HTML::askYesNo('extras_reallydelete', $filename, array( HTML::askYesNo('extras_reallydelete', $filename, [
'id' => $id, 'id' => $id,
'page' => $page, 'page' => $page,
'action' => $action 'action' => $action
), $result['username'] . ' (' . $result['path'] . ')'); ], $result['username'] . ' (' . $result['path'] . ')');
} }
} }
} elseif ($action == 'add') { } elseif ($action == 'add') {
@@ -120,30 +115,28 @@ if ($page == 'overview') {
try { try {
DirProtections::getLocal($userinfo, $_POST)->add(); DirProtections::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']); $pathSelect = FileDir::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 = \Froxlor\UI\HtmlForm::genHTMLForm($htpasswd_add_data);
$title = $htpasswd_add_data['htpasswd_add']['title']; UI::view('user/form.html.twig', [
$image = $htpasswd_add_data['htpasswd_add']['image']; 'formaction' => $linker->getLink(['section' => 'extras']),
'formdata' => $htpasswd_add_data['htpasswd_add']
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htpasswds_add") . "\";"); ]);
} }
} elseif ($action == 'edit' && $id != 0) { } elseif ($action == 'edit' && $id != 0) {
try { try {
$json_result = DirProtections::getLocal($userinfo, array( $json_result = DirProtections::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
@@ -152,89 +145,63 @@ if ($page == 'overview') {
try { try {
DirProtections::getLocal($userinfo, $_POST)->update(); DirProtections::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
if (strpos($result['path'], $userinfo['documentroot']) === 0) { if (strpos($result['path'], $userinfo['documentroot']) === 0) {
$result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']); $result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']);
} }
$result = PhpHelper::htmlentitiesArray($result);
$result = \Froxlor\PhpHelper::htmlentitiesArray($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 = \Froxlor\UI\HtmlForm::genHTMLForm($htpasswd_edit_data);
$title = $htpasswd_edit_data['htpasswd_edit']['title']; UI::view('user/form.html.twig', [
$image = $htpasswd_edit_data['htpasswd_edit']['image']; 'formaction' => $linker->getLink(['section' => 'extras', 'id' => $id]),
'formdata' => $htpasswd_edit_data['htpasswd_edit'],
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htpasswds_edit") . "\";"); 'editid' => $id
]);
} }
} }
} }
} elseif ($page == 'htaccess') { } elseif ($page == 'htaccess') {
// redirect if this customer sub-page is hidden via settings // redirect if this customer sub-page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options', 'extras.pathoptions')) { if (Settings::IsInList('panel.customer_hide_options', 'extras.pathoptions')) {
\Froxlor\UI\Response::redirectTo('customer_index.php'); Response::redirectTo('customer_index.php');
} }
if ($action == '') { if ($action == '') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_extras::htaccess"); $log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_extras::htaccess");
$fields = array(
'path' => $lng['panel']['path'],
'options_indexes' => $lng['extras']['view_directory'],
'error404path' => $lng['extras']['error404path'],
'error403path' => $lng['extras']['error403path'],
'error500path' => $lng['extras']['error500path'],
'options_cgi' => $lng['extras']['execute_perl']
);
$paging = new \Froxlor\UI\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']
));
$paging->setEntries(Database::num_rows());
$sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$i = 0;
$count = 0;
$htaccess = '';
$cperlenabled = \Froxlor\Customer\Customer::customerHasPerlEnabled($userinfo['customerid']); $cperlenabled = Customer::customerHasPerlEnabled($userinfo['customerid']);
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { try {
if ($paging->checkDisplay($i)) { $htaccess_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/customer/tablelisting.htaccess.php';
if (strpos($row['path'], $userinfo['documentroot']) === 0) { $collection = (new Collection(DirOptions::class, $userinfo))
$row['path'] = str_replace($userinfo['documentroot'], "/", $row['path']); ->withPagination($htaccess_list_data['htaccess_list']['columns'], $htaccess_list_data['htaccess_list']['default_sorting']);
} } catch (Exception $e) {
$row['path'] = \Froxlor\FileDir::makeCorrectDir($row['path']); Response::dynamicError($e->getMessage());
$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 = \Froxlor\PhpHelper::htmlentitiesArray($row);
eval("\$htaccess.=\"" . \Froxlor\UI\Template::getTemplate("extras/htaccess_htaccess") . "\";");
$count ++;
} }
$i ++; UI::view('user/table.html.twig', [
} 'listing' => Listing::format($collection, $htaccess_list_data, 'htaccess_list'),
'actions_links' => [
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htaccess") . "\";"); [
'href' => $linker->getLink(['section' => 'extras', 'page' => 'htaccess', 'action' => 'add']),
'label' => lng('extras.pathoptions_add')
]
],
'entity_info' => lng('extras.description')
]);
} elseif ($action == 'delete' && $id != 0) { } elseif ($action == 'delete' && $id != 0) {
try { try {
$json_result = DirOptions::getLocal($userinfo, array( $json_result = DirOptions::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
@@ -243,18 +210,17 @@ if ($page == 'overview') {
try { try {
DirOptions::getLocal($userinfo, $_POST)->delete(); DirOptions::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
\Froxlor\UI\HTML::askYesNo('extras_reallydelete_pathoptions', $filename, array( HTML::askYesNo('extras_reallydelete_pathoptions', $filename, [
'id' => $id, 'id' => $id,
'page' => $page, 'page' => $page,
'action' => $action 'action' => $action
), str_replace($userinfo['documentroot'], '/', $result['path'])); ], str_replace($userinfo['documentroot'], '/', $result['path']));
} }
} }
} elseif ($action == 'add') { } elseif ($action == 'add') {
@@ -262,31 +228,29 @@ if ($page == 'overview') {
try { try {
DirOptions::getLocal($userinfo, $_POST)->add(); DirOptions::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']); $pathSelect = FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
$cperlenabled = \Froxlor\Customer\Customer::customerHasPerlEnabled($userinfo['customerid']); $cperlenabled = Customer::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 = \Froxlor\UI\HtmlForm::genHTMLForm($htaccess_add_data);
$title = $htaccess_add_data['htaccess_add']['title']; UI::view('user/form.html.twig', [
$image = $htaccess_add_data['htaccess_add']['image']; 'formaction' => $linker->getLink(['section' => 'extras']),
'formdata' => $htaccess_add_data['htaccess_add']
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htaccess_add") . "\";"); ]);
} }
} elseif (($action == 'edit') && ($id != 0)) { } elseif (($action == 'edit') && ($id != 0)) {
try { try {
$json_result = DirOptions::getLocal($userinfo, array( $json_result = DirOptions::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
@@ -295,106 +259,86 @@ if ($page == 'overview') {
try { try {
DirOptions::getLocal($userinfo, $_POST)->update(); DirOptions::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
if (strpos($result['path'], $userinfo['documentroot']) === 0) { if (strpos($result['path'], $userinfo['documentroot']) === 0) {
$result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']); $result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']);
} }
$cperlenabled = Customer::customerHasPerlEnabled($userinfo['customerid']);
$result['error404path'] = $result['error404path']; $result = PhpHelper::htmlentitiesArray($result);
$result['error403path'] = $result['error403path'];
$result['error500path'] = $result['error500path'];
$cperlenabled = \Froxlor\Customer\Customer::customerHasPerlEnabled($userinfo['customerid']);
/*
* $options_indexes = \Froxlor\UI\HTML::makeyesno('options_indexes', '1', '0', $result['options_indexes']);
* $options_cgi = \Froxlor\UI\HTML::makeyesno('options_cgi', '1', '0', $result['options_cgi']);
*/
$result = \Froxlor\PhpHelper::htmlentitiesArray($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 = \Froxlor\UI\HtmlForm::genHTMLForm($htaccess_edit_data);
$title = $htaccess_edit_data['htaccess_edit']['title']; UI::view('user/form.html.twig', [
$image = $htaccess_edit_data['htaccess_edit']['image']; 'formaction' => $linker->getLink(['section' => 'extras', 'id' => $id]),
'formdata' => $htaccess_edit_data['htaccess_edit'],
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htaccess_edit") . "\";"); 'editid' => $id
]);
} }
} }
} }
} elseif ($page == 'backup') { } elseif ($page == 'backup') {
// redirect if this customer sub-page is hidden via settings // redirect if this customer sub-page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options', 'extras.backup')) { if (Settings::IsInList('panel.customer_hide_options', 'extras.backup')) {
\Froxlor\UI\Response::redirectTo('customer_index.php'); Response::redirectTo('customer_index.php');
} }
if (Settings::Get('system.backupenabled') == 1) { if (Settings::Get('system.backupenabled') == 1) {
if ($action == 'abort' && isset($_POST['send']) && $_POST['send'] == 'send') { if ($action == 'abort') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "customer_extras::backup - aborted scheduled backupjob"); if (isset($_POST['send']) && $_POST['send'] == 'send') {
$log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "customer_extras::backup - aborted scheduled backupjob");
try { try {
CustomerBackups::getLocal($userinfo, $_POST)->delete(); CustomerBackups::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::standard_success('backupaborted'); Response::redirectTo($filename, [
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page, 'page' => $page,
'action' => '', 'action' => ''
's' => $s ]);
)); } else {
HTML::askYesNo('extras_reallydelete_backup', $filename, [
'backup_job_entry' => $id,
'section' => 'extras',
'page' => $page,
'action' => $action
]);
} }
if ($action == '') { } elseif ($action == '') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_extras::backup"); $log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_extras::backup");
// check whether there is a backup-job for this customer // check whether there is a backup-job for this customer
try { try {
$json_result = CustomerBackups::getLocal($userinfo)->listing(); $backup_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/customer/tablelisting.backups.php';
$collection = (new Collection(CustomerBackups::class, $userinfo));
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
$existing_backupJob = null;
if ($result['count'] > 0) {
$existing_backupJob = array_shift($result['list']);
} }
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try { try {
CustomerBackups::getLocal($userinfo, $_POST)->add(); CustomerBackups::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::standard_success('backupscheduled'); Response::standardSuccess('backupscheduled');
} else { } else {
$pathSelect = FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
if (! empty($existing_backupJob)) {
$action = "abort";
$row = $existing_backupJob['data'];
$row['path'] = \Froxlor\FileDir::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 = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
$backup_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.backup.php'; $backup_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.backup.php';
$backup_form = \Froxlor\UI\HtmlForm::genHTMLForm($backup_data);
$title = $backup_data['backup']['title'];
$image = $backup_data['backup']['image'];
if (! empty($existing_backupJob)) { UI::view('user/form-datatable.html.twig', [
// overwrite backup_form after we took everything from it we needed 'formaction' => $linker->getLink(['section' => 'extras']),
eval("\$backup_form = \"" . \Froxlor\UI\Template::getTemplate("extras/backup_listexisting") . "\";"); 'formdata' => $backup_data['backup'],
} 'tabledata' => Listing::format($collection, $backup_list_data, 'backup_list'),
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/backup") . "\";"); ]);
} }
} }
} else { } else {
\Froxlor\UI\Response::standard_error('backupfunctionnotenabled'); Response::standardError('backupfunctionnotenabled');
} }
} }

View File

@@ -2,93 +2,83 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Panel
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'customer');
require './lib/init.php';
use Froxlor\Database\Database; const AREA = 'customer';
use Froxlor\Settings; require __DIR__ . '/lib/init.php';
use Froxlor\Api\Commands\Ftps as Ftps; use Froxlor\Api\Commands\Ftps as Ftps;
use Froxlor\Database\Database;
use Froxlor\FileDir;
use Froxlor\FroxlorLogger;
use Froxlor\Settings;
use Froxlor\UI\Collection;
use Froxlor\UI\HTML;
use Froxlor\UI\Listing;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
use Froxlor\CurrentUser;
// redirect if this customer page is hidden via settings // redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options', 'ftp')) { if (Settings::IsInList('panel.customer_hide_options', 'ftp') || $userinfo['ftps'] == 0) {
\Froxlor\UI\Response::redirectTo('customer_index.php'); Response::redirectTo('customer_index.php');
} }
$id = 0; $id = (int)Request::any('id', 0);
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
if ($page == 'overview') { if ($page == 'overview' || $page == 'accounts') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_ftp");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/ftp') . "\";");
} elseif ($page == 'accounts') {
if ($action == '') { if ($action == '') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_ftp::accounts"); $log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_ftp::accounts");
$fields = array( try {
'username' => $lng['login']['username'], $ftp_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/customer/tablelisting.ftps.php';
'homedir' => $lng['panel']['path'], $collection = (new Collection(Ftps::class, $userinfo))
'description' => $lng['panel']['ftpdesc'] ->withPagination($ftp_list_data['ftp_list']['columns'], $ftp_list_data['ftp_list']['default_sorting']);
); } catch (Exception $e) {
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_FTP_USERS, $fields); Response::dynamicError($e->getMessage());
$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']
));
$ftps_count = Database::num_rows();
$paging->setEntries($ftps_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);
$i = 0;
$count = 0;
$accounts = '';
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
if ($paging->checkDisplay($i)) {
if (strpos($row['homedir'], $userinfo['documentroot']) === 0) {
$row['documentroot'] = str_replace($userinfo['documentroot'], "/", $row['homedir']);
} else {
$row['documentroot'] = $row['homedir'];
} }
$row['documentroot'] = \Froxlor\FileDir::makeCorrectDir($row['documentroot']); $actions_links = false;
if (CurrentUser::canAddResource('ftps')) {
$row = \Froxlor\PhpHelper::htmlentitiesArray($row); $actions_links = [
eval("\$accounts.=\"" . \Froxlor\UI\Template::getTemplate('ftp/accounts_account') . "\";"); [
$count ++; 'href' => $linker->getLink(['section' => 'ftp', 'page' => 'accounts', 'action' => 'add']),
'label' => lng('ftp.account_add')
]
];
} }
$i ++; UI::view('user/table.html.twig', [
} 'listing' => Listing::format($collection, $ftp_list_data, 'ftp_list'),
'actions_links' => $actions_links,
eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/accounts') . "\";"); 'entity_info' => lng('ftp.description')
]);
} elseif ($action == 'delete' && $id != 0) { } elseif ($action == 'delete' && $id != 0) {
try { try {
$json_result = Ftps::getLocal($userinfo, array( $json_result = Ftps::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
@@ -97,21 +87,20 @@ if ($page == 'overview') {
try { try {
Ftps::getLocal($userinfo, $_POST)->delete(); Ftps::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
\Froxlor\UI\HTML::askYesNoWithCheckbox('ftp_reallydelete', 'admin_customer_alsoremoveftphomedir', $filename, array( HTML::askYesNoWithCheckbox('ftp_reallydelete', 'admin_customer_alsoremoveftphomedir', $filename, [
'id' => $id, 'id' => $id,
'page' => $page, 'page' => $page,
'action' => $action 'action' => $action
), $result['username']); ], $result['username']);
} }
} else { } else {
\Froxlor\UI\Response::standard_error('ftp_cantdeletemainaccount'); Response::standardError('ftp_cantdeletemainaccount');
} }
} elseif ($action == 'add') { } elseif ($action == 'add') {
if ($userinfo['ftps_used'] < $userinfo['ftps'] || $userinfo['ftps'] == '-1') { if ($userinfo['ftps_used'] < $userinfo['ftps'] || $userinfo['ftps'] == '-1') {
@@ -119,68 +108,55 @@ if ($page == 'overview') {
try { try {
Ftps::getLocal($userinfo, $_POST)->add(); Ftps::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], '/'); $pathSelect = FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], '/');
if (Settings::Get('customer.ftpatdomain') == '1') { if (Settings::Get('customer.ftpatdomain') == '1') {
$domainlist = array(); $domainlist = [];
$domains = '';
$result_domains_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` $result_domains_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `customerid`= :customerid"); WHERE `customerid`= :customerid");
Database::pexecute($result_domains_stmt, array( Database::pexecute($result_domains_stmt, [
"customerid" => $userinfo['customerid'] "customerid" => $userinfo['customerid']
)); ]);
while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
$domainlist[] = $row_domain['domain']; $domainlist[$row_domain['domain']] = $idna_convert->decode($row_domain['domain']);
} }
sort($domainlist); sort($domainlist);
if (isset($domainlist[0]) && $domainlist[0] != '') {
foreach ($domainlist as $dom) {
$domains .= \Froxlor\UI\HTML::makeoption($idna_convert->decode($dom), $dom);
}
}
} }
if (Settings::Get('system.allow_customer_shell') == '1') { if (Settings::Get('system.allow_customer_shell') == '1') {
$shells = \Froxlor\UI\HTML::makeoption("/bin/false", "/bin/false", "/bin/false"); $shells['/bin/false'] = "/bin/false";
$shells_avail = Settings::Get('system.available_shells'); $shells_avail = Settings::Get('system.available_shells');
if (! empty($shells_avail)) { if (!empty($shells_avail)) {
$shells_avail = explode(",", $shells_avail); $shells_avail_arr = explode(",", $shells_avail);
$shells_avail = array_map("trim", $shells_avail); $shells_avail_arr = array_map("trim", $shells_avail_arr);
foreach ($shells_avail as $_shell) { foreach ($shells_avail_arr as $shell) {
$shells .= \Froxlor\UI\HTML::makeoption($_shell, $_shell, "/bin/false"); $shells[$shell] = $shell;
} }
} }
} }
// $sendinfomail = \Froxlor\UI\HTML::makeyesno('sendinfomail', '1', '0', '0');
$ftp_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/ftp/formfield.ftp_add.php'; $ftp_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/ftp/formfield.ftp_add.php';
$ftp_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($ftp_add_data);
$title = $ftp_add_data['ftp_add']['title']; UI::view('user/form.html.twig', [
$image = $ftp_add_data['ftp_add']['image']; 'formaction' => $linker->getLink(['section' => 'ftp']),
'formdata' => $ftp_add_data['ftp_add']
eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/accounts_add') . "\";"); ]);
} }
} }
} elseif ($action == 'edit' && $id != 0) { } elseif ($action == 'edit' && $id != 0) {
try { try {
$json_result = Ftps::getLocal($userinfo, array( $json_result = Ftps::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
@@ -189,55 +165,40 @@ if ($page == 'overview') {
try { try {
Ftps::getLocal($userinfo, $_POST)->update(); Ftps::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
if (strpos($result['homedir'], $userinfo['documentroot']) === 0) { if (strpos($result['homedir'], $userinfo['documentroot']) === 0) {
$homedir = str_replace($userinfo['documentroot'], "/", $result['homedir']); $homedir = str_replace($userinfo['documentroot'], "/", $result['homedir']);
} else { } else {
$homedir = $result['homedir']; $homedir = $result['homedir'];
} }
$homedir = \Froxlor\FileDir::makeCorrectDir($homedir); $homedir = FileDir::makeCorrectDir($homedir);
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $homedir); $pathSelect = FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $homedir);
if (Settings::Get('customer.ftpatdomain') == '1') {
$domains = '';
$result_domains_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `customerid` = :customerid");
Database::pexecute($result_domains_stmt, array(
"customerid" => $userinfo['customerid']
));
while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
$domains .= \Froxlor\UI\HTML::makeoption($idna_convert->decode($row_domain['domain']), $row_domain['domain']);
}
}
if (Settings::Get('system.allow_customer_shell') == '1') { if (Settings::Get('system.allow_customer_shell') == '1') {
$shells = \Froxlor\UI\HTML::makeoption("/bin/false", "/bin/false", $result['shell']); $shells['/bin/false'] = "/bin/false";
$shells_avail = Settings::Get('system.available_shells'); $shells_avail = Settings::Get('system.available_shells');
if (! empty($shells_avail)) { if (!empty($shells_avail)) {
$shells_avail = explode(",", $shells_avail); $shells_avail_arr = explode(",", $shells_avail);
$shells_avail = array_map("trim", $shells_avail); $shells_avail_arr = array_map("trim", $shells_avail_arr);
foreach ($shells_avail as $_shell) { foreach ($shells_avail_arr as $shell) {
$shells .= \Froxlor\UI\HTML::makeoption($_shell, $_shell, $result['shell']); $shells[$shell] = $shell;
} }
} }
} }
$ftp_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/ftp/formfield.ftp_edit.php'; $ftp_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/ftp/formfield.ftp_edit.php';
$ftp_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($ftp_edit_data);
$title = $ftp_edit_data['ftp_edit']['title']; UI::view('user/form.html.twig', [
$image = $ftp_edit_data['ftp_edit']['image']; 'formaction' => $linker->getLink(['section' => 'ftp', 'id' => $id]),
'formdata' => $ftp_edit_data['ftp_edit'],
eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/accounts_edit') . "\";"); 'editid' => $id
]);
} }
} }
} }

View File

@@ -2,71 +2,86 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Panel
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'customer');
require './lib/init.php';
use Froxlor\Database\Database; const AREA = 'customer';
use Froxlor\Settings; require __DIR__ . '/lib/init.php';
use Froxlor\Api\Commands\Customers as Customers; use Froxlor\Api\Commands\Customers as Customers;
use Froxlor\CurrentUser;
use Froxlor\Database\Database;
use Froxlor\Froxlor;
use Froxlor\FroxlorLogger;
use Froxlor\Settings;
use Froxlor\System\Crypt;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Response;
use Froxlor\Validate\Validate;
use Froxlor\Language;
use Froxlor\System\Cronjob;
use Froxlor\Cron\TaskId;
if ($action == 'logout') { if ($action == 'logout') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, 'logged out'); $log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, 'logged out');
$params = array( unset($_SESSION['userinfo']);
"customerid" => $userinfo['customerid'] CurrentUser::setData();
); session_destroy();
if (Settings::Get('session.allow_multiple_login') == '1') {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` Response::redirectTo('index.php');
WHERE `userid` = :customerid } elseif ($action == 'suback') {
AND `adminsession` = '0' if (is_array(CurrentUser::getField('switched_user'))) {
AND `hash` = :hash"); $result = CurrentUser::getData();
$params["hash"] = $s; $result = $result['switched_user'];
} else { CurrentUser::setData($result);
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` $target = (isset($_GET['target']) ? $_GET['target'] : 'index');
WHERE `userid` = :customerid $redirect = "admin_" . $target . ".php";
AND `adminsession` = '0'"); if (!file_exists(Froxlor::getInstallDir() . "/" . $redirect)) {
$redirect = "admin_index.php";
}
Response::redirectTo($redirect, null, true);
} else {
Response::dynamicError("Cannot change back - You've never switched to another user :-)");
} }
Database::pexecute($stmt, $params);
\Froxlor\UI\Response::redirectTo('index.php');
} }
if ($page == 'overview') { if ($page == 'overview') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_index"); $log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_index");
$domain_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` $domain_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `customerid` = :customerid WHERE `customerid` = :customerid
AND `parentdomainid` = '0' AND `parentdomainid` = '0'
AND `id` <> :standardsubdomain AND `id` <> :standardsubdomain
"); ");
Database::pexecute($domain_stmt, array( Database::pexecute($domain_stmt, [
"customerid" => $userinfo['customerid'], "customerid" => $userinfo['customerid'],
"standardsubdomain" => $userinfo['standardsubdomain'] "standardsubdomain" => $userinfo['standardsubdomain']
)); ]);
$domains = '';
$domainArray = array();
$domainArray = [];
while ($row = $domain_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row = $domain_stmt->fetch(PDO::FETCH_ASSOC)) {
$domainArray[] = $idna_convert->decode($row['domain']); $domainArray[] = $idna_convert->decode($row['domain']);
} }
natsort($domainArray); natsort($domainArray);
$domains = implode(',<br />', $domainArray);
// standard-subdomain // standard-subdomain
$stdsubdomain = ''; $stdsubdomain = '';
@@ -76,10 +91,10 @@ if ($page == 'overview') {
WHERE `customerid` = :customerid WHERE `customerid` = :customerid
AND `id` = :standardsubdomain AND `id` = :standardsubdomain
"); ");
$std_domain = Database::pexecute_first($std_domain_stmt, array( $std_domain = Database::pexecute_first($std_domain_stmt, [
"customerid" => $userinfo['customerid'], "customerid" => $userinfo['customerid'],
"standardsubdomain" => $userinfo['standardsubdomain'] "standardsubdomain" => $userinfo['standardsubdomain']
)); ]);
$stdsubdomain = $std_domain['domain']; $stdsubdomain = $std_domain['domain'];
} }
@@ -89,278 +104,169 @@ if ($page == 'overview') {
// get disk-space usages for web, mysql and mail // 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_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_DISKSPACE . "` WHERE `customerid` = :cid ORDER BY `stamp` DESC LIMIT 1");
$usages = Database::pexecute_first($usages_stmt, array( $usages = Database::pexecute_first($usages_stmt, [
'cid' => $userinfo['customerid'] 'cid' => $userinfo['customerid']
)); ]);
if ($usages) // get everything in bytes for the percentage calculation on the dashboard
{ $userinfo['diskspace_bytes'] = ($userinfo['diskspace'] > -1) ? $userinfo['diskspace'] * 1024 : -1;
$userinfo['diskspace_used'] = round($usages['webspace'] / 1024, Settings::Get('panel.decimal_places')); $userinfo['traffic_bytes'] = ($userinfo['traffic'] > -1) ? $userinfo['traffic'] * 1024 : -1;
$userinfo['mailspace_used'] = round($usages['mail'] / 1024, Settings::Get('panel.decimal_places')); $userinfo['traffic_bytes_used'] = $userinfo['traffic_used'] * 1024;
$userinfo['dbspace_used'] = round($usages['mysql'] / 1024, Settings::Get('panel.decimal_places'));
if ($usages) {
$userinfo['diskspace_bytes_used'] = $usages['webspace'] * 1024;
$userinfo['total_bytes_used'] = ($usages['webspace'] + $usages['mail'] + $usages['mysql']) * 1024;
} else { } else {
$userinfo['diskspace_used'] = 0; $userinfo['diskspace_bytes_used'] = 0;
$userinfo['mailspace_used'] = 0; $userinfo['total_bytes_used'] = 0;
$userinfo['dbspace_used'] = 0;
} }
$userinfo['diskspace'] = round($userinfo['diskspace'] / 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 = \Froxlor\PhpHelper::strReplaceArray('-1', $lng['customer']['unlimited'], $userinfo, 'diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps subdomains');
$userinfo['custom_notes'] = ($userinfo['custom_notes'] != '') ? nl2br($userinfo['custom_notes']) : ''; UI::twig()->addGlobal('userinfo', $userinfo);
UI::view('user/index.html.twig', [
$services_enabled = ""; 'domains' => $domainArray,
$se = array(); 'stdsubdomain' => $stdsubdomain
if ($userinfo['imap'] == '1') ]);
$se[] = "IMAP";
if ($userinfo['pop3'] == '1')
$se[] = "POP3";
if ($userinfo['phpenabled'] == '1')
$se[] = "PHP";
if ($userinfo['perlenabled'] == '1')
$se[] = "Perl/CGI";
$services_enabled = implode(", ", $se);
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/index') . "\";");
} elseif ($page == 'change_password') { } elseif ($page == 'change_password') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$old_password = \Froxlor\Validate\Validate::validate($_POST['old_password'], 'old password'); $old_password = Validate::validate($_POST['old_password'], 'old password');
if (! \Froxlor\System\Crypt::validatePasswordLogin($userinfo, $old_password, TABLE_PANEL_CUSTOMERS, 'customerid')) {
\Froxlor\UI\Response::standard_error('oldpasswordnotcorrect'); if (!Crypt::validatePasswordLogin($userinfo, $old_password, TABLE_PANEL_CUSTOMERS, 'customerid')) {
Response::standardError('oldpasswordnotcorrect');
} }
$new_password = \Froxlor\System\Crypt::validatePassword($_POST['new_password'], 'new password'); try {
$new_password_confirm = \Froxlor\System\Crypt::validatePassword($_POST['new_password_confirm'], 'new password confirm'); $new_password = Crypt::validatePassword($_POST['new_password'], 'new password');
$new_password_confirm = Crypt::validatePassword($_POST['new_password_confirm'], 'new password confirm');
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
}
if ($old_password == '') { if ($old_password == '') {
\Froxlor\UI\Response::standard_error(array( Response::standardError([
'stringisempty', 'stringisempty',
'oldpassword' 'changepassword.old_password'
)); ]);
} elseif ($new_password == '') { } elseif ($new_password == '') {
\Froxlor\UI\Response::standard_error(array( Response::standardError([
'stringisempty', 'stringisempty',
'newpassword' 'changepassword.new_password'
)); ]);
} elseif ($new_password_confirm == '') { } elseif ($new_password_confirm == '') {
\Froxlor\UI\Response::standard_error(array( Response::standardError([
'stringisempty', 'stringisempty',
'newpasswordconfirm' 'changepassword.new_password_confirm'
)); ]);
} elseif ($new_password != $new_password_confirm) { } elseif ($new_password != $new_password_confirm) {
\Froxlor\UI\Response::standard_error('newpasswordconfirmerror'); Response::standardError('newpasswordconfirmerror');
} else { } else {
// Update user password // Update user password
try { try {
Customers::getLocal($userinfo, array( Customers::getLocal($userinfo, [
'id' => $userinfo['customerid'], 'id' => $userinfo['customerid'],
'new_customer_password' => $new_password 'new_customer_password' => $new_password
))->update(); ])->update();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, 'changed password'); $log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, 'changed password');
// Update ftp password // Update ftp password
if (isset($_POST['change_main_ftp']) && $_POST['change_main_ftp'] == 'true') { if (isset($_POST['change_main_ftp']) && $_POST['change_main_ftp'] == 'true') {
$cryptPassword = \Froxlor\System\Crypt::makeCryptPassword($new_password); $cryptPassword = Crypt::makeCryptPassword($new_password);
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "` $stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "`
SET `password` = :password SET `password` = :password
WHERE `customerid` = :customerid WHERE `customerid` = :customerid
AND `username` = :username"); AND `username` = :username");
$params = array( $params = [
"password" => $cryptPassword, "password" => $cryptPassword,
"customerid" => $userinfo['customerid'], "customerid" => $userinfo['customerid'],
"username" => $userinfo['loginname'] "username" => $userinfo['loginname']
); ];
Database::pexecute($stmt, $params); Database::pexecute($stmt, $params);
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, 'changed main ftp password'); $log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, 'changed main ftp password');
} }
// Update statistics password // Update statistics password
if (isset($_POST['change_stats']) && $_POST['change_stats'] == 'true') { if (isset($_POST['change_stats']) && $_POST['change_stats'] == 'true') {
$new_stats_password = \Froxlor\System\Crypt::makeCryptPassword($new_password, true); $new_stats_password = Crypt::makeCryptPassword($new_password, true);
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_HTPASSWDS . "` $stmt = Database::prepare("UPDATE `" . TABLE_PANEL_HTPASSWDS . "`
SET `password` = :password SET `password` = :password
WHERE `customerid` = :customerid WHERE `customerid` = :customerid
AND `username` = :username"); AND `username` = :username");
$params = array( $params = [
"password" => $new_stats_password, "password" => $new_stats_password,
"customerid" => $userinfo['customerid'], "customerid" => $userinfo['customerid'],
"username" => $userinfo['loginname'] "username" => $userinfo['loginname']
); ];
Database::pexecute($stmt, $params); Database::pexecute($stmt, $params);
Cronjob::inserttask(TaskId::REBUILD_VHOST);
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename);
's' => $s
));
} }
} else { } else {
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/change_password') . "\";"); UI::view('user/change_password.html.twig');
} }
} elseif ($page == 'change_language') { } elseif ($page == 'change_language') {
$languages = Language::getLanguages();
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$def_language = \Froxlor\Validate\Validate::validate($_POST['def_language'], 'default language'); $def_language = Validate::validate($_POST['def_language'], 'default language');
if (isset($languages[$def_language])) { if (isset($languages[$def_language])) {
try { try {
Customers::getLocal($userinfo, array( Customers::getLocal($userinfo, [
'id' => $userinfo['customerid'], 'id' => $userinfo['customerid'],
'def_language' => $def_language 'def_language' => $def_language
))->update(); ])->update();
CurrentUser::setField('language', $def_language);
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
// also update current session
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_SESSIONS . "`
SET `language` = :lang
WHERE `hash` = :hash");
Database::pexecute($stmt, array(
"lang" => $def_language,
"hash" => $s
));
} }
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "changed default language to '" . $def_language . "'"); $log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "changed default language to '" . $def_language . "'");
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename);
's' => $s
));
} else { } else {
$default_lang = Settings::Get('panel.standardlanguage'); $default_lang = Settings::Get('panel.standardlanguage');
if ($userinfo['def_language'] != '') { if ($userinfo['def_language'] != '') {
$default_lang = $userinfo['def_language']; $default_lang = $userinfo['def_language'];
} }
$language_options = ''; UI::view('user/change_language.html.twig', [
foreach ($languages as $language_file => $language_name) { 'languages' => $languages,
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $default_lang, true); 'default_lang' => $default_lang
} ]);
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/change_language') . "\";");
} }
} elseif ($page == 'change_theme') { } elseif ($page == 'change_theme') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$theme = \Froxlor\Validate\Validate::validate($_POST['theme'], 'theme'); $theme = Validate::validate($_POST['theme'], 'theme');
try { try {
Customers::getLocal($userinfo, array( Customers::getLocal($userinfo, [
'id' => $userinfo['customerid'], 'id' => $userinfo['customerid'],
'theme' => $theme 'theme' => $theme
))->update(); ])->update();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
// also update current session $log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "changed default theme to '" . $theme . "'");
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_SESSIONS . "` Response::redirectTo($filename);
SET `theme` = :theme
WHERE `hash` = :hash");
Database::pexecute($stmt, array(
"theme" => $theme,
"hash" => $s
));
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "changed default theme to '" . $theme . "'");
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} else { } else {
$default_theme = Settings::Get('panel.default_theme'); $default_theme = Settings::Get('panel.default_theme');
if ($userinfo['theme'] != '') { if ($userinfo['theme'] != '') {
$default_theme = $userinfo['theme']; $default_theme = $userinfo['theme'];
} }
$theme_options = ''; $themes_avail = UI::getThemes();
$themes_avail = \Froxlor\UI\Template::getThemes();
foreach ($themes_avail as $t => $d) {
$theme_options .= \Froxlor\UI\HTML::makeoption($d, $t, $default_theme, true);
}
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/change_theme') . "\";"); UI::view('user/change_theme.html.twig', [
'themes' => $themes_avail,
'default_theme' => $default_theme
]);
} }
} elseif ($page == 'send_error_report' && Settings::Get('system.allow_error_report_customer') == '1') { } elseif ($page == 'send_error_report' && Settings::Get('system.allow_error_report_customer') == '1') {
require_once __DIR__ . '/error_report.php';
// only show this if we really have an exception to report
if (isset($_GET['errorid']) && $_GET['errorid'] != '') {
$errid = $_GET['errorid'];
// read error file
$err_dir = \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir() . "/logs/");
$err_file = \Froxlor\FileDir::makeCorrectFile($err_dir . "/" . $errid . "_sql-error.log");
if (file_exists($err_file)) {
$error_content = file_get_contents($err_file);
$error = explode("|", $error_content);
$_error = array(
'code' => str_replace("\n", "", substr($error[1], 5)),
'message' => str_replace("\n", "", substr($error[2], 4)),
'file' => str_replace("\n", "", substr($error[3], 5 + strlen(\Froxlor\Froxlor::getInstallDir()))),
'line' => str_replace("\n", "", substr($error[4], 5)),
'trace' => str_replace(\Froxlor\Froxlor::getInstallDir(), "", substr($error[5], 6))
);
// build mail-content
$mail_body = "Dear froxlor-team,\n\n";
$mail_body .= "the following error has been reported by a user:\n\n";
$mail_body .= "-------------------------------------------------------------\n";
$mail_body .= $_error['code'] . ' ' . $_error['message'] . "\n\n";
$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";
$mail_body .= "DB-version: " . $dbversion . "\n\n";
$mail_body .= "End of report";
$mail_html = str_replace("\n", "<br />", $mail_body);
// send actual report to dev-team
if (isset($_POST['send']) && $_POST['send'] == 'send') {
// send mail and say thanks
$_mailerror = false;
try {
$mail->Subject = '[Froxlor] Error report by user';
$mail->AltBody = $mail_body;
$mail->MsgHTML($mail_html);
$mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team');
$mail->Send();
} catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
$mailerr_msg = $e->getMessage();
$_mailerror = true;
}
if ($_mailerror) {
// error when reporting an error...LOLFUQ
\Froxlor\UI\Response::standard_error('send_report_error', $mailerr_msg);
}
// finally remove error from fs
@unlink($err_file);
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
}
// show a nice summary of the error-report
// before actually sending anything
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/send_error_report") . "\";");
} else {
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
}
} else {
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
}
} elseif ($page == 'apikeys' && Settings::Get('api.enabled') == 1) { } elseif ($page == 'apikeys' && Settings::Get('api.enabled') == 1) {
require_once __DIR__ . '/api_keys.php'; require_once __DIR__ . '/api_keys.php';
} elseif ($page == 'apihelp' && Settings::Get('api.enabled') == 1) {
require_once __DIR__ . '/apihelp.php';
} elseif ($page == '2fa' && Settings::Get('2fa.enabled') == 1) { } elseif ($page == '2fa' && Settings::Get('2fa.enabled') == 1) {
require_once __DIR__ . '/2fa.php'; require_once __DIR__ . '/2fa.php';
} }

View File

@@ -2,123 +2,53 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Panel
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'customer');
require './lib/init.php';
use Froxlor\Database\Database; const AREA = 'customer';
require __DIR__ . '/lib/init.php';
use Froxlor\Api\Commands\SysLog;
use Froxlor\Settings; use Froxlor\Settings;
use Froxlor\UI\Collection;
use Froxlor\UI\Listing;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Response;
// redirect if this customer page is hidden via settings // redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options', 'extras.logger')) { if (Settings::IsInList('panel.customer_hide_options', 'extras.logger')) {
\Froxlor\UI\Response::redirectTo('customer_index.php'); Response::redirectTo('customer_index.php');
} }
if ($page == 'log') { if ($page == 'log') {
if ($action == '') { if ($action == '') {
$fields = array( try {
'date' => $lng['logger']['date'], $syslog_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/tablelisting.syslog.php';
'type' => $lng['logger']['type'], $collection = (new Collection(SysLog::class, $userinfo))
'user' => $lng['logger']['user'], ->withPagination($syslog_list_data['syslog_list']['columns'], $syslog_list_data['syslog_list']['default_sorting']);
'text' => $lng['logger']['action'] } catch (Exception $e) {
); Response::dynamicError($e->getMessage());
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_LOG, $fields, null, null, 0, 'desc', 30);
$query = 'SELECT * FROM `' . TABLE_PANEL_LOG . '` WHERE `user` = :loginname ' . $paging->getSqlWhere(true) . ' ' . $paging->getSqlOrderBy();
$result_stmt = Database::prepare($query . ' ' . $paging->getSqlLimit());
Database::pexecute($result_stmt, array(
"loginname" => $userinfo['loginname']
));
$result_cnt_stmt = Database::prepare($query);
Database::pexecute($result_cnt_stmt, array(
"loginname" => $userinfo['loginname']
));
$res_cnt = $result_cnt_stmt->fetch(PDO::FETCH_ASSOC);
$logs_count = $result_cnt_stmt->rowCount();
$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; UI::view('user/table.html.twig', [
} 'listing' => Listing::format($collection, $syslog_list_data, 'syslog_list')
]);
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 = \Froxlor\PhpHelper::htmlentitiesArray($row);
$row['date'] = date("d.m.y H:i:s", $row['date']);
if ($_action != $action) {
switch ($action) {
case \Froxlor\FroxlorLogger::USR_ACTION:
$_action = $lng['admin']['customer'];
break;
case \Froxlor\FroxlorLogger::RES_ACTION:
$_action = $lng['logger']['reseller'];
break;
case \Froxlor\FroxlorLogger::ADM_ACTION:
$_action = $lng['logger']['admin'];
break;
case \Froxlor\FroxlorLogger::CRON_ACTION:
$_action = $lng['logger']['cron'];
break;
case \Froxlor\FroxlorLogger::LOGIN_ACTION:
$_action = $lng['logger']['login'];
break;
case \Froxlor\FroxlorLogger::LOG_ERROR:
$_action = $lng['logger']['intern'];
break;
default:
$_action = $lng['logger']['unknown'];
break;
}
$row['action'] = $_action;
eval("\$log.=\"" . \Froxlor\UI\Template::getTemplate('logger/logger_action') . "\";");
}
$log_count ++;
$row['type'] = \Froxlor\FroxlorLogger::getInstanceOf()->getLogLevelDesc($row['type']);
eval("\$log.=\"" . \Froxlor\UI\Template::getTemplate('logger/logger_log') . "\";");
$count ++;
$_action = $action;
// }
$i ++;
}
$i ++;
}
eval("echo \"" . \Froxlor\UI\Template::getTemplate('logger/logger') . "\";");
} }
} }

View File

@@ -2,30 +2,46 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Panel
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'customer');
require './lib/init.php';
const AREA = 'customer';
require __DIR__ . '/lib/init.php';
use Froxlor\Api\Commands\Mysqls;
use Froxlor\Api\Commands\MysqlServer;
use Froxlor\Database\Database; use Froxlor\Database\Database;
use Froxlor\FroxlorLogger;
use Froxlor\Settings; use Froxlor\Settings;
use Froxlor\Api\Commands\Mysqls as Mysqls; use Froxlor\UI\Collection;
use Froxlor\UI\HTML;
use Froxlor\UI\Listing;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
use Froxlor\CurrentUser;
// redirect if this customer page is hidden via settings // redirect if this customer page is hidden via settings or no resources given
if (Settings::IsInList('panel.customer_hide_options', 'mysql')) { if (Settings::IsInList('panel.customer_hide_options', 'mysql') || $userinfo['mysqls'] == 0) {
\Froxlor\UI\Response::redirectTo('customer_index.php'); Response::redirectTo('customer_index.php');
} }
// get sql-root access data // get sql-root access data
@@ -34,87 +50,54 @@ Database::needSqlData();
$sql_root = Database::getSqlData(); $sql_root = Database::getSqlData();
Database::needRoot(false); Database::needRoot(false);
if (isset($_POST['id'])) { $id = (int)Request::any('id');
$id = intval($_POST['id']);
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
if ($page == 'overview') { if ($page == 'overview' || $page == 'mysqls') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_mysql");
Database::needSqlData();
$sql = Database::getSqlData();
$lng['mysql']['description'] = str_replace('<SQL_HOST>', $sql['host'], $lng['mysql']['description']);
eval("echo \"" . \Froxlor\UI\Template::getTemplate('mysql/mysql') . "\";");
} elseif ($page == 'mysqls') {
if ($action == '') { if ($action == '') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_mysql::mysqls"); $log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_mysql::mysqls");
$fields = array(
'databasename' => $lng['mysql']['databasename'],
'description' => $lng['mysql']['databasedescription']
);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_DATABASES, $fields);
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_DATABASES . "`
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
Database::pexecute($result_stmt, array(
"customerid" => $userinfo['customerid']
));
$mysqls_count = Database::num_rows();
$paging->setEntries($mysqls_count);
$sortcode = $paging->getHtmlSortCode($lng); $multiple_mysqlservers = count(json_decode($userinfo['allowed_mysqlserver'] ?? '[]', true)) > 1;
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$i = 0;
$count = 0;
$mysqls = '';
$dbservers_stmt = Database::query("SELECT COUNT(DISTINCT `dbserver`) as numservers FROM `" . TABLE_PANEL_DATABASES . "`");
$dbserver = $dbservers_stmt->fetch(PDO::FETCH_ASSOC);
$count_mysqlservers = $dbserver['numservers'];
// Begin root-session
Database::needRoot(true);
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
if ($paging->checkDisplay($i)) {
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
$mbdata_stmt = Database::prepare("SELECT SUM(data_length + index_length) as MB FROM information_schema.TABLES
WHERE table_schema = :table_schema
GROUP BY table_schema");
Database::pexecute($mbdata_stmt, array(
"table_schema" => $row['databasename']
));
$mbdata = $mbdata_stmt->fetch(PDO::FETCH_ASSOC);
$row['size'] = \Froxlor\PhpHelper::sizeReadable($mbdata['MB'], 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
eval("\$mysqls.=\"" . \Froxlor\UI\Template::getTemplate('mysql/mysqls_database') . "\";");
$count ++;
}
$i ++;
}
Database::needRoot(false);
// End root-session
eval("echo \"" . \Froxlor\UI\Template::getTemplate('mysql/mysqls') . "\";");
} elseif ($action == 'delete' && $id != 0) {
try { try {
$json_result = Mysqls::getLocal($userinfo, array( $mysql_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/customer/tablelisting.mysqls.php';
'id' => $id $collection = (new Collection(Mysqls::class, $userinfo))
))->get(); ->withPagination($mysql_list_data['mysql_list']['columns'], $mysql_list_data['mysql_list']['default_sorting']);
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
}
$actions_links = false;
if (CurrentUser::canAddResource('mysqls')) {
$actions_links = [
[
'href' => $linker->getLink(['section' => 'mysql', 'page' => 'mysqls', 'action' => 'add']),
'label' => lng('mysql.database_create')
]
];
}
UI::view('user/table.html.twig', [
'listing' => Listing::format($collection, $mysql_list_data, 'mysql_list'),
'actions_links' => $actions_links,
'entity_info' => lng('mysql.description')
]);
} elseif ($action == 'delete' && $id != 0) {
try {
$json_result = Mysqls::getLocal($userinfo, [
'id' => $id
])->get();
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
if (isset($result['databasename']) && $result['databasename'] != '') { if (isset($result['databasename']) && $result['databasename'] != '') {
Database::needRoot(true, $result['dbserver']); Database::needRoot(true, $result['dbserver']);
Database::needSqlData(); Database::needSqlData();
$sql_root = Database::getSqlData(); $sql_root = Database::getSqlData();
Database::needRoot(false); Database::needRoot(false);
if (! isset($sql_root[$result['dbserver']]) || ! is_array($sql_root[$result['dbserver']])) { if (!isset($sql_root[$result['dbserver']]) || !is_array($sql_root[$result['dbserver']])) {
$result['dbserver'] = 0; $result['dbserver'] = 0;
} }
@@ -122,22 +105,21 @@ if ($page == 'overview') {
try { try {
Mysqls::getLocal($userinfo, $_POST)->delete(); Mysqls::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
$dbnamedesc = $result['databasename']; $dbnamedesc = $result['databasename'];
if (isset($result['description']) && $result['description'] != '') { if (isset($result['description']) && $result['description'] != '') {
$dbnamedesc .= ' (' . $result['description'] . ')'; $dbnamedesc .= ' (' . $result['description'] . ')';
} }
\Froxlor\UI\HTML::askYesNo('mysql_reallydelete', $filename, array( HTML::askYesNo('mysql_reallydelete', $filename, [
'id' => $id, 'id' => $id,
'page' => $page, 'page' => $page,
'action' => $action 'action' => $action
), $dbnamedesc); ], $dbnamedesc);
} }
} }
} elseif ($action == 'add') { } elseif ($action == 'add') {
@@ -146,42 +128,38 @@ if ($page == 'overview') {
try { try {
Mysqls::getLocal($userinfo, $_POST)->add(); Mysqls::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
$mysql_servers = [];
$dbservers_stmt = Database::query("SELECT DISTINCT `dbserver` FROM `" . TABLE_PANEL_DATABASES . "`"); try {
$mysql_servers = ''; $result_json = MysqlServer::getLocal($userinfo)->listing();
$count_mysqlservers = 0; $result_decoded = json_decode($result_json, true)['data']['list'];
while ($dbserver = $dbservers_stmt->fetch(PDO::FETCH_ASSOC)) { foreach ($result_decoded as $dbserver => $dbdata) {
Database::needRoot(true, $dbserver['dbserver']); $mysql_servers[$dbserver] = $dbdata['caption'];
Database::needSqlData(); }
$sql_root = Database::getSqlData(); } catch (Exception $e) {
$mysql_servers .= \Froxlor\UI\HTML::makeoption($sql_root['caption'], $dbserver['dbserver']); /* just none */
$count_mysqlservers ++;
} }
Database::needRoot(false);
$mysql_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/mysql/formfield.mysql_add.php'; $mysql_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/mysql/formfield.mysql_add.php';
$mysql_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($mysql_add_data);
$title = $mysql_add_data['mysql_add']['title']; UI::view('user/form.html.twig', [
$image = $mysql_add_data['mysql_add']['image']; 'formaction' => $linker->getLink(['section' => 'mysql']),
'formdata' => $mysql_add_data['mysql_add']
eval("echo \"" . \Froxlor\UI\Template::getTemplate('mysql/mysqls_add') . "\";"); ]);
} }
} }
} elseif ($action == 'edit' && $id != 0) { } elseif ($action == 'edit' && $id != 0) {
try { try {
$json_result = Mysqls::getLocal($userinfo, array( $json_result = Mysqls::getLocal($userinfo, [
'id' => $id 'id' => $id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
@@ -190,30 +168,30 @@ if ($page == 'overview') {
try { try {
$json_result = Mysqls::getLocal($userinfo, $_POST)->update(); $json_result = Mysqls::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
\Froxlor\UI\Response::redirectTo($filename, array( Response::redirectTo($filename, [
'page' => $page, 'page' => $page
's' => $s ]);
));
} else { } else {
$mysql_servers = [];
$dbservers_stmt = Database::query("SELECT COUNT(DISTINCT `dbserver`) as numservers FROM `" . TABLE_PANEL_DATABASES . "`"); try {
$dbserver = $dbservers_stmt->fetch(PDO::FETCH_ASSOC); $result_json = MysqlServer::getLocal($userinfo)->listing();
$count_mysqlservers = $dbserver['numservers']; $result_decoded = json_decode($result_json, true)['data']['list'];
foreach ($result_decoded as $dbserver => $dbdata) {
Database::needRoot(true, $result['dbserver']); $mysql_servers[$dbserver] = $dbdata['caption'] . ' (' . $dbdata['host'] . (isset($dbdata['port']) && !empty($dbdata['port']) ? ':' . $dbdata['port'] : '').')';
Database::needSqlData(); }
$sql_root = Database::getSqlData(); } catch (Exception $e) {
Database::needRoot(false); /* just none */
}
$mysql_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/mysql/formfield.mysql_edit.php'; $mysql_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/mysql/formfield.mysql_edit.php';
$mysql_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($mysql_edit_data);
$title = $mysql_edit_data['mysql_edit']['title']; UI::view('user/form.html.twig', [
$image = $mysql_edit_data['mysql_edit']['image']; 'formaction' => $linker->getLink(['section' => 'mysql', 'id' => $id]),
'formdata' => $mysql_edit_data['mysql_edit'],
eval("echo \"" . \Froxlor\UI\Template::getTemplate('mysql/mysqls_edit') . "\";"); 'editid' => $id
]);
} }
} }
} }

View File

@@ -2,165 +2,52 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Panel
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'customer');
$intrafficpage = 1;
require './lib/init.php';
use Froxlor\Database\Database; const AREA = 'customer';
require __DIR__ . '/lib/init.php';
use Froxlor\Traffic\Traffic;
use Froxlor\Settings; use Froxlor\Settings;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
// redirect if this customer page is hidden via settings // redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options', 'traffic')) { if (Settings::IsInList('panel.customer_hide_options', 'traffic')) {
\Froxlor\UI\Response::redirectTo('customer_index.php'); Response::redirectTo('customer_index.php');
} }
$traffic = ''; $range = Request::any('range', 'currentyear');
$month = null;
$year = null;
if (isset($_POST['month']) && isset($_POST['year'])) { if ($page == 'current') {
$month = intval($_POST['month']); $range = 'currentmonth';
$year = intval($_POST['year']);
} elseif (isset($_GET['month']) && isset($_GET['year'])) {
$month = intval($_GET['month']);
$year = intval($_GET['year']);
} // BAM! $_GET???
elseif (isset($_GET['page']) && $_GET['page'] == 'current') {
if (date('d') != '01') {
$month = date('m');
$year = date('Y');
} else {
if (date('m') == '01') {
$month = 12;
$year = date('Y') - 1;
} else {
$month = date('m') - 1;
$year = date('Y');
}
}
} }
if (! is_null($month) && ! is_null($year)) { try {
$traf['byte'] = 0; $context = Traffic::getCustomerStats($userinfo, $range);
$result_stmt = Database::prepare("SELECT SUM(`http`) as 'http', SUM(`ftp_up`) AS 'ftp_up', SUM(`ftp_down`) as 'ftp_down', SUM(`mail`) as 'mail', `day`, `month`, `year` } catch (Exception $e) {
FROM `" . TABLE_PANEL_TRAFFIC . "` Response::dynamicError($e->getMessage());
WHERE `customerid`= :customerid
AND `month` = :month
AND `year` = :year
GROUP BY `day`
ORDER BY `day` DESC");
$params = array(
"customerid" => $userinfo['customerid'],
"month" => $month,
"year" => $year
);
Database::pexecute($result_stmt, $params);
$traffic_complete['http'] = 0;
$traffic_complete['ftp'] = 0;
$traffic_complete['mail'] = 0;
$show = '';
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$http = $row['http'];
$ftp = $row['ftp_up'] + $row['ftp_down'];
$mail = $row['mail'];
$traf['byte'] = $http + $ftp + $mail;
$traffic_complete['http'] += $http;
$traffic_complete['ftp'] += $ftp;
$traffic_complete['mail'] += $mail;
$traf['day'] = $row['day'] . '.';
if (extension_loaded('bcmath')) {
$traf['ftptext'] = bcdiv($row['ftp_up'], 1024, Settings::Get('panel.decimal_places')) . " MiB up/ " . bcdiv($row['ftp_down'], 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)";
$traf['httptext'] = bcdiv($http, 1024, Settings::Get('panel.decimal_places')) . " MiB (HTTP)";
$traf['mailtext'] = bcdiv($mail, 1024, Settings::Get('panel.decimal_places')) . " MiB (Mail)";
$traf['ftp'] = bcdiv($ftp, 1024, Settings::Get('panel.decimal_places'));
$traf['http'] = bcdiv($http, 1024, Settings::Get('panel.decimal_places'));
$traf['mail'] = bcdiv($mail, 1024, Settings::Get('panel.decimal_places'));
$traf['byte'] = bcdiv($traf['byte'], 1024, Settings::Get('panel.decimal_places'));
} else {
$traf['ftptext'] = round($row['ftp_up'] / 1024, Settings::Get('panel.decimal_places')) . " MiB up/ " . round($row['ftp_down'] / 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)";
$traf['httptext'] = round($http / 1024, Settings::Get('panel.decimal_places')) . " MiB (HTTP)";
$traf['mailtext'] = round($mail / 1024, Settings::Get('panel.decimal_places')) . " MiB (Mail)";
$traf['http'] = round($http, Settings::Get('panel.decimal_places'));
$traf['ftp'] = round($ftp, Settings::Get('panel.decimal_places'));
$traf['mail'] = round($mail, Settings::Get('panel.decimal_places'));
$traf['byte'] = round($traf['byte'] / 1024, Settings::Get('panel.decimal_places'));
}
eval("\$traffic.=\"" . \Froxlor\UI\Template::getTemplate('traffic/traffic_month') . "\";");
$show = $lng['traffic']['months'][intval($row['month'])] . ' ' . $row['year'];
}
$traffic_complete['http'] = \Froxlor\PhpHelper::sizeReadable($traffic_complete['http'] * 1024, 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
$traffic_complete['ftp'] = \Froxlor\PhpHelper::sizeReadable($traffic_complete['ftp'] * 1024, 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
$traffic_complete['mail'] = \Froxlor\PhpHelper::sizeReadable($traffic_complete['mail'] * 1024, 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
eval("echo \"" . \Froxlor\UI\Template::getTemplate('traffic/traffic_details') . "\";");
} else {
$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 `year` DESC, `month` DESC
LIMIT 12");
Database::pexecute($result_stmt, array(
"customerid" => $userinfo['customerid']
));
$traffic_complete['http'] = 0;
$traffic_complete['ftp'] = 0;
$traffic_complete['mail'] = 0;
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$http = $row['http'];
$ftp_up = $row['ftp_up'];
$ftp_down = $row['ftp_down'];
$mail = $row['mail'];
$traffic_complete['http'] += $http;
$traffic_complete['ftp'] += $ftp_up + $ftp_down;
$traffic_complete['mail'] += $mail;
$traf['month'] = $row['month'];
$traf['year'] = $row['year'];
$traf['monthname'] = $lng['traffic']['months'][intval($row['month'])] . " " . $row['year'];
$traf['byte'] = $http + $ftp_up + $ftp_down + $mail;
if (extension_loaded('bcmath')) {
$traf['ftptext'] = bcdiv($ftp_up, 1024, Settings::Get('panel.decimal_places')) . " MiB up/ " . bcdiv($ftp_down, 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)";
$traf['httptext'] = bcdiv($http, 1024, Settings::Get('panel.decimal_places')) . " MiB (HTTP)";
$traf['mailtext'] = bcdiv($mail, 1024, Settings::Get('panel.decimal_places')) . " MiB (Mail)";
$traf['ftp'] = bcdiv(($ftp_up + $ftp_down), 1024, Settings::Get('panel.decimal_places'));
$traf['http'] = bcdiv($http, 1024, Settings::Get('panel.decimal_places'));
$traf['mail'] = bcdiv($mail, 1024, Settings::Get('panel.decimal_places'));
$traf['byte'] = bcdiv($traf['byte'], 1024 * 1024, Settings::Get('panel.decimal_places'));
} else {
$traf['ftptext'] = round($ftp_up / 1024, Settings::Get('panel.decimal_places')) . " MiB up/ " . round($ftp_down / 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)";
$traf['httptext'] = round($http / 1024, Settings::Get('panel.decimal_places')) . " MiB (HTTP)";
$traf['mailtext'] = round($mail / 1024, Settings::Get('panel.decimal_places')) . " MiB (Mail)";
$traf['ftp'] = round(($ftp_up + $ftp_down) / 1024, Settings::Get('panel.decimal_places'));
$traf['http'] = round($http / 1024, Settings::Get('panel.decimal_places'));
$traf['mail'] = round($mail / 1024, Settings::Get('panel.decimal_places'));
$traf['byte'] = round($traf['byte'] / (1024 * 1024), Settings::Get('panel.decimal_places'));
}
eval("\$traffic.=\"" . \Froxlor\UI\Template::getTemplate('traffic/traffic_traffic') . "\";");
}
$traffic_complete['http'] = \Froxlor\PhpHelper::sizeReadable($traffic_complete['http'] * 1024, 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
$traffic_complete['ftp'] = \Froxlor\PhpHelper::sizeReadable($traffic_complete['ftp'] * 1024, 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
$traffic_complete['mail'] = \Froxlor\PhpHelper::sizeReadable($traffic_complete['mail'] * 1024, 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
eval("echo \"" . \Froxlor\UI\Template::getTemplate('traffic/traffic') . "\";");
} }
// pass metrics to the view
UI::view('user/traffic.html.twig', $context);

View File

@@ -1,139 +1,149 @@
<?php <?php
if (! defined('AREA')) {
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/
if (!defined('AREA')) {
header("Location: index.php"); header("Location: index.php");
exit(); exit();
} }
/** use Froxlor\Api\Commands\DomainZones;
* This file is part of the Froxlor project. use Froxlor\Dns\Dns;
* Copyright (c) 2016 the Froxlor Team (see authors). use Froxlor\UI\Collection;
* use Froxlor\UI\HTML;
* For the full copyright and license information, please view the COPYING use Froxlor\UI\Listing;
* file that was distributed with this source code. You can also view the use Froxlor\UI\Panel\UI;
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt use Froxlor\UI\Request;
* use Froxlor\UI\Response;
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2016-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
*
*/
use Froxlor\Database\Database;
use Froxlor\Api\Commands\DomainZones as DomainZones;
// This file is being included in admin_domains and customer_domains // This file is being included in admin_domains and customer_domains
// and therefore does not need to require lib/init.php // and therefore does not need to require lib/init.php
$domain_id = isset($_GET['domain_id']) ? (int) $_GET['domain_id'] : null; $domain_id = (int)Request::any('domain_id');
$record = isset($_POST['record']['record']) ? trim($_POST['record']['record']) : null; $record = isset($_POST['dns_record']) ? trim($_POST['dns_record']) : null;
$type = isset($_POST['record']['type']) ? $_POST['record']['type'] : 'A'; $type = isset($_POST['dns_type']) ? $_POST['dns_type'] : 'A';
$prio = isset($_POST['record']['prio']) ? (int) $_POST['record']['prio'] : null; $prio = isset($_POST['dns_mxp']) ? (int)$_POST['dns_mxp'] : null;
$content = isset($_POST['record']['content']) ? trim($_POST['record']['content']) : null; $content = isset($_POST['dns_content']) ? trim($_POST['dns_content']) : null;
$ttl = isset($_POST['record']['ttl']) ? (int) $_POST['record']['ttl'] : 18000; $ttl = isset($_POST['dns_ttl']) ? (int)$_POST['dns_ttl'] : 18000;
// get domain-name // get domain-name
$domain = \Froxlor\Dns\Dns::getAllowedDomainEntry($domain_id, AREA, $userinfo); $domain = Dns::getAllowedDomainEntry($domain_id, AREA, $userinfo);
// 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 = ""; $errors = "";
$success_message = ""; $success_message = "";
// action for adding a new entry // action for adding a new entry
if ($action == 'add_record' && ! empty($_POST)) { if ($action == 'add_record' && !empty($_POST)) {
try { try {
DomainZones::getLocal($userinfo, array( DomainZones::getLocal($userinfo, [
'id' => $domain_id, 'id' => $domain_id,
'record' => $record, 'record' => $record,
'type' => $type, 'type' => $type,
'prio' => $prio, 'prio' => $prio,
'content' => $content, 'content' => $content,
'ttl' => $ttl 'ttl' => $ttl
))->add(); ])->add();
$success_message = $lng['success']['dns_record_added']; $success_message = lng('success.dns_record_added');
} catch (Exception $e) { $record = $prio = $content = "";
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
} elseif ($action == 'delete') {
// remove entry
$entry_id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
if ($entry_id > 0) {
try {
DomainZones::getLocal($userinfo, array(
'entry_id' => $entry_id,
'id' => $domain_id
))->delete();
} catch (Exception $e) { } catch (Exception $e) {
$errors = str_replace("\n", "<br>", $e->getMessage()); $errors = str_replace("\n", "<br>", $e->getMessage());
} }
} elseif ($action == 'delete') {
if (empty($errors)) { $entry_id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
// remove deleted entry from internal data array (no reread of DB necessary) HTML::askYesNo('dnsentry_reallydelete', $filename, [
$_t = $dom_entries; 'id' => $entry_id,
foreach ($_t as $idx => $entry) { 'domain_id' => $domain_id,
if ($entry['id'] == $entry_id) { 'page' => $page,
unset($dom_entries[$idx]); 'action' => 'deletesure'
break; ], '', [
} 'section' => 'domains',
} 'page' => $page,
unset($_t); 'domain_id' => $domain_id
]);
} elseif (isset($_POST['send']) && $_POST['send'] == 'send' && $action == 'deletesure' && !empty($_POST)) {
$entry_id = isset($_POST['id']) ? (int)$_POST['id'] : 0;
$domain_id = isset($_POST['domain_id']) ? (int)$_POST['domain_id'] : 0;
// remove entry
if ($entry_id > 0 && $domain_id > 0) {
try {
DomainZones::getLocal($userinfo, [
'entry_id' => $entry_id,
'id' => $domain_id
])->delete();
// success message (inline) // success message (inline)
$success_message = $lng['success']['dns_record_deleted']; $success_message = lng('success.dns_record_deleted');
} catch (Exception $e) {
$errors = str_replace("\n", "<br>", $e->getMessage());
} }
} }
} }
// show editor // select all entries
$record_list = ""; try {
$existing_entries = ""; $dns_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/tablelisting.dns.php';
$type_select = ""; $collection = (new Collection(DomainZones::class, $userinfo, ['id' => $domain_id]))
$entriescount = 0; ->withPagination($dns_list_data['dns_list']['columns'], $dns_list_data['dns_list']['default_sorting']);
} catch (Exception $e) {
if (! empty($dom_entries)) { Response::dynamicError($e->getMessage());
$entriescount = count($dom_entries);
foreach ($dom_entries as $entry) {
$entry['content'] = wordwrap($entry['content'], 100, '<br>', true);
eval("\$existing_entries.=\"" . \Froxlor\UI\Template::getTemplate("dns_editor/entry_bit", true) . "\";");
}
} }
// available types
$type_select_values = array(
'A',
'AAAA',
'CAA',
'CNAME',
'DNAME',
'LOC',
'MX',
'NS',
'RP',
'SRV',
'SSHFP',
'TXT',
);
asort($type_select_values);
foreach ($type_select_values as $_type) {
$type_select .= \Froxlor\UI\HTML::makeoption($_type, $_type, $type);
}
eval("\$record_list=\"" . \Froxlor\UI\Template::getTemplate("dns_editor/list", true) . "\";");
try { try {
$json_result = DomainZones::getLocal($userinfo, array( $json_result = DomainZones::getLocal($userinfo, [
'id' => $domain_id 'id' => $domain_id
))->get(); ])->get();
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); Response::dynamicError($e->getMessage());
} }
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
$zonefile = implode("\n", $result); $zonefile = implode("\n", $result);
eval("echo \"" . \Froxlor\UI\Template::getTemplate("dns_editor/index", true) . "\";"); $dns_add_data = include_once dirname(__FILE__) . '/lib/formfields/formfield.dns_add.php';
UI::view('user/dns-editor.html.twig', [
'listing' => Listing::format($collection, $dns_list_data, 'dns_list', ['domain_id' => $domain_id]),
'actions_links' => [
[
'href' => $linker->getLink([
'section' => 'domains',
'page' => 'domains',
'action' => 'edit',
'id' => $domain_id
]),
'label' => lng('admin.domain_edit'),
'icon' => 'fa-solid fa-pen'
],
[
'href' => $linker->getLink(['section' => 'domains', 'page' => 'domains']),
'label' => lng('panel.backtooverview'),
'icon' => 'fa-solid fa-reply'
]
],
'formaction' => $linker->getLink(['section' => 'domains', 'action' => 'add_record', 'domain_id' => $domain_id]),
'formdata' => $dns_add_data['dns_add'],
// alert-box
'type' => (!empty($errors) ? 'danger' : (!empty($success_message) ? 'success' : 'warning')),
'alert_msg' => (!empty($errors) ? $errors : (!empty($success_message) ? $success_message : lng('dns.howitworks'))),
'zonefile' => $zonefile,
]);

View File

@@ -2,212 +2,66 @@
/** /**
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
* Copyright (c) 2018 the Froxlor Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Froxlor team <team@froxlor.org> (2018-) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @package API-example * GNU General Public License for more details.
* @since 0.10.0
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
class FroxlorAPI class FroxlorAPI
{ {
private string $url;
private string $key;
private string $secret;
private ?array $lastError = null;
private ?string $lastStatusCode = null;
/** public function __construct($url, $key, $secret)
* URL to api.php of your froxlor installation
*
* @var string
*/
private $host = "";
/**
* your api-key
*
* @var string
*/
private $api_key = "";
/**
* your api-secret
*
* @var string
*/
private $api_secret = "";
/**
* last cURL error message
*
* @var string
*/
private $last_error = "";
/**
* last response header received
*
* @var array
*/
private $last_header = array();
/**
* last response data received
*
* @var array
*/
private $last_body = array();
/**
* create FroxlorAPI object
*
* @param string $host
* URL to api.php of your froxlor installation
* @param string $api_key
* your api-key
* @param string $api_secret
* your api-secret
*
* @return FroxlorAPI
*/
public function __construct(string $host, string $api_key, string $api_secret)
{ {
$this->host = $host; $this->url = $url;
$this->api_key = $api_key; $this->key = $key;
$this->api_secret = $api_secret; $this->secret = $secret;
} }
/** public function request($command, array $data = [])
* send request to froxlor api
*
* @param string $command
* @param array $params
*
* @return FroxlorAPI
*/
public function request(string $command, array $params = array()): FroxlorAPI
{ {
// build request array $payload = [
$request = [ 'command' => $command,
'header' => [ 'params' => $data
'apikey' => $this->api_key,
'secret' => $this->api_secret
],
'body' => [
'command' => $command
]
]; ];
// add parameter to request-body if any $ch = curl_init($this->url);
if (! empty($params)) { curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$request['body']['params'] = $params; curl_setopt($ch, CURLOPT_HEADER, 0);
} curl_setopt($ch, CURLOPT_USERPWD, $this->key . ":" . $this->secret);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
// reset last data
$this->last_header = array();
$this->last_body = array();
// send actual request
$response = $this->requestCurl(json_encode($request));
// decode response
$resp = json_decode($response[1], true);
// set body to data-part of response
$this->last_body = $resp['data'];
// set header of response
$this->last_header = [
'status' => $resp['status'],
'status_message' => $resp['status_message']
];
// check for error in api response
if (isset($this->last_header['status']) && $this->last_header['status'] >= 400) {
// set last-error message
$this->last_error .= "[" . $this->last_header['status'] . "] " . $this->last_header['status_message'];
}
return $this;
}
/**
* returns last response header
*
* @return array status|status_message
*/
public function getLastHeader(): array
{
return $this->last_header;
}
/**
* returns last response data
*
* @return array
*/
public function getLastResponse(): array
{
if (!empty($this->getLastError())) {
// nothing is returned when the last call
// was not successful
return [];
}
return $this->last_body;
}
/**
* return last known error message
*
* @return string
*/
public function getLastError(): string
{
return $this->last_error;
}
/**
* send cURL request to api
*
* @param string $data
* json array
*
* @return array header|body
*/
private function requestCurl(string $data): array
{
// reset last error message
$this->last_error = "";
$ch = curl_init($this->host);
curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $result = curl_exec($ch);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-type: application/json'
));
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_HEADER, 1);
$verbose = fopen('php://temp', 'w+');
curl_setopt($ch, CURLOPT_STDERR, $verbose);
if (! $data = curl_exec($ch)) { $this->lastStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$this->last_error = 'Curl execution error: ' . curl_error($ch) . "\n";
rewind($verbose); return json_decode($result ?? curl_error($ch), true);
$verboseLog = stream_get_contents($verbose);
$this->last_error .= "Verbose information: " . htmlspecialchars($verboseLog) . "\n";
} }
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); public function getLastStatusCode(): ?string
$header = substr($data, 0, $header_size); {
$body = substr($data, $header_size); return $this->lastStatusCode;
curl_close($ch);
return array(
$header,
$body
);
} }
} }

View File

@@ -4,7 +4,7 @@
require __DIR__ . '/FroxlorAPI.php'; require __DIR__ . '/FroxlorAPI.php';
// create object of FroxlorAPI with URL, apikey and apisecret // create object of FroxlorAPI with URL, apikey and apisecret
$fapi = new FroxlorAPI('https://froxlor.your-host.tld/api.php', 'your-api-key', 'your-api-secret'); $fapi = new FroxlorAPI('http://127.0.0.1/api.php', 'your-api-key', 'your-api-secret');
// customer data // customer data
$data = [ $data = [
@@ -16,19 +16,17 @@ $data = [
'new_customer_password' => 's0mEcRypt1cpassword' . uniqid() 'new_customer_password' => 's0mEcRypt1cpassword' . uniqid()
]; ];
// send request // send request
$fapi->request('Customers.add', $data); $response = $fapi->request('Customers.add', $data);
// check for error // check for error
if (! empty($fapi->getLastError())) { if ($fapi->getLastStatusCode() != 200) {
echo "Error: " . $fapi->getLastError(); echo "HTTP-STATUS: " . $fapi->getLastStatusCode() . PHP_EOL;
echo "Description: " . $response['message'] . PHP_EOL;
exit(); exit();
} }
// get response of request
$request = $fapi->getLastResponse();
// view response data // view response data
var_dump($request); var_dump($response);
/* /*
array(60) { array(60) {

0
doc/example/index.html Normal file
View File

View File

@@ -4,19 +4,17 @@
require __DIR__ . '/FroxlorAPI.php'; require __DIR__ . '/FroxlorAPI.php';
// create object of FroxlorAPI with URL, apikey and apisecret // create object of FroxlorAPI with URL, apikey and apisecret
$fapi = new FroxlorAPI('https://froxlor.your-host.tld/api.php', 'your-api-key', 'your-api-secret'); $fapi = new FroxlorAPI('http://localhost/api.php', 'your-api-key', 'your-api-secret');
// send request // send request
$fapi->request('Froxlor.listFunctions'); $response = $fapi->request('Froxlor.listFunctions');
// check for error // check for error
if (! empty($fapi->getLastError())) { if ($fapi->getLastStatusCode() != 200) {
echo "Error: " . $fapi->getLastError(); echo "HTTP-STATUS: " . $fapi->getLastStatusCode() . PHP_EOL;
echo "Description: " . $response['message'] . PHP_EOL;
exit(); exit();
} }
// get response of request
$request = $fapi->getLastResponse();
// view response data // view response data
var_dump($request); var_dump($response);

0
doc/index.html Normal file
View File

111
error_report.php Normal file
View File

@@ -0,0 +1,111 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/
if (!defined('AREA')) {
header("Location: index.php");
exit();
}
use Froxlor\FileDir;
use Froxlor\Froxlor;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
use Froxlor\UI\Response;
// This file is being included in admin_domains and customer_domains
// and therefore does not need to require lib/init.php
$errid = Request::any('errorid');
if (!empty($errid)) {
// read error file
$err_dir = FileDir::makeCorrectDir(Froxlor::getInstallDir() . "/logs/");
$err_file = FileDir::makeCorrectFile($err_dir . "/" . $errid . "_sql-error.log");
if (file_exists($err_file)) {
$error_content = file_get_contents($err_file);
$error = explode("|", $error_content);
$_error = [
'code' => str_replace("\n", "", substr($error[1], 5)),
'message' => str_replace("\n", "", substr($error[2], 4)),
'file' => str_replace("\n", "", substr($error[3], 5 + strlen(Froxlor::getInstallDir()))),
'line' => str_replace("\n", "", substr($error[4], 5)),
'trace' => str_replace(Froxlor::getInstallDir(), "", substr($error[5], 6))
];
// build mail-content
$mail_body = "Dear froxlor-team,\n\n";
$mail_body .= "the following error has been reported by a user:\n\n";
$mail_body .= "-------------------------------------------------------------\n";
$mail_body .= $_error['code'] . ' ' . $_error['message'] . "\n\n";
$mail_body .= "File: " . $_error['file'] . ':' . $_error['line'] . "\n\n";
$mail_body .= "Trace:\n" . trim($_error['trace']) . "\n\n";
$mail_body .= "-------------------------------------------------------------\n\n";
$mail_body .= "User-Area: " . AREA . "\n";
$mail_body .= "Froxlor-version: " . Froxlor::VERSION . "\n";
$mail_body .= "DB-version: " . Froxlor::DBVERSION . "\n\n";
$mail_body .= "End of report";
$mail_html = nl2br($mail_body);
// send actual report to dev-team
if (isset($_POST['send']) && $_POST['send'] == 'send') {
// send mail and say thanks
$_mailerror = false;
try {
$mail->Subject = '[Froxlor] Error report by user';
$mail->AltBody = $mail_body;
$mail->MsgHTML($mail_html);
$mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team');
$mail->Send();
} catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
$mailerr_msg = $e->getMessage();
$_mailerror = true;
}
if ($_mailerror) {
// error when reporting an error...LOLFUQ
Response::standardError('send_report_error', $mailerr_msg);
}
// finally remove error from fs
@unlink($err_file);
Response::standardSuccess('sent_error_report', '', ['filename' => 'index.php']);
}
// show a nice summary of the error-report
// before actually sending anything
UI::view('user/error_report.html.twig', [
'mail_html' => $mail_body,
'errorid' => $errid
]);
} else {
Response::redirectTo($filename);
}
} else {
Response::redirectTo($filename);
}

521
index.php
View File

@@ -2,54 +2,71 @@
/** /**
* This file is part of the Froxlor project. * 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). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Florian Lippert <flo@syscp.org> (2003-2009) * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Panel
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
define('AREA', 'login');
require './lib/init.php';
const AREA = 'login';
require __DIR__ . '/lib/init.php';
use Froxlor\CurrentUser;
use Froxlor\Customer\Customer;
use Froxlor\Database\Database; use Froxlor\Database\Database;
use Froxlor\Settings; use Froxlor\FileDir;
use Froxlor\Froxlor;
use Froxlor\FroxlorLogger; use Froxlor\FroxlorLogger;
use Froxlor\FroxlorTwoFactorAuth;
use Froxlor\PhpHelper;
use Froxlor\Settings;
use Froxlor\System\Crypt;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Response;
use Froxlor\User;
use Froxlor\Validate\Validate;
use Froxlor\Language;
if ($action == '') { if ($action == '') {
$action = 'login'; $action = 'login';
} }
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
if ($action == '2fa_entercode') { if ($action == '2fa_entercode') {
// page for entering the 2FA code after successful login // page for entering the 2FA code after successful login
if (! isset($_SESSION) || ! isset($_SESSION['secret_2fa'])) { if (!isset($_SESSION) || !isset($_SESSION['secret_2fa'])) {
// no session - redirect to index // no session - redirect to index
\Froxlor\UI\Response::redirectTo('index.php'); Response::redirectTo('index.php');
exit(); exit();
} }
// show template to enter code // show template to enter code
eval("echo \"" . \Froxlor\UI\Template::getTemplate('2fa/entercode', true) . "\";"); UI::view('login/enter2fa.html.twig', [
'pagetitle' => lng('login.2fa')
]);
} elseif ($action == '2fa_verify') { } elseif ($action == '2fa_verify') {
// verify code from 2fa code-enter form // verify code from 2fa code-enter form
if (! isset($_SESSION) || ! isset($_SESSION['secret_2fa'])) { if (!isset($_SESSION) || !isset($_SESSION['secret_2fa'])) {
// no session - redirect to index // no session - redirect to index
\Froxlor\UI\Response::redirectTo('index.php'); Response::redirectTo('index.php');
exit(); exit();
} }
$code = isset($_POST['2fa_code']) ? $_POST['2fa_code'] : null; $code = isset($_POST['2fa_code']) ? $_POST['2fa_code'] : null;
// verify entered code // verify entered code
$tfa = new \Froxlor\FroxlorTwoFactorAuth('Froxlor'); $tfa = new FroxlorTwoFactorAuth('Froxlor ' . Settings::Get('system.hostname'));
$result = ($_SESSION['secret_2fa'] == 'email' ? true : $tfa->verifyCode($_SESSION['secret_2fa'], $code, 3)); $result = ($_SESSION['secret_2fa'] == 'email' ? true : $tfa->verifyCode($_SESSION['secret_2fa'], $code, 3));
// either the code is valid when using authenticator-app, or we will select userdata by id and entered code // either the code is valid when using authenticator-app, or we will select userdata by id and entered code
// which is temporarily stored for the customer when using email-2fa // which is temporarily stored for the customer when using email-2fa
@@ -59,9 +76,9 @@ if ($action == '2fa_entercode') {
$field = $_SESSION['uidfield_2fa']; $field = $_SESSION['uidfield_2fa'];
$uid = $_SESSION['uid_2fa']; $uid = $_SESSION['uid_2fa'];
$isadmin = $_SESSION['unfo_2fa']; $isadmin = $_SESSION['unfo_2fa'];
$sel_param = array( $sel_param = [
'uid' => $uid 'uid' => $uid
); ];
if ($_SESSION['secret_2fa'] == 'email') { if ($_SESSION['secret_2fa'] == 'email') {
// verify code by selecting user by id and the temp. stored code, // verify code by selecting user by id and the temp. stored code,
// so only if it's the correct code, we get the user-data // so only if it's the correct code, we get the user-data
@@ -74,75 +91,75 @@ if ($action == '2fa_entercode') {
$userinfo = Database::pexecute_first($sel_stmt, $sel_param); $userinfo = Database::pexecute_first($sel_stmt, $sel_param);
// whoops, no (valid) user? Start again // whoops, no (valid) user? Start again
if (empty($userinfo)) { if (empty($userinfo)) {
\Froxlor\UI\Response::redirectTo('index.php', array( Response::redirectTo('index.php', [
'showmessage' => '2' 'showmessage' => '2'
)); ]);
} }
// set fields in $userinfo required for finishLogin() // set fields in $userinfo required for finishLogin()
$userinfo['adminsession'] = $isadmin; $userinfo['adminsession'] = $isadmin;
$userinfo['userid'] = $uid; $userinfo['userid'] = $uid;
// if not successful somehow - start again // if not successful somehow - start again
if (! finishLogin($userinfo)) { if (!finishLogin($userinfo)) {
\Froxlor\UI\Response::redirectTo('index.php', array( Response::redirectTo('index.php', [
'showmessage' => '2' 'showmessage' => '2'
)); ]);
} }
// when using email-2fa, remove the one-time-code // when using email-2fa, remove the one-time-code
if ($userinfo['type_2fa'] == '1') { if ($userinfo['type_2fa'] == '1') {
$del_stmt = Database::prepare("UPDATE $table SET `data_2fa` = '' WHERE `" . $field . "` = :uid"); $del_stmt = Database::prepare("UPDATE $table SET `data_2fa` = '' WHERE `" . $field . "` = :uid");
$userinfo = Database::pexecute_first($del_stmt, array( $userinfo = Database::pexecute_first($del_stmt, [
'uid' => $uid 'uid' => $uid
)); ]);
} }
exit(); exit();
} }
\Froxlor\UI\Response::redirectTo('index.php', array( Response::redirectTo('index.php', [
'showmessage' => '2' 'showmessage' => '2'
)); ]);
exit(); exit();
} elseif ($action == 'login') { } elseif ($action == 'login') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$loginname = \Froxlor\Validate\Validate::validate($_POST['loginname'], 'loginname'); $loginname = Validate::validate($_POST['loginname'], 'loginname');
$password = \Froxlor\Validate\Validate::validate($_POST['password'], 'password'); $password = Validate::validate($_POST['password'], 'password');
$stmt = Database::prepare("SELECT `loginname` AS `customer` FROM `" . TABLE_PANEL_CUSTOMERS . "` $stmt = Database::prepare("SELECT `loginname` AS `customer` FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE `loginname`= :loginname"); WHERE `loginname`= :loginname");
Database::pexecute($stmt, array( Database::pexecute($stmt, [
"loginname" => $loginname "loginname" => $loginname
)); ]);
$row = $stmt->fetch(PDO::FETCH_ASSOC); $row = $stmt->fetch(PDO::FETCH_ASSOC);
if ($row['customer'] == $loginname) { if ($row && $row['customer'] == $loginname) {
$table = "`" . TABLE_PANEL_CUSTOMERS . "`"; $table = "`" . TABLE_PANEL_CUSTOMERS . "`";
$uid = 'customerid'; $uid = 'customerid';
$adminsession = '0'; $adminsession = '0';
$is_admin = false; $is_admin = false;
} else { } else {
$is_admin = true; $is_admin = true;
if ((int) Settings::Get('login.domain_login') == 1) { if ((int)Settings::Get('login.domain_login') == 1) {
$domainname = $idna_convert->encode(preg_replace(array( $domainname = $idna_convert->encode(preg_replace([
'/\:(\d)+$/', '/\:(\d)+$/',
'/^https?\:\/\//' '/^https?\:\/\//'
), '', $loginname)); ], '', $loginname));
$stmt = Database::prepare("SELECT `customerid` FROM `" . TABLE_PANEL_DOMAINS . "` $stmt = Database::prepare("SELECT `customerid` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `domain` = :domain"); WHERE `domain` = :domain");
Database::pexecute($stmt, array( Database::pexecute($stmt, [
"domain" => $domainname "domain" => $domainname
)); ]);
$row2 = $stmt->fetch(PDO::FETCH_ASSOC); $row2 = $stmt->fetch(PDO::FETCH_ASSOC);
if (isset($row2['customerid']) && $row2['customerid'] > 0) { if (isset($row2['customerid']) && $row2['customerid'] > 0) {
$loginname = \Froxlor\Customer\Customer::getCustomerDetail($row2['customerid'], 'loginname'); $loginname = Customer::getCustomerDetail($row2['customerid'], 'loginname');
if ($loginname !== false) { if ($loginname !== false) {
$stmt = Database::prepare("SELECT `loginname` AS `customer` FROM `" . TABLE_PANEL_CUSTOMERS . "` $stmt = Database::prepare("SELECT `loginname` AS `customer` FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE `loginname`= :loginname"); WHERE `loginname`= :loginname");
Database::pexecute($stmt, array( Database::pexecute($stmt, [
"loginname" => $loginname "loginname" => $loginname
)); ]);
$row3 = $stmt->fetch(PDO::FETCH_ASSOC); $row3 = $stmt->fetch(PDO::FETCH_ASSOC);
if ($row3['customer'] == $loginname) { if ($row3 && $row3['customer'] == $loginname) {
$table = "`" . TABLE_PANEL_CUSTOMERS . "`"; $table = "`" . TABLE_PANEL_CUSTOMERS . "`";
$uid = 'customerid'; $uid = 'customerid';
$adminsession = '0'; $adminsession = '0';
@@ -153,72 +170,72 @@ if ($action == '2fa_entercode') {
} }
} }
if ((\Froxlor\Froxlor::hasUpdates() || \Froxlor\Froxlor::hasDbUpdates()) && $is_admin == false) { if ((Froxlor::hasUpdates() || Froxlor::hasDbUpdates()) && $is_admin == false) {
\Froxlor\UI\Response::redirectTo('index.php'); Response::redirectTo('index.php');
exit(); exit();
} }
if ($is_admin) { if ($is_admin) {
if (\Froxlor\Froxlor::hasUpdates() || \Froxlor\Froxlor::hasDbUpdates()) { if (Froxlor::hasUpdates() || Froxlor::hasDbUpdates()) {
$stmt = Database::prepare("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "` $stmt = Database::prepare("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "`
WHERE `loginname`= :loginname WHERE `loginname`= :loginname
AND `change_serversettings` = '1'"); AND `change_serversettings` = '1'");
Database::pexecute($stmt, array( Database::pexecute($stmt, [
"loginname" => $loginname "loginname" => $loginname
)); ]);
$row = $stmt->fetch(PDO::FETCH_ASSOC); $row = $stmt->fetch(PDO::FETCH_ASSOC);
if (! isset($row['admin'])) { if (!isset($row['admin'])) {
// not an admin who can see updates // not an admin who can see updates
\Froxlor\UI\Response::redirectTo('index.php'); Response::redirectTo('index.php');
exit(); exit();
} }
} else { } else {
$stmt = Database::prepare("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "` $stmt = Database::prepare("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "`
WHERE `loginname`= :loginname"); WHERE `loginname`= :loginname");
Database::pexecute($stmt, array( Database::pexecute($stmt, [
"loginname" => $loginname "loginname" => $loginname
)); ]);
$row = $stmt->fetch(PDO::FETCH_ASSOC); $row = $stmt->fetch(PDO::FETCH_ASSOC);
} }
if ($row['admin'] == $loginname) { if ($row && $row['admin'] == $loginname) {
$table = "`" . TABLE_PANEL_ADMINS . "`"; $table = "`" . TABLE_PANEL_ADMINS . "`";
$uid = 'adminid'; $uid = 'adminid';
$adminsession = '1'; $adminsession = '1';
} else { } else {
// Log failed login // Log failed login
$rstlog = FroxlorLogger::getInstanceOf(array( $rstlog = FroxlorLogger::getInstanceOf([
'loginname' => $_SERVER['REMOTE_ADDR'] 'loginname' => $_SERVER['REMOTE_ADDR']
)); ]);
$rstlog->logAction(\Froxlor\FroxlorLogger::LOGIN_ACTION, LOG_WARNING, "Unknown user '" . $loginname . "' tried to login."); $rstlog->logAction(FroxlorLogger::LOGIN_ACTION, LOG_WARNING, "Unknown user '" . $loginname . "' tried to login.");
\Froxlor\UI\Response::redirectTo('index.php', array( Response::redirectTo('index.php', [
'showmessage' => '2' 'showmessage' => '2'
)); ]);
exit(); exit();
} }
} }
$userinfo_stmt = Database::prepare("SELECT * FROM $table $userinfo_stmt = Database::prepare("SELECT * FROM $table
WHERE `loginname`= :loginname"); WHERE `loginname`= :loginname");
Database::pexecute($userinfo_stmt, array( Database::pexecute($userinfo_stmt, [
"loginname" => $loginname "loginname" => $loginname
)); ]);
$userinfo = $userinfo_stmt->fetch(PDO::FETCH_ASSOC); $userinfo = $userinfo_stmt->fetch(PDO::FETCH_ASSOC);
if ($userinfo['loginfail_count'] >= Settings::Get('login.maxloginattempts') && $userinfo['lastlogin_fail'] > (time() - Settings::Get('login.deactivatetime'))) { if ($userinfo['loginfail_count'] >= Settings::Get('login.maxloginattempts') && $userinfo['lastlogin_fail'] > (time() - Settings::Get('login.deactivatetime'))) {
\Froxlor\UI\Response::redirectTo('index.php', array( Response::redirectTo('index.php', [
'showmessage' => '3' 'showmessage' => '3'
)); ]);
exit(); exit();
} elseif (\Froxlor\System\Crypt::validatePasswordLogin($userinfo, $password, $table, $uid)) { } elseif (Crypt::validatePasswordLogin($userinfo, $password, $table, $uid)) {
// only show "you're banned" if the login was successful // only show "you're banned" if the login was successful
// because we don't want to publish that the user does exist // because we don't want to publish that the user does exist
if ($userinfo['deactivated']) { if ($userinfo['deactivated']) {
unset($userinfo); unset($userinfo);
\Froxlor\UI\Response::redirectTo('index.php', array( Response::redirectTo('index.php', [
'showmessage' => '5' 'showmessage' => '5'
)); ]);
exit(); exit();
} else { } else {
// login correct // login correct
@@ -226,10 +243,10 @@ if ($action == '2fa_entercode') {
$stmt = Database::prepare("UPDATE $table $stmt = Database::prepare("UPDATE $table
SET `lastlogin_succ`= :lastlogin_succ, `loginfail_count`='0' SET `lastlogin_succ`= :lastlogin_succ, `loginfail_count`='0'
WHERE `$uid`= :uid"); WHERE `$uid`= :uid");
Database::pexecute($stmt, array( Database::pexecute($stmt, [
"lastlogin_succ" => time(), "lastlogin_succ" => time(),
"uid" => $userinfo[$uid] "uid" => $userinfo[$uid]
)); ]);
$userinfo['userid'] = $userinfo[$uid]; $userinfo['userid'] = $userinfo[$uid];
$userinfo['adminsession'] = $adminsession; $userinfo['adminsession'] = $adminsession;
} }
@@ -238,21 +255,21 @@ if ($action == '2fa_entercode') {
$stmt = Database::prepare("UPDATE $table $stmt = Database::prepare("UPDATE $table
SET `lastlogin_fail`= :lastlogin_fail, `loginfail_count`=`loginfail_count`+1 SET `lastlogin_fail`= :lastlogin_fail, `loginfail_count`=`loginfail_count`+1
WHERE `$uid`= :uid"); WHERE `$uid`= :uid");
Database::pexecute($stmt, array( Database::pexecute($stmt, [
"lastlogin_fail" => time(), "lastlogin_fail" => time(),
"uid" => $userinfo[$uid] "uid" => $userinfo[$uid]
)); ]);
// Log failed login // Log failed login
$rstlog = FroxlorLogger::getInstanceOf(array( $rstlog = FroxlorLogger::getInstanceOf([
'loginname' => $_SERVER['REMOTE_ADDR'] 'loginname' => $_SERVER['REMOTE_ADDR']
)); ]);
$rstlog->logAction(\Froxlor\FroxlorLogger::LOGIN_ACTION, LOG_WARNING, "User '" . $loginname . "' tried to login with wrong password."); $rstlog->logAction(FroxlorLogger::LOGIN_ACTION, LOG_WARNING, "User '" . $loginname . "' tried to login with wrong password.");
unset($userinfo); unset($userinfo);
\Froxlor\UI\Response::redirectTo('index.php', array( Response::redirectTo('index.php', [
'showmessage' => '2' 'showmessage' => '2'
)); ]);
exit(); exit();
} }
@@ -267,27 +284,27 @@ if ($action == '2fa_entercode') {
// send mail if type_2fa = 1 (email) // send mail if type_2fa = 1 (email)
if ($userinfo['type_2fa'] == 1) { if ($userinfo['type_2fa'] == 1) {
// generate code // generate code
$tfa = new \Froxlor\FroxlorTwoFactorAuth('Froxlor'); $tfa = new FroxlorTwoFactorAuth('Froxlor ' . Settings::Get('system.hostname'));
$code = $tfa->getCode($tfa->createSecret()); $code = $tfa->getCode($tfa->createSecret());
// set code for user // set code for user
$stmt = Database::prepare("UPDATE $table SET `data_2fa` = :d2fa WHERE `$uid` = :uid"); $stmt = Database::prepare("UPDATE $table SET `data_2fa` = :d2fa WHERE `$uid` = :uid");
Database::pexecute($stmt, array( Database::pexecute($stmt, [
"d2fa" => $code, "d2fa" => $code,
"uid" => $userinfo[$uid] "uid" => $userinfo[$uid]
)); ]);
// build up & send email // build up & send email
$_mailerror = false; $_mailerror = false;
$mailerr_msg = ""; $mailerr_msg = "";
$replace_arr = array( $replace_arr = [
'CODE' => $code 'CODE' => $code
); ];
$mail_body = html_entity_decode(\Froxlor\PhpHelper::replaceVariables($lng['mails']['2fa']['mailbody'], $replace_arr)); $mail_body = html_entity_decode(PhpHelper::replaceVariables(lng('mails.2fa.mailbody'), $replace_arr));
try { try {
$mail->Subject = $lng['mails']['2fa']['subject']; $mail->Subject = lng('mails.2fa.subject');
$mail->AltBody = $mail_body; $mail->AltBody = $mail_body;
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body)); $mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
$mail->AddAddress($userinfo['email'], \Froxlor\User::getCorrectUserSalutation($userinfo)); $mail->AddAddress($userinfo['email'], User::getCorrectUserSalutation($userinfo));
$mail->Send(); $mail->Send();
} catch (\PHPMailer\PHPMailer\Exception $e) { } catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage(); $mailerr_msg = $e->errorMessage();
@@ -298,82 +315,76 @@ if ($action == '2fa_entercode') {
} }
if ($_mailerror) { if ($_mailerror) {
$rstlog = FroxlorLogger::getInstanceOf(array( $rstlog = FroxlorLogger::getInstanceOf([
'loginname' => '2fa code-sending' 'loginname' => '2fa code-sending'
)); ]);
$rstlog->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg); $rstlog->logAction(FroxlorLogger::ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
\Froxlor\UI\Response::redirectTo('index.php', array( Response::redirectTo('index.php', [
'showmessage' => '4', 'showmessage' => '4',
'customermail' => $userinfo['email'] 'customermail' => $userinfo['email']
)); ]);
exit(); exit();
} }
$mail->ClearAddresses(); $mail->ClearAddresses();
} }
\Froxlor\UI\Response::redirectTo('index.php', array( Response::redirectTo('index.php', [
'action' => '2fa_entercode' 'action' => '2fa_entercode'
)); ]);
exit(); exit();
} }
if (! finishLogin($userinfo)) { if (!finishLogin($userinfo)) {
\Froxlor\UI\Response::redirectTo('index.php', array( Response::redirectTo('index.php', [
'showmessage' => '2' 'showmessage' => '2'
)); ]);
} }
exit(); exit();
} else { } else {
$language_options = ''; $smessage = isset($_GET['showmessage']) ? (int)$_GET['showmessage'] : 0;
$language_options .= \Froxlor\UI\HTML::makeoption($lng['login']['profile_lng'], 'profile', 'profile', true, true);
foreach ($languages as $language_file => $language_name) {
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, 'profile', true);
}
$smessage = isset($_GET['showmessage']) ? (int) $_GET['showmessage'] : 0;
$message = ''; $message = '';
$successmessage = ''; $successmessage = '';
switch ($smessage) { switch ($smessage) {
case 1: case 1:
$successmessage = $lng['pwdreminder']['success']; $successmessage = lng('pwdreminder.success');
break; break;
case 2: case 2:
$message = $lng['error']['login']; $message = lng('error.login');
break; break;
case 3: case 3:
$message = sprintf($lng['error']['login_blocked'], Settings::Get('login.deactivatetime')); $message = lng('error.login_blocked', [Settings::Get('login.deactivatetime')]);
break; break;
case 4: case 4:
$cmail = isset($_GET['customermail']) ? $_GET['customermail'] : 'unknown'; $message = lng('error.errorsendingmailpub');
$message = str_replace('%s', $cmail, $lng['error']['errorsendingmail']);
break; break;
case 5: case 5:
$message = $lng['error']['user_banned']; $message = lng('error.user_banned');
break; break;
case 6: case 6:
$successmessage = $lng['pwdreminder']['changed']; $successmessage = lng('pwdreminder.changed');
break; break;
case 7: case 7:
$message = $lng['pwdreminder']['wrongcode']; $message = lng('pwdreminder.wrongcode');
break; break;
case 8: case 8:
$message = $lng['pwdreminder']['notallowed']; $message = lng('pwdreminder.notallowed');
break; break;
} }
$update_in_progress = ''; $update_in_progress = false;
if (\Froxlor\Froxlor::hasUpdates() || \Froxlor\Froxlor::hasDbUpdates()) { if (Froxlor::hasUpdates() || Froxlor::hasDbUpdates()) {
$update_in_progress = $lng['update']['updateinprogress_onlyadmincanlogin']; $update_in_progress = true;
} }
// Pass the last used page if needed // Pass the last used page if needed
$lastscript = ""; $lastscript = "";
if (isset($_REQUEST['script']) && $_REQUEST['script'] != "") { if (isset($_REQUEST['script']) && $_REQUEST['script'] != "") {
$lastscript = $_REQUEST['script']; $lastscript = $_REQUEST['script'];
$lastscript = str_replace("..", "", $lastscript);
$lastscript = htmlspecialchars($lastscript, ENT_QUOTES);
if (! file_exists(__DIR__ . "/" . $lastscript)) { if (!file_exists(__DIR__ . "/" . $lastscript)) {
$lastscript = ""; $lastscript = "";
} }
} }
@@ -382,7 +393,14 @@ if ($action == '2fa_entercode') {
$lastqrystr = htmlspecialchars($_REQUEST['qrystr'], ENT_QUOTES); $lastqrystr = htmlspecialchars($_REQUEST['qrystr'], ENT_QUOTES);
} }
eval("echo \"" . \Froxlor\UI\Template::getTemplate('login') . "\";"); UI::view('login/login.html.twig', [
'pagetitle' => 'Login',
'lastscript' => $lastscript,
'lastqrystr' => $lastqrystr,
'upd_in_progress' => $update_in_progress,
'message' => $message,
'successmsg' => $successmessage
]);
} }
} }
@@ -391,24 +409,24 @@ if ($action == 'forgotpwd') {
$message = ''; $message = '';
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$loginname = \Froxlor\Validate\Validate::validate($_POST['loginname'], 'loginname'); $loginname = Validate::validate($_POST['loginname'], 'loginname');
$email = \Froxlor\Validate\Validate::validateEmail($_POST['loginemail'], 'email'); $email = Validate::validateEmail($_POST['loginemail']);
$result_stmt = Database::prepare("SELECT `adminid`, `customerid`, `firstname`, `name`, `company`, `email`, `loginname`, `def_language`, `deactivated` FROM `" . TABLE_PANEL_CUSTOMERS . "` $result_stmt = Database::prepare("SELECT `adminid`, `customerid`, `customernumber`, `firstname`, `name`, `company`, `email`, `loginname`, `def_language`, `deactivated` FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE `loginname`= :loginname WHERE `loginname`= :loginname
AND `email`= :email"); AND `email`= :email");
Database::pexecute($result_stmt, array( Database::pexecute($result_stmt, [
"loginname" => $loginname, "loginname" => $loginname,
"email" => $email "email" => $email
)); ]);
if (Database::num_rows() == 0) { if (Database::num_rows() == 0) {
$result_stmt = Database::prepare("SELECT `adminid`, `name`, `email`, `loginname`, `def_language`, `deactivated` FROM `" . TABLE_PANEL_ADMINS . "` $result_stmt = Database::prepare("SELECT `adminid`, `name`, `email`, `loginname`, `def_language`, `deactivated` FROM `" . TABLE_PANEL_ADMINS . "`
WHERE `loginname`= :loginname WHERE `loginname`= :loginname
AND `email`= :email"); AND `email`= :email");
Database::pexecute($result_stmt, array( Database::pexecute($result_stmt, [
"loginname" => $loginname, "loginname" => $loginname,
"email" => $email "email" => $email
)); ]);
if (Database::num_rows() > 0) { if (Database::num_rows() > 0) {
$adminchecked = true; $adminchecked = true;
@@ -417,51 +435,59 @@ if ($action == 'forgotpwd') {
} }
} }
if ($adminchecked) {
if (Settings::Get('panel.allow_preset_admin') != '1') {
$message = lng('pwdreminder.notallowed');
unset($adminchecked);
}
} else {
if (Settings::Get('panel.allow_preset') != '1') {
$message = lng('pwdreminder.notallowed');
}
}
if (empty($message)) {
if ($result_stmt !== null) { if ($result_stmt !== null) {
$user = $result_stmt->fetch(PDO::FETCH_ASSOC); $user = $result_stmt->fetch(PDO::FETCH_ASSOC);
/* Check whether user is banned */ /* Check whether user is banned */
if ($user['deactivated']) { if ($user['deactivated']) {
\Froxlor\UI\Response::redirectTo('index.php', array( $message = lng('pwdreminder.notallowed');
'showmessage' => '8' } else {
));
exit();
}
if (($adminchecked && Settings::Get('panel.allow_preset_admin') == '1') || $adminchecked == false) { if (($adminchecked && Settings::Get('panel.allow_preset_admin') == '1') || $adminchecked == false) {
if ($user !== false) { if ($user !== false) {
// build a activation code // build a activation code
$timestamp = time(); $timestamp = time();
$first = substr(md5($user['loginname'] . $timestamp . \Froxlor\PhpHelper::randomStr(16)), 0, 15); $first = substr(md5($user['loginname'] . $timestamp . PhpHelper::randomStr(16)), 0, 15);
$third = substr(md5($user['email'] . $timestamp . \Froxlor\PhpHelper::randomStr(16)), - 15); $third = substr(md5($user['email'] . $timestamp . PhpHelper::randomStr(16)), -15);
$activationcode = $first . $timestamp . $third . substr(md5($third . $timestamp), 0, 10); $activationcode = $first . $timestamp . $third . substr(md5($third . $timestamp), 0, 10);
// Drop all existing activation codes for this user // Drop all existing activation codes for this user
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_ACTIVATION . "` $stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_ACTIVATION . "`
WHERE `userid` = :userid WHERE `userid` = :userid
AND `admin` = :admin"); AND `admin` = :admin");
$params = array( $params = [
"userid" => $adminchecked ? $user['adminid'] : $user['customerid'], "userid" => $adminchecked ? $user['adminid'] : $user['customerid'],
"admin" => $adminchecked ? 1 : 0 "admin" => $adminchecked ? 1 : 0
); ];
Database::pexecute($stmt, $params); Database::pexecute($stmt, $params);
// Add new activation code to database // Add new activation code to database
$stmt = Database::prepare("INSERT INTO `" . TABLE_PANEL_ACTIVATION . "` $stmt = Database::prepare("INSERT INTO `" . TABLE_PANEL_ACTIVATION . "`
(userid, admin, creation, activationcode) (userid, admin, creation, activationcode)
VALUES (:userid, :admin, :creation, :activationcode)"); VALUES (:userid, :admin, :creation, :activationcode)");
$params = array( $params = [
"userid" => $adminchecked ? $user['adminid'] : $user['customerid'], "userid" => $adminchecked ? $user['adminid'] : $user['customerid'],
"admin" => $adminchecked ? 1 : 0, "admin" => $adminchecked ? 1 : 0,
"creation" => $timestamp, "creation" => $timestamp,
"activationcode" => $activationcode "activationcode" => $activationcode
); ];
Database::pexecute($stmt, $params); Database::pexecute($stmt, $params);
$rstlog = FroxlorLogger::getInstanceOf(array( $rstlog = FroxlorLogger::getInstanceOf([
'loginname' => 'password_reset' 'loginname' => 'password_reset'
)); ]);
$rstlog->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_WARNING, "User '" . $user['loginname'] . "' requested a link for setting a new password."); $rstlog->logAction(FroxlorLogger::USR_ACTION, LOG_WARNING, "User '" . $user['loginname'] . "' requested a link for setting a new password.");
// Set together our activation link // Set together our activation link
$protocol = empty($_SERVER['HTTPS']) ? 'http' : 'https'; $protocol = empty($_SERVER['HTTPS']) ? 'http' : 'https';
@@ -475,15 +501,19 @@ if ($action == 'forgotpwd') {
// there can be only one script to handle this so we can use a fixed value here // there can be only one script to handle this so we can use a fixed value here
$script = "/index.php"; // $_SERVER['SCRIPT_NAME']; $script = "/index.php"; // $_SERVER['SCRIPT_NAME'];
if (Settings::Get('system.froxlordirectlyviahostname') == 0) { if (Settings::Get('system.froxlordirectlyviahostname') == 0) {
$script = \Froxlor\FileDir::makeCorrectFile("/" . basename(__DIR__) . "/" . $script); $script = FileDir::makeCorrectFile("/" . basename(__DIR__) . "/" . $script);
} }
$activationlink = $protocol . '://' . $host . $port . $script . '?action=resetpwd&resetcode=' . $activationcode; $activationlink = $protocol . '://' . $host . $port . $script . '?action=resetpwd&resetcode=' . $activationcode;
$replace_arr = array( $replace_arr = [
'SALUTATION' => \Froxlor\User::getCorrectUserSalutation($user), 'SALUTATION' => User::getCorrectUserSalutation($user),
'NAME' => $user['name'],
'FIRSTNAME' => $user['firstname'] ?? "",
'COMPANY' => $user['company'] ?? "",
'CUSTOMER_NO' => $user['customernumber'] ?? 0,
'USERNAME' => $loginname, 'USERNAME' => $loginname,
'LINK' => $activationlink 'LINK' => $activationlink
); ];
$def_language = ($user['def_language'] != '') ? $user['def_language'] : Settings::Get('panel.standardlanguage'); $def_language = ($user['def_language'] != '') ? $user['def_language'] : Settings::Get('panel.standardlanguage');
$result_stmt = Database::prepare('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` $result_stmt = Database::prepare('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '`
@@ -491,24 +521,24 @@ if ($action == 'forgotpwd') {
AND `language`= :lang AND `language`= :lang
AND `templategroup`=\'mails\' AND `templategroup`=\'mails\'
AND `varname`=\'password_reset_subject\''); AND `varname`=\'password_reset_subject\'');
Database::pexecute($result_stmt, array( Database::pexecute($result_stmt, [
"adminid" => $user['adminid'], "adminid" => $user['adminid'],
"lang" => $def_language "lang" => $def_language
)); ]);
$result = $result_stmt->fetch(PDO::FETCH_ASSOC); $result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$mail_subject = html_entity_decode(\Froxlor\PhpHelper::replaceVariables((($result['value'] != '') ? $result['value'] : $lng['mails']['password_reset']['subject']), $replace_arr)); $mail_subject = html_entity_decode(PhpHelper::replaceVariables((($result['value'] != '') ? $result['value'] : lng('mails.password_reset.subject')), $replace_arr));
$result_stmt = Database::prepare('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` $result_stmt = Database::prepare('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '`
WHERE `adminid`= :adminid WHERE `adminid`= :adminid
AND `language`= :lang AND `language`= :lang
AND `templategroup`=\'mails\' AND `templategroup`=\'mails\'
AND `varname`=\'password_reset_mailbody\''); AND `varname`=\'password_reset_mailbody\'');
Database::pexecute($result_stmt, array( Database::pexecute($result_stmt, [
"adminid" => $user['adminid'], "adminid" => $user['adminid'],
"lang" => $def_language "lang" => $def_language
)); ]);
$result = $result_stmt->fetch(PDO::FETCH_ASSOC); $result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$mail_body = html_entity_decode(\Froxlor\PhpHelper::replaceVariables((($result['value'] != '') ? $result['value'] : $lng['mails']['password_reset']['mailbody']), $replace_arr)); $mail_body = html_entity_decode(PhpHelper::replaceVariables((($result['value'] != '') ? $result['value'] : lng('mails.password_reset.mailbody')), $replace_arr));
$_mailerror = false; $_mailerror = false;
$mailerr_msg = ""; $mailerr_msg = "";
@@ -516,7 +546,7 @@ if ($action == 'forgotpwd') {
$mail->Subject = $mail_subject; $mail->Subject = $mail_subject;
$mail->AltBody = $mail_body; $mail->AltBody = $mail_body;
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body)); $mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
$mail->AddAddress($user['email'], \Froxlor\User::getCorrectUserSalutation($user)); $mail->AddAddress($user['email'], User::getCorrectUserSalutation($user));
$mail->Send(); $mail->Send();
} catch (\PHPMailer\PHPMailer\Exception $e) { } catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage(); $mailerr_msg = $e->errorMessage();
@@ -527,49 +557,44 @@ if ($action == 'forgotpwd') {
} }
if ($_mailerror) { if ($_mailerror) {
$rstlog = FroxlorLogger::getInstanceOf(array( $rstlog = FroxlorLogger::getInstanceOf([
'loginname' => 'password_reset' 'loginname' => 'password_reset'
)); ]);
$rstlog->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg); $rstlog->logAction(FroxlorLogger::ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
\Froxlor\UI\Response::redirectTo('index.php', array( Response::redirectTo('index.php', [
'showmessage' => '4', 'showmessage' => '4',
'customermail' => $user['email'] 'customermail' => $user['email']
)); ]);
exit(); exit();
} }
$mail->ClearAddresses(); $mail->ClearAddresses();
\Froxlor\UI\Response::redirectTo('index.php', array( Response::redirectTo('index.php', [
'showmessage' => '1' 'showmessage' => '1'
)); ]);
exit(); exit();
} else { } else {
$rstlog = FroxlorLogger::getInstanceOf(array( $rstlog = FroxlorLogger::getInstanceOf([
'loginname' => 'password_reset' 'loginname' => 'password_reset'
)); ]);
$rstlog->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_WARNING, "User '" . $loginname . "' requested to set a new password, but was not found in database!"); $rstlog->logAction(FroxlorLogger::USR_ACTION, LOG_WARNING, "User '" . $loginname . "' requested to set a new password, but was not found in database!");
$message = $lng['login']['combination_not_found']; $message = lng('login.usernotfound');
} }
unset($user); unset($user);
} }
}
} else { } else {
$message = $lng['login']['usernotfound']; $message = lng('pwdreminder.notallowed');
}
} }
} }
if ($adminchecked) { UI::view('login/fpwd.html.twig', [
if (Settings::Get('panel.allow_preset_admin') != '1') { 'pagetitle' => lng('login.presend'),
$message = $lng['pwdreminder']['notallowed']; 'action' => $action,
unset($adminchecked); 'message' => $message,
} ]);
} else {
if (Settings::Get('panel.allow_preset') != '1') {
$message = $lng['pwdreminder']['notallowed'];
}
}
eval("echo \"" . \Froxlor\UI\Template::getTemplate('fpwd') . "\";");
} }
if ($action == 'resetpwd') { if ($action == 'resetpwd') {
@@ -578,9 +603,9 @@ if ($action == 'resetpwd') {
// Remove old activation codes // Remove old activation codes
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_ACTIVATION . "` $stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_ACTIVATION . "`
WHERE creation < :oldest"); WHERE creation < :oldest");
Database::pexecute($stmt, array( Database::pexecute($stmt, [
"oldest" => time() - 86400 "oldest" => time() - 86400
)); ]);
if (isset($_GET['resetcode']) && strlen($_GET['resetcode']) == 50) { if (isset($_GET['resetcode']) && strlen($_GET['resetcode']) == 50) {
// Check if activation code is valid // Check if activation code is valid
@@ -593,26 +618,23 @@ if ($action == 'resetpwd') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$stmt = Database::prepare("SELECT `userid`, `admin` FROM `" . TABLE_PANEL_ACTIVATION . "` $stmt = Database::prepare("SELECT `userid`, `admin` FROM `" . TABLE_PANEL_ACTIVATION . "`
WHERE `activationcode` = :activationcode"); WHERE `activationcode` = :activationcode");
$result = Database::pexecute_first($stmt, array( $result = Database::pexecute_first($stmt, [
"activationcode" => $activationcode "activationcode" => $activationcode
)); ]);
if ($result !== false) { if ($result !== false) {
if ($result['admin'] == 1) { try {
$new_password = \Froxlor\Validate\Validate::validate($_POST['new_password'], 'new password'); $new_password = Crypt::validatePassword($_POST['new_password'], true);
$new_password_confirm = \Froxlor\Validate\Validate::validate($_POST['new_password_confirm'], 'new password confirm'); $new_password_confirm = Crypt::validatePassword($_POST['new_password_confirm'], true);
} else { } catch (Exception $e) {
$new_password = \Froxlor\System\Crypt::validatePassword($_POST['new_password'], 'new password'); $message = $e->getMessage();
$new_password_confirm = \Froxlor\System\Crypt::validatePassword($_POST['new_password_confirm'], 'new password confirm');
} }
if ($new_password == '') { if (empty($message) && (empty($new_password) || $new_password != $new_password_confirm)) {
$message = $new_password; $message = lng('error.newpasswordconfirmerror');
} elseif ($new_password_confirm == '') { }
$message = $new_password_confirm;
} elseif ($new_password != $new_password_confirm) { if (empty($message)) {
$message = $new_password . " != " . $new_password_confirm;
} else {
// Update user password // Update user password
if ($result['admin'] == 1) { if ($result['admin'] == 1) {
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_ADMINS . "` $stmt = Database::prepare("UPDATE `" . TABLE_PANEL_ADMINS . "`
@@ -623,140 +645,91 @@ if ($action == 'resetpwd') {
SET `password` = :newpassword SET `password` = :newpassword
WHERE `customerid` = :userid"); WHERE `customerid` = :userid");
} }
Database::pexecute($stmt, array( Database::pexecute($stmt, [
"newpassword" => \Froxlor\System\Crypt::makeCryptPassword($new_password), "newpassword" => Crypt::makeCryptPassword($new_password),
"userid" => $result['userid'] "userid" => $result['userid']
)); ]);
$rstlog = FroxlorLogger::getInstanceOf(array( $rstlog = FroxlorLogger::getInstanceOf([
'loginname' => 'password_reset' 'loginname' => 'password_reset'
)); ]);
$rstlog->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "changed password using password reset."); $rstlog->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "changed password using password reset.");
// Remove activation code from DB // Remove activation code from DB
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_ACTIVATION . "` $stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_ACTIVATION . "`
WHERE `activationcode` = :activationcode WHERE `activationcode` = :activationcode
AND `userid` = :userid"); AND `userid` = :userid");
Database::pexecute($stmt, array( Database::pexecute($stmt, [
"activationcode" => $activationcode, "activationcode" => $activationcode,
"userid" => $result['userid'] "userid" => $result['userid']
)); ]);
\Froxlor\UI\Response::redirectTo('index.php', array( Response::redirectTo('index.php', [
"showmessage" => '6' "showmessage" => '6'
)); ]);
} }
} else { } else {
\Froxlor\UI\Response::redirectTo('index.php', array( Response::redirectTo('index.php', [
"showmessage" => '7' "showmessage" => '7'
)); ]);
} }
} }
eval("echo \"" . \Froxlor\UI\Template::getTemplate('rpwd') . "\";"); UI::view('login/rpwd.html.twig', [
'pagetitle' => lng('pwdreminder.choosenew'),
'formaction' => 'index.php?action=resetpwd&resetcode=' . $activationcode,
'message' => $message,
]);
} else { } else {
\Froxlor\UI\Response::redirectTo('index.php', array( Response::redirectTo('index.php', [
"showmessage" => '7' "showmessage" => '7'
)); ]);
} }
} else { } else {
\Froxlor\UI\Response::redirectTo('index.php'); Response::redirectTo('index.php');
} }
} }
function finishLogin($userinfo) function finishLogin($userinfo)
{ {
global $version, $dbversion, $remote_addr, $http_user_agent, $languages;
if (isset($userinfo['userid']) && $userinfo['userid'] != '') { if (isset($userinfo['userid']) && $userinfo['userid'] != '') {
$s = md5(uniqid(microtime(), 1)); CurrentUser::setData($userinfo);
if (isset($_POST['language'])) { $language = $userinfo['def_language'] ?? Settings::Get('panel.standardlanguage');
$language = \Froxlor\Validate\Validate::validate($_POST['language'], 'language'); CurrentUser::setField('language', $language);
if ($language == 'profile') {
$language = $userinfo['def_language'];
} elseif (! isset($languages[$language])) {
$language = Settings::Get('panel.standardlanguage');
}
} else {
$language = Settings::Get('panel.standardlanguage');
}
if (isset($userinfo['theme']) && $userinfo['theme'] != '') { if (isset($userinfo['theme']) && $userinfo['theme'] != '') {
$theme = $userinfo['theme']; $theme = $userinfo['theme'];
} else { } else {
$theme = Settings::Get('panel.default_theme'); $theme = Settings::Get('panel.default_theme');
CurrentUser::setField('theme', $theme);
} }
if (Settings::Get('session.allow_multiple_login') != '1') { $qryparams = [];
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :uid
AND `adminsession` = :adminsession");
Database::pexecute($stmt, array(
"uid" => $userinfo['userid'],
"adminsession" => $userinfo['adminsession']
));
}
// check for field 'theme' in session-table, refs #607
// Changed with #1287 to new method
$stmt = Database::query("SHOW COLUMNS FROM panel_sessions LIKE 'theme'");
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
if ($row['Field'] == "theme") {
$has_theme = true;
}
}
$params = array(
"hash" => $s,
"userid" => $userinfo['userid'],
"ipaddress" => $remote_addr,
"useragent" => $http_user_agent,
"lastactivity" => time(),
"language" => $language,
"adminsession" => $userinfo['adminsession']
);
if ($has_theme) {
$params["theme"] = $theme;
$stmt = Database::prepare("INSERT INTO `" . TABLE_PANEL_SESSIONS . "`
(`hash`, `userid`, `ipaddress`, `useragent`, `lastactivity`, `language`, `adminsession`, `theme`)
VALUES (:hash, :userid, :ipaddress, :useragent, :lastactivity, :language, :adminsession, :theme)");
} else {
$stmt = Database::prepare("INSERT INTO `" . TABLE_PANEL_SESSIONS . "`
(`hash`, `userid`, `ipaddress`, `useragent`, `lastactivity`, `language`, `adminsession`)
VALUES (:hash, :userid, :ipaddress, :useragent, :lastactivity, :language, :adminsession)");
}
Database::pexecute($stmt, $params);
$qryparams = array();
if (isset($_POST['qrystr']) && $_POST['qrystr'] != "") { if (isset($_POST['qrystr']) && $_POST['qrystr'] != "") {
parse_str(urldecode($_POST['qrystr']), $qryparams); parse_str(urldecode($_POST['qrystr']), $qryparams);
} }
$qryparams['s'] = $s;
if ($userinfo['adminsession'] == '1') { if ($userinfo['adminsession'] == '1') {
if (\Froxlor\Froxlor::hasUpdates() || \Froxlor\Froxlor::hasDbUpdates()) { if (Froxlor::hasUpdates() || Froxlor::hasDbUpdates()) {
\Froxlor\UI\Response::redirectTo('admin_updates.php', array( Response::redirectTo('admin_updates.php?page=overview');
's' => $s
));
} else { } else {
if (isset($_POST['script']) && $_POST['script'] != "") { if (isset($_POST['script']) && $_POST['script'] != "") {
if (preg_match("/customer\_/", $_POST['script']) === 1) { if (preg_match("/customer\_/", $_POST['script']) === 1) {
\Froxlor\UI\Response::redirectTo('admin_customers.php', array( Response::redirectTo('admin_customers.php', [
"page" => "customers" "page" => "customers"
)); ]);
} else { } else {
\Froxlor\UI\Response::redirectTo($_POST['script'], $qryparams); Response::redirectTo($_POST['script'], $qryparams);
} }
} else { } else {
\Froxlor\UI\Response::redirectTo('admin_index.php', $qryparams); Response::redirectTo('admin_index.php', $qryparams);
} }
} }
} else { } else {
if (isset($_POST['script']) && $_POST['script'] != "") { if (isset($_POST['script']) && $_POST['script'] != "") {
\Froxlor\UI\Response::redirectTo($_POST['script'], $qryparams); Response::redirectTo($_POST['script'], $qryparams);
} else { } else {
\Froxlor\UI\Response::redirectTo('customer_index.php', $qryparams); Response::redirectTo('customer_index.php', $qryparams);
} }
} }
} }

View File

@@ -1,3 +1,29 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/
return <<<'FROXLORSQL'
DROP TABLE IF EXISTS `ftp_groups`; DROP TABLE IF EXISTS `ftp_groups`;
CREATE TABLE `ftp_groups` ( CREATE TABLE `ftp_groups` (
`id` int(20) NOT NULL auto_increment, `id` int(20) NOT NULL auto_increment,
@@ -10,15 +36,13 @@ CREATE TABLE `ftp_groups` (
KEY `customerid` (`customerid`) KEY `customerid` (`customerid`)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `ftp_users`; DROP TABLE IF EXISTS `ftp_users`;
CREATE TABLE `ftp_users` ( CREATE TABLE `ftp_users` (
`id` int(20) NOT NULL auto_increment, `id` int(20) NOT NULL auto_increment,
`username` varchar(255) NOT NULL default '', `username` varchar(255) NOT NULL,
`uid` int(5) NOT NULL default '0', `uid` int(5) NOT NULL default '0',
`gid` int(5) NOT NULL default '0', `gid` int(5) NOT NULL default '0',
`password` varchar(128) NOT NULL default '', `password` varchar(255) NOT NULL,
`homedir` varchar(255) NOT NULL default '', `homedir` varchar(255) NOT NULL default '',
`shell` varchar(255) NOT NULL default '/bin/false', `shell` varchar(255) NOT NULL default '/bin/false',
`login_enabled` enum('N','Y') NOT NULL default 'N', `login_enabled` enum('N','Y') NOT NULL default 'N',
@@ -36,14 +60,13 @@ CREATE TABLE `ftp_users` (
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `mail_users`; DROP TABLE IF EXISTS `mail_users`;
CREATE TABLE `mail_users` ( CREATE TABLE `mail_users` (
`id` int(11) NOT NULL auto_increment, `id` int(11) NOT NULL auto_increment,
`email` varchar(255) NOT NULL default '', `email` varchar(255) NOT NULL default '',
`username` varchar(255) NOT NULL default '', `username` varchar(255) NOT NULL default '',
`password` varchar(128) NOT NULL default '', `password` varchar(255) NOT NULL default '',
`password_enc` varchar(128) NOT NULL default '', `password_enc` varchar(255) NOT NULL default '',
`uid` int(11) NOT NULL default '0', `uid` int(11) NOT NULL default '0',
`gid` int(11) NOT NULL default '0', `gid` int(11) NOT NULL default '0',
`homedir` varchar(255) NOT NULL default '', `homedir` varchar(255) NOT NULL default '',
@@ -60,7 +83,6 @@ CREATE TABLE `mail_users` (
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `mail_virtual`; DROP TABLE IF EXISTS `mail_virtual`;
CREATE TABLE `mail_virtual` ( CREATE TABLE `mail_virtual` (
`id` int(11) NOT NULL auto_increment, `id` int(11) NOT NULL auto_increment,
@@ -71,6 +93,7 @@ CREATE TABLE `mail_virtual` (
`customerid` int(11) NOT NULL default '0', `customerid` int(11) NOT NULL default '0',
`popaccountid` int(11) NOT NULL default '0', `popaccountid` int(11) NOT NULL default '0',
`iscatchall` tinyint(1) unsigned NOT NULL default '0', `iscatchall` tinyint(1) unsigned NOT NULL default '0',
`description` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `email` (`email`) KEY `email` (`email`)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -90,18 +113,17 @@ CREATE TABLE `panel_activation` (
DROP TABLE IF EXISTS `panel_admins`; DROP TABLE IF EXISTS `panel_admins`;
CREATE TABLE `panel_admins` ( CREATE TABLE `panel_admins` (
`adminid` int(11) unsigned NOT NULL auto_increment, `adminid` int(11) unsigned NOT NULL auto_increment,
`loginname` varchar(50) NOT NULL default '', `loginname` varchar(50) NOT NULL,
`password` varchar(255) NOT NULL default '', `password` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL default '', `name` varchar(255) NOT NULL default '',
`email` varchar(255) NOT NULL default '', `email` varchar(255) NOT NULL default '',
`def_language` varchar(255) NOT NULL default '', `def_language` varchar(100) NOT NULL default '',
`ip` varchar(500) NOT NULL default '-1', `ip` varchar(500) NOT NULL default '-1',
`customers` int(15) NOT NULL default '0', `customers` int(15) NOT NULL default '0',
`customers_used` int(15) NOT NULL default '0', `customers_used` int(15) NOT NULL default '0',
`customers_see_all` tinyint(1) NOT NULL default '0', `customers_see_all` tinyint(1) NOT NULL default '0',
`domains` int(15) NOT NULL default '0', `domains` int(15) NOT NULL default '0',
`domains_used` int(15) NOT NULL default '0', `domains_used` int(15) NOT NULL default '0',
`domains_see_all` tinyint(1) NOT NULL default '0',
`caneditphpsettings` tinyint(1) NOT NULL default '0', `caneditphpsettings` tinyint(1) NOT NULL default '0',
`change_serversettings` tinyint(1) NOT NULL default '0', `change_serversettings` tinyint(1) NOT NULL default '0',
`diskspace` int(15) NOT NULL default '0', `diskspace` int(15) NOT NULL default '0',
@@ -127,22 +149,21 @@ CREATE TABLE `panel_admins` (
`lastlogin_fail` int(11) unsigned NOT NULL default '0', `lastlogin_fail` int(11) unsigned NOT NULL default '0',
`loginfail_count` int(11) unsigned NOT NULL default '0', `loginfail_count` int(11) unsigned NOT NULL default '0',
`reportsent` tinyint(4) unsigned NOT NULL default '0', `reportsent` tinyint(4) unsigned NOT NULL default '0',
`theme` varchar(255) NOT NULL default 'Sparkle', `theme` varchar(50) NOT NULL default 'Froxlor',
`custom_notes` text, `custom_notes` text,
`custom_notes_show` tinyint(1) NOT NULL default '0', `custom_notes_show` tinyint(1) NOT NULL default '0',
`type_2fa` tinyint(1) NOT NULL default '0', `type_2fa` tinyint(1) NOT NULL default '0',
`data_2fa` varchar(500) NOT NULL default '', `data_2fa` varchar(25) NOT NULL default '',
`api_allowed` tinyint(1) NOT NULL default '1', `api_allowed` tinyint(1) NOT NULL default '1',
PRIMARY KEY (`adminid`), PRIMARY KEY (`adminid`),
UNIQUE KEY `loginname` (`loginname`) UNIQUE KEY `loginname` (`loginname`)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_customers`; DROP TABLE IF EXISTS `panel_customers`;
CREATE TABLE `panel_customers` ( CREATE TABLE `panel_customers` (
`customerid` int(11) unsigned NOT NULL auto_increment, `customerid` int(11) unsigned NOT NULL auto_increment,
`loginname` varchar(50) NOT NULL default '', `loginname` varchar(50) NOT NULL,
`password` varchar(255) NOT NULL default '', `password` varchar(255) NOT NULL default '',
`adminid` int(11) unsigned NOT NULL default '0', `adminid` int(11) unsigned NOT NULL default '0',
`name` varchar(255) NOT NULL default '', `name` varchar(255) NOT NULL default '',
@@ -150,13 +171,13 @@ CREATE TABLE `panel_customers` (
`gender` int(1) NOT NULL DEFAULT '0', `gender` int(1) NOT NULL DEFAULT '0',
`company` varchar(255) NOT NULL default '', `company` varchar(255) NOT NULL default '',
`street` varchar(255) NOT NULL default '', `street` varchar(255) NOT NULL default '',
`zipcode` varchar(255) NOT NULL default '', `zipcode` varchar(25) NOT NULL default '',
`city` varchar(255) NOT NULL default '', `city` varchar(255) NOT NULL default '',
`phone` varchar(255) NOT NULL default '', `phone` varchar(50) NOT NULL default '',
`fax` varchar(255) NOT NULL default '', `fax` varchar(50) NOT NULL default '',
`email` varchar(255) NOT NULL default '', `email` varchar(255) NOT NULL default '',
`customernumber` varchar(255) NOT NULL default '', `customernumber` varchar(100) NOT NULL default '',
`def_language` varchar(255) NOT NULL default '', `def_language` varchar(100) NOT NULL default '',
`diskspace` bigint(30) NOT NULL default '0', `diskspace` bigint(30) NOT NULL default '0',
`diskspace_used` bigint(30) NOT NULL default '0', `diskspace_used` bigint(30) NOT NULL default '0',
`mysqls` int(15) NOT NULL default '0', `mysqls` int(15) NOT NULL default '0',
@@ -190,24 +211,23 @@ CREATE TABLE `panel_customers` (
`imap` tinyint(1) NOT NULL default '1', `imap` tinyint(1) NOT NULL default '1',
`perlenabled` tinyint(1) NOT NULL default '0', `perlenabled` tinyint(1) NOT NULL default '0',
`dnsenabled` tinyint(1) NOT NULL default '0', `dnsenabled` tinyint(1) NOT NULL default '0',
`theme` varchar(255) NOT NULL default 'Sparkle', `theme` varchar(50) NOT NULL default 'Froxlor',
`custom_notes` text, `custom_notes` text,
`custom_notes_show` tinyint(1) NOT NULL default '0', `custom_notes_show` tinyint(1) NOT NULL default '0',
`lepublickey` mediumtext default NULL, `lepublickey` mediumtext default NULL,
`leprivatekey` mediumtext default NULL, `leprivatekey` mediumtext default NULL,
`leregistered` tinyint(1) NOT NULL default '0', `leregistered` tinyint(1) NOT NULL default '0',
`leaccount` varchar(255) default '', `allowed_phpconfigs` text NOT NULL,
`allowed_phpconfigs` varchar(500) NOT NULL default '',
`type_2fa` tinyint(1) NOT NULL default '0', `type_2fa` tinyint(1) NOT NULL default '0',
`data_2fa` varchar(500) NOT NULL default '', `data_2fa` varchar(25) NOT NULL default '',
`api_allowed` tinyint(1) NOT NULL default '1', `api_allowed` tinyint(1) NOT NULL default '1',
`logviewenabled` tinyint(1) NOT NULL default '0', `logviewenabled` tinyint(1) NOT NULL default '0',
`allowed_mysqlserver` text NOT NULL,
PRIMARY KEY (`customerid`), PRIMARY KEY (`customerid`),
UNIQUE KEY `loginname` (`loginname`) UNIQUE KEY `loginname` (`loginname`)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_databases`; DROP TABLE IF EXISTS `panel_databases`;
CREATE TABLE `panel_databases` ( CREATE TABLE `panel_databases` (
`id` int(11) unsigned NOT NULL auto_increment, `id` int(11) unsigned NOT NULL auto_increment,
@@ -220,11 +240,11 @@ CREATE TABLE `panel_databases` (
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_domains`; DROP TABLE IF EXISTS `panel_domains`;
CREATE TABLE `panel_domains` ( CREATE TABLE `panel_domains` (
`id` int(11) unsigned NOT NULL auto_increment, `id` int(11) unsigned NOT NULL auto_increment,
`domain` varchar(255) NOT NULL default '', `domain` varchar(255) NOT NULL,
`domain_ace` varchar(255) NOT NULL default '',
`adminid` int(11) unsigned NOT NULL default '0', `adminid` int(11) unsigned NOT NULL default '0',
`customerid` int(11) unsigned NOT NULL default '0', `customerid` int(11) unsigned NOT NULL default '0',
`aliasdomain` int(11) unsigned NULL, `aliasdomain` int(11) unsigned NULL,
@@ -248,6 +268,8 @@ CREATE TABLE `panel_domains` (
`speciallogfile` tinyint(1) NOT NULL default '0', `speciallogfile` tinyint(1) NOT NULL default '0',
`ssl_redirect` tinyint(4) NOT NULL default '0', `ssl_redirect` tinyint(4) NOT NULL default '0',
`specialsettings` text, `specialsettings` text,
`ssl_specialsettings` text,
`include_specialsettings` tinyint(1) NOT NULL default '0',
`deactivated` tinyint(1) NOT NULL default '0', `deactivated` tinyint(1) NOT NULL default '0',
`bindserial` varchar(10) NOT NULL default '2000010100', `bindserial` varchar(10) NOT NULL default '2000010100',
`add_date` int( 11 ) NOT NULL default '0', `add_date` int( 11 ) NOT NULL default '0',
@@ -266,6 +288,14 @@ CREATE TABLE `panel_domains` (
`notryfiles` tinyint(1) DEFAULT '0', `notryfiles` tinyint(1) DEFAULT '0',
`writeaccesslog` tinyint(1) DEFAULT '1', `writeaccesslog` tinyint(1) DEFAULT '1',
`writeerrorlog` tinyint(1) DEFAULT '1', `writeerrorlog` tinyint(1) DEFAULT '1',
`override_tls` tinyint(1) DEFAULT '0',
`ssl_protocols` varchar(255) NOT NULL DEFAULT '',
`ssl_cipher_list` varchar(500) NOT NULL DEFAULT '',
`tlsv13_cipher_list` varchar(500) NOT NULL DEFAULT '',
`ssl_enabled` tinyint(1) DEFAULT '1',
`ssl_honorcipherorder` tinyint(1) DEFAULT '0',
`ssl_sessiontickets` tinyint(1) DEFAULT '1',
`description` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `customerid` (`customerid`), KEY `customerid` (`customerid`),
KEY `parentdomain` (`parentdomainid`), KEY `parentdomain` (`parentdomainid`),
@@ -273,11 +303,10 @@ CREATE TABLE `panel_domains` (
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_ipsandports`; DROP TABLE IF EXISTS `panel_ipsandports`;
CREATE TABLE `panel_ipsandports` ( CREATE TABLE `panel_ipsandports` (
`id` int(11) unsigned NOT NULL auto_increment, `id` int(11) unsigned NOT NULL auto_increment,
`ip` varchar(39) NOT NULL default '', `ip` varchar(39) NOT NULL,
`port` int(5) NOT NULL default '80', `port` int(5) NOT NULL default '80',
`listen_statement` tinyint(1) NOT NULL default '0', `listen_statement` tinyint(1) NOT NULL default '0',
`namevirtualhost_statement` tinyint(1) NOT NULL default '0', `namevirtualhost_statement` tinyint(1) NOT NULL default '0',
@@ -291,12 +320,15 @@ CREATE TABLE `panel_ipsandports` (
`default_vhostconf_domain` text, `default_vhostconf_domain` text,
`ssl_cert_chainfile` varchar(255) NOT NULL default '', `ssl_cert_chainfile` varchar(255) NOT NULL default '',
`docroot` varchar(255) NOT NULL default '', `docroot` varchar(255) NOT NULL default '',
`ssl_specialsettings` text,
`include_specialsettings` tinyint(1) NOT NULL default '0',
`ssl_default_vhostconf_domain` text,
`include_default_vhostconf_domain` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `ip_port` (`ip`,`port`) UNIQUE KEY `ip_port` (`ip`,`port`)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_htaccess`; DROP TABLE IF EXISTS `panel_htaccess`;
CREATE TABLE `panel_htaccess` ( CREATE TABLE `panel_htaccess` (
`id` int(11) unsigned NOT NULL auto_increment, `id` int(11) unsigned NOT NULL auto_increment,
@@ -312,7 +344,6 @@ CREATE TABLE `panel_htaccess` (
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_htpasswds`; DROP TABLE IF EXISTS `panel_htpasswds`;
CREATE TABLE `panel_htpasswds` ( CREATE TABLE `panel_htpasswds` (
`id` int(11) unsigned NOT NULL auto_increment, `id` int(11) unsigned NOT NULL auto_increment,
@@ -326,7 +357,6 @@ CREATE TABLE `panel_htpasswds` (
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_sessions`; DROP TABLE IF EXISTS `panel_sessions`;
CREATE TABLE `panel_sessions` ( CREATE TABLE `panel_sessions` (
`hash` varchar(32) NOT NULL default '', `hash` varchar(32) NOT NULL default '',
@@ -344,7 +374,6 @@ CREATE TABLE `panel_sessions` (
) ENGINE=HEAP; ) ENGINE=HEAP;
DROP TABLE IF EXISTS `panel_settings`; DROP TABLE IF EXISTS `panel_settings`;
CREATE TABLE `panel_settings` ( CREATE TABLE `panel_settings` (
`settingid` int(11) unsigned NOT NULL auto_increment, `settingid` int(11) unsigned NOT NULL auto_increment,
@@ -373,7 +402,8 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('dkim', 'dkim_prefix', '/etc/postfix/dkim/'), ('dkim', 'dkim_prefix', '/etc/postfix/dkim/'),
('dkim', 'dkim_domains', 'domains'), ('dkim', 'dkim_domains', 'domains'),
('dkim', 'dkim_dkimkeys', 'dkim-keys.conf'), ('dkim', 'dkim_dkimkeys', 'dkim-keys.conf'),
('dkim', 'dkimrestart_command', '/etc/init.d/dkim-filter restart'), ('dkim', 'dkimrestart_command', 'service dkim-filter restart'),
('dkim', 'privkeysuffix', '.priv'),
('admin', 'show_news_feed', '0'), ('admin', 'show_news_feed', '0'),
('admin', 'show_version_login', '0'), ('admin', 'show_version_login', '0'),
('admin', 'show_version_footer', '0'), ('admin', 'show_version_footer', '0'),
@@ -479,7 +509,6 @@ opcache.load_comments
opcache.revalidate_path opcache.revalidate_path
opcache.save_comments opcache.save_comments
opcache.use_cwd opcache.use_cwd
opcache.validate_timestamps
opcache.fast_shutdown'), opcache.fast_shutdown'),
('phpfpm', 'ini_admin_values', 'cgi.redirect_status_env ('phpfpm', 'ini_admin_values', 'cgi.redirect_status_env
date.timezone date.timezone
@@ -503,22 +532,23 @@ opcache.restrict_api
opcache.revalidate_freq opcache.revalidate_freq
opcache.max_accelerated_files opcache.max_accelerated_files
opcache.memory_consumption opcache.memory_consumption
opcache.interned_strings_buffer'), opcache.interned_strings_buffer
opcache.validate_timestamps'),
('nginx', 'fastcgiparams', '/etc/nginx/fastcgi_params'), ('nginx', 'fastcgiparams', '/etc/nginx/fastcgi_params'),
('system', 'lastaccountnumber', '0'), ('system', 'lastaccountnumber', '0'),
('system', 'lastguid', '9999'), ('system', 'lastguid', '9999'),
('system', 'documentroot_prefix', '/var/customers/webs/'), ('system', 'documentroot_prefix', '/var/customers/webs/'),
('system', 'logfiles_directory', '/var/customers/logs/'), ('system', 'logfiles_directory', '/var/customers/logs/'),
('system', 'ipaddress', 'SERVERIP'), ('system', 'ipaddress', 'SERVERIP'),
('system', 'apachereload_command', '/etc/init.d/apache2 reload'), ('system', 'apachereload_command', 'service apache2 reload'),
('system', 'last_traffic_run', '000000'), ('system', 'last_traffic_run', '000000'),
('system', 'vmail_uid', '2000'), ('system', 'vmail_uid', '2000'),
('system', 'vmail_gid', '2000'), ('system', 'vmail_gid', '2000'),
('system', 'vmail_homedir', '/var/customers/mail/'), ('system', 'vmail_homedir', '/var/customers/mail/'),
('system', 'vmail_maildirname', 'Maildir'), ('system', 'vmail_maildirname', 'Maildir'),
('system', 'bind_enable', '1'), ('system', 'bind_enable', '0'),
('system', 'bindconf_directory', '/etc/bind/'), ('system', 'bindconf_directory', '/etc/bind/'),
('system', 'bindreload_command', '/etc/init.d/bind9 reload'), ('system', 'bindreload_command', 'service bind9 reload'),
('system', 'hostname', 'SERVERNAME'), ('system', 'hostname', 'SERVERNAME'),
('system', 'mysql_access_host', 'localhost'), ('system', 'mysql_access_host', 'localhost'),
('system', 'lastcronrun', ''), ('system', 'lastcronrun', ''),
@@ -538,13 +568,12 @@ opcache.interned_strings_buffer'),
('system', 'last_archive_run', '000000'), ('system', 'last_archive_run', '000000'),
('system', 'mod_fcgid_configdir', '/var/www/php-fcgi-scripts'), ('system', 'mod_fcgid_configdir', '/var/www/php-fcgi-scripts'),
('system', 'mod_fcgid_tmpdir', '/var/customers/tmp'), ('system', 'mod_fcgid_tmpdir', '/var/customers/tmp'),
('system', 'ssl_cert_file', '/etc/apache2/apache2.pem'), ('system', 'ssl_cert_file', '/etc/ssl/froxlor_selfsigned.pem'),
('system', 'use_ssl', '0'), ('system', 'use_ssl', '0'),
('system', 'default_vhostconf', ''), ('system', 'default_vhostconf', ''),
('system', 'default_sslvhostconf', ''),
('system', 'mail_quota_enabled', '0'), ('system', 'mail_quota_enabled', '0'),
('system', 'mail_quota', '100'), ('system', 'mail_quota', '100'),
('system', 'webalizer_enabled', '1'),
('system', 'awstats_enabled', '0'),
('system', 'httpuser', 'www-data'), ('system', 'httpuser', 'www-data'),
('system', 'httpgroup', 'www-data'), ('system', 'httpgroup', 'www-data'),
('system', 'webserver', 'apache2'), ('system', 'webserver', 'apache2'),
@@ -553,19 +582,20 @@ opcache.interned_strings_buffer'),
('system', 'mod_fcgid_peardir', '/usr/share/php/:/usr/share/php5/'), ('system', 'mod_fcgid_peardir', '/usr/share/php/:/usr/share/php5/'),
('system', 'index_file_extension', 'html'), ('system', 'index_file_extension', 'html'),
('system', 'mod_fcgid_maxrequests', '250'), ('system', 'mod_fcgid_maxrequests', '250'),
('system', 'ssl_key_file','/etc/apache2/apache2.key'), ('system', 'ssl_key_file','/etc/ssl/froxlor_selfsigned.key'),
('system', 'ssl_ca_file', ''), ('system', 'ssl_ca_file', ''),
('system', 'debug_cron', '0'), ('system', 'debug_cron', '0'),
('system', 'store_index_file_subs', '1'), ('system', 'store_index_file_subs', '1'),
('system', 'stdsubdomain', ''), ('system', 'stdsubdomain', ''),
('system', 'awstats_path', '/usr/bin/'), ('system', 'awstats_path', '/usr/share/awstats/tools/'),
('system', 'awstats_conf', '/etc/awstats/'), ('system', 'awstats_conf', '/etc/awstats/'),
('system', 'awstats_logformat', '1'),
('system', 'defaultttl', '604800'), ('system', 'defaultttl', '604800'),
('system', 'mod_fcgid_defaultini', '1'), ('system', 'mod_fcgid_defaultini', '1'),
('system', 'ftpserver', 'proftpd'), ('system', 'ftpserver', 'proftpd'),
('system', 'dns_createmailentry', '0'), ('system', 'dns_createmailentry', '0'),
('system', 'dns_createcaaentry', '1'), ('system', 'dns_createcaaentry', '1'),
('system', 'froxlordirectlyviahostname', '0'), ('system', 'froxlordirectlyviahostname', '1'),
('system', 'report_enable', '1'), ('system', 'report_enable', '1'),
('system', 'report_webmax', '90'), ('system', 'report_webmax', '90'),
('system', 'report_trafficmax', '90'), ('system', 'report_trafficmax', '90'),
@@ -579,7 +609,7 @@ opcache.interned_strings_buffer'),
('system', 'mod_fcgid_ownvhost', '0'), ('system', 'mod_fcgid_ownvhost', '0'),
('system', 'mod_fcgid_httpuser', 'froxlorlocal'), ('system', 'mod_fcgid_httpuser', 'froxlorlocal'),
('system', 'mod_fcgid_httpgroup', 'froxlorlocal'), ('system', 'mod_fcgid_httpgroup', 'froxlorlocal'),
('system', 'awstats_awstatspath', '/usr/bin/'), ('system', 'awstats_awstatspath', '/usr/lib/cgi-bin/'),
('system', 'mod_fcgid_defaultini_ownvhost', '2'), ('system', 'mod_fcgid_defaultini_ownvhost', '2'),
('system', 'awstats_icons', '/usr/share/awstats/icon/'), ('system', 'awstats_icons', '/usr/share/awstats/icon/'),
('system', 'ssl_cert_chainfile', ''), ('system', 'ssl_cert_chainfile', ''),
@@ -591,8 +621,9 @@ opcache.interned_strings_buffer'),
('system', 'apache24', '1'), ('system', 'apache24', '1'),
('system', 'apache24_ocsp_cache_path', 'shmcb:/var/run/apache2/ocsp-stapling.cache(131072)'), ('system', 'apache24_ocsp_cache_path', 'shmcb:/var/run/apache2/ocsp-stapling.cache(131072)'),
('system', 'documentroot_use_default_value', '0'), ('system', 'documentroot_use_default_value', '0'),
('system', 'passwordcryptfunc', '3'), ('system', 'passwordcryptfunc', '2y'),
('system', 'axfrservers', ''), ('system', 'axfrservers', ''),
('system', 'powerdns_mode', 'Native'),
('system', 'customer_ssl_path', '/etc/ssl/froxlor-custom/'), ('system', 'customer_ssl_path', '/etc/ssl/froxlor-custom/'),
('system', 'allow_error_report_admin', '1'), ('system', 'allow_error_report_admin', '1'),
('system', 'allow_error_report_customer', '0'), ('system', 'allow_error_report_customer', '0'),
@@ -602,7 +633,7 @@ opcache.interned_strings_buffer'),
('system', 'mtaserver', 'postfix'), ('system', 'mtaserver', 'postfix'),
('system', 'mailtraffic_enabled', '1'), ('system', 'mailtraffic_enabled', '1'),
('system', 'cronconfig', '/etc/cron.d/froxlor'), ('system', 'cronconfig', '/etc/cron.d/froxlor'),
('system', 'crondreload', '/etc/init.d/cron reload'), ('system', 'crondreload', 'service cron reload'),
('system', 'croncmdline', '/usr/bin/nice -n 5 /usr/bin/php -q'), ('system', 'croncmdline', '/usr/bin/nice -n 5 /usr/bin/php -q'),
('system', 'cron_allowautoupdate', '0'), ('system', 'cron_allowautoupdate', '0'),
('system', 'dns_createhostnameentry', '0'), ('system', 'dns_createhostnameentry', '0'),
@@ -610,9 +641,7 @@ opcache.interned_strings_buffer'),
('system', 'apacheitksupport', '0'), ('system', 'apacheitksupport', '0'),
('system', 'leprivatekey', 'unset'), ('system', 'leprivatekey', 'unset'),
('system', 'lepublickey', 'unset'), ('system', 'lepublickey', 'unset'),
('system', 'letsencryptca', 'production'), ('system', 'letsencryptca', 'letsencrypt'),
('system', 'letsencryptcountrycode', 'DE'),
('system', 'letsencryptstate', 'Hessen'),
('system', 'letsencryptchallengepath', '/var/www/froxlor'), ('system', 'letsencryptchallengepath', '/var/www/froxlor'),
('system', 'letsencryptkeysize', '4096'), ('system', 'letsencryptkeysize', '4096'),
('system', 'letsencryptreuseold', 0), ('system', 'letsencryptreuseold', 0),
@@ -634,15 +663,18 @@ opcache.interned_strings_buffer'),
('system', 'mail_smtp_auth', '1'), ('system', 'mail_smtp_auth', '1'),
('system', 'mail_smtp_user', ''), ('system', 'mail_smtp_user', ''),
('system', 'mail_smtp_passwd', ''), ('system', 'mail_smtp_passwd', ''),
('system', 'hsts_maxage', '0'), ('system', 'hsts_maxage', '10368000'),
('system', 'hsts_incsub', '0'), ('system', 'hsts_incsub', '0'),
('system', 'hsts_preload', '0'), ('system', 'hsts_preload', '0'),
('system', 'leregistered', '0'), ('system', 'leregistered', '0'),
('system', 'leaccount', ''), ('system', 'leaccount', ''),
('system', 'nssextrausers', '0'), ('system', 'nssextrausers', '1'),
('system', 'disable_le_selfcheck', '0'), ('system', 'le_domain_dnscheck', '1'),
('system', 'ssl_protocols', 'TLSv1,TLSv1.2'), ('system', 'ssl_protocols', 'TLSv1.2'),
('system', 'tlsv13_cipher_list', ''), ('system', 'tlsv13_cipher_list', ''),
('system', 'honorcipherorder', '0'),
('system', 'sessiontickets', '1'),
('system', 'sessionticketsenabled', '1'),
('system', 'logfiles_format', ''), ('system', 'logfiles_format', ''),
('system', 'logfiles_type', '1'), ('system', 'logfiles_type', '1'),
('system', 'logfiles_piped', '0'), ('system', 'logfiles_piped', '0'),
@@ -651,6 +683,21 @@ opcache.interned_strings_buffer'),
('system', 'errorlog_level', 'warn'), ('system', 'errorlog_level', 'warn'),
('system', 'leecc', '0'), ('system', 'leecc', '0'),
('system', 'froxloraliases', ''), ('system', 'froxloraliases', ''),
('system', 'apply_specialsettings_default', '1'),
('system', 'apply_phpconfigs_default', '1'),
('system', 'hide_incompatible_settings', '1'),
('system', 'include_default_vhostconf', '0'),
('system', 'soaemail', ''),
('system', 'domaindefaultalias', '0'),
('system', 'createstdsubdom_default', '1'),
('system', 'froxlorusergroup', ''),
('system', 'froxlorusergroup_gid', ''),
('system', 'acmeshpath', '/root/.acme.sh/acme.sh'),
('system', 'distribution', ''),
('system', 'update_channel', 'stable'),
('system', 'updatecheck_data', ''),
('system', 'update_notify_last', '2.0.1'),
('system', 'traffictool', 'goaccess'),
('api', 'enabled', '0'), ('api', 'enabled', '0'),
('2fa', 'enabled', '1'), ('2fa', 'enabled', '1'),
('panel', 'decimal_places', '4'), ('panel', 'decimal_places', '4'),
@@ -658,16 +705,15 @@ opcache.interned_strings_buffer'),
('panel', 'phpmyadmin_url', ''), ('panel', 'phpmyadmin_url', ''),
('panel', 'webmail_url', ''), ('panel', 'webmail_url', ''),
('panel', 'webftp_url', ''), ('panel', 'webftp_url', ''),
('panel', 'standardlanguage', 'English'), ('panel', 'standardlanguage', 'en'),
('panel', 'pathedit', 'Manual'), ('panel', 'pathedit', 'Manual'),
('panel', 'paging', '20'), ('panel', 'paging', '20'),
('panel', 'natsorting', '1'), ('panel', 'natsorting', '1'),
('panel', 'sendalternativemail', '0'), ('panel', 'sendalternativemail', '0'),
('panel', 'no_robots', '1'),
('panel', 'allow_domain_change_admin', '0'), ('panel', 'allow_domain_change_admin', '0'),
('panel', 'allow_domain_change_customer', '0'), ('panel', 'allow_domain_change_customer', '0'),
('panel', 'frontend', 'froxlor'), ('panel', 'frontend', 'froxlor'),
('panel', 'default_theme', 'Sparkle'), ('panel', 'default_theme', 'Froxlor'),
('panel', 'password_min_length', '0'), ('panel', 'password_min_length', '0'),
('panel', 'adminmail_defname', 'Froxlor Administrator'), ('panel', 'adminmail_defname', 'Froxlor Administrator'),
('panel', 'adminmail_return', ''), ('panel', 'adminmail_return', ''),
@@ -676,6 +722,7 @@ opcache.interned_strings_buffer'),
('panel', 'allow_preset_admin', '0'), ('panel', 'allow_preset_admin', '0'),
('panel', 'password_regex', ''), ('panel', 'password_regex', ''),
('panel', 'phpconfigs_hidestdsubdomain', '0'), ('panel', 'phpconfigs_hidestdsubdomain', '0'),
('panel', 'phpconfigs_hidesubdomains', '1'),
('panel', 'allow_theme_change_admin', '1'), ('panel', 'allow_theme_change_admin', '1'),
('panel', 'allow_theme_change_customer', '1'), ('panel', 'allow_theme_change_customer', '1'),
('panel', 'password_alpha_lower', '1'), ('panel', 'password_alpha_lower', '1'),
@@ -685,8 +732,16 @@ opcache.interned_strings_buffer'),
('panel', 'password_special_char', '!?<>§$%+#=@'), ('panel', 'password_special_char', '!?<>§$%+#=@'),
('panel', 'customer_hide_options', ''), ('panel', 'customer_hide_options', ''),
('panel', 'is_configured', '0'), ('panel', 'is_configured', '0'),
('panel', 'version', '0.10.1'), ('panel', 'imprint_url', ''),
('panel', 'db_version', '201910090'); ('panel', 'terms_url', ''),
('panel', 'privacy_url', ''),
('panel', 'logo_image_header', ''),
('panel', 'logo_image_login', ''),
('panel', 'logo_overridetheme', '0'),
('panel', 'logo_overridecustom', '0'),
('panel', 'settings_mode', '0'),
('panel', 'version', '2.0.1'),
('panel', 'db_version', '202212060');
DROP TABLE IF EXISTS `panel_tasks`; DROP TABLE IF EXISTS `panel_tasks`;
@@ -697,6 +752,7 @@ CREATE TABLE `panel_tasks` (
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
INSERT INTO `panel_tasks` (`type`) VALUES ('99'); INSERT INTO `panel_tasks` (`type`) VALUES ('99');
@@ -713,7 +769,6 @@ CREATE TABLE `panel_templates` (
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_traffic`; DROP TABLE IF EXISTS `panel_traffic`;
CREATE TABLE `panel_traffic` ( CREATE TABLE `panel_traffic` (
`id` int(11) unsigned NOT NULL auto_increment, `id` int(11) unsigned NOT NULL auto_increment,
@@ -731,7 +786,6 @@ CREATE TABLE `panel_traffic` (
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_traffic_admins`; DROP TABLE IF EXISTS `panel_traffic_admins`;
CREATE TABLE `panel_traffic_admins` ( CREATE TABLE `panel_traffic_admins` (
`id` int(11) unsigned NOT NULL auto_increment, `id` int(11) unsigned NOT NULL auto_increment,
@@ -749,7 +803,6 @@ CREATE TABLE `panel_traffic_admins` (
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_diskspace`; DROP TABLE IF EXISTS `panel_diskspace`;
CREATE TABLE `panel_diskspace` ( CREATE TABLE `panel_diskspace` (
`id` int(11) unsigned NOT NULL auto_increment, `id` int(11) unsigned NOT NULL auto_increment,
@@ -766,45 +819,6 @@ CREATE TABLE `panel_diskspace` (
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_diskspace_admins`;
CREATE TABLE `panel_diskspace_admins` (
`id` int(11) unsigned NOT NULL auto_increment,
`adminid` int(11) unsigned NOT NULL default '0',
`year` int(4) unsigned zerofill NOT NULL default '0000',
`month` int(2) unsigned zerofill NOT NULL default '00',
`day` int(2) unsigned zerofill NOT NULL default '00',
`stamp` int(11) unsigned NOT NULL default '0',
`webspace` bigint(30) unsigned NOT NULL default '0',
`mail` bigint(30) unsigned NOT NULL default '0',
`mysql` bigint(30) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `adminid` (`adminid`)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_languages`;
CREATE TABLE `panel_languages` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`language` varchar(30) NOT NULL DEFAULT '',
`iso` char(3) NOT NULL DEFAULT 'foo',
`file` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
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&ccedil;ais', 'fr', 'lng/french.lng.php'),
(4, 'Portugu&ecirc;s', 'pt', 'lng/portugues.lng.php'),
(5, 'Italiano', 'it', 'lng/italian.lng.php'),
(6, 'Nederlands', 'nl', 'lng/dutch.lng.php'),
(7, 'Svenska', 'sv', 'lng/swedish.lng.php');
DROP TABLE IF EXISTS `panel_syslog`; DROP TABLE IF EXISTS `panel_syslog`;
CREATE TABLE IF NOT EXISTS `panel_syslog` ( CREATE TABLE IF NOT EXISTS `panel_syslog` (
`logid` bigint(20) NOT NULL auto_increment, `logid` bigint(20) NOT NULL auto_increment,
@@ -817,31 +831,29 @@ CREATE TABLE IF NOT EXISTS `panel_syslog` (
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_fpmdaemons`; DROP TABLE IF EXISTS `panel_fpmdaemons`;
CREATE TABLE `panel_fpmdaemons` ( CREATE TABLE `panel_fpmdaemons` (
`id` int(11) unsigned NOT NULL auto_increment, `id` int(11) unsigned NOT NULL auto_increment,
`description` varchar(50) NOT NULL, `description` varchar(50) NOT NULL,
`reload_cmd` varchar(255) NOT NULL, `reload_cmd` varchar(255) NOT NULL,
`config_dir` varchar(255) NOT NULL, `config_dir` varchar(255) NOT NULL,
`pm` varchar(15) NOT NULL DEFAULT 'static', `pm` varchar(15) NOT NULL DEFAULT 'dynamic',
`max_children` int(4) NOT NULL DEFAULT '1', `max_children` int(4) NOT NULL DEFAULT '5',
`start_servers` int(4) NOT NULL DEFAULT '20', `start_servers` int(4) NOT NULL DEFAULT '2',
`min_spare_servers` int(4) NOT NULL DEFAULT '5', `min_spare_servers` int(4) NOT NULL DEFAULT '1',
`max_spare_servers` int(4) NOT NULL DEFAULT '35', `max_spare_servers` int(4) NOT NULL DEFAULT '3',
`max_requests` int(4) NOT NULL DEFAULT '0', `max_requests` int(4) NOT NULL DEFAULT '0',
`idle_timeout` int(4) NOT NULL DEFAULT '30', `idle_timeout` int(4) NOT NULL DEFAULT '10',
`limit_extensions` varchar(255) NOT NULL default '.php', `limit_extensions` varchar(255) NOT NULL default '.php',
`custom_config` text,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `reload` (`reload_cmd`), UNIQUE KEY `reload` (`reload_cmd`),
UNIQUE KEY `config` (`config_dir`) UNIQUE KEY `config` (`config_dir`)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
INSERT INTO `panel_fpmdaemons` (`id`, `description`, `reload_cmd`, `config_dir`) VALUES INSERT INTO `panel_fpmdaemons` (`id`, `description`, `reload_cmd`, `config_dir`) VALUES
(1, 'System default', 'service php7.0-fpm restart', '/etc/php/7.0/fpm/pool.d/'); (1, 'System default', 'service php7.4-fpm restart', '/etc/php/7.4/fpm/pool.d/');
DROP TABLE IF EXISTS `panel_phpconfigs`; DROP TABLE IF EXISTS `panel_phpconfigs`;
@@ -860,23 +872,22 @@ CREATE TABLE `panel_phpconfigs` (
`fpmsettingid` int(11) NOT NULL DEFAULT '1', `fpmsettingid` int(11) NOT NULL DEFAULT '1',
`pass_authorizationheader` tinyint(1) NOT NULL default '0', `pass_authorizationheader` tinyint(1) NOT NULL default '0',
`override_fpmconfig` tinyint(1) NOT NULL DEFAULT '0', `override_fpmconfig` tinyint(1) NOT NULL DEFAULT '0',
`pm` varchar(15) NOT NULL DEFAULT 'static', `pm` varchar(15) NOT NULL DEFAULT 'dynamic',
`max_children` int(4) NOT NULL DEFAULT '1', `max_children` int(4) NOT NULL DEFAULT '5',
`start_servers` int(4) NOT NULL DEFAULT '20', `start_servers` int(4) NOT NULL DEFAULT '2',
`min_spare_servers` int(4) NOT NULL DEFAULT '5', `min_spare_servers` int(4) NOT NULL DEFAULT '1',
`max_spare_servers` int(4) NOT NULL DEFAULT '35', `max_spare_servers` int(4) NOT NULL DEFAULT '3',
`max_requests` int(4) NOT NULL DEFAULT '0', `max_requests` int(4) NOT NULL DEFAULT '0',
`idle_timeout` int(4) NOT NULL DEFAULT '30', `idle_timeout` int(4) NOT NULL DEFAULT '10',
`limit_extensions` varchar(255) NOT NULL default '.php', `limit_extensions` varchar(255) NOT NULL default '.php',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `fpmsettingid` (`fpmsettingid`) KEY `fpmsettingid` (`fpmsettingid`)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
INSERT INTO `panel_phpconfigs` (`id`, `description`, `binary`, `file_extensions`, `mod_fcgid_starter`, `mod_fcgid_maxrequests`, `pass_authorizationheader`, `phpsettings`) VALUES
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', '1', 'allow_url_fopen = Off\r\nallow_url_include = Off\r\nauto_append_file =\r\nauto_globals_jit = On\r\nauto_prepend_file =\r\nbcmath.scale = 0\r\ncli_server.color = On\r\ndefault_charset = "UTF-8"\r\ndefault_mimetype = "text/html"\r\ndefault_socket_timeout = 60\r\nasp_tags = Off\r\ndisable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,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\ndoc_root =\r\nenable_dl = Off\r\nerror_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE\r\nexpose_php = Off\r\nfile_uploads = On\r\nhtml_errors = On\r\nignore_repeated_errors = Off\r\nignore_repeated_source = Off\r\ninclude_path = ".:{PEAR_DIR}"\r\nimplicit_flush = Off\r\nldap.max_links = -1\r\nlog_errors = On\r\nlog_errors_max_len = 1024\r\nmail.add_x_header = Off\r\nmax_execution_time = 30\r\nmax_file_uploads = 20\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\nreport_memleaks = On\r\nrequest_order = "GP"\r\nsendmail_path = "/usr/sbin/sendmail -t -i -f {CUSTOMER_EMAIL}"\r\nserialize_precision = -1\r\nsession.auto_start = 0\r\nsession.cache_expire = 180\r\nsession.cache_limiter = nocache\r\nsession.cookie_domain =\r\nsession.cookie_httponly =\r\nsession.cookie_lifetime = 0\r\nsession.cookie_path = /\r\nsession.cookie_samesite =\r\nsession.gc_divisor = 1000\r\nsession.gc_maxlifetime = 1440\r\nsession.gc_probability = 0\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.sid_bits_per_character = 5\r\nsession.sid_length = 26\r\nsession.trans_sid_tags = "a=href,area=href,frame=src,form="\r\nsession.use_cookies = 1\r\nsession.use_only_cookies = 1\r\nsession.use_strict_mode = 0\r\nsession.use_trans_sid = 0\r\nshort_open_tag = On\r\nupload_max_filesize = 32M\r\nupload_tmp_dir = "{TMP_DIR}"\r\nvariables_order = "GPCS"\r\nopcache.restrict_api = "{DOCUMENT_ROOT}"\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', '1', 'allow_url_fopen = On\r\nallow_url_include = Off\r\nauto_append_file =\r\nauto_globals_jit = On\r\nauto_prepend_file =\r\nbcmath.scale = 0\r\ncli_server.color = On\r\ndefault_charset = "UTF-8"\r\ndefault_mimetype = "text/html"\r\ndefault_socket_timeout = 60\r\nasp_tags = Off\r\ndisable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,curl_multi_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\ndoc_root =\r\nenable_dl = Off\r\nerror_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE\r\nexpose_php = Off\r\nfile_uploads = On\r\nhtml_errors = On\r\nignore_repeated_errors = Off\r\nignore_repeated_source = Off\r\ninclude_path = ".:{PEAR_DIR}"\r\nimplicit_flush = Off\r\nldap.max_links = -1\r\nlog_errors = On\r\nlog_errors_max_len = 1024\r\nmail.add_x_header = Off\r\nmax_execution_time = 60\r\nmax_file_uploads = 20\r\nmax_input_time = 60\r\nmemory_limit = 128M\r\noutput_buffering = 4096\r\npost_max_size = 16M\r\nprecision = 14\r\nregister_argc_argv = Off\r\nreport_memleaks = On\r\nrequest_order = "GP"\r\nsendmail_path = "/usr/sbin/sendmail -t -i -f {CUSTOMER_EMAIL}"\r\nserialize_precision = -1\r\nsession.auto_start = 0\r\nsession.cache_expire = 180\r\nsession.cache_limiter = nocache\r\nsession.cookie_domain =\r\nsession.cookie_httponly =\r\nsession.cookie_lifetime = 0\r\nsession.cookie_path = /\r\nsession.cookie_samesite =\r\nsession.gc_divisor = 1000\r\nsession.gc_maxlifetime = 1440\r\nsession.gc_probability = 0\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.sid_bits_per_character = 5\r\nsession.sid_length = 26\r\nsession.trans_sid_tags = "a=href,area=href,frame=src,form="\r\nsession.use_cookies = 1\r\nsession.use_only_cookies = 1\r\nsession.use_strict_mode = 0\r\nsession.use_trans_sid = 0\r\nshort_open_tag = On\r\nupload_max_filesize = 32M\r\nupload_tmp_dir = "{TMP_DIR}"\r\nvariables_order = "GPCS"\r\nopcache.restrict_api = ""\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,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\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 = ""\r\n');
DROP TABLE IF EXISTS `cronjobs_run`; DROP TABLE IF EXISTS `cronjobs_run`;
@@ -899,13 +910,12 @@ INSERT INTO `cronjobs_run` (`id`, `module`, `cronfile`, `cronclass`, `interval`,
(3, 'froxlor/reports', 'usage_report', '\\Froxlor\\Cron\\Traffic\\ReportsCron', '1 DAY', '1', 'cron_usage_report'), (3, 'froxlor/reports', 'usage_report', '\\Froxlor\\Cron\\Traffic\\ReportsCron', '1 DAY', '1', 'cron_usage_report'),
(4, 'froxlor/core', 'mailboxsize', '\\Froxlor\\Cron\\System\\MailboxsizeCron', '6 HOUR', '1', 'cron_mailboxsize'), (4, 'froxlor/core', 'mailboxsize', '\\Froxlor\\Cron\\System\\MailboxsizeCron', '6 HOUR', '1', 'cron_mailboxsize'),
(5, 'froxlor/letsencrypt', 'letsencrypt', '\\Froxlor\\Cron\\Http\\LetsEncrypt\\AcmeSh', '5 MINUTE', '0', 'cron_letsencrypt'), (5, 'froxlor/letsencrypt', 'letsencrypt', '\\Froxlor\\Cron\\Http\\LetsEncrypt\\AcmeSh', '5 MINUTE', '0', 'cron_letsencrypt'),
(6, 'froxlor/backup', 'backup', '\\Froxlor\\Cron\\System\\BackupCron', '1 DAY', '1', 'cron_backup'); (6, 'froxlor/backup', 'backup', '\\Froxlor\\Cron\\System\\BackupCron', '1 DAY', '0', 'cron_backup');
DROP TABLE IF EXISTS `ftp_quotalimits`; DROP TABLE IF EXISTS `ftp_quotalimits`;
CREATE TABLE IF NOT EXISTS `ftp_quotalimits` ( CREATE TABLE IF NOT EXISTS `ftp_quotalimits` (
`name` varchar(30) default NULL, `name` varchar(255) default NULL,
`quota_type` enum('user','group','class','all') NOT NULL default 'user', `quota_type` enum('user','group','class','all') NOT NULL default 'user',
`per_session` enum('false','true') NOT NULL default 'false', `per_session` enum('false','true') NOT NULL default 'false',
`limit_type` enum('soft','hard') NOT NULL default 'hard', `limit_type` enum('soft','hard') NOT NULL default 'hard',
@@ -918,15 +928,13 @@ CREATE TABLE IF NOT EXISTS `ftp_quotalimits` (
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
INSERT INTO `ftp_quotalimits` (`name`, `quota_type`, `per_session`, `limit_type`, `bytes_in_avail`, `bytes_out_avail`, `bytes_xfer_avail`, `files_in_avail`, `files_out_avail`, `files_xfer_avail`) VALUES INSERT INTO `ftp_quotalimits` (`name`, `quota_type`, `per_session`, `limit_type`, `bytes_in_avail`, `bytes_out_avail`, `bytes_xfer_avail`, `files_in_avail`, `files_out_avail`, `files_xfer_avail`) VALUES
('froxlor', 'user', 'false', 'hard', 0, 0, 0, 0, 0, 0); ('froxlor', 'user', 'false', 'hard', 0, 0, 0, 0, 0, 0);
DROP TABLE IF EXISTS `ftp_quotatallies`; DROP TABLE IF EXISTS `ftp_quotatallies`;
CREATE TABLE IF NOT EXISTS `ftp_quotatallies` ( CREATE TABLE IF NOT EXISTS `ftp_quotatallies` (
`name` varchar(30) NOT NULL, `name` varchar(255) NOT NULL,
`quota_type` enum('user','group','class','all') NOT NULL, `quota_type` enum('user','group','class','all') NOT NULL,
`bytes_in_used` float NOT NULL, `bytes_in_used` float NOT NULL,
`bytes_out_used` float NOT NULL, `bytes_out_used` float NOT NULL,
@@ -937,7 +945,6 @@ CREATE TABLE IF NOT EXISTS `ftp_quotatallies` (
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `redirect_codes`; DROP TABLE IF EXISTS `redirect_codes`;
CREATE TABLE IF NOT EXISTS `redirect_codes` ( CREATE TABLE IF NOT EXISTS `redirect_codes` (
`id` int(5) NOT NULL auto_increment, `id` int(5) NOT NULL auto_increment,
@@ -948,7 +955,6 @@ CREATE TABLE IF NOT EXISTS `redirect_codes` (
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
INSERT INTO `redirect_codes` (`id`, `code`, `desc`, `enabled`) VALUES INSERT INTO `redirect_codes` (`id`, `code`, `desc`, `enabled`) VALUES
(1, '---', 'rc_default', 1), (1, '---', 'rc_default', 1),
(2, '301', 'rc_movedperm', 1), (2, '301', 'rc_movedperm', 1),
@@ -957,7 +963,6 @@ INSERT INTO `redirect_codes` (`id`, `code`, `desc`, `enabled`) VALUES
(5, '307', 'rc_tempred', 1); (5, '307', 'rc_tempred', 1);
DROP TABLE IF EXISTS `domain_redirect_codes`; DROP TABLE IF EXISTS `domain_redirect_codes`;
CREATE TABLE IF NOT EXISTS `domain_redirect_codes` ( CREATE TABLE IF NOT EXISTS `domain_redirect_codes` (
`rid` int(5) NOT NULL, `rid` int(5) NOT NULL,
@@ -977,7 +982,8 @@ CREATE TABLE IF NOT EXISTS `domain_ssl_settings` (
`ssl_csr_file` mediumtext, `ssl_csr_file` mediumtext,
`ssl_fullchain_file` mediumtext, `ssl_fullchain_file` mediumtext,
`expirationdate` datetime DEFAULT NULL, `expirationdate` datetime DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`),
UNIQUE KEY (`domainid`)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -1029,3 +1035,15 @@ CREATE TABLE `api_keys` (
KEY customerid (customerid) KEY customerid (customerid)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_usercolumns`;
CREATE TABLE `panel_usercolumns` (
`adminid` int(11) NOT NULL default '0',
`customerid` int(11) NOT NULL default '0',
`section` varchar(500) NOT NULL default '',
`columns` text NOT NULL,
UNIQUE KEY `user_section` (`adminid`, `customerid`, `section`),
KEY adminid (adminid),
KEY customerid (customerid)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
FROXLORSQL;

0
install/index.html Normal file
View File

View File

@@ -4,27 +4,64 @@
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * This program is free software; you can redistribute it and/or
* file that was distributed with this source code. You can also view the * modify it under the terms of the GNU General Public License
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* @copyright (c) the authors * This program is distributed in the hope that it will be useful,
* @author Michael Kaufmann <mkaufmann@nutime.de> * but WITHOUT ANY WARRANTY; without even the implied warranty of
* @author Froxlor team <team@froxlor.org> (2010-) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * GNU General Public License for more details.
* @package Install
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, you can also view it online at
* https://files.froxlor.org/misc/COPYING.txt
*
* @copyright the authors
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/ */
if (! file_exists(dirname(__DIR__) . '/vendor/autoload.php')) {
// get hint-template
$vendor_hint = file_get_contents(dirname(__DIR__) . '/templates/Sparkle/misc/vendormissinghint.tpl');
// replace values
$vendor_hint = str_replace("<FROXLOR_INSTALL_DIR>", dirname(__DIR__), $vendor_hint);
$vendor_hint = str_replace("<CURRENT_YEAR>", date('Y', time()), $vendor_hint);
die($vendor_hint);
}
require dirname(__DIR__) . '/vendor/autoload.php';
require __DIR__ . '/lib/class.FroxlorInstall.php';
$frxinstall = new FroxlorInstall(); use Froxlor\UI\Panel\UI;
$frxinstall->run(); use Froxlor\Install\Install;
require dirname(__DIR__) . '/lib/functions.php';
// define default theme for configurehint, etc.
$_deftheme = 'Froxlor';
// validate correct php version
if (version_compare("7.4.0", PHP_VERSION, ">=")) {
die(view($_deftheme . '/misc/phprequirementfailed.html.twig', [
'{{ basehref }}' => '../',
'{{ froxlor_min_version }}' => '7.4.0',
'{{ current_version }}' => PHP_VERSION,
'{{ current_year }}' => date('Y', time()),
]));
}
// validate vendor autoloader
if (!file_exists(dirname(__DIR__) . '/vendor/autoload.php')) {
die(view($_deftheme . '/misc/vendormissinghint.html.twig', [
'{{ basehref }}' => '../',
'{{ froxlor_install_dir }}' => dirname(__DIR__),
'{{ current_year }}' => date('Y', time()),
]));
}
// check installation status
if (file_exists(dirname(__DIR__) . '/lib/userdata.inc.php')) {
header("Location: ../");
exit;
}
require dirname(__DIR__) . '/vendor/autoload.php';
require dirname(__DIR__) . '/lib/tables.inc.php';
// init twig
UI::initTwig(true);
UI::sendHeaders();
$installer = new Install();
$installer->handle();

File diff suppressed because it is too large Load Diff

View File

@@ -1,89 +0,0 @@
<?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 Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Functions
*
*/
/**
* Function showUpdateStep
*
* outputs and logs the current
* update progress
*
* @param
* string task/status
* @param
* bool needs_status (if false, a linebreak will be added)
*
* @return string formatted output and log-entry
*/
function showUpdateStep($task = null, $needs_status = true)
{
if (! $needs_status)
echo "<b>";
// output
echo $task;
if (! $needs_status) {
echo "</b><br />";
}
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, $task);
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, $task);
}
/**
* Function lastStepStatus
*
* outputs [OK] (success), [??] (warning) or [!!] (failure)
* of the last update-step
*
* @param
* int status (0 = success, 1 = warning, 2 = failure)
*
* @return string formatted output and log-entry
*/
function lastStepStatus($status = -1, $message = '')
{
switch ($status) {
case 0:
$status_sign = ($message != '') ? '[' . $message . ']' : '[OK]';
$status_color = 'ok';
break;
case 1:
$status_sign = ($message != '') ? '[' . $message . ']' : '[??]';
$status_color = 'warn';
break;
case 2:
$status_sign = ($message != '') ? '[' . $message . ']' : '[!!]';
$status_color = 'err';
break;
default:
$status_sign = '[unknown]';
$status_color = 'unknown';
break;
}
// output
echo "<span class=\"update-step update-step-" . $status_color . "\">" . $status_sign . "</span><br />";
if ($status == - 1 || $status == 2) {
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, 'Attention - last update task failed!!!');
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, 'Attention - last update task failed!!!');
} elseif ($status == 0 || $status == 1) {
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, 'Success');
}
}

View File

@@ -1,96 +0,0 @@
<?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 Language
*
*/
$lng['requirements']['title'] = 'Checking system requirements...';
$lng['requirements']['installed'] = 'installed';
$lng['requirements']['not_true'] = 'no';
$lng['requirements']['notfound'] = 'not found';
$lng['requirements']['notinstalled'] = 'not installed';
$lng['requirements']['activated'] = 'enabled';
$lng['requirements']['phpversion'] = 'PHP version >= 7.0';
$lng['requirements']['newerphpprefered'] = 'Good, but php-7.1 is prefered.';
$lng['requirements']['phppdo'] = 'PHP PDO extension and PDO-MySQL driver...';
$lng['requirements']['phpsession'] = 'PHP session-extension...';
$lng['requirements']['phpctype'] = 'PHP ctype-extension...';
$lng['requirements']['phpsimplexml'] = 'PHP SimpleXML-extension...';
$lng['requirements']['phpxml'] = 'PHP XML-extension...';
$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']['phpjson'] = 'PHP json-extension...';
$lng['requirements']['bcmathdescription'] = 'Traffic-calculation related functions will 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']['mysqldump'] = 'MySQL dump tool';
$lng['requirements']['mysqldumpmissing'] = 'Automatic backup of possible existing database is not possible. Please install mysql-client tools';
$lng['requirements']['diedbecauseofrequirements'] = 'Cannot install Froxlor without these requirements! Try to fix them and retry.';
$lng['requirements']['froxlor_succ_checks'] = 'All requirements are satisfied';
$lng['install']['lngtitle'] = 'Froxlor install - choose language';
$lng['install']['language'] = 'Installation language';
$lng['install']['lngbtn_go'] = 'Change language';
$lng['install']['title'] = 'Froxlor install - setup';
$lng['install']['welcometext'] = 'Thank you for choosing Froxlor. Please fill out the following fields with the required information to start the installation.<br /><b>Attention:</b> If the database you chose for Froxlor already exists on your System, it will be erased with all containing data!';
$lng['install']['database'] = 'Database connection';
$lng['install']['mysql_host'] = 'MySQL-Hostname';
$lng['install']['mysql_database'] = 'Database name';
$lng['install']['mysql_unpriv_user'] = 'Username for the unprivileged MySQL-account';
$lng['install']['mysql_unpriv_pass'] = 'Password for the unprivileged MySQL-account';
$lng['install']['mysql_root_user'] = 'Username for the MySQL-root-account';
$lng['install']['mysql_root_pass'] = 'Password for the MySQL-root-account';
$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.2';
$lng['install']['apache24'] = 'Apache 2.4';
$lng['install']['lighttpd'] = 'LigHTTPd';
$lng['install']['nginx'] = 'NGINX';
$lng['install']['httpuser'] = 'HTTP username';
$lng['install']['httpgroup'] = 'HTTP groupname';
$lng['install']['testing_mysql'] = 'Checking MySQL-root access...';
$lng['install']['testing_mysql_fail'] = 'There seems to be a problem with the database-connection. Cannot continue. Please go back and check your credentials.';
$lng['install']['backup_old_db'] = 'Creating backup of old database...';
$lng['install']['backup_binary_missing'] = 'Could not find mysqldump';
$lng['install']['backup_failed'] = 'Could not backup database';
$lng['install']['prepare_db'] = 'Preparing database...';
$lng['install']['create_mysqluser_and_db'] = 'Creating database and username...';
$lng['install']['testing_new_db'] = 'Testing if database and user have been created correctly...';
$lng['install']['importing_data'] = 'Importing data...';
$lng['install']['changing_data'] = 'Adjusting settings...';
$lng['install']['creating_entries'] = 'Inserting new values...';
$lng['install']['adding_admin_user'] = 'Creating admin-account...';
$lng['install']['creating_configfile'] = 'Creating configfile...';
$lng['install']['creating_configfile_temp'] = 'File was saved in /tmp/userdata.inc.php, please move to ' . dirname(dirname(__DIR__)) . '/lib/.';
$lng['install']['creating_configfile_failed'] = 'Could not create ' . dirname(dirname(__DIR__)) . '/lib/userdata.inc.php, please create it manually with the following content:';
$lng['install']['froxlor_succ_installed'] = 'Froxlor was installed successfully.';
$lng['click_here_to_refresh'] = 'Click here to check again';
$lng['click_here_to_goback'] = 'Click here to go back';
$lng['click_here_to_continue'] = 'Click here to continue';
$lng['click_here_to_login'] = 'Click here to login.';

View File

@@ -1,86 +0,0 @@
<?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 Language
*
*/
$lng['requirements']['title'] = 'Vérification des prérequis système...';
$lng['requirements']['installed'] = 'installé';
$lng['requirements']['not_true'] = 'non';
$lng['requirements']['notfound'] = 'introuvable';
$lng['requirements']['notinstalled'] = 'non installé';
$lng['requirements']['activated'] = 'activé';
$lng['requirements']['phpversion'] = 'PHP version >= 7.0';
$lng['requirements']['phppdo'] = 'extension PHP PDO et pilote PDO-MySQL ...';
$lng['requirements']['phpxml'] = 'extension PHP XML...';
$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']['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.';
$lng['requirements']['froxlor_succ_checks'] = 'Tous les prérequis sont vérifiés';
$lng['install']['lngtitle'] = 'Installation de Froxlor - choisisez la langue';
$lng['install']['language'] = 'Langue d\'installation';
$lng['install']['lngbtn_go'] = 'Changer la langue';
$lng['install']['title'] = 'Installation de Froxlor - paramètrage';
$lng['install']['welcometext'] = 'Merci d\'avoir choisi Froxlor. Merci de remplir les champs suivant avec les informations nécessaires pour démarrer l\'installation.<br /><b>Attention:</b> Si la base de données que vous choisissez existe déjà sur votre système, elle sera écrasée ainsi que les données contenues!';
$lng['install']['database'] = 'Connexion à la base de données';
$lng['install']['mysql_host'] = 'Nom d\'hôte MySQL';
$lng['install']['mysql_database'] = 'Nom de la base de données';
$lng['install']['mysql_unpriv_user'] = 'Nom d\'utilisateur pour le compte non priviligié MySQL';
$lng['install']['mysql_unpriv_pass'] = 'Mot de passe pour le compte non priviligié MySQL';
$lng['install']['mysql_root_user'] = 'Nom d\'utilisateur pour le compte MySQL root';
$lng['install']['mysql_root_pass'] = 'Mot de passe pour le compte MySQL root';
$lng['install']['admin_account'] = 'Compte administrateur';
$lng['install']['admin_user'] = 'Nom d\'utilisateur administrateur';
$lng['install']['admin_pass1'] = 'Mot de passe administrateur';
$lng['install']['admin_pass2'] = 'Mot de passe administrateur (confirmez)';
$lng['install']['serversettings'] = 'Réglages serveur';
$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';
$lng['install']['httpgroup'] = 'Nom de groupe HTTP';
$lng['install']['testing_mysql'] = 'Vérification de l\'accès root MySQL...';
$lng['install']['testing_mysql_fail'] = 'Il semble y avoir un problème avec la connexion à la base de données. Impossible de continuer. Merci de revenir en arrière et de vérifier les informations d\'identification.';
$lng['install']['backup_old_db'] = 'Création des sauvegardes de l\'ancienne base de données...';
$lng['install']['backup_binary_missing'] = 'Impossible de trouver mysqldump';
$lng['install']['backup_failed'] = 'Impossible de sauvegarde la base de données';
$lng['install']['prepare_db'] = 'Préparation de la base de données...';
$lng['install']['create_mysqluser_and_db'] = 'Création de la base de données et l\'utilisateur...';
$lng['install']['testing_new_db'] = 'Teste si la base de données et l\'utilisateur ont été créés correctement...';
$lng['install']['importing_data'] = 'Import des données...';
$lng['install']['changing_data'] = 'Ajustement des paramètres...';
$lng['install']['creating_entries'] = 'Insertion des nouvelles valeurs...';
$lng['install']['adding_admin_user'] = 'Création du compte administrateur...';
$lng['install']['creating_configfile'] = 'Création du fichier de configuration...';
$lng['install']['creating_configfile_temp'] = 'Le fichier a été enregistré dans /tmp/userdata.inc.php, merci de le déplacer dans ' . dirname(dirname(__DIR__)) . '/lib/.';
$lng['install']['creating_configfile_failed'] = 'Impossible de créer ' . dirname(dirname(__DIR__)) . '/lib/userdata.inc.php, merci de le créer manuellement avec le contenu suivant:';
$lng['install']['froxlor_succ_installed'] = 'Froxlor a été installé avec succès.';
$lng['click_here_to_refresh'] = 'Cliquez ici pour vérifier à nouveau';
$lng['click_here_to_goback'] = 'Cliquez ici pour revenir';
$lng['click_here_to_continue'] = 'Cliquez ici pour continuer';
$lng['click_here_to_login'] = 'Cliquez ici pour vous connecter.';

View File

@@ -1,96 +0,0 @@
<?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 Language
*
*/
$lng['requirements']['title'] = 'Prüfe Systemvoraussetzungen...';
$lng['requirements']['installed'] = 'installiert';
$lng['requirements']['not_true'] = 'nein';
$lng['requirements']['notfound'] = 'nicht gefunden';
$lng['requirements']['notinstalled'] = 'nicht installiert';
$lng['requirements']['activated'] = 'ist aktiviert.';
$lng['requirements']['phpversion'] = 'PHP Version >= 7.0';
$lng['requirements']['newerphpprefered'] = 'Passt, aber php-7.1 wird bevorzugt.';
$lng['requirements']['phppdo'] = 'PHP PDO Erweiterung und PDO-MySQL Treiber...';
$lng['requirements']['phpsession'] = 'PHP session-Erweiterung...';
$lng['requirements']['phpctype'] = 'PHP ctype-Erweiterung...';
$lng['requirements']['phpsimplexml'] = 'PHP SimpleXML-Erweiterung...';
$lng['requirements']['phpxml'] = 'PHP XML-Erweiterung...';
$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']['phpjson'] = 'PHP json-Erweiterung...';
$lng['requirements']['bcmathdescription'] = 'Traffic-Berechnungs bezogene Funktionen 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']['mysqldump'] = 'MySQL dump Tool';
$lng['requirements']['mysqldumpmissing'] = 'Ein automatisches Backup einer möglicherweise schon existierenden Datenbank nicht möglich. Bitte mysql-client installieren';
$lng['requirements']['diedbecauseofrequirements'] = 'Kann Froxlor ohne diese Voraussetzungen nicht installieren! Beheben Sie die angezeigten Probleme und versuchen Sie es erneut.';
$lng['requirements']['froxlor_succ_checks'] = 'Alle Vorraussetzungen sind erfüllt';
$lng['install']['lngtitle'] = 'Froxlor Installation - Sprache auswählen';
$lng['install']['language'] = 'Sprache für die Installation';
$lng['install']['lngbtn_go'] = 'Sprache ändern';
$lng['install']['title'] = 'Froxlor Installation - Einrichtung';
$lng['install']['welcometext'] = 'Vielen Dank dass Sie sich für Froxlor entschieden haben. Um die Installation von Froxlor zu starten, füllen Sie bitte alle Felder mit den geforderten Angaben aus.<br /><b>Achtung:</b> Eine eventuell existierende Datenbank, die den selben Namen hat wie den Gewählten, wird mit allen enthaltenen Daten gelöscht!';
$lng['install']['database'] = 'Datenbankverbindung';
$lng['install']['mysql_host'] = 'MySQL-Hostname';
$lng['install']['mysql_database'] = 'Datenbank Name';
$lng['install']['mysql_unpriv_user'] = 'Benutzername für den unprivilegierten MySQL-Account';
$lng['install']['mysql_unpriv_pass'] = 'Passwort für den unprivilegierten MySQL-Account';
$lng['install']['mysql_root_user'] = 'Benutzername für den MySQL-Root-Account';
$lng['install']['mysql_root_pass'] = 'Passwort für den MySQL-Root-Account';
$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';
$lng['install']['httpgroup'] = 'HTTP Gruppenname';
$lng['install']['testing_mysql'] = 'Teste MySQL-Root Zugang...';
$lng['install']['testing_mysql_fail'] = 'Bei der Verwendung der Datenbank gibt es scheinbar Probleme. Installation kann nicht fortgesetzt werden. Bitte Zugangsdaten prüfen und erneut versuchen.';
$lng['install']['backup_old_db'] = 'Sicherung vorheriger Datenbank...';
$lng['install']['backup_binary_missing'] = 'Konnte mysqldump nicht finden';
$lng['install']['backup_failed'] = 'Sicherung fehlgeschlagen';
$lng['install']['prepare_db'] = 'Datenbank wird vorbereitet...';
$lng['install']['create_mysqluser_and_db'] = 'Erstelle Datenbank und Benutzer...';
$lng['install']['testing_new_db'] = 'Teste, ob Datenbank und Benutzer korrekt angelegt wurden...';
$lng['install']['importing_data'] = 'Importiere Daten...';
$lng['install']['changing_data'] = 'Einstellungen anpassen...';
$lng['install']['creating_entries'] = 'Trage neue Werte ein...';
$lng['install']['adding_admin_user'] = 'Erstelle Admin-Benutzer...';
$lng['install']['creating_configfile'] = 'Erstelle Konfigurationsdatei...';
$lng['install']['creating_configfile_temp'] = 'Datei wurde in /tmp/userdata.inc.php gespeichert, bitte nach ' . dirname(dirname(__DIR__)) . '/lib/ verschieben.';
$lng['install']['creating_configfile_failed'] = 'Konnte ' . dirname(dirname(__DIR__)) . '/lib/userdata.inc.php nicht erstellen, bitte manuell mit folgendem Inhalt anlegen:';
$lng['install']['froxlor_succ_installed'] = 'Froxlor wurde erfolgreich installiert.';
$lng['click_here_to_refresh'] = 'Hier klicken, um erneut zu prüfen';
$lng['click_here_to_goback'] = 'Einen Schritt zurück';
$lng['click_here_to_continue'] = 'Installation fortführen';
$lng['click_here_to_login'] = 'Hier geht es weiter zum Login-Fenster.';

View File

@@ -1,31 +0,0 @@
#!/usr/bin/php
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2018 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> (2018-)
* @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.');
}
require dirname(dirname(__DIR__)) . '/vendor/autoload.php';
// give control to command line handler
try {
\Froxlor\Cli\ConfigServicesCmd::processParameters($argc, $argv);
} catch (Exception $e) {
\Froxlor\Cli\ConfigServicesCmd::printerr($e->getMessage());
}

View File

@@ -1,31 +0,0 @@
#!/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.');
}
require dirname(dirname(__DIR__)) . '/vendor/autoload.php';
// give control to command line handler
try {
\Froxlor\Cli\SwitchServerIpCmd::processParameters($argc, $argv);
} catch (Exception $e) {
\Froxlor\Cli\SwitchServerIpCmd::printerr($e->getMessage());
}

View File

@@ -1,637 +0,0 @@
@charset "UTF-8";
/* RESET */
html, body, div, ul, ol, li, dl, dt, dd, h1, h2, h3, h4, h5, h6, pre,
form, p, blockquote, fieldset, input {
margin: 0;
padding: 0;
}
h1, h2, h3, h4, h5, h6, pre, code, address, caption, cite, code, em,
strong, th {
font-size: 1em;
font-weight: 400;
font-style: normal;
}
ul, ol {
list-style: none;
}
fieldset, img {
border: none;
}
caption, th {
text-align: left;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
article, aside, details, figcaption, figure, footer, header, hgroup,
menu, nav, section {
display: block;
}
/* TYPE */
html, body {
font: 12px/18px 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial,
Verdana, sans-serif;
background-color: #f5f5f5;
color: #444;
-webkit-font-smoothing: subpixel-antialiased;
}
body {
margin: 0;
padding: 0;
}
.dark {
background-color: #e9edf0;
border-bottom: 1px solid #d1d5d8;
}
header img {
padding: 10px 0 10px 10px;
}
h1 {
display: none;
}
h2, h3 {
margin: 0 0 1em 0;
padding: 0;
font-weight: bold;
}
h2 {
font-size: 17px;
}
h3 {
font-size: 15px;
}
img {
border: 0;
vertical-align: middle;
}
td a {
text-decoration: none;
}
.bradius {
border-radius: 5px 5px 5px 5px;
box-shadow: rgba(0, 0, 0, 0.34902) 0 1px 3px 0;
}
/* FOOTER */
footer {
clear: both;
text-align: center;
color: #888;
font-size: 10px !important;
margin: 10px 0;
}
footer a, footer a:active, footer a:visited {
color: #888;
}
.install {
background-color: #fff;
margin: 20px auto 12px;
width: 800px;
}
p {
margin: 0 10px !important;
}
.installsec {
margin-top: 10px;
padding: 0;
text-align: left;
}
.installsec table {
width: 100%;
padding: 0 10px;
margin: 15px 0 15px 0;
}
.installsec h2 {
display: block;
border-bottom: 1px solid #d1d5d8;
margin: 0;
padding: 5px 15px 15px 15px;
}
.installsec form {
width: 800px;
margin: 0 auto;
padding: 10px 0 0;
text-align: left;
}
.installsec fieldset {
border: 0;
float: left;
clear: left;
width: 600px;
margin: 0 100px 10px;
padding: 0;
}
.installsec fieldset p, .installsec fieldset h3 {
clear: both;
}
.installsec legend {
display: none;
}
.installsec label {
float: left;
margin-right: 0;
margin-top: 8px;
text-align: left;
}
p.submit {
text-align: right;
padding-right: 46px;
}
.installsec aside {
border-top: 1px solid #d1d5d8;
clear: both;
float: none;
width: auto;
text-align: right;
padding: 10px;
}
.line {
border: 0;
width: 800px;
border-bottom: 1px solid #d1d5d8;
}
.messagewrapper {
width: 650px;
margin: 0 auto;
padding: 120px 0 0;
overflow: hidden;
}
.messagewrapperfull {
width: 100%;
margin: 0 auto;
padding: 0;
overflow: hidden;
}
.overviewsearch {
position: absolute;
top: 155px;
right: 36px;
font-size: 80%;
}
.overviewadd {
padding: 10px;
font-weight: 700;
}
/*
* error message display
*/
.errorcontainer {
background: url(../img/icons/error_big.png) 10px center no-repeat
#ffedef;
border: 1px solid #ffc2ca;
padding: 10px 10px 10px 68px !important;
margin: 10px 0 10px 0 !important;
text-align: left !important;
overflow: hidden;
box-shadow: 0 0 0 black;
}
.errortitle {
font-weight: 700;
color: #c00 !important;
}
.error {
font-weight: 400 !important;
color: #c00 !important;
}
/*
* warning message display
*/
.warningcontainer, .ui-dialog {
background: url(../img/icons/warning_big.png) 10px center no-repeat
#fffecc;
border: 1px solid #f3c37e;
padding: 10px 10px 10px 68px !important;
margin: 10px 0 10px 0 !important;
text-align: left !important;
overflow: hidden;
box-shadow: 0 0 0 black;
}
.ui-dialog {
padding: 10px !important;
}
.warningtitle, .ui-dialog-titlebar {
font-weight: 700;
color: #D57D00;
}
.warning, .ui-dialog-content {
color: #D57D00 !important;
}
/*
* success message display
*/
.successcontainer {
background: url(../img/icons/ok_big.png) 10px center no-repeat #E2F9E3;
border: 1px solid #9C9;
padding: 10px 10px 10px 68px !important;
margin: 10px 0 10px 0 !important;
text-align: left !important;
overflow: hidden;
box-shadow: 0 0 0 black;
}
.successtitle {
font-weight: 700;
color: #060 !important;
}
.success {
font-weight: 400 !important;
}
/*
* neutral/info message display
*/
.neutralcontainer {
background: url(../img/icons/info_big.png) 10px center no-repeat #d2eaf6;
border: 1px solid #b7d8ed;
padding: 10px 10px 10px 68px !important;
margin: 10px 0 10px 0 !important;
text-align: left !important;
overflow: hidden;
box-shadow: 0 0 0 black;
}
.neutraltitle {
font-weight: 700;
color: #3188c1 !important;
}
.neutral {
font-weight: 400 !important;
color: #3188c1 !important;
}
/* std hyperlink */
a, a:active, a:visited {
color: #176fa1;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.infotext {
font-size: 11px;
}
/*
* main container
*/
.main {
margin: 105px 10px 0 240px;
background-color: #fff;
padding: 30px 30px 30px 30px;
min-height: 400px;
}
.noborder {
width: 100%;
border-spacing: 0;
border-collapse: separate;
border: 0;
}
.noborder td {
border: 0;
}
table {
width: 100%;
border-spacing: 0;
border: 1px solid #d1d5d8;
border-collapse: separate;
box-shadow: 0 0 0 black !important;
}
table thead th, table th {
border-top: 1px solid #d1d5d8;
border-bottom: 1px solid #d1d5d8;
height: 25px !important;
padding: 5px 0 5px 8px;
background-color: #e9edf0;
font-weight: bold;
}
table thead:first-child th, table:first-child th {
border-top: none !important;
}
table th {
border-top: 0;
}
th a:hover {
text-decoration: none;
}
th a img {
}
th a:nth-child(odd) img {
position: relative;
top: -5px;
left: 4px;
}
th a:nth-child(even) img {
position: relative;
top: 3px;
left: -7px;
}
table thead:first-child th {
border-top: 0;
}
.disabled td, .disabled td a {
color: #cfcfcf;
}
table tbody td {
border-bottom: 1px dotted #ccc;
}
table tbody tr:last-child td {
border-bottom: 0;
}
.formtable {
width: 100%;
border-spacing: 0;
border: 0;
border-collapse: separate;
margin: 0 0 0;
}
.formtable tbody td {
border: 0;
border-bottom: 1px dotted #ccc;
min-height: 20px;
}
.formtable label {
float: none;
display: block;
padding: 0;
margin: 0;
width: 100%;
text-align: left;
}
td {
padding: 5px 10px;
min-height: 20px;
}
table tfoot td {
height: 25px;
border-top: 1px solid #d1d5d8;
background-color: #f2f8fa;
}
.tfootleft {
text-align: left;
}
.maintitle {
padding-top: 20px;
}
/* input elements */
input {
background: #fff url(../img/text_align_left.png) no-repeat 5px 4px;
color: #333;
padding: 2px 4px 2px 24px;
height: 22px;
border: 1px solid #d9d9d9;
margin-bottom: 5px;
border-radius: 3px;
}
textarea {
background: #fff url(../img/text_align_left.png) no-repeat 5px 4px;
color: #333;
padding: 4px 4px 2px 24px;
border: 1px solid #d9d9d9;
margin-bottom: 5px;
border-radius: 3px;
}
input[type="password"] {
background: #fff url(../img/password.png) no-repeat 5px 4px;
}
/*
* BUTTONS
*/
input[type="button"], input[type="submit"], input[type="reset"] {
margin: 0 5px;
padding: 5px 14px;
outline: 0;
border: 0;
background-color: #eee;
min-width: 80px;
height: 26px;
background-image: none;
}
.loginsec input[type="button"], .loginsec input[type="submit"],
.loginsec input[type="reset"] {
margin: 0 1px;
}
input[type="button"]:hover, input[type="submit"]:hover, input[type="reset"]:hover
{
color: #333;
background-color: #dcdcdc;
}
input[type="button"]:active, input[type="submit"]:active, input[type="reset"]:active
{
-webkit-box-shadow: inset 0 1px 8px rgba(0, 0, 0, 0.25);
-moz-box-shadow: inset 0 1px 8px rgba(0, 0, 0, 0.25);
box-shadow: inset 0 1px 8px rgba(0, 0, 0, 0.25);
color: white !important;
}
input[type="submit"], input[class="yesbutton"] {
color: white;
background-color: #35aa47;
}
input[type="submit"]:hover, input[class="yesbutton"]:hover {
color: white;
background-color: #1d943b;
}
input[class="submit"]:active, input[class="yesbutton"]:active {
background-color: #35aa47;
}
input[class="nobutton"], input[type="reset"] {
color: white;
background-color: #d84a38;
}
input[class="nobutton"]:hover, input[type="reset"]:hover {
color: white;
background-color: #c53727;
}
input[class="nobutton"]:active, input[type="reset"]:active {
background-color: #dd4b39;
}
input[type="checkbox"] {
background: #dae7ee;
padding: 0;
margin: 0 5px 0 0;
vertical-align: middle;
height: 26px;
}
input[type="radio"] {
vertical-align: middle;
margin: 0 10px 0 10px;
height: 22px;
}
select {
background: #fff;
padding: 4px;
color: #333;
border: 1px solid #d9d9d9;
margin-bottom: 5px;
min-width: 100px;
}
select.dropdown {
padding: 2px 4px 2px 24px;
height: 26px;
border: 1px solid #d9d9d9;
margin-bottom: 5px;
border-radius: 3px;
background: url(../../../../templates/Sparkle/assets/img/icons/down.png)
no-repeat 9px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
.maintable {
width: 90%;
}
.update_progess {
padding: 2em;
text-align: left;
}
.preconfig {
text-align: left;
margin-top: 20px;
margin-bottom: 5px;
margin-right: 15px;
margin-left: 15px;
}
.preconfigitem {
padding: .15em;
border-bottom: 1px solid #ccc;
}
.preconfdesc {
display: block;
margin-bottom: .5em;
font-size: 120%;
}
.installprogress {
width: 100%;
background-color: #e4e4e4;
height: 5px;
border-bottom: 1px solid #d1d5d8;
}
.installprogress .bar {
background-color: #35aa47;
height: 5px;
}
.red {
color: #ff0000;
}
.green {
color: green;
}
.orange {
color: orange;
}
.blue {
color: blue;
}
.install-block {
width: 65%;
}
.install-step {
width: 250px;
}
.install-h3 {
text-align: center;
}
.install-text {
margin: 20px 20px 0 !important;
}

Some files were not shown because too many files have changed in this diff Show More