Compare commits

...

959 Commits

Author SHA1 Message Date
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
Michael Kaufmann
9167608794 set version to 0.10.1 for maintenance release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-10 14:55:45 +02:00
Michael Kaufmann
050af61082 show success in updater when there are no more old files to delete and exec() is disallowed (showed empty list)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-09 12:05:04 +02:00
Michael Kaufmann
2c23431daf show on API keys page wether api access is allowed
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-09 11:52:55 +02:00
Michael Kaufmann
4543c73b4f add possibility to enable/disable api access on a per user base
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-09 11:43:22 +02:00
Michael Kaufmann
88d85fc02e fix curly bracket array access (deprecated)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-09 07:59:38 +02:00
Michael Kaufmann
6102fabcb6 allow setting http2 flag for (sub)domains in customer view, fixes #725
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-09 07:59:11 +02:00
Michael Kaufmann
d7a7412973 Merge pull request #724 from kionez/add-ssl-expirationdate
Add expiration date to SSL certificates loaded via API request, fixes #723
2019-10-08 18:59:27 +02:00
kionez
1b3029b826 Fix typo 2019-10-08 18:50:10 +02:00
Michael Kaufmann
26cb53c8fb correctly validate that a domain has not a certificate in Certificates.add(), refs #722
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-08 18:44:42 +02:00
Michael Kaufmann
b4999fcc83 Throw exception if domain used to call Certificates.get() does not have a certificate, fixes #722
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-08 18:01:59 +02:00
kionez
05f602d457 Fix for null expiration date and coding style 2019-10-08 17:44:41 +02:00
Michael Kaufmann
89b95d61d2 return empty array in FroxlorAPI.php example class if last call was unsuccessful, fixes #722
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-08 17:36:42 +02:00
kionez
9ec03bade7 Add expiration date to SSL certificates loaded via API request 2019-10-08 17:32:03 +02:00
Michael Kaufmann
20699a15a6 update composer dependencies
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-08 12:54:15 +02:00
Michael Kaufmann
9b8a6e7e67 more php-7.4 compatibility
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-08 12:38:22 +02:00
Michael Kaufmann
3a8d5a9517 correct Mysql.add phpDoc to produce correct api-doc, fixes #721
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-08 12:11:00 +02:00
Michael Kaufmann
557b28a69d more php-7.4 compatibility
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-08 12:08:36 +02:00
Michael Kaufmann
0f1c5506e2 do not create username@domain ftp user if the default-ftp-user is being created in Ftps.add, fixes #720
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-08 12:04:10 +02:00
Michael Kaufmann
c6a93fa336 fix possible php-7.4 notice 'Trying to access array offset on value of type bool'
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-08 11:26:05 +02:00
Michael Kaufmann
466ea0fa99 show update steps for version updates (forgot that once or twice); add fallback for file deletion if exec() is not allowed; fix php7.4 warnings
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-08 10:54:08 +02:00
Michael Kaufmann
8f850ee7f3 simplify config-templates for cronjob setup
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-06 22:54:54 +02:00
Michael Kaufmann
55d21e475d set low timeout for version-check and output message if check is not possible (due to connection error, downtime of server, etc.)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-06 18:53:30 +02:00
Michael Kaufmann
fa3e3da7ac only flush privileges if anything at all happened
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-06 14:47:04 +02:00
Michael Kaufmann
05d66c034e update min-required version of php in composer.json
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-06 09:04:18 +02:00
Michael Kaufmann
98f0839664 Merge branch 'master' of github.com:Froxlor/Froxlor 2019-10-06 09:01:15 +02:00
Michael Kaufmann
4d52c6b6d0 Update README.md 2019-10-04 21:48:10 +02:00
Michael Kaufmann
eb5ea51da1 add explicit tlsv1.3 ciphersuite setting (used for apache-only as of now) 2019-10-04 17:43:11 +02:00
Michael Kaufmann
4b555b4ef2 set version to 0.10.0 for upcoming stable release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-03 12:35:42 +02:00
Michael Kaufmann
1657af8719 updating external libraries prior to release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-03 12:31:27 +02:00
Michael Kaufmann
c9d30654e0 update link to openssl-ciphers manual, thx to lod
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-10-02 09:12:06 +02:00
Michael Kaufmann
47ca350127 increase php requirement to 7.0 as 5.6 is way too old
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-09-27 12:55:14 +02:00
Michael Kaufmann
cc04e44031 add possibility to add customer using a hosting-plan instead of specifying resources
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-09-27 12:54:43 +02:00
Michael Kaufmann
eabad4917b correct try_files in NginxFcgi, fixes #717
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-09-26 09:50:13 +02:00
Michael Kaufmann
6188e5b0e3 Merge pull request #716 from Bobselp/patch-1
fix MysqlHandler user field
2019-09-25 20:18:22 +02:00
Bobselp
13ab7a598b fix MysqlHandler user field
See lib/Froxlor/FroxlorLogger.php:152
2019-09-25 20:03:16 +02:00
Michael Kaufmann
bf2584da65 Merge pull request #714 from Bobselp/patch-1
Get mailbox size with maildirsize file
2019-09-24 19:16:58 +02:00
Bobselp
31cebccd5d fix calc, add check if quota is enabled 2019-09-24 18:16:07 +02:00
Michael Kaufmann
3728e9b22c Merge pull request #715 from z3dm4n/master
lng/english.lng.php: fix typo
2019-09-24 12:55:45 +02:00
Erik Zettel
8a145eca92 lng/english.lng.php: fix typo 2019-09-24 12:44:33 +02:00
Bobselp
14914fce44 Get mailbox size with maildirsize file 2019-09-23 21:08:16 +02:00
Michael Kaufmann
6e3fdc1cf9 Merge pull request #713 from Bobselp/patch-1
fix missing namespaces in PowerDNS cron
2019-09-22 18:05:48 +02:00
Bobselp
6ca68f6a2d fix missing namespaces in PowerDNS cron
Some getDB calls were missing the `\Froxlor\Dns\` prefix
2019-09-22 17:59:21 +02:00
Michael Kaufmann
fd4d3cbcfd specify pop3_logout_format explicitly for dovecot to satisfy maillogparser
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-09-19 13:06:32 +02:00
Michael Kaufmann
75f49e2ee2 added HostingPlans ApiCommand + unit-tests
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-09-16 12:31:02 +02:00
Michael Kaufmann
aca22a9c94 only add lets encrypt certificate if cert is valid; display acme.sh output if --debug is specified
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-09-15 15:40:13 +02:00
Michael Kaufmann
5a8ae0f75f do not log multiple times due to pushing log-handlers multiple times
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-09-15 13:49:40 +02:00
Michael Kaufmann
6ef2be8c1a fixed typo
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-09-15 13:42:32 +02:00
Michael Kaufmann
1b968c885b remove old files from 0.9.x to avoid conflicts and errors; change mod_proxy-usage and ACMEv2 default values to true
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-09-15 10:28:19 +02:00
Michael Kaufmann
dc3f159c90 correctly trigger re-generation of let's encrypt certificates
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-09-15 10:22:25 +02:00
Michael Kaufmann
6ebb8dabc4 re-create certificate if SAN list or domain changes
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-09-12 12:30:47 +02:00
Michael Kaufmann
9e2dcf51d7 also remove let's encrypt certificate for froxlor-hostname when updating to acme.sh; make installation more mysql/mariadb compatible
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-09-09 17:16:41 +02:00
Michael Kaufmann
2d8b0181b3 add gitter notifications for travis-ci
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-08-22 16:20:42 +02:00
Michael Kaufmann
accd6e7416 Update README.md 2019-08-22 16:15:17 +02:00
Michael Kaufmann
f5027695dd Create FUNDING.yml 2019-08-22 15:45:00 +02:00
Michael Kaufmann
34696df700 Merge pull request #711 from TimoStramann/patch-1
Remove unnecessary slash for SSL redirect
2019-08-18 16:15:50 +02:00
Timo Stramann
8e9ddd3d50 Remove unnecessary slash for SSL redirect
Remove slash after hostname since requests directly to the hostname do not require a slash at the end and all other content goes to `$request_uri` which starts with shlash, hence no longer doubleslashes on hostname only queries.
2019-08-18 16:07:59 +02:00
Michael Kaufmann
eca941bdae Merge pull request #710 from TimoStramann/patch-1
Updating another fastcgi_param SCRIPT_FILENAME
2019-08-18 15:19:42 +02:00
Timo Stramann
bd6aba8875 Updating another fastcgi_param SCRIPT_FILENAME
Use $request_filename instead of $document_root$fastcgi_script_name as described in: https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/#use-request-filename-for-script-filename
2019-08-17 13:04:18 +02:00
Michael Kaufmann
58f6b558df Merge pull request #709 from TimoStramann/patch-1
Updating fastcgi_param SCRIPT_FILENAME
2019-08-17 07:51:12 +02:00
Michael Kaufmann
7ba72269a4 add dovecot stats service and use correct permissions
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-08-11 11:12:53 +02:00
Michael Kaufmann
76c4486d26 fix subcanemaildomain parameter for Domains.update(); allow exec() in froxlor default vhost php.ini or logfiles-viewer feature
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-08-11 10:31:33 +02:00
Michael Kaufmann
69d7889f02 do not require codecoverage to pass checks
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-08-09 17:55:39 +02:00
Timo Stramann
04898c6114 Updating fastcgi_param
Use $request_filename instead of $document_root$fastcgi_script_name as described in: https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/#use-request-filename-for-script-filename
2019-08-09 09:40:55 +02:00
Michael Kaufmann
7364dca53d fix homedir of automatically added ftp-user for new customers, thx Gamerboy59 for finding this
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-08-07 14:01:05 +02:00
Michael Kaufmann
90e7f7af0c correct language-array and minor formatting in serversettings.caa_entry_custom
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-07-30 10:05:26 +02:00
Michael Kaufmann
878be08563 Merge pull request #706 from makuser/master
Implement CAA DNS records
2019-07-30 09:53:46 +02:00
Michael Kaufmann
a98ae562b2 change mysql-username-test so it generates a loginname that fails depending on the mysql/mariadb version
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-07-30 08:48:44 +02:00
Michael Kaufmann
2aec6a10ed argh, mixed up the If statement for mysql-version check
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-07-30 08:31:03 +02:00
Michael Kaufmann
70ac914a86 fix drop database on mysql-5.6 as there is no 'if exists' for 'drop user' prior to mysql-5.7
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-07-30 07:34:42 +02:00
Michael Kaufmann
169353c429 Merge branch 'makuser-travis-test' 2019-07-30 07:30:56 +02:00
Marc-André Kolly
ede19946c2 Tell ant to fail the build when a php unit test fails 2019-07-29 16:29:39 +02:00
Marc-André Kolly
dd488106af Remove lib/userdata.inc.php.bak 2019-07-29 16:09:11 +02:00
Marc-André Kolly
2489658353 Extrawurst 2.0. 2019-07-29 16:03:27 +02:00
Marc-André Kolly
61b12e3f25 Extrawurst. 2019-07-29 15:47:45 +02:00
Marc-André Kolly
c2ffb6d6bd Update Travis CI to run database tests on MySQL 5.6, 5.7 and 8.0 and on MariaDB 10.3 and 10.4. 2019-07-29 15:12:35 +02:00
Marc-André Kolly
4ef78df27f Update Travis CI 2019-07-29 15:07:18 +02:00
Marc-André Kolly
84d80d695a Add Url and Domain validation for CAA records using native Froxlor function 2019-07-29 15:02:13 +02:00
Marc-André Kolly
3cba61a8d8 Simplify unit tests for CAA entry validation 2019-07-29 14:30:39 +02:00
Marc-André Kolly
16ccc273a9 Don't actually enclose CAA records in brackets 2019-07-29 14:27:44 +02:00
Marc-André Kolly
95d47eb6c9 Add unit tests for CAA entry validation 2019-07-29 11:53:00 +02:00
Marc-André Kolly
bfb3fb0a92 Add Regex to check for invalid CAA entry 2019-07-29 11:36:34 +02:00
Marc-André Kolly
78ef2a4e23 Fix serversettings field 2019-07-29 07:41:09 +02:00
Marc-André Kolly
a377c1e6c5 Split l18n string into title and description 2019-07-29 07:39:21 +02:00
Marc-André Kolly
e67e2a85de Implement test for Domain Zone CAA record 2019-07-28 20:05:55 +02:00
Marc-André Kolly
be0470aec1 Revert per-domain CAA settings 2019-07-28 19:49:56 +02:00
Marc-André Kolly
240178eba7 Implement global CAA settings 2019-07-28 19:49:32 +02:00
Marc-André Kolly
358ca61a26 Implement validators to prevent breaking DNS server when adding newly introduced RR types 2019-07-28 18:47:47 +02:00
Marc-André Kolly
b427212b00 Properly implement migrations for caa field in TABLE_DOMAIN_DNS using showUpdateStep() and lastStepStatus() 2019-07-28 18:12:00 +02:00
Marc-André Kolly
5eef98fdfd Bump DB Version to 201907270 2019-07-28 18:10:01 +02:00
Marc-André Kolly
57ac337ef7 Add a few more commonly used RR types to DNS editor 2019-07-28 16:52:05 +02:00
Marc-André Kolly
64fe300e42 Implement general CAA DNS records for all issuers 2019-07-28 16:28:29 +02:00
Marc-André Kolly
d4e5e32c14 Implement CAA DNS record for letsencrypt.org 2019-07-27 17:36:31 +02:00
Michael Kaufmann
d5e4182878 beautification and minor fixes
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-07-26 07:49:17 +02:00
Michael Kaufmann
dd87a7374e fix ftp-group not added correctly when new customer is added
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-07-26 07:45:38 +02:00
Michael Kaufmann
7bc57ed269 set password directly when adding new mysql user
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-07-26 07:34:32 +02:00
Michael Kaufmann
5658717653 fix wrong parameter for acme.sh --delete when ecc certificates are used
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-07-19 11:43:14 +02:00
Michael Kaufmann
6c0fb007e4 travis changed the default OS to xenial, set it to the previous trusty which works
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-07-19 08:43:42 +02:00
Michael Kaufmann
0b898b9936 Merge branch 'master' of github.com:Froxlor/Froxlor 2019-07-19 08:42:31 +02:00
Michael Kaufmann
a261e84830 Merge pull request #705 from MDXDave/patch-2
Disable mail redirections if customer is disabled, fixes #704
2019-07-19 08:28:40 +02:00
Dave
7e9b373a58 Update xenial.xml 2019-07-19 01:43:07 +02:00
Dave
5698f8360e Update rhel_centos.xml 2019-07-19 01:42:49 +02:00
Dave
de7c438315 Update gentoo.xml 2019-07-19 01:42:31 +02:00
Dave
0669450676 Update bionic.xml 2019-07-19 01:42:14 +02:00
Dave
507a62f52d Update trusty.xml 2019-07-19 01:41:54 +02:00
Dave
77a7037072 Update jessie.xml 2019-07-19 01:41:24 +02:00
Dave
577e9d3b70 Update buster.xml 2019-07-19 01:40:55 +02:00
Dave
2526512069 Update stretch.xml 2019-07-19 01:39:01 +02:00
Michael Kaufmann
e91debcbb1 buster dovceot has ssl enabled by default
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-07-14 09:41:46 +02:00
Michael Kaufmann
065fa0b58b do not store punycode-notation of email-account domain, fixes #703
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-07-13 09:09:39 +02:00
Michael Kaufmann
db3c95ea10 set last run of letsencrypt cron when called in webserver-cron
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-07-11 08:39:26 +02:00
Michael Kaufmann
8b417c044c let nginx auto-detect the best ecdh-curve to use, fixes #652
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-07-11 08:13:00 +02:00
Michael Kaufmann
5e3cfaf847 insert task to regenerate config files after removing old-format lets encrypt certificates
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-07-10 09:58:12 +02:00
Michael Kaufmann
0f0dd91246 combine Let's Encrypt cron with webserver-vhost-generation but allow manually execution using --debug/--force
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-07-09 07:50:11 +02:00
Michael Kaufmann
fd912dd161 combine webserver-reload command to parent class to avoid repeating code
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-07-09 07:13:02 +02:00
Michael Kaufmann
98325a0f40 don't need NSCD when using libnss-extrausers
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-07-03 18:07:02 +02:00
Michael Kaufmann
c43915c09d show task 12 in admin dashboard overview if active
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-07-03 12:00:47 +02:00
Michael Kaufmann
01bf814496 remove domain ssl information from acme.sh and filesystem on deletion to avoid trying to renew certificates
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-07-01 20:32:13 +02:00
Michael Kaufmann
2ce517e84a use Fts.add when adding new Customers to reduce duplicate code
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-06-28 15:15:17 +02:00
Michael Kaufmann
e209989f2a use EmailAccounts.delete API call in Emails.delete instead of repeating the code
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-06-28 11:07:29 +02:00
Michael Kaufmann
5dfb74701c improve error message display on missing vendor-folder
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-06-25 11:10:32 +02:00
Michael Kaufmann
bdd583d251 Merge branch 'drexlma-patch-2' 2019-06-25 10:59:06 +02:00
Michael Kaufmann
fd8a1d8dc2 Merge branch 'patch-2' of https://github.com/drexlma/Froxlor into drexlma-patch-2 2019-06-25 10:58:57 +02:00
Michael Kaufmann
d2818f8020 Merge branch 'drexlma-patch-3' 2019-06-25 10:58:20 +02:00
Michael Kaufmann
80a0a34b46 Merge branch 'patch-3' of https://github.com/drexlma/Froxlor into drexlma-patch-3 2019-06-25 10:57:45 +02:00
Michael Kaufmann
6e41c0ad2c add codecov.io to travis build for code-coverage stats - yay
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-06-17 14:11:40 +02:00
Michael Kaufmann
a07a9e6a88 more unit-testing, enhancements in Store-functions
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-06-11 12:10:56 +02:00
Michael Kaufmann
7a94a43053 started \Settings\Store unit tests
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-06-10 13:37:22 +02:00
Michael Kaufmann
028524291e test improvements and preparation for more tests later
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-06-10 11:38:47 +02:00
Michael Kaufmann
1ac304e5ac fix missing domainname parameter when manually adding ssl-certificates for a domain, fixes #700
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-06-10 11:36:05 +02:00
Michael Kaufmann
f266bb05c9 testing \Froxlor\Settings\FroxlorVhostSettings
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-06-06 13:04:43 +02:00
Michael Kaufmann
d8a8f76dc9 update dev-environment to use more recent versions, requries php-7.3 now (dev-only)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-06-06 10:18:03 +02:00
Michael Kaufmann
0afbe3d13b add validation tests
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-06-05 20:52:37 +02:00
Michael Kaufmann
4917b9c057 added first validation tests
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-06-05 09:07:21 +02:00
Michael Kaufmann
13bfd62ac5 move validateUrl function to correct file
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-06-05 06:50:06 +02:00
Michael Kaufmann
97703e7a0c add a few tests for Settings
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-06-05 06:39:44 +02:00
Michael Kaufmann
13086d91d8 only validate and process ip-list if given at all
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-06-04 15:14:51 +02:00
Michael Kaufmann
b7a10fdeda fix vhost(parts)-merging in nginx cron, fixes #669
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-06-03 11:59:56 +02:00
Michael Kaufmann
6806f896d6 fix proftp path of rhel/centos config template, fixes #636
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-05-31 08:02:03 +02:00
Michael Kaufmann
87a2f86365 do not set default ssl-ips if the frontend values are left empty; if default ssl-ips are specified, preset them in the form when adding a domain, fixes #697
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-05-30 17:44:08 +02:00
Michael Kaufmann
a647d48fbe fix up testing/production switch and challengepath for lets encrypt, fixes #696
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-05-27 17:48:33 +02:00
Daniel Drexlmaier
6ea91f55e5 Update install.php 2019-05-27 15:47:30 +02:00
Daniel Drexlmaier
fb87129e29 Update init.php 2019-05-27 15:46:39 +02:00
Daniel Drexlmaier
79e5113e12 Update init.php 2019-05-27 15:28:08 +02:00
Daniel Drexlmaier
b75c9ddff6 Update install.php 2019-05-27 15:27:28 +02:00
Michael Kaufmann
35e14fde14 set version to 0.10.0-rc2 for second release candidate
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-05-27 11:47:58 +02:00
Michael Kaufmann
68f55f9596 dont allow bootstrap.php file from tests/ to be called via browser
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-05-27 08:33:36 +02:00
Michael Kaufmann
3fec579f85 Merge pull request #683 from discordier/hotfix/pcre-maillog
Fixes #682 - mail log parsing regex character group
2019-05-13 20:03:49 +02:00
Christian Schiffler
e2d69c664a Fixes #682 - mail log parsing regex character group
The mail log parsing regex was incorrectly using a character group of `\A`
2019-05-13 19:53:55 +02:00
Michael Kaufmann
72016a5735 fix integrity-check language-file entries
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-05-07 14:03:37 +02:00
Michael Kaufmann
eba163fc4a Merge pull request #677 from pquerner/#646
allow auth basic in URL, fixes #646
2019-04-30 07:14:48 +02:00
Michael Kaufmann
8df6654ad0 Merge pull request #676 from pquerner/#675
use correct validate-ip function in \Froxlor\Validate\Validate::validateUrl, fixes #675
2019-04-30 07:09:20 +02:00
Pascal
1a5e43b6f7 fixes #646
change regex by using well tested regex from here:
https://mathiasbynens.be/demo/url-regex

by @diegoperini
https://gist.github.com/dperini/729294
2019-04-30 00:08:32 +02:00
Pascal
c4c7f4b636 fixes #675
fix call to static method
2019-04-29 23:39:10 +02:00
Michael Kaufmann
9aa0de16be Merge branch 'foliengriller-annotationsAPI' 2019-04-26 12:24:15 +02:00
Michael Kaufmann
cb636fe2c9 Merge branch 'annotationsAPI' of https://github.com/foliengriller/Froxlor into foliengriller-annotationsAPI 2019-04-26 12:23:58 +02:00
Michael Kaufmann
f93dc5643f fix error that wildcard-domains and lets-encrypt are not possible when using ACMEv2; fixes #674
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-04-25 14:20:02 +02:00
Michael Kaufmann
974b151d02 add Debian 10 (Buster) and Ubuntu 18.04 (Bionic) config-templates for TESTING
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-04-25 14:04:15 +02:00
Michael Kaufmann
8835dd0b65 remove deprecated config-templates for Ubuntu 12.04 (Precise); mark Debian 7 (Jessie) and Ubuntu 14.04 (Trusty) as deprecated
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-04-25 14:03:39 +02:00
Michael Kaufmann
626b791c67 remove recursor options in powerdns config template for gentoo, as recursion has been removed in pdns >=4.1.0; fixes #673
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-04-25 13:56:42 +02:00
Michael Kaufmann
82508587b3 update mysql-table engines to InnoDB; fixes #671
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-04-25 13:31:18 +02:00
Michael Kaufmann
0d7fa5728c fix auto-delete of cetificates when no domain exists anylonger, thx to an error-report
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-04-14 08:13:34 +02:00
Michael Kaufmann
29365838b3 set version to 0.10.0-rc1 for upcoming release candidate
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-04-10 08:24:04 +02:00
Michael Kaufmann
13ac7ef66c Merge pull request #666 from sokai/sokai-patch-1
logrotate snipet: (more) GDPR ‚compliant‘; fixes #665
2019-03-16 18:10:19 +01:00
Michael Kaufmann
6764747fa9 use system.defaultttl setting also for SOA record; fixes #667
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-03-16 18:09:21 +01:00
sokai
91df02916c logrotate snipet: GDPR ‚compliance‘
see: https://github.com/Froxlor/Froxlor/issues/665
2019-03-16 13:08:44 +01:00
sokai
bf400fc5f8 logrotate snipet: GDPR ‚compliance‘
see: https://github.com/Froxlor/Froxlor/issues/665
2019-03-16 13:07:49 +01:00
sokai
6cd73c9ebf logrotate snipet: GDPR ‚compliance‘
see: https://github.com/Froxlor/Froxlor/issues/665
2019-03-16 13:07:14 +01:00
sokai
ed9ab39c5e logrotate snipet: GDPR ‚complieance‘
see: https://github.com/Froxlor/Froxlor/issues/665
2019-03-16 13:05:54 +01:00
sokai
678bd1bcdc logrotate snipet: GDPR ‚complieance‘
see: https://github.com/Froxlor/Froxlor/issues/665
2019-03-16 13:05:11 +01:00
sokai
90fe548901 logrotate snipet: GDPR ‚complieance‘
see: https://github.com/Froxlor/Froxlor/issues/665
2019-03-16 13:04:26 +01:00
sokai
a158d4bfb9 logrotate snipet: GDPR ‚complieance‘
see https://github.com/Froxlor/Froxlor/issues/665
2019-03-16 13:02:01 +01:00
Michael Kaufmann
4028e3ba5c testing with new IdnaConverter seems to require php-7.1
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-03-10 17:16:59 +01:00
Michael Kaufmann
f7d24e8870 IdnaConverter repository changed url
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-03-10 17:13:51 +01:00
Michael Kaufmann
b1bbb1847d put log_format directive in correct context (http-context only); refs #663
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-03-08 13:23:38 +01:00
Michael Kaufmann
fb6e231f77 avoid passing non-variable as reference
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-03-01 10:40:01 +01:00
Michael Kaufmann
5786644c76 fix installation for current development for now; fixes #661
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-25 17:13:13 +01:00
Michael Kaufmann
51efba0a8d Check for SSL enabled vhost-container for ssl-related settings in froxlor-vhost-settings; fixes #642
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-24 09:03:03 +01:00
Michael Kaufmann
2f38de90e5 use DbManager for updating the password of a mysql-db
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-24 08:52:50 +01:00
Michael Kaufmann
410bfe2c97 fix typo in phpdoc
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-22 12:59:11 +01:00
Michael Kaufmann
cfae5b7516 fix deleting of certificate when certificate is froxor-vhost-certificate
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-21 14:18:00 +01:00
Michael Kaufmann
6e81c235d9 fix SAN domains for froxlor-vhost-aliases in let's encrypt
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-21 13:51:34 +01:00
Michael Kaufmann
0257149316 fix generation of serveralias in froxlor vhost
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-21 13:41:23 +01:00
Michael Kaufmann
ef331ccc81 Add setting to specify domain aliases for the froxlor-vhost (and add them to the SAN list of let's encrypt certificates if enabled)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-21 12:54:53 +01:00
Michael Kaufmann
b187114c50 output real names in libnss-extrausers passwd file, fixes #659
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-21 10:31:05 +01:00
Michael Kaufmann
fdefd4f1fe fix re-enabling of database users after being deactivated, fixes #660
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-21 10:19:58 +01:00
Michael Kaufmann
4ec32c0972 set keysize to the former default and the default from installation
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-19 10:26:33 +01:00
Michael Kaufmann
111e9bf64b fix typo for getting Settings of lets encrypt keysize when not using ECC
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-19 09:58:28 +01:00
Michael Kaufmann
7d3577d649 fix superfluous ssl_key directive in dovoecot for stretch and xenial
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-18 19:14:48 +01:00
Michael Kaufmann
a8fb0a6d88 check for non-empty required field 'name' in hosting plans, which are still not fully migrated to API, refs #658
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-18 13:07:58 +01:00
Michael Kaufmann
8d628daf83 fix update of acmesh class in cronjobs_run
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-17 21:41:19 +01:00
Michael Kaufmann
010f30bc9e check for upgrade of acme.sh prior to issue/renew certifice, refs #657
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-17 20:48:11 +01:00
Michael Kaufmann
2273a11978 remove unneeded let's encrypt settings; self-update acme.sh only once a day
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-17 20:36:18 +01:00
Michael Kaufmann
5c36b79277 honor setting for let's encrypt key size if needed
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-17 19:47:51 +01:00
Michael Kaufmann
f5127eccd1 outsource acmesh-command to reduce duplicate code
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-17 19:43:12 +01:00
Michael Kaufmann
e962f76b32 Merge branch 'master' of github.com:Froxlor/Froxlor 2019-02-17 19:34:33 +01:00
Michael Kaufmann
6d8521d8dc Merge pull request #657 from patschi/patch-1
Run acme.sh upgrade just once when cron starts
2019-02-17 19:34:21 +01:00
Patrik Kernstock
7b231bb755 Run acme.sh upgrade just once when cron starts
Only run acme.sh upgrade command once when cronjob starts, and not everytime when there's a certificate going to be renewed.
2019-02-17 19:30:03 +01:00
Michael Kaufmann
459cbcc0dd keep re-use old-key setting for Let's Encrypt
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-17 19:25:23 +01:00
Michael Kaufmann
44433ef86e only variables can be passed by reference
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-17 18:24:31 +01:00
Michael Kaufmann
cb8e83bdfa use new AcmeSh class also in froxlor.sql
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-17 17:56:14 +01:00
Michael Kaufmann
84eec155de only empty the certificates if there's actually something to empty
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-17 16:57:03 +01:00
Michael Kaufmann
73a059b318 usinng acme.sh for issuing Let's Encrypt certificates now; please test thoroughly; fixes #651
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-17 16:17:35 +01:00
Michael Kaufmann
39d38eea8d fix missed cronlog variable usage in LetsEncrypt cron
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-15 13:58:29 +01:00
Michael Kaufmann
bfb7f28ff0 add linebreak after LogLevel
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-15 13:21:50 +01:00
Michael Kaufmann
036ec68651 fix unit-tests
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-13 21:59:01 +01:00
Michael Kaufmann
8cebcc8a5d allow DnsZone functions only if dns-editor is enabled AND the customer is allowed to use it
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-13 21:51:24 +01:00
Michael Kaufmann
fbcba3ef4e remove unnecessary if-statement in nginx when redirecting to https, thx to patschi; fixes #653
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-13 15:32:41 +01:00
Michael Kaufmann
fca7b95579 meh it's february already :P
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-12 17:42:36 +01:00
Michael Kaufmann
73c05fb231 add setting for customzing webserver error-log level, fixes #650
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-12 17:38:46 +01:00
Michael Kaufmann
d0fb77f3e9 Merge pull request #648 from princeofnaxos/Fix-english-typos
Corrections to the English texts
2019-02-11 16:18:50 +01:00
Edwin Boersma
32cf6dfaef Re-added missing line. 2019-02-11 16:17:17 +01:00
Michael Kaufmann
8ab86a05b2 disable settings in 'froxlor vhost settings' that wont have any effect if no IP/port has the 'create vHost container' option enabled; fixes #642
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-11 16:08:34 +01:00
Edwin Boersma
79b913131e Corrections to the English texts 2019-02-11 15:59:29 +01:00
Michael Kaufmann
8fd910a92e use correct settings-class
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-10 22:54:05 +01:00
Michael Kaufmann
2ce1a5abb5 ups, where did they go? :P
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-10 22:49:32 +01:00
Michael Kaufmann
8448a7141a do not add task 11 (delete domain from pdns db) if namserver is disabled and dns-server is not PowerDNS
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-09 11:56:15 +01:00
Michael Kaufmann
21f9a24780 remove 'change_date' field from pdns-records table as it is being removed in pdns >=4.2; fixes #645
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-08 07:59:02 +01:00
Michael Kaufmann
1b5e31e59d fallback to default froxlor newsfeed when no custom newsfeed (rss) is given if newsfeed is shown on customer dashboard
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-07 10:05:41 +01:00
Michael Kaufmann
03afbc902d fix static method not being declared as such
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-02 09:05:14 +01:00
Michael Kaufmann
83b760a43b add missing description for task 11
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-02-01 14:17:54 +01:00
Michael Kaufmann
c0e67dc240 fix incorrect usage of class-constant
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-01-30 12:32:06 +01:00
Michael Kaufmann
2166999fef fix logging in Nginx cron
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-01-26 10:23:56 +01:00
Michael Kaufmann
7bb7cc6a00 fix isbinddomain/zonefile field saving when editing domain, fixes #639
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-01-22 08:29:13 +01:00
Michael Kaufmann
8b96912ab4 correctly use system-setting of default-ttl, thx to K1rk
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-01-17 09:26:04 +01:00
Michael Kaufmann
de33ec509b move_to_admin is not a binary value, fixes #637
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-01-16 19:21:50 +01:00
Michael Kaufmann
5ecb43ba73 correct increasing/decreasing of admin-resources
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-01-16 15:14:22 +01:00
Michael Kaufmann
97ff3485b7 fix deletion of admins; fixes #638
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-01-16 10:59:32 +01:00
Michael Kaufmann
98daef7224 Merge pull request #635 from heavygale/patch-3
htpasswd only on configured paths
2019-01-14 06:31:42 +01:00
Max
2983aa5737 htpasswd only on given paths
Only apply htpasswd rules to (sub)domains if the rule's path begins with the domain's document root.
2019-01-14 00:18:26 +01:00
Michael Kaufmann
9a906427e7 ensure the replacing of the stdsubdomain url on update is encoded correctly
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-01-11 08:55:55 +01:00
Michael Kaufmann
7841eebf08 correct handling of storeSettingHostname when system.stdsubdomain is changed; refs #633
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-01-11 00:06:44 +01:00
Michael Kaufmann
b4597d54af create full dns zone if main-but-subdomain has dns enabled but maindomain to that domain does not, fixes #632
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-01-08 12:52:10 +01:00
Michael Kaufmann
19ffc9587a issubof Parameter in Domains.add and Domains.update is not boolean
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-01-08 11:18:53 +01:00
Michael Kaufmann
bbe0a0b3a5 Merge pull request #630 from princeofnaxos/master
Corrections to the Dutch translations
2019-01-07 11:12:37 +01:00
Edwin Boersma
0d30f71097 Corrections to the Dutch translations 2019-01-07 11:06:25 +01:00
Michael Kaufmann
0cc5693180 damn typo
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-01-06 08:54:49 +01:00
Michael Kaufmann
045a62a9db remove duplcate visible-field in admin-edit formfield; fixes #625
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-01-06 08:48:24 +01:00
Michael Kaufmann
725372b6ae add 4th parameter $step to Admins::increaseUsage(); fixes #628
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-01-06 08:45:24 +01:00
Michael Kaufmann
9e77fecc29 removed deprectated create_function statement; fixes #623
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-01-06 08:39:56 +01:00
Michael Kaufmann
44c47fa6eb Merge pull request #629 from PHPGangsta/composer_sugg
added ext-apcu and ext-readline to composer.json suggest block
2019-01-05 16:22:07 +01:00
Michael Kliewe
448de78ea5 added ext-apcu and ext-readline to composer.json suggest block 2019-01-05 13:31:26 +01:00
Michael Kaufmann
f3859052e5 fix getParamListFromDoc() for api doc
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-01-05 07:56:55 +01:00
Michael Kaufmann
2b4199e558 drop ADSP support, fixes #622
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-01-04 20:58:20 +01:00
Michael Kaufmann
b7585585dc also include table-definitions in external api.php
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-01-02 18:46:38 +01:00
Michael Kaufmann
92b133b11d fix Froxlor::listFunction() api-call after namespacing
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2019-01-02 18:36:01 +01:00
Michael Kaufmann
5dda57458a fix incorrect variable
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-28 15:18:56 +01:00
Michael Kaufmann
16efd1191a forgot to remove require of formfield-constants
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-26 21:12:58 +01:00
Michael Kaufmann
1c9d76725c get rid of last function file
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-26 20:54:00 +01:00
Michael Kaufmann
4ee735a81f Merge branch 'namespaces' 2018-12-26 20:38:05 +01:00
Michael Kaufmann
2ba8fa2785 Merge branch 'master' into namespaces 2018-12-26 20:37:47 +01:00
Michael Kaufmann
e64e8cafa6 define logger constants in logger class
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-26 15:51:26 +01:00
Michael Kaufmann
3949a6858b fixed to Cron
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-26 12:00:32 +01:00
Michael Kaufmann
792d25fdd8 add MysqlHandler for Monolog-Logger
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-25 08:48:28 +01:00
Michael Kaufmann
af5ef4b9dc Merge pull request #617 from JB1985/patch-3
Update logfiles_viewer.php
2018-12-25 07:54:10 +01:00
JB1985
bd79022475 Update logfiles_viewer.php
typo
2018-12-24 20:50:38 +01:00
Michael Kaufmann
684130871b forgot one function in Froxlor\PhpHelper
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-24 14:04:52 +01:00
Michael Kaufmann
7416a41a42 get rid of most of the checkstyle warnings
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-24 13:50:45 +01:00
Michael Kaufmann
30f5902b88 fix some more checkstyle issues
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-24 13:21:35 +01:00
Michael Kaufmann
35c631946d more and more checkstyle fixes
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-24 12:59:40 +01:00
Michael Kaufmann
585d42f1b8 more checkstyle fixes
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-24 12:02:26 +01:00
Michael Kaufmann
c3d44b4558 Minor enhancements and starting to comply with checkstyle
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-24 09:35:05 +01:00
Michael Kaufmann
04e87cce98 forgot to add a few statics... :p
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-23 19:49:10 +01:00
Michael Kaufmann
4cd005051b fixed last remaining function calls which are class-methods now
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-23 19:34:32 +01:00
Michael Kaufmann
e1987af34d [CI] add composer to build.xml; run PHPCompatibility check; run only phpunit in travis
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-23 10:39:27 +01:00
Michael Kaufmann
17c6b11a1b remove superfluous inserttask
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-22 21:11:43 +01:00
Michael Kaufmann
7170fab884 fix build-testing on jenkins
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-22 20:32:36 +01:00
Michael Kaufmann
7f82038255 fix up some cron related things
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-22 20:01:10 +01:00
Michael Kaufmann
c1cd0004bf fix saving of settings
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-22 15:52:20 +01:00
Michael Kaufmann
b43a63d665 also regenerate quota and cron.d if settings have changed
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-22 13:44:41 +01:00
Michael Kaufmann
3794003e63 minor fixes here and there
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-22 13:42:10 +01:00
Michael Kaufmann
13aa19e5f4 got rid of all global functions, I guess
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-22 13:28:51 +01:00
Michael Kaufmann
28bb614489 begin refactoring of form-stuff
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-22 11:57:54 +01:00
Michael Kaufmann
085d25346d remove unneeded include of functions.php
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-22 10:37:33 +01:00
Michael Kaufmann
685267d6fc fix CLI scripts
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-22 10:36:01 +01:00
Michael Kaufmann
0401e6971a Revert "refactor global array"
This reverts commit c5a58e3f36.
2018-12-22 08:15:31 +01:00
Michael Kaufmann
7e39a7bc60 Revert "refactor global array"
This reverts commit 370ccbdb74.
2018-12-22 08:15:31 +01:00
Michael Kaufmann
c800e89414 Revert "fix wrong usage of \Froxlor\User::getAll()"
This reverts commit 48ff2e6b6d.
2018-12-22 08:15:31 +01:00
Michael Kaufmann
e719731de0 Revert "argh..."
This reverts commit fed9efff41.
2018-12-22 08:15:30 +01:00
Michael Kaufmann
fed9efff41 argh...
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-21 21:00:35 +01:00
Michael Kaufmann
48ff2e6b6d fix wrong usage of \Froxlor\User::getAll()
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-21 20:56:47 +01:00
Michael Kaufmann
370ccbdb74 refactor global array
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-21 20:51:44 +01:00
Michael Kaufmann
c5a58e3f36 refactor global array
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-21 20:31:17 +01:00
Michael Kaufmann
5fa0f4b87e ugh, where was 2fa integration gone?
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-21 19:25:06 +01:00
Michael Kaufmann
7c68fa7bd0 fixed a few functions I've missed
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-21 19:16:49 +01:00
Michael Kaufmann
7563907df5 convert html-related functions
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-21 18:31:06 +01:00
Michael Kaufmann
def3d6d19e forgot generateDkimEntries()
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-21 17:56:23 +01:00
Michael Kaufmann
59453a47fa fix dns-related function calls
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-21 17:51:29 +01:00
Michael Kaufmann
1b090377ee even more function to class conversion
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-21 17:41:22 +01:00
Michael Kaufmann
b0e11f5708 and more and more and more
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-21 17:00:54 +01:00
Michael Kaufmann
a819d81ef2 more function reducing and fixing
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-21 16:53:04 +01:00
Michael Kaufmann
0a28ef2af6 minor changes for unit-tests
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-21 16:32:44 +01:00
Michael Kaufmann
1ba4164028 add new PHPMail Wrapper to avoid multiple setting of properties
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-21 14:49:55 +01:00
Michael Kaufmann
f9ad392e39 remove refactored functions
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-21 13:00:39 +01:00
Michael Kaufmann
97b5439c0d auto-format all files; add table-definitions to test-bootstrap file
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-21 12:24:07 +01:00
Michael Kaufmann
1ff784198c adjust paths to classes
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-21 11:31:41 +01:00
Michael Kaufmann
05402a4a1c add new namespaces branch to travis testing
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-21 11:26:25 +01:00
Michael Kaufmann
dd8fbf0900 add new namespaces branch to travis testing
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-21 11:25:48 +01:00
Michael Kaufmann
c0e89bbd05 refactor UI functions
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-21 11:22:03 +01:00
Michael Kaufmann
b0df4e46d6 convert validate/check functions
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-20 21:00:39 +01:00
Michael Kaufmann
5888927239 get rid of more functions
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-20 12:38:18 +01:00
Michael Kaufmann
f263175802 more function reduction
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-20 09:57:00 +01:00
Michael Kaufmann
bed069f269 more function moving
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-20 08:33:32 +01:00
Michael Kaufmann
8c896d60d6 get rid of some more functions
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-20 07:43:40 +01:00
Michael Kaufmann
adc627ca4e minor fixes to template engine for now
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-19 20:38:29 +01:00
Michael Kaufmann
d654b18517 get rid of storeSetting*-functions
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-19 19:58:14 +01:00
Michael Kaufmann
26510f0745 removing more ticket-stuff; update all unit-tests
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-19 19:42:50 +01:00
Michael Kaufmann
60f1db5caf LetEncrypt cronjob refactoring
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-19 17:31:03 +01:00
Michael Kaufmann
549ccda166 use safe_exec from class now
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-19 17:19:56 +01:00
Michael Kaufmann
c4024c8107 use correct makeCorrect(Dir/File) everywhere
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-19 17:13:41 +01:00
Michael Rosenberger
98f6ad183e Corrects annotations in API 2018-12-19 16:58:52 +01:00
Michael Kaufmann
8e84a4ff44 correct use of Database use
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-19 16:57:03 +01:00
Michael Kaufmann
2c893fef25 adjustments in settings-arrays
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-19 14:54:46 +01:00
Michael Kaufmann
e4a0cc73bd convert three more dns-related functions
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-19 14:38:45 +01:00
Michael Kaufmann
4c4b2a6df3 use TwoFactorAuth via composer
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-19 14:12:42 +01:00
Michael Kaufmann
28f24fda72 ported CLI stuff to namespaces-layout
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-19 13:59:11 +01:00
Michael Kaufmann
3ff20e327f removed ticketsystem; lots of work on cron stuff
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-19 13:09:14 +01:00
Michael Kaufmann
903b775f79 make cronjobs also classes and began to refactor the whole cronjob stuff
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-19 08:55:23 +01:00
Michael Kaufmann
a25150babf use correct Settings-class in templates
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-18 15:53:08 +01:00
Michael Kaufmann
a2f205bae3 Update class.SImExporter.php 2018-12-18 15:52:19 +01:00
Michael Kaufmann
a0125bb93e Update function.setCycleOfCronjob.php 2018-12-18 15:51:48 +01:00
Michael Kaufmann
6329042d40 use namespaces in modules
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-18 13:45:05 +01:00
Michael Kaufmann
9d314aaa3f use Monolog via composer instead of our own implementation, @TODO MySQL logging-handler
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-18 12:16:48 +01:00
Michael Kaufmann
fc0a495f2d use PHPMailer via composer
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-18 10:49:18 +01:00
Michael Kaufmann
c9ee2ae7e0 use IdnaConvert from composer
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-18 10:40:16 +01:00
Michael Kaufmann
4c27efa4ae put Api-Commands into namespaces
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-18 09:46:36 +01:00
Michael Kaufmann
c7e5df95e7 add psr-4 autoload to composer.json
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-18 08:40:04 +01:00
Michael Kaufmann
c3cc3d1f62 started to refactor functions to classes and use PSR-4 autoloader and namespacing
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-18 08:38:34 +01:00
Michael Kaufmann
ba93265ac6 Merge branch 'ServiusHack-write_no_log' 2018-12-17 12:22:02 +01:00
Michael Kaufmann
bf7df9a8d6 Merge branch 'write_no_log' of https://github.com/ServiusHack/Froxlor into ServiusHack-write_no_log 2018-12-17 12:21:49 +01:00
Michael Kaufmann
8b0966d332 do not generate ssl vhost with fallback ssl-certificate if file does not exist, fixes #614
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-16 20:21:53 +01:00
Michael Kaufmann
aa90747089 fix deleting of Certificates as admin with customer_see_all flag
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-16 09:27:31 +01:00
Michael Kaufmann
efe54d8b56 enhance config-services script a bit
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-15 22:22:37 +01:00
Michael Kaufmann
1e816de8cf refactor domainValidate() function; allow underscore in CNAME and SRV entries
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-14 11:51:19 +01:00
Michael Kaufmann
e3a78f0f84 Merge pull request #612 from foliengriller/install
Checks Mysql version only if no fatal error occured
2018-12-12 21:12:12 +01:00
Michael Rosenberger
d0c7706840 Checks Mysql version only if no fatal error occured
Otherwise it is not possible to install current master due to fatal error.
2018-12-12 20:54:56 +01:00
Michael Kaufmann
1a15cef76d when using --force on the cronjob it will now also re-set quotas if enabled
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-12 19:49:46 +01:00
Michael Kaufmann
dc44c67f86 do not show 'override fpmconfig' checkbox when not using php-fpm in php-configs
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-12 19:48:56 +01:00
Michael Kaufmann
ab819129dd return the subdomain-names in PhpSettings::listing() instead of only the amount
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-11 11:45:39 +01:00
Michael Kaufmann
8d966aebee Show number of subdomains that use a php-config; fixes #532
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-11 10:12:37 +01:00
Michael Kaufmann
4988600881 added new indicator whether services/system has been configured (on new installations); show alternative configuration possibility via config-services.php script
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-10 20:34:43 +01:00
Michael Kaufmann
d381528c06 reload fpm before nginx
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-09 11:51:43 +01:00
Michael Kaufmann
3d647a2c2e fix read in correct fpm-daemon config-id for nginx and lighttpd own-vhost, thx again to heavygale
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-09 11:05:36 +01:00
Michael Kaufmann
7e6180fed8 read in correct fpm-daemon config-id for nginx and lighttpd, thx to heavygale
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-09 10:45:22 +01:00
Michael Kaufmann
9e4ed645f7 use correct page title for php-fpm versions
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-09 10:29:19 +01:00
Michael Kaufmann
9522e0cfb1 fix typo and fix '"continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"' warning (as of php-7.3)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-09 08:31:21 +01:00
Michael Kaufmann
db36d57683 fix an issue where the isemaildomain flag for a main-domain can be set to false when edited by customer
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-08 12:46:17 +01:00
Michael Kaufmann
ddddbdfb18 Merge pull request #609 from foliengriller/annotations
Improves annotations in /lib/classes/api/
2018-12-04 22:03:07 +01:00
Michael Rosenberger
df3ad9ed12 Improves annotations for API 2018-12-04 21:58:46 +01:00
Michael Kaufmann
456875905d set password compatibility for mysql8
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-04 19:52:18 +01:00
Michael Kaufmann
1707b5e7fd fix create user for mysql8 for good, thx to bimmer
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-04 17:33:58 +01:00
Michael Kaufmann
034d1b1c8e correct syntax for CREATE USER when using mysql8
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-04 15:42:05 +01:00
Michael Kaufmann
5dd915736b changed all boolean parameters to getBoolParam-function
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-04 14:40:11 +01:00
Michael Kaufmann
07d7908f6e added wrapper for boolean api-parameters, Domains-Module for now, more later; fixes #597
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-04 13:27:21 +01:00
Michael Kaufmann
cf53365007 update README and CONTRIBUTING files; added PULL_REQUEST_TEMPLATE; database user-creation fix for MySQL8
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-04 10:52:49 +01:00
Michael Kaufmann
1f2c1c1d2f Merge pull request #608 from foliengriller/openssl1
Ads missing extension openssl to composer.json
2018-12-03 21:41:30 +01:00
Michael Kaufmann
51390d8add Merge pull request #607 from foliengriller/caseMissmatch1
Corrects case missmatch of function calls
2018-12-03 21:37:35 +01:00
Michael Rosenberger
98120de7e1 Ads missing extension openssl to composer.json 2018-12-03 21:37:17 +01:00
Michael Rosenberger
88a2cb37c9 Case missmatch of function calls 2018-12-03 21:30:12 +01:00
Michael Kaufmann
ec4d34d37a let's see if that works :P
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-03 17:29:42 +01:00
Michael Kaufmann
0b3d532028 ups, how did these get lost?
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-03 17:18:44 +01:00
Michael Kaufmann
4a0be40f92 require php-5.6 for 0.10.0; fixes #606 and remove invalid value NO_AUTO_CREATE_USER in mysql-attributes for mysql8
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-03 17:15:54 +01:00
Michael Kaufmann
2da59f1055 do not rely on fixed order of import-file for domains-import; first line now has to be the names of the api-parameters used for Domains.add, see https://api.froxlor.org/doc/0.10.0/#v-Domains, fixes #544
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-02 20:06:53 +01:00
Michael Kaufmann
1ca1314ac4 fix typo in updater
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-02 19:27:50 +01:00
Michael Kaufmann
426e46a2df show registration date of domain (if given) in admin and customer domain-list, fixes #553
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-02 11:50:45 +01:00
Michael Kaufmann
212cb0140d ups minor CSS typo, refs #603
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-01 15:06:16 +01:00
Michael Kaufmann
8291c7d2ab Allow access to webserver logs via weinterface, if activated for customer; todo: view more content dynamically; fixes #603
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-12-01 13:33:08 +01:00
Michael Kaufmann
1bd4c00631 forgot to replace frontend variables with replacer
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-30 13:55:08 +01:00
Michael Kaufmann
69495b94af add 2FA mechanism, fixes #547
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-30 13:45:17 +01:00
Michael Kaufmann
29c754e700 add new CUSTOMER_HOMEDIR replacer for php-configs, thx to rubberduck for the hint
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-29 09:37:18 +01:00
Michael Kaufmann
fd69fc22db format composer.json and add php-7.0 as dev-requirement (phpunit6); add unit-test for Backup.add() when customer passes / as path value
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-28 13:17:44 +01:00
Michael Kaufmann
c7bee4edf2 update 0.9.x updater according to latest bugfix-release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-27 18:53:37 +01:00
Michael Kaufmann
9756c792d7 disable sending of emails when running tests completely when run on travis
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-27 12:05:56 +01:00
Michael Kaufmann
a86f10a4b4 fix typo in function name, refs #601
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-27 11:49:32 +01:00
Michael Kaufmann
946c2507c5 last try before i branch for testing this - next time, really
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-26 22:00:50 +01:00
Michael Kaufmann
56ac4b5c26 last try before i branch for testing this :P
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-26 21:57:15 +01:00
Michael Kaufmann
e4becfb1dd add missing php-invoker stuff
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-26 21:50:35 +01:00
Michael Kaufmann
6129768711 actually use the required phpunit version pulled from composer
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-26 21:38:36 +01:00
Michael Kaufmann
72690e311f add specific phpunit version to dev-requirements
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-26 21:33:40 +01:00
Michael Kaufmann
2ef067e12d set a few settings according to the test-system
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-26 21:05:57 +01:00
Michael Kaufmann
ae71e3ad2a new try with travis-ci #last-really
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-26 20:29:27 +01:00
Michael Kaufmann
745621c416 new try with travis-ci #last
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-26 20:23:56 +01:00
Michael Kaufmann
069ccd24e6 new try with travis-ci #3
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-26 20:16:15 +01:00
Michael Kaufmann
76b5f813c5 new try with travis-ci #2
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-26 20:12:32 +01:00
Michael Kaufmann
9ad6616fa3 new try with travis-ci
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-26 20:09:27 +01:00
Michael Kaufmann
4dca2d6217 travis-ci testing...
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-26 20:00:40 +01:00
Michael Kaufmann
eab88abd54 Merge pull request #596 from foliengriller/composer-json
Adds first composer.json file
2018-11-26 20:00:08 +01:00
Michael Kaufmann
ea3c49befe Update composer.json 2018-11-26 19:56:39 +01:00
Michael Kaufmann
e1bfb2690d Update composer.json 2018-11-26 19:53:34 +01:00
Michael Kaufmann
091f92400b move integer-conversion of array to the place where the array is known
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-26 12:21:02 +01:00
Michael Kaufmann
18df961381 ensure allowed_phpconfigs parameter for Customers.add() and Customers.edit() is an integer-array, fixes #598
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-26 12:14:53 +01:00
Michael Kaufmann
18c49e4c48 Merge pull request #595 from foliengriller/gitignore
Improves gitignore and deletes unused .keep in /logs
2018-11-26 06:51:53 +01:00
Michael Rosenberger
4da9d4c7c0 Adds first composer.json file 2018-11-25 23:24:30 +01:00
Michael Rosenberger
9a528532d2 Improves gitignore and deletes unused .keep in /logs 2018-11-25 21:49:41 +01:00
Michael Kaufmann
96addebdf3 Merge pull request #594 from Broatcast/patch-1
Change formfield id for new admins
2018-11-25 17:42:06 +01:00
Michael Kaufmann
49adcb6886 Merge branch 'heavygale-master' 2018-11-25 17:38:05 +01:00
Michael Kaufmann
ed86c2a892 Merge branch 'master' of https://github.com/heavygale/Froxlor into heavygale-master 2018-11-25 17:37:52 +01:00
Robert Kuntz
7c7ef5be09 Change formfield id for new admins
little Bug, requested "new_loginname" instead of "loginname"
2018-11-25 17:30:48 +01:00
Michael Kaufmann
c269cd5c5c added unit-tests for version-check; implemented settings import/export in API; minor variable declarations
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-25 11:17:56 +01:00
Michael Kaufmann
f6e0298d25 more api-documentation and code-formatting
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-25 10:04:09 +01:00
Michael Kaufmann
983e1ce6ad add more api documenation
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-24 19:49:27 +01:00
Michael Kaufmann
a87f1c5561 trim ip-addresses for validation as they are invalid with leading/trailing spaces
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-24 07:53:08 +01:00
Michael Kaufmann
9d82f0d269 Merge pull request #593 from foliengriller/master
Improves CSS in installer
2018-11-23 14:55:14 +01:00
Michael Rosenberger
32b5bef221 Improves CSS in installer
Correct alignment of radio options
Fixes design-problem with chrome
2018-11-23 14:34:11 +01:00
Michael Kaufmann
50eec8d8a7 Merge pull request #592 from foliengriller/master
Some minor CSS improvements
2018-11-23 11:18:45 +01:00
Michael Kaufmann
fc8373f6b6 fix unit-test testCustomerEmailForwardersDelete() to comply with new testCustomerEmailForwardersAddWithSpaces()
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-23 09:06:23 +01:00
Michael Kaufmann
1d3d8d0f28 trim email address when added as forwarder, fixes #591
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-23 09:03:35 +01:00
Michael Rosenberger
b9e4adc634 Some minor CSS improvements
- Removes unit if value is 0
- Uses shorthand notation where possible

Signed-off-by: Michael Rosenberger <mr@simpelwebservice.de>
2018-11-22 23:38:54 +01:00
Michael Kaufmann
3a3b35b2eb add ipv6 support for resolving nameserver-hostnames
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-21 19:26:19 +01:00
Michael Kaufmann
8a565532b2 more api-doc
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-19 20:38:18 +01:00
Michael Kaufmann
02ba4b5f67 Merge branch 'master' of github.com:Froxlor/Froxlor 2018-11-18 20:35:47 +01:00
Michael Kaufmann
b032f5b2ba add dhparams for webserver/ssl, refs #519
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-18 20:35:27 +01:00
Michael Kaufmann
758111a7c1 Merge pull request #589 from heavygale/patch-2
Update list.tpl
2018-11-18 15:20:34 +01:00
Max
ba124c99af Update list.tpl 2018-11-18 15:09:59 +01:00
Michael Kaufmann
776bb56b24 add more phpdoc to DomainZones ApiCommand; minor fixes in DirOptions and DirProtections
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-18 15:07:06 +01:00
Michael Kaufmann
d2024e06ff more phpdoc in DirOptions and DirProtections
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-18 14:54:20 +01:00
Michael Kaufmann
8c8be45769 added more phpdoc for api-documentation
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-18 14:39:20 +01:00
Michael Kaufmann
892d259805 Also remove DNS zones of deleted Subdomains, refs #581
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-17 20:19:29 +01:00
Michael Kaufmann
13c624400e remove domain from pdns database if removed or updated so nameserver is disabled (remove) or update of db triggered when isemaildomain option is disabled, fixes #581
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-17 20:14:58 +01:00
Michael Kaufmann
e184201327 minor cosmetic changes and new create_customer api example
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-13 08:30:41 +01:00
Michael Kaufmann
059e36aa78 finish testing of Traffic ApiCommand
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-12 07:44:35 +01:00
Michael Kaufmann
18aa8eb5d2 added Traffic.listing ApiCommand; added first Unit-Tests for Traffic-Api; SQL IN-clause cannot be prepared, replaced all occurances accordingly; added --no-fork parameter to traffic-cron
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-11 21:51:39 +01:00
Michael Kaufmann
41acbc745c Merge remote-tracking branch 'origin/0.10.0' 2018-11-10 12:03:23 +01:00
Michael Kaufmann
ab81004bf2 Merge branch 'master' into 0.10.0 2018-11-10 11:58:17 +01:00
Michael Kaufmann
d80cf6525c Merge remote-tracking branch 'origin/master' into 0.10.0 2018-11-10 11:55:39 +01:00
Michael Kaufmann
247efb1c0a set version to 0.9.40 for upcoming release
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-10 11:34:50 +01:00
Michael Kaufmann
e1b62d3af4 outsource apihelp to api.froxlor.org
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-11-10 07:17:13 +01:00
Michael Kaufmann
b340221055 update Traffic Api-Command
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-10-29 08:56:23 +01:00
Michael Kaufmann
e16ea186dc add some more unit-tests for Cronjobs and PhpSettings
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-10-28 13:47:19 +01:00
Michael Kaufmann
ce2722d429 forgot to tell phpunit which files is being covered, stupid copy'n'paste
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-10-28 09:00:04 +01:00
Michael Kaufmann
e0a195e3bc forgot to add tests/Cronjobs to the unit-test directories
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-10-28 08:57:43 +01:00
Michael Kaufmann
899a7ac189 add Cronjobs API command ad unit-tests
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-10-28 08:53:25 +01:00
Michael Kaufmann
fb4d379047 Merge remote-tracking branch 'origin/master' into 0.10.0 2018-10-27 19:57:55 +02:00
Michael Kaufmann
98c55435ae Merge pull request #583 from heavygale/patch-1
Update archive.tpl
2018-10-27 17:14:28 +02:00
Max
981f5840b3 Update archive.tpl 2018-10-27 14:57:27 +02:00
Michael Kaufmann
4efdb0cd66 add example of API usage
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-10-27 10:56:42 +02:00
Max
06dcaeacb5 Update german.lng.php 2018-10-21 12:02:10 +02:00
Max
14112bf5d7 Update german.lng.php 2018-10-20 16:39:21 +02:00
Max
c55ef54937 Update german.lng.php 2018-10-20 16:37:24 +02:00
heavygale
2e65de176b Update lng/german.lng.php 2018-10-20 16:10:27 +02:00
Michael Kaufmann
3b31cd8432 Merge remote-tracking branch 'origin/master' into 0.10.0 2018-10-20 14:06:19 +02:00
Michael Kaufmann
c1809fc084 Merge pull request #579 from quthla/patch-1
Add TLSv1.3
2018-10-20 14:02:17 +02:00
quthla
090bdaaea8 Add TLSv1.3 2018-10-20 13:29:25 +02:00
Michael Kaufmann
611bec6849 Merge pull request #578 from stweil/lgtm
Fix warnings from LGTM
2018-10-17 11:55:36 +02:00
Stefan Weil
8cf797374d Add missing variable declarations
This fixes warnings from LGTM:

    Variable i is used like a local variable,
    but is missing a declaration.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-17 11:49:59 +02:00
Stefan Weil
20177e06fc Add missing semicolons
This fixes warnings from LGTM:

    Avoid automated semicolon insertion (91% of all statements
    in the enclosing function have an explicit semicolon).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-17 11:45:25 +02:00
Severin Leonhardt
d76df274f4 Make writing AccessLog and ErrorLog optional 2018-10-11 19:07:09 +02:00
Michael Kaufmann
95b305b865 Merge remote-tracking branch 'origin/master' into 0.10.0 2018-10-11 14:57:53 +02:00
Michael Kaufmann
aa6f3d33eb clearify description and enhance validation for path-field in backup-job-planning
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-10-11 14:52:45 +02:00
Michael Kaufmann
b6e4dbd70a fix saving of apikey allowed-from setting
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-10-09 10:37:27 +02:00
Michael Kaufmann
854986abcb add some more function-doc; add setting to enable/disable api in system-settings; added last three api-command classes (empty so far)
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-10-08 09:35:15 +02:00
Michael Kaufmann
c35407bc94 fix undefined debug-flag if not present
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-09-30 10:18:19 +02:00
Michael Kaufmann
5752f7b64e Merge remote-tracking branch 'origin/master' into 0.10.0 2018-09-30 10:04:15 +02:00
Michael Kaufmann
23d4bee184 add override-required info to php-config edit formfields like in add formfields, refs #573
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-09-28 11:00:56 +02:00
Michael Kaufmann
37988fa645 forgot to add override_fpmconfig flag to panel_phpconfigs, refs #573
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-09-28 10:57:43 +02:00
Michael Kaufmann
6c7ee0c222 add possibility to specify pm-related settings per php-config (if override of fpm-daemon settings is set to yes), fixes #573
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-09-28 10:55:08 +02:00
Michael Kaufmann
108c4c25b3 move 'enable http/2' setting from froxlor-vhost-settings to webserver-settings, fixes #575
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-09-26 13:29:30 +02:00
Michael Kaufmann
095e54d88d fix missing update in version.inc.php
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-09-25 08:17:31 +02:00
Michael Kaufmann
70cb760862 fix missing update in version.inc.php
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-09-25 08:16:54 +02:00
Michael Kaufmann
738e629eec Merge remote-tracking branch 'origin/master' into 0.10.0 2018-09-25 08:14:16 +02:00
Michael Kaufmann
bd036a0fde remove unnecessary string-break; use standardlanguage-variable as fallback language for installer
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-09-25 08:12:21 +02:00
Michael Kaufmann
f766c6f920 Merge pull request #572 from markuspetermann/master
Fixed class.lescript_v2.php to work with ACMEv2
2018-09-25 08:09:16 +02:00
Markus Petermann
4588bc7f5c Merge branch 'master' of github.com:markuspetermann/Froxlor 2018-09-19 15:14:46 +02:00
Markus Petermann
9e289a2380 Fixed class.lescript_v2.php to work with ACMEv2
Account(kid) needs to be saved for future requests.
Install/Update part is untested.
2018-09-19 15:11:27 +02:00
Michael Kaufmann
f0edf97ac7 do not follow url location/redirect when using LE selfcheck
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-09-19 11:15:42 +02:00
Michael Kaufmann
91195fda89 check for all needed php extensions and mysqldump tool in setup process, fixes #569
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-09-19 11:15:03 +02:00
Michael Kaufmann
6161ad1bd3 make CURLOPT_FOLLOWLOCATION optional in HttpClient::urlGet
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-09-19 11:09:27 +02:00
Michael Kaufmann
f72d87228b restrict sending of emails when user is locked
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-09-19 11:07:54 +02:00
Markus Petermann
4f0acd176a Fixed class.lescript_v2.php to work with ACMEv2
Account(kid) needs to be saved for future requests.
Install/Update part is untested.
2018-09-18 02:20:17 +02:00
Markus Petermann
5f29b2cc4a Fixed class.lescript_v2.php to work with ACMEv2
When requesting a certificate for multiple Domains/SANs, the request must be done in a single order.
2018-09-18 00:53:51 +02:00
Michael Kaufmann
164f1a921e Merge pull request #570 from markuspetermann/patch-1
Fixed class.lescript_v2.php to work with ACMEv2
2018-09-15 13:25:01 +02:00
markuspetermann
94c4d52476 Fixed class.lescript_v2.php to work with ACMEv2
As GET /document never returns any Reply-Nonce Header, getLastNonce() caused an infinite loop.
The Content-Type for v2 must be application/jose+json.
2018-09-15 12:41:27 +02:00
Michael Kaufmann
174739bc0c Merge remote-tracking branch 'origin/master' into 0.10.0 2018-08-15 10:59:36 +02:00
Michael Kaufmann
b777053133 allow a higher amount of diskspace and traffic to be entered in the forms, fixes #560
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-08-15 10:59:16 +02:00
Michael Kaufmann
d0c2888508 Merge pull request #494 from xelaz/master
extend nginx letsencrypt (.well-known) redirect regex to https
2018-08-15 08:03:45 +02:00
Michael Kaufmann
ff8afef614 Merge pull request #563 from Froxlor/revert-561-patch-1
Revert "acme challenges can include hyphens (-)"
2018-08-12 18:11:45 +02:00
Michael Kaufmann
a28b2e8115 Revert "acme challenges can include hyphens (-)" 2018-08-12 18:11:36 +02:00
Michael Kaufmann
b0e348a2c5 Merge pull request #561 from oliverrahner/patch-1
acme challenges can include hyphens (-)
2018-08-12 17:09:03 +02:00
Oliver Rahner
512abda38d acme challenges can include hyphens (-)
made a small adjustment so that acme challenges like "CrgFuFZU-U7mwXxjjHZi8if851XGVjdPRtWN91LTWmM" also don't get redirected
2018-08-09 16:33:27 +02:00
Michael Kaufmann
963c7c4616 Merge remote-tracking branch 'origin/master' into 0.10.0 2018-07-10 09:47:20 +02:00
Michael Kaufmann
1690cadab9 show link to clear plaintext email account passwords if enabled; set store-plaintext-passwords default to 'off'; fixes #557
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
2018-07-10 09:47:01 +02:00
Michael Kaufmann
9e7715430b fix editing api-keys as customer
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2018-06-23 09:27:56 +02:00
Michael Kaufmann
4f69571e1c do not reload current page after apikey modification to prevent unwanted actions being executed (addKey)
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2018-06-22 10:13:48 +02:00
Michael Kaufmann
d4312fc481 update jquery/jquery-ui; fininshed api_key editing (needs a bit more validating); added PhpSettings-Unit-test
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2018-06-22 10:05:04 +02:00
Michael Kaufmann
f1d91dfef8 interface adjustments for apikey interaction
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2018-06-21 08:21:27 +02:00
Michael Kaufmann
f198833f8c Merge remote-tracking branch 'origin/master' into 0.10.0 2018-06-21 08:12:00 +02:00
Michael Kaufmann
da99398561 update jquery-ui
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2018-06-21 07:55:35 +02:00
Michael Kaufmann
436d141bd1 fix ticket access when posting answer
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2018-06-21 07:52:11 +02:00
Michael Kaufmann
aa881560cc deny access to tickets not owned by current user, thx to chbi
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2018-06-19 21:46:11 +02:00
Michael Kaufmann
06ef81cc5b adjust year in copyright in std-customer-index file, thx to demlak
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2018-06-17 09:41:31 +02:00
Michael Kaufmann
4a99e4ba57 Merge pull request #556 from nachtgeist/master
fix triggering an LE CSR when changing www on a main domain, fixes #526
2018-06-05 07:52:03 +02:00
Daniel Reichelt
2ba4137e7d fix triggering an LE CSR when changing www on a main domain
Prior to this, LE CSRs were triggered only when the wwwserveralias was
changed on alias domains, but not on main domains.

Fixes #526
2018-06-05 06:51:20 +02:00
Daniel Reichelt
72835c56ad trim trailing whitespace 2018-06-05 06:51:10 +02:00
Michael Kaufmann
d39cebc70e Merge remote-tracking branch 'origin/master' into 0.10.0 2018-06-01 08:01:09 +02:00
Michael Kaufmann
b80bdcbc4f forgot to add version file
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2018-05-29 15:54:44 +02:00
Michael Kaufmann
c1e62e6be7 get rid of serialization completely to avoid possible code execution, fixes #555
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2018-05-29 15:47:41 +02:00
Michael Kaufmann
10330f8a7a fix fallback redirect code when customredirect is enabled and default is selected
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2018-05-24 17:44:36 +02:00
Michael Kaufmann
18fb422a69 correct order of settings
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2018-05-24 14:50:52 +02:00
Michael Kaufmann
f8236dff7b fix not quite correctly webserver-log-piping
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2018-05-24 14:44:59 +02:00
Michael Kaufmann
8ccb898aa9 Merge remote-tracking branch 'origin/master' into 0.10.0 2018-05-24 13:25:24 +02:00
Michael Kaufmann
bad680cfdb enhancements for webserver-log settings
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2018-05-24 13:23:37 +02:00
Michael Kaufmann
5a070d6d91 add settings to customize webserver logs
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2018-05-24 11:36:13 +02:00
Robert Förster (Dessa)
07a3f76568 remove wheezy configs 2018-05-10 16:42:27 +02:00
Michael Kaufmann
d07d63e240 Merge remote-tracking branch 'origin/master' into 0.10.0 2018-05-07 10:57:55 +02:00
Michael Kaufmann
67b95a301b check only for existing .conf files when trying to find out whether a fpm pool config directory is empty; fixes #543
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2018-05-06 14:38:18 +02:00
Michael Kaufmann
926914788f Merge remote-tracking branch 'origin/master' into 0.10.0 2018-04-25 12:30:00 +02:00
Michael Kaufmann
6f9187d1bb Merge branch 'master' of github.com:Froxlor/Froxlor 2018-04-25 12:29:41 +02:00
Michael Kaufmann
84b8cda7ac allow usage of up to 255 characters in a txt record, fixes #548
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2018-04-25 12:29:30 +02:00
Michael Kaufmann
75616cc727 fix typo in german language file
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2018-04-25 12:27:59 +02:00
Michael Kaufmann
b3d018c506 corrected usage of default redirect code from settings; fixes #546
Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
2018-04-25 12:27:40 +02:00
Robert Förster (Dessa)
2508d855e3 deprecate precise, as xenial configs are now available 2018-04-03 13:12:32 +02:00
Erik
a21f3c5a3f added xenial.xml (#533)
* added xenial.xml

* fixed touch commands as in commit 3c802038f2

* changed a2dismod php to a2dismod php7.0

* fixed overlooked a2dismod php to a2dismod php7.0
2018-04-03 12:59:14 +02:00
Michael Kaufmann (d00p)
060115c5e9 added new ApiParameterTest
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-04-01 10:35:55 +02:00
Michael Kaufmann (d00p)
697d972fba Merge remote-tracking branch 'origin/master' into 0.10.0 2018-04-01 10:35:33 +02:00
Michael Kaufmann (d00p)
3f69c97874 opzimize ApiParameter::getModFunctionString(); corrected FpmDaemons::update(); added a few more unit-tests
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-04-01 10:31:38 +02:00
Michael Kaufmann (d00p)
85407abfb4 optimize stats-folder-decision in Customers-ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-04-01 09:59:25 +02:00
Michael Kaufmann
20d9be537a Merge pull request #542 from d00p/patch-1
Update README.md
2018-03-29 13:11:11 +02:00
Michael Kaufmann
30d39d622d Update README.md 2018-03-29 13:10:33 +02:00
Michael Kaufmann (d00p)
e58192edc2 show whether curl extension is installed when trying to check for a new version in admin-dashboard
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-29 11:11:39 +02:00
Michael Kaufmann (d00p)
d15e4a8270 more unit-tests
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-27 14:43:24 +02:00
Michael Kaufmann (d00p)
45d7307a8f fix phpunit test for FpmDaemonTest
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-26 14:33:43 +02:00
Michael Kaufmann (d00p)
bf3ae3009f add tests/PhpAndFpm to phpunit-testsuite
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-26 14:28:32 +02:00
Michael Kaufmann (d00p)
cb3d5f3488 unit-test FpmDaemons-ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-26 14:26:05 +02:00
Michael Kaufmann (d00p)
efb416ae7c phpdoc for Admins-ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-26 10:13:51 +02:00
Michael Kaufmann (d00p)
c98be3c04f finished unit-tests for Mysqls-ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-26 09:53:09 +02:00
Michael Kaufmann (d00p)
6006b16c95 added first test for Mysqls-ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-25 12:38:57 +02:00
Michael Kaufmann (d00p)
c149cbacf7 more DomainZones unit-tests
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-23 13:35:50 +01:00
Michael Kaufmann (d00p)
48d7110779 add first unit tests for DomainZones ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-22 14:56:18 +01:00
Michael Kaufmann (d00p)
bd7f2c2654 add unit-tests for CustomerBackup-ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-21 20:22:43 +01:00
Michael Kaufmann (d00p)
5123b5fccd fix error-display in dns_editor.php
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-20 08:55:14 +01:00
Michael Kaufmann (d00p)
190c95baca created DomainZones ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-19 21:25:23 +01:00
Michael Kaufmann (d00p)
975d46044d added unit-tests for DirOptions
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-19 20:38:59 +01:00
Michael Kaufmann (d00p)
bf589cdec8 forgot to check for customer-id in CustomerBackups.delete()
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-19 10:52:38 +01:00
Michael Kaufmann (d00p)
715e5f7a64 fix update of domain as admin if domain is a std-subdomain; fix update of mysql-entry; add CustomerBackups-ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-19 10:45:12 +01:00
Michael Kaufmann (d00p)
dfcb7160cb fix global lng-array
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-18 08:45:20 +01:00
Michael Kaufmann (d00p)
f5654d5931 fix var-names in DirOptions-ApiCommand; fix pmd issues
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-18 08:42:22 +01:00
Michael Kaufmann (d00p)
2bf5fde0e5 Merge remote-tracking branch 'origin/master' into 0.10.0 2018-03-16 09:19:52 +01:00
Michael Kaufmann (d00p)
be0099bf01 add duplicate check to switch-server-ip script
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-16 09:18:02 +01:00
Michael Kaufmann (d00p)
7a68dfc450 DirProtections and DirOptions stuff
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-15 19:35:56 +01:00
Michael Kaufmann (d00p)
858a9ba6a4 added DirProtections.update() and various unit-tests
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-15 11:01:17 +01:00
Michael Kaufmann (d00p)
f2809c47ac finished DirProtections.add() and some basic tests
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-14 19:41:12 +01:00
Michael Kaufmann (d00p)
616fb77de5 check for installed/configured froxlor in api.php and return 404 if not
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-14 18:13:32 +01:00
Michael Kaufmann (d00p)
b03d41087a Merge remote-tracking branch 'origin/master' into 0.10.0 2018-03-14 11:41:42 +01:00
Michael Kaufmann (d00p)
724e88b94f rename handler php5-fastcgi to php-fastcgi, just cosmetics; fixes #536
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-14 11:37:45 +01:00
Michael Kaufmann (d00p)
3c802038f2 split touch-command for multiple files into single ones, fixes #535
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-14 11:35:03 +01:00
Michael Kaufmann (d00p)
fe385b7800 Merge remote-tracking branch 'origin/master' into 0.10.0 2018-03-13 10:41:01 +01:00
Michael Kaufmann (d00p)
38b57117e2 minor fixes in froxlor-sql file
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-13 10:40:45 +01:00
Michael Kaufmann (d00p)
7e47383ee3 ignore NumberOfChildren pmd warning
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-12 22:12:16 +01:00
Michael Kaufmann (d00p)
ae3d954766 started work on DirProtections-ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-12 22:07:51 +01:00
Michael Kaufmann (d00p)
52da7ad40f exclude some irritating pmd rules #2
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-12 21:47:14 +01:00
Michael Kaufmann (d00p)
309e613c83 exclude some irritating pmd rules
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-12 21:40:19 +01:00
Michael Kaufmann (d00p)
05857985f8 add more tests for Email-ApiCommands
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-12 21:29:03 +01:00
Michael Kaufmann (d00p)
a7523bbdea add domainid to result-list of Emails.get(); fix typo in EmailAccounts.add(); enhance debugging in Database-class
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-12 15:52:34 +01:00
Michael Kaufmann (d00p)
54deec87d0 add a few emails-apicommand unit-tests
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-12 15:41:08 +01:00
Michael Kaufmann (d00p)
f0e084ef0e minor fixes in EmailAccounts.update()
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-12 14:17:45 +01:00
Michael Kaufmann (d00p)
fa7bb53d58 added EmailAccounts-ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-12 14:13:35 +01:00
Michael Kaufmann (d00p)
6fc8cce8f5 add EmailAccounts.add; added wrapper function ApiCommand.getMailTemplate() to reduce code-duplication
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-12 13:44:44 +01:00
Michael Kaufmann (d00p)
2e597ef7d9 remove unused local variables
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-12 11:09:30 +01:00
Michael Kaufmann (d00p)
ff611fa8dc fix parameter for ApiCommand::getCustomerData()
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-12 10:57:31 +01:00
Michael Kaufmann (d00p)
c920bf6a63 some code-reduction
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-12 10:45:46 +01:00
Michael Kaufmann (d00p)
66ebfaf21b Merge remote-tracking branch 'origin/master' into 0.10.0 2018-03-12 10:23:53 +01:00
Michael Kaufmann (d00p)
349fa7a761 avoid possible undefined index if no issuer-organisation is set in a certificate
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-12 10:22:50 +01:00
Michael Kaufmann (d00p)
81bd9d945d fix parameter customerid for Emails.add() in unit-test
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-11 10:26:05 +01:00
Michael Kaufmann (d00p)
b205f8ea5d add EmailFowarders ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-11 10:24:17 +01:00
Michael Kaufmann (d00p)
7b52c0c78c fix default value of panel.no_robots settings; add phpdoc for Database-class-methods
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-08 17:03:17 +01:00
Michael Kaufmann (d00p)
164650adc3 added Emails.update() and Emails.delete() commands
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-08 11:49:28 +01:00
Michael Kaufmann (d00p)
9e97e82990 Merge remote-tracking branch 'origin/master' into 0.10.0 2018-03-06 21:08:02 +01:00
Michael Kaufmann (d00p)
cd5cef51e8 allow config and settings json file for config-services.php to be downloaded from a remote url
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-06 21:07:08 +01:00
Michael Kaufmann (d00p)
231159a6c6 added first methods of Emails ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-06 14:02:27 +01:00
Michael Kaufmann (d00p)
a83031504f implement generating of api-key for customer
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-06 12:43:24 +01:00
Michael Kaufmann (d00p)
893fd0774c implement deleting of api-keys via webinterface
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-06 12:26:41 +01:00
Michael Kaufmann (d00p)
704188fe27 Merge remote-tracking branch 'origin/master' into 0.10.0 2018-03-06 11:06:31 +01:00
Michael Kaufmann (d00p)
a621fd3b09 run cronjob at the end of config-services script (when using --apply), thx v3ng
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-06 11:05:26 +01:00
Michael Kaufmann (d00p)
0c43c5d2b5 backport config-services --import-settings parameter from 0.10.0
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-06 10:52:57 +01:00
Michael Kaufmann (d00p)
864331d371 code reduction; added unit-tests for Certificates-Command; minor fixes here and there
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-05 23:35:00 +01:00
Michael Kaufmann (d00p)
f5ec759d99 added Certificates-ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-05 14:21:36 +01:00
Michael Kaufmann (d00p)
b2e2590324 implemented SubDomains.update; minor fixes and enhancements in Domains-Command and validateUrl-function
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-05 12:13:01 +01:00
Michael Kaufmann (d00p)
ae4a7ff943 wrap ip-validating in Domains-ApiCommand to reduce duplicate code
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-05 08:12:08 +01:00
Michael Kaufmann (d00p)
a869bc58cd fix wrong variable-name in SubDomains.listing
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-04 19:47:48 +01:00
Michael Kaufmann (d00p)
cfa07bab47 simplified and wrapped internal api calls
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-04 18:30:16 +01:00
Michael Kaufmann (d00p)
b664917147 fix sql variable in Admins.delete
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-04 12:44:31 +01:00
Michael Kaufmann (d00p)
b12392f0a9 Merge remote-tracking branch 'origin/master' into 0.10.0 2018-03-04 12:40:55 +01:00
Michael Kaufmann (d00p)
b07d6ceeaa started UI api-key management
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-04 12:40:47 +01:00
Michael Kaufmann
aff6d82321 Merge pull request #531 from Crease29/patch-1
Link domains to HTTPS in certificate list
2018-03-04 12:11:12 +01:00
Kai Neuwerth
91cecf8c1e Link domains to HTTPS in certificate list
As an admin I want to check if the certificate of a website is working.
Therefore I click on the domain in the SSL certificate list and have to prepend "https" to the URL later.
In this case I'd link the domain to HTTPS initially.
2018-03-04 11:43:50 +01:00
Michael Kaufmann (d00p)
702b52d13e forgot to save again
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-03 21:42:34 +01:00
Michael Kaufmann (d00p)
bb3fddb08f optimize phpmd config
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-03 21:39:51 +01:00
Michael Kaufmann (d00p)
7cc17b9ca5 fix short variables
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-03 21:29:16 +01:00
Michael Kaufmann (d00p)
f30887e3c0 removed unused local variables
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-03 21:26:37 +01:00
Michael Kaufmann (d00p)
0d7afc5c24 fixes in move-domain-to-another-customer functionality in Domains.update
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-03 21:10:58 +01:00
Michael Kaufmann (d00p)
826f1378d2 minor fixes to Domains.update + another unit-test
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-03 15:55:23 +01:00
Michael Kaufmann (d00p)
6d8b22dccf Merge remote-tracking branch 'origin/master' into 0.10.0 2018-03-03 14:58:46 +01:00
Michael Kaufmann
26c3c8e6f0 Merge pull request #527 from JB1985/patch-2
Update german.lng.php
2018-03-03 14:58:38 +01:00
Michael Kaufmann (d00p)
0f6cc05089 Merge remote-tracking branch 'origin/master' into 0.10.0 2018-03-03 14:58:06 +01:00
Michael Kaufmann
08814f8c9a Merge pull request #530 from michaelzangl/fix-hostname-error-message
Fix hostname error message
2018-03-03 14:57:22 +01:00
Michael Kaufmann
632eb98df9 Merge pull request #529 from michaelzangl/fix-installer-path
Froxlor installer: Use same file path for chmod.
2018-03-03 13:05:59 +01:00
Michael Zangl
909c983aec Fix invalidhostname error message (de). 2018-03-03 11:49:58 +01:00
Michael Zangl
8642254175 Fix invalidhostname error message. 2018-03-03 11:48:26 +01:00
Michael Zangl
7e81b0bb5a Froxlor installer: Use same file path for chmod. 2018-03-03 11:18:28 +01:00
Michael Kaufmann (d00p)
22a48cac33 Merge remote-tracking branch 'origin/master' into 0.10.0 2018-03-02 19:37:32 +01:00
Michael Kaufmann (d00p)
20eaa7bc08 fix missing sql-prepared-statement parameter, fixes #528
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-02 19:36:56 +01:00
Michael Kaufmann (d00p)
1605d2af07 enhance phpdox config
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-02 18:25:06 +01:00
JB1985
abb94c9189 Update german.lng.php
Übersetzung Änderung von Lets Encrypt
2018-03-02 17:28:30 +01:00
Michael Kaufmann (d00p)
cadb6618ec list() is a reserved php keyword, changed ApiCommand::list() to ApiCommand::listing()
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-02 17:22:47 +01:00
Michael Kaufmann (d00p)
594512404f optimized CustomersTest and DomainsTest; minor fixes in SubDomains-ApiCommand; added more tests for SubDomains-Command
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-02 15:24:46 +01:00
Michael Kaufmann (d00p)
aeb8655cc3 fix sql query in Domains.get; minor fixes in Domains.update; first unit-test for Domains.update
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-01 19:59:27 +01:00
Michael Kaufmann (d00p)
601d16b17c minor fixes in Domains.add; added more tests
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-01 19:41:57 +01:00
Michael Kaufmann (d00p)
02616d3080 minor fixes and first tests for Domains-ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-03-01 16:46:47 +01:00
Michael Kaufmann (d00p)
2bf5e90a77 add testsuite parameter to phpunit to respect our required test-order; minor fixes in Domains- and SubDomains Command
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-27 18:07:43 +01:00
Michael Kaufmann (d00p)
75bc6d32ab minor fixes in SubDomains.add; first Unit-Tests for SubDomains-ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-27 17:10:52 +01:00
Michael Kaufmann (d00p)
3e0b551416 fix copy'n'paste fail
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-27 15:56:05 +01:00
Michael Kaufmann (d00p)
a038e35e45 added Subdomains.add; minor fixes and enhancements
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-27 15:54:07 +01:00
Michael Kaufmann (d00p)
6318e5514b ignore some more checkstyle rules
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-27 10:54:03 +01:00
Michael Kaufmann (d00p)
392db944a2 started work in SubDomains-ApiCommand; minor fixes
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-27 10:34:37 +01:00
Michael Kaufmann (d00p)
b097c19c0a correct phpcs config
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-27 09:30:57 +01:00
Michael Kaufmann
b46d3a3769 Update README.md
new test :)
2018-02-27 08:59:49 +01:00
Michael Kaufmann
a2172329cd Update README.md
added CI build-status
2018-02-27 08:50:54 +01:00
Michael Kaufmann (d00p)
309b70c0f8 completed Ftps-ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-27 08:23:19 +01:00
Michael Kaufmann (d00p)
4b9ed8ee39 use correct order
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-26 22:39:06 +01:00
Michael Kaufmann (d00p)
2599f61b32 add jenkins build.xml and more; added first unit-tests
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-26 22:35:04 +01:00
Michael Kaufmann (d00p)
9a4359e010 fix IpsAndPorts.delete
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-26 19:56:03 +01:00
Michael Kaufmann (d00p)
4d89f614e3 remove unnecessary checks as getParam() validates the existance already
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-26 18:08:43 +01:00
Michael Kaufmann (d00p)
4fad0def1e fix mailer variable and fix typo in Ftps.add and Ftps.delete
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-26 18:02:18 +01:00
Michael Kaufmann (d00p)
c093783904 forgot the mailobject :P
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-26 16:02:09 +01:00
Michael Kaufmann (d00p)
257855b43b fix typo in field-value for ApiCommand::getUserDetail()
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-26 16:00:54 +01:00
Michael Kaufmann (d00p)
55ec20be10 use Ftps.add in webinterface
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-26 15:55:49 +01:00
Michael Kaufmann (d00p)
b0f355ba2f fixed in Mysqls.add, added Ftps.add
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-26 15:49:41 +01:00
Michael Kaufmann (d00p)
ceb8619552 preparations for assign-multiple-ips-to-an-admin in Api, not in webinterface yet
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-26 12:15:48 +01:00
Michael Kaufmann (d00p)
6191ee6fba add Ftps.list and Ftps.delete
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-26 09:36:58 +01:00
Michael Kaufmann (d00p)
c9256c0020 add 'adminname' to result in Customers.get; fix Customers.move and return customer-data there instead of just true
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-26 09:01:13 +01:00
Michael Kaufmann (d00p)
592c9ed0b9 automatically trim() all parameters given
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-26 08:21:56 +01:00
Michael Kaufmann (d00p)
4a1decf359 do not update fields of customer a customer cannot even change; unset custom_notes when admin of customer set custom_notes_show to 0
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-26 07:51:44 +01:00
Michael Kaufmann (d00p)
ae42e87a64 fix in Admins.update; code-format Customers ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-25 21:26:51 +01:00
Michael Kaufmann (d00p)
5c330505ea correct Admins.update and Admins.delete
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-25 20:47:36 +01:00
Michael Kaufmann (d00p)
c65d95c1ef Merge remote-tracking branch 'origin/master' into 0.10.0 2018-02-25 18:29:28 +01:00
Michael Kaufmann (d00p)
2b366c8f23 add field for fullchain to be stored in ssl-certificates-table; create fullchain file if given (it's not used by froxlor); do not generate/renew certificates for disabled customers domains
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-25 18:22:15 +01:00
Michael Kaufmann (d00p)
e66dde2e64 id <> loginname, grrr
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-25 17:08:30 +01:00
Michael Kaufmann (d00p)
f32a1921c5 re-read admin/customer when adding/updating so we return the fields from the table, not the placeholders of the prepared-statement
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-25 17:03:49 +01:00
Michael Kaufmann (d00p)
0958d07f23 fixes in Admins and Customers ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-25 16:49:24 +01:00
Michael Kaufmann (d00p)
a222114d0a remove unnecessary parameter-checks as they will never happen; make Customers.update callable for customers
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-25 15:02:58 +01:00
Michael Kaufmann (d00p)
243b68cc37 minor changes for testing
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-25 11:47:28 +01:00
Michael Kaufmann (d00p)
2f30d85d32 minor changes in ApiCommand; added Ftps.get ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-24 20:52:21 +01:00
Michael Kaufmann (d00p)
ca07621de7 reduce mysql-usage counter for admins too when deleting a mysql-database
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-24 20:12:57 +01:00
Michael Kaufmann (d00p)
e5a1b504d7 consistency replace dbserver with mysql_server everywhere
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-24 16:52:14 +01:00
Michael Kaufmann (d00p)
20aac1ccd4 finish Mysqls.update, untested
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-24 16:46:56 +01:00
Michael Kaufmann (d00p)
bda652f947 tiny fixes in Domains.add and Domains.update
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-24 16:26:47 +01:00
Michael Kaufmann (d00p)
87912a9e07 refactored moveCustomerToAdmin() function to Customers.move ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-24 16:06:53 +01:00
Michael Kaufmann (d00p)
0bf430e0c1 let customers edit password, def-language and theme in Customers.edit
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-24 15:02:49 +01:00
Michael Kaufmann (d00p)
d2aaf84eff added Mysqls.add
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-24 12:13:47 +01:00
Michael Kaufmann (d00p)
b5ebe48715 forgot to save this one
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-24 11:01:29 +01:00
Michael Kaufmann (d00p)
9a61a56732 enhance phpdoc and add @access to specify which usergroup can use the ApiCommands; add --import-settings parameter to config-services.php CLI script to gain even more automatism when setting up
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-24 10:57:52 +01:00
Michael Kaufmann (d00p)
81d6a856d9 forgot to hit save :P
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-23 19:51:06 +01:00
Michael Kaufmann (d00p)
344ca827e4 beautify api-help in webinterface
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-23 19:46:57 +01:00
Michael Kaufmann (d00p)
1c4ecdffbf use correct dbserver for getting mysql-size info in Mysqls.get()
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-23 18:24:10 +01:00
Michael Kaufmann (d00p)
831ee221f6 make lng, version, dbversion and branding protected variables of ApiCommand to avoid the need of 'global' statement
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-23 18:18:31 +01:00
Michael Kaufmann (d00p)
6409fb2dbe started working on Mysqls-ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-23 15:17:22 +01:00
Michael Kaufmann (d00p)
662f537a0d fixes in Admins.update(); use ApiCommand for theme-, language- and password-change
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-23 12:48:17 +01:00
Michael Kaufmann (d00p)
8e0bfe9d09 add Admins.update()
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-23 11:57:29 +01:00
Michael Kaufmann (d00p)
8930d2a1bf check remote-ip when ip-restriction is set in api_keys table
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-23 11:08:24 +01:00
Michael Kaufmann (d00p)
d9ec214e17 secure included webinterface-modules; add settings-functions to Froxlor-ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-22 21:05:58 +01:00
Michael Kaufmann (d00p)
dfb5d33a56 add Admins.add()
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-22 16:51:56 +01:00
Michael Kaufmann (d00p)
b42a7b1b26 show basic api doc in webinterface (top-menu - options - API help)
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-22 13:41:28 +01:00
Michael Kaufmann (d00p)
a468fe50df filter deactivated users who want to use the API; fix error-output in Customers::update()
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-22 11:42:13 +01:00
Michael Kaufmann (d00p)
c1875132ef fix unchecked-checkbox value passed to API
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-22 11:34:40 +01:00
Michael Kaufmann (d00p)
332e29be24 lots of phpdoc; fix Customers::update()
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-22 11:16:55 +01:00
Michael Kaufmann (d00p)
c93e2678f7 make Customers::update() also work with loginname as an alternative to the id
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-22 10:47:14 +01:00
Michael Kaufmann (d00p)
f8fe4be3ef fix parameters for checkboxes when passed via webinterface
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-21 14:52:23 +01:00
Michael Kaufmann (d00p)
689ca853c3 minor fixes in Customers and Domains ApiCommands, added list() and get() for Admins-ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-21 14:38:27 +01:00
Michael Kaufmann (d00p)
8310e8554b enable usage of 'domainname' as an alternative to 'id' for Domains::get() and Domains::delete(); enable usage of 'loginname' as an alternative to 'id' for Customers::get() and Customers::delete()
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-21 13:14:54 +01:00
Michael Kaufmann (d00p)
b56414ed0e add sql-query of last statement to sql-debug for debugging purposes; fix default-ssl-ip setting and allow 'none' value
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-21 12:16:50 +01:00
Michael Kaufmann (d00p)
5480fcbf5d add default-ssl-ip setting
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-21 11:50:34 +01:00
Michael Kaufmann (d00p)
26b9c030b5 leave default-values for adding std-subdomain when adding customer from the parameters-array; do not require ipandports parameter when adding domain but rather default to system.defaultip if no ipandport is given
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-21 10:57:46 +01:00
Michael Kaufmann (d00p)
aef528bea1 Merge remote-tracking branch 'origin/master' into 0.10.0 2018-02-21 08:54:29 +01:00
Michael Kaufmann (d00p)
d5b9ad3452 darn, stay php-5.3 compatible, thx greppy
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-20 21:37:06 +01:00
Michael Kaufmann (d00p)
5437fcdc89 insert tasks to rebuild configs etc. after import of settings, thx to v3ng for noticing
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-20 19:15:55 +01:00
Michael Kaufmann (d00p)
b9653c5abd fix company-required check for good now :P
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-20 19:11:33 +01:00
Michael Kaufmann (d00p)
eabc78c84f enhance check for requirement of company field
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-20 14:21:40 +01:00
Michael Kaufmann (d00p)
033393880d fix typo in variable name
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-20 14:14:47 +01:00
Michael Kaufmann (d00p)
6bcfb81c6c Merge remote-tracking branch 'origin/master' into 0.10.0 2018-02-19 14:10:42 +01:00
Michael Kaufmann (d00p)
b2ac1fb593 add FpmDaemons ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-19 13:58:39 +01:00
Michael Kaufmann (d00p)
8c6ae4f3a3 add PhpSettings ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-19 13:36:15 +01:00
Michael Kaufmann (d00p)
131efc544d fix syntax error in lang file, fixes #522
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-19 12:27:00 +01:00
Michael Kaufmann (d00p)
5524ff7cae fixes in Customers::update()
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-19 11:36:01 +01:00
Michael Kaufmann (d00p)
603e14913b finished Customer::update(), untested
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-19 10:45:41 +01:00
Michael Kaufmann
160474f2b6 Merge pull request #521 from JB1985/master
Update german.lng.php
2018-02-19 09:03:32 +01:00
JB1985
168738b23a Update german.lng.php
Statt Benutze Lets Encrypt => SSL Zertifikat erstellen (Let\'s Encrypt)
2018-02-19 09:02:34 +01:00
Michael Kaufmann (d00p)
133af365bd enhance ApiCommand::getParam() to specify required and optional parameter
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-19 08:59:24 +01:00
Michael Kaufmann (d00p)
532551263d add new api-module to output list of possible modules/functions
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-18 10:19:17 +01:00
Michael Kaufmann (d00p)
bdfd601dae Merge remote-tracking branch 'origin/master' into 0.10.0 2018-02-18 10:17:38 +01:00
Michael Kaufmann (d00p)
9619abdad7 when importing settings with enabled ssl flag, validate that the target system has ssl enabled ip's to avoid unexpected behaviour, tthx v3ng for testing
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-17 16:00:50 +01:00
Michael Kaufmann (d00p)
fd287e7be4 add apache restart command after enabling modules in config-templates
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-17 14:51:04 +01:00
Michael Kaufmann (d00p)
5afdbae83a minor phpDoc fixes in Logger classes
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-16 15:50:31 +01:00
Michael Kaufmann (d00p)
7c96164770 fix lng availability; add returncode for not-found messages
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-16 15:39:59 +01:00
Michael Kaufmann (d00p)
60defd3cdf fix unlimited flags when adding customer; add debug flag to log all api-requests for testing purposes now
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-16 14:34:55 +01:00
Michael Kaufmann (d00p)
8978dd3a4b std-subdomain <> ip connection is already handled by Domains::add()
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-16 13:55:12 +01:00
Michael Kaufmann (d00p)
1e45da2410 more work on Customer-ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-16 13:27:31 +01:00
Michael Kaufmann (d00p)
2da2912c9c set update-check-urls to api-version; started working on Customers-ApiCommand
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-16 10:56:27 +01:00
Michael Kaufmann (d00p)
4d12a4f37b Merge remote-tracking branch 'origin/master' into 0.10.0 2018-02-16 09:24:14 +01:00
Michael Kaufmann (d00p)
350e3d733a do not check for options if field is disabled, unset enabled-ownvhost flags for fcgid/fpm if the corresponding other one is activated; fixes #518
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-16 09:22:34 +01:00
Michael Kaufmann (d00p)
81602f17be add Domains api module
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-15 14:44:48 +01:00
Michael Kaufmann (d00p)
df5fb963c1 make language strings the language the user uses
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-15 13:03:30 +01:00
Michael Kaufmann (d00p)
0fc2fbaf09 add language strings (english only currently)
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-15 12:59:34 +01:00
Michael Kaufmann (d00p)
a82d5cf764 minor fixes
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-15 11:37:38 +01:00
Michael Kaufmann (d00p)
2c1f76e6a4 definetly require json extension now
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-15 07:56:27 +01:00
Michael Kaufmann (d00p)
d068477a93 set version to 0.10.0
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-15 07:54:21 +01:00
Michael Kaufmann (d00p)
4663f8c6ec converted IpsAndPorts to API
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-15 07:48:03 +01:00
Michael Kaufmann (d00p)
dd371c72a2 start api implementation
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-15 07:47:35 +01:00
Michael Kaufmann (d00p)
6f91bece17 fix postfix config for postfix/courier on precise and trusty, fixes #516
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-15 07:44:54 +01:00
Michael Kaufmann (d00p)
5c30961d3c set version to 0.9.39.5 for bugfix release (imap/pop3 ticks not enabled if active in hosting plan when editing hosting plan)
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-14 13:31:39 +01:00
Michael Kaufmann (d00p)
edd5ef0ca0 fix correct display of selected checkbox imap/pop3 when editing hosting plan
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-14 07:40:39 +01:00
Michael Kaufmann (d00p)
6befe85656 fix add/edit domain due to wrong access to settings; setting version to 0.9.39.4 for bugfix release
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-13 12:23:05 +01:00
Michael Kaufmann (d00p)
27f8c8b438 show domains of disabled customers also as disabled
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-13 11:49:15 +01:00
Michael Kaufmann (d00p)
fc0c796b68 avoid undefined variables/indexes
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-13 10:58:06 +01:00
Michael Kaufmann (d00p)
482e8c9a11 set version to 0.9.39.3 for maintenance release and upcoming debian package so the new hosting-plan feature is included
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-13 09:06:49 +01:00
Michael Kaufmann (d00p)
7a664a9990 clean up panel_diskspace/panel_diskspace_admins when removing customer/admin
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-13 08:21:45 +01:00
Michael Kaufmann (d00p)
372ab5d9c8 add domain flag to avoid generation of nginx try_files directive in webroot which is not suitable for some applications; fixes #461
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-13 08:12:58 +01:00
Michael Kaufmann (d00p)
de70dbb888 fix checked-property when applying hosting-plan for allowed-phpconfigs
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-12 14:58:17 +01:00
Michael Kaufmann (d00p)
4d7ceb9efe add missing question-string
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-12 13:33:29 +01:00
Michael Kaufmann (d00p)
bb792f228f add new hosting-plans feature
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-12 13:28:13 +01:00
Michael Kaufmann (d00p)
017396197e set version to 0.9.39.2 for bugfix release
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-12 07:49:07 +01:00
Michael Kaufmann (d00p)
216f013c96 add script to automatically configure services from shell without the need of copy/paste from the interface
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-12 07:47:51 +01:00
Michael Kaufmann (d00p)
05f1bf0a1f meh, forgot to uncomment the settings storage for settings-import
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-12 07:46:38 +01:00
Michael Kaufmann (d00p)
295fbae6f5 create bash script to generate proftpd-certificates in case system does not use /bin/bash as shell
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-11 16:10:10 +01:00
Michael Kaufmann (d00p)
ca4c93ac92 set default dns server in config-templates; separate CmdLineHandler from switch-server-ip script for further usage
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-11 13:57:07 +01:00
Michael Kaufmann (d00p)
13b1503bf2 set version to 0.9.39.1 for maintenance release
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-10 16:06:57 +01:00
Michael Kaufmann (d00p)
2980397545 fix include path in lib/ajax.php
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-10 10:13:55 +01:00
Michael Kaufmann (d00p)
5612720342 only let admin select php-configs that the customer is allowed to use to avoid unwanted php-config changes when customer edits domain, refs #514
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-09 13:57:23 +01:00
Michael Kaufmann (d00p)
4d3fa6eca5 get rid of the need for allow_url_fopen
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-09 10:50:14 +01:00
Michael Kaufmann (d00p)
05b4c58aa8 fix updating wrong column when deleting a fpm configuration
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-09 09:20:46 +01:00
Michael Kaufmann (d00p)
f290497b64 fix selected phpfpm daemon when editing php-configuration, fixes #514
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-09 07:33:28 +01:00
Michael Kaufmann (d00p)
b4dd35eed2 correct description of nsswitch.conf file
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-08 07:35:06 +01:00
Michael Kaufmann (d00p)
ec21e28000 use md5() instead of base64_encode for dummy-fpm-socket name to avoid possible equal-sign in string which leads to an invalid socket, fixes #513
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-07 15:10:59 +01:00
Michael Kaufmann (d00p)
0aa707ebc9 set version to 0.9.39 for upcoming release
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-06 12:19:21 +01:00
Michael Kaufmann (d00p)
f38a0fd8b6 remove unnecessary and out-of-date info from README, fixed variable typo in lib/init.php
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-02-05 08:36:25 +01:00
Michael Kaufmann (d00p)
a6b2daa77d fix typo
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-30 14:41:56 +01:00
Michael Kaufmann (d00p)
7ae31496ac add requirement check for php-json as settings import/export uses json_decode/json_encode
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-30 07:58:24 +01:00
Michael Kaufmann (d00p)
c62dd2ecf4 fix mysql-strict-mode issue (hopefully for good), enhance error-reporting when importing froxlor.sql on installation
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-29 20:04:54 +01:00
Michael Kaufmann (d00p)
840b5ea229 add new feature: import/export of settings
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-28 14:33:00 +01:00
Michael Kaufmann (d00p)
d8a3015303 put le acme version setting right above the CA setting, less confusing
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-27 11:50:34 +01:00
Michael Kaufmann (d00p)
194b7863b8 fix invalid ipv6 value in mysql-access-host setting
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-27 11:37:06 +01:00
Michael Kaufmann (d00p)
f034695290 remove '/etc/postfix/master.cf: line x: using backwards-compatible default setting chroot=y' warning; set correct permission for dkim-public key as it should not be group or other writable
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-27 11:14:22 +01:00
Michael Kaufmann (d00p)
f896fe11a0 do not split dkim-entry content in generateDkimEntries(); re-add braces to enclose TXT record content
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-27 10:09:43 +01:00
Michael Kaufmann (d00p)
2603a9c869 add new setting to specify values for the PATH env-variable for php-fpm
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-26 17:30:20 +01:00
Michael Kaufmann (d00p)
fcd0dddfd5 Update phpMailer to 5.2.26
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-26 17:18:12 +01:00
Michael Kaufmann (d00p)
3fb92259a8 readd starting and ending quotes which got removed with the braces in #503
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-26 17:17:22 +01:00
Michael Kaufmann
54d7b01ac5 Merge pull request #506 from RipClaw2971/http2_fix
http2 could be set even if http2 is not enabled
2018-01-22 14:43:10 +01:00
Michael Kaufmann (d00p)
ca0ab1f97a add fixed dovecot/conf.d/10-ssl.conf template for debian stretch; update phpMailer to 5.2.26
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-21 23:37:09 +01:00
Michael Kaufmann (d00p)
f3733ca249 set apache-2.4 as default ON also in froxlor.sql; fix wrong DbManagerMySQL::disableUser, fixes #505
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-18 19:50:28 +01:00
Andreas Grundler
7442bf7347 http2 Konfiguration nur einfügen wenn http2 in den Einstellungen aktiviert ist 2018-01-18 18:30:38 +01:00
Andreas Grundler
6ac3cb2014 Revert "http2 Konfiguration nur einfügen wenn http2 in den Einstellungen aktiviert ist"
This reverts commit c3fb6f6a1c.
2018-01-18 18:23:08 +01:00
Andreas Grundler
ca76e572a2 http2 Option darf nur dann zu sehen sein wenn http2 in den Einstellungen aktiv ist 2018-01-18 18:18:30 +01:00
Andreas Grundler
c3fb6f6a1c http2 Konfiguration nur einfügen wenn http2 in den Einstellungen aktiviert ist 2018-01-18 18:16:53 +01:00
Michael Kaufmann
1796a8ff17 Merge pull request #503 from lonesomewalker/patch-1
Update class.DnsEntry.php
2018-01-17 07:54:57 +01:00
lonesomewalker
52c7839b9b Update class.DnsEntry.php
Klammerfehler bei Bind, PowerDNS braucht ja keinen Linesplit.
2018-01-16 14:57:42 +01:00
Michael Kaufmann (d00p)
d16a7b2089 on installation, set apache-2.4 as default if apache is detected; clearify that apache2 is 2.2; output complete folder where the userdata.inc.php file is to be put when necessary to avoid misunderstanding
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-15 07:45:50 +01:00
Michael Kaufmann (d00p)
9a00a67f71 apache2-suexec => apache2-suexec-pristine for debian stretch
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-13 11:33:20 +01:00
Michael Kaufmann (d00p)
6e651200ca Make php.ini flag/value possibilities dynamic (settings)
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-11 13:04:38 +01:00
Michael Kaufmann (d00p)
29968e6026 add stretch config-templates, testers/feedback welcome
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-11 10:44:42 +01:00
Michael Kaufmann (d00p)
8c61773280 fix usage of extensions from limit_extensions list in apache-cron
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-10 17:01:17 +01:00
Michael Kaufmann (d00p)
29433ce963 escape possible dots in extension (e.g. to allow .php.xml or similar)
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-10 15:49:07 +01:00
Michael Kaufmann (d00p)
eed3a91385 fix (not yet perfect) regex for limit_extension setting
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-10 15:45:21 +01:00
Michael Kaufmann (d00p)
62006d584e fix limit_extensions setting
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-10 15:42:11 +01:00
Michael Kaufmann (d00p)
bba872618a fix ssl-procotols in apache-cron; fix files-match regex in apache-cron
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-10 15:28:48 +01:00
Michael Kaufmann (d00p)
941dd14c72 read limit_extensions value from wrong array
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-10 15:22:22 +01:00
Michael Kaufmann (d00p)
f2a79d4d96 add new security.limit_extensions setting to fpm-daemon settings
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-10 15:20:19 +01:00
Michael Kaufmann (d00p)
281b131c62 ups, forgot to adjust version in lib/version.inc.php
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-10 10:21:02 +01:00
Michael Kaufmann (d00p)
4bcdfc0786 Added option to set the TLS protocol versions to be used in webservers
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-10 10:12:26 +01:00
Michael Kaufmann (d00p)
9312e4967e fix access to idle-timeout setting which moved from global settings to per-fpm-daemon setting, thx to gunnyst for pointing this out
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-10 08:45:20 +01:00
Michael Kaufmann (d00p)
6b44dfe9b2 well, we should also save the new settings :)
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-09 17:22:20 +01:00
Michael Kaufmann (d00p)
ba58991d11 allow per php-config setting of adding '-pass-header Authorization' / 'CGIPassAuth On' to the domains vhosts
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-09 17:14:57 +01:00
Michael Kaufmann (d00p)
84abb33e54 exclude wildcard-domains agains also vor ACMEv2 of LE2
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-09 17:12:55 +01:00
Michael Kaufmann (d00p)
07a4f045f1 do not advertise wildcard-certificates as it might never be possible in froxlor (no http-01 challenge)
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-09 16:08:13 +01:00
Michael Kaufmann (d00p)
f49cb81e49 disable wildcard-usage with Let's Encrypt as ACME-v2 only supports the dns-01 challenge for now (pity)
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-09 15:33:23 +01:00
Michael Kaufmann (d00p)
b2b9d4e31a add missing setting-strings for new acme-version setting; allow using let's encrypt with wildcard-alias when using ACME-v2
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-09 14:56:41 +01:00
Michael Kaufmann (d00p)
d40d1f30b6 make it a setting to switch between ACME v1 and v2
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-09 14:50:52 +01:00
Michael Kaufmann (d00p)
9aaadb1f8b implement lets-encrypt api-v02 (testing only currently; not activated in froxlor, test with 'php froxlor_master_cronjob.php --letsencrypt_v2 --debug' but set api endpoint to staging); no chain is returned currently, seems to be a known bug
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-09 14:40:36 +01:00
Michael Kaufmann (d00p)
3969ef63c5 do not check hide-options 'domains' in customer_tickets, fixes #502
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-09 11:18:03 +01:00
Michael Kaufmann (d00p)
d8abe30c44 create dummy pool-config whenever a fpm-daemons configdir is empty so it still restarts
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-09 09:25:56 +01:00
Michael Kaufmann (d00p)
eaa10ce6a5 add option to update php-configs for all subdomains when editing a domain as admin (default: yes)
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-08 15:31:27 +01:00
Michael Kaufmann (d00p)
c434249616 allow admin to set php-configs that can be used by customers
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-08 14:45:00 +01:00
Michael Kaufmann (d00p)
b849a5f29a preparations for php-config select for customers
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-08 13:59:30 +01:00
Michael Kaufmann (d00p)
3dc6a64252 fix pm select when editing fpmdaemon; fix saving of pm value
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-08 10:22:09 +01:00
Michael Kaufmann (d00p)
ebd636494a fix wrong table constant
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-08 10:11:38 +01:00
Michael Kaufmann (d00p)
07caf55f79 fixes to multi-fpm in cron
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-08 09:16:00 +01:00
Michael Kaufmann (d00p)
73868b7947 soften the file cleaning to reduce risk
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-07 23:31:39 +01:00
Michael Kaufmann (d00p)
af55fe5b82 add possibility to add multiple php-fpm instances
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2018-01-07 14:55:25 +01:00
Michael Kaufmann
de408347fc Merge pull request #500 from heavygale/patch-1
Update preconfig_0.9.inc.php
2018-01-05 18:26:57 +01:00
heavygale
ea96039128 Update preconfig_0.9.inc.php
fixed a typo
2018-01-05 18:11:23 +01:00
Michael Kaufmann
c49539258e Merge pull request #498 from RipClaw2971/fix
Added "nscd -i passwd" to clear user cache when using libnss-*
2018-01-01 17:45:23 +01:00
Andreas Grundler
64653a2bb1 nscd -i passwd in froxlor_master_cronjob.php eingefügt 2018-01-01 13:54:32 +01:00
Andreas Grundler
732c6e3a78 Added nscd -i passwd to clear user 2017-12-31 22:40:19 +01:00
Michael Kaufmann (d00p)
66a4309fe5 add setting to disable LE self-check; set version to 0.9.38.8 for maintenance/bugfix release
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-12-31 11:18:59 +01:00
Michael Kaufmann (d00p)
57277eb1e3 also add locked users to the passwd file for quota not to rage :P thx J-BBB
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-12-27 10:36:10 +01:00
Michael Kaufmann (d00p)
148b2fc1be validating config-template parameters; avoid URL misuse, thx to hyp3rlinx for noticing this
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-12-27 10:01:07 +01:00
Michael Kaufmann (d00p)
cf4f15a83c explicitly deactivate TLS (and auto-tls) when setting use-tls is OFF; fixes #496
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-12-19 08:00:39 +01:00
azerr
297f3f638c change sign direction 2017-12-08 17:47:09 +01:00
azerr
d2a9fa8632 extend nginx redirect regex to https 2017-12-08 15:39:05 +01:00
Michael Kaufmann (d00p)
a5251824ae try to reduce weird path-values when people are getting creative, fixes #487
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-11-27 08:14:31 +01:00
Michael Kaufmann (d00p)
cb31c5258d correct setting for php-fpm peardir, fixes #475
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-11-27 08:09:33 +01:00
Michael Kaufmann (d00p)
5540b02e35 do not remove Let's Encrypt token when self-check fails but rather give out the information as warning. The self-check fails for many users due to different local configurations and might not always be correct; fixes #480
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-11-27 07:54:41 +01:00
Michael Kaufmann (d00p)
e725b48c4c add default/global directory options in apache regardless of whether fcgid/fpm is being used or not; fixes #485
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-11-27 07:48:36 +01:00
Michael Kaufmann (d00p)
45c0915b59 fix ssl integration in lighttpd, thx to black-night for the info
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-11-17 15:15:09 +01:00
Michael Kaufmann (d00p)
1e03946df7 set sql_mode to disable STRICT_MODE usage for froxlor, thx to albech for the hint
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-11-08 07:49:40 +01:00
Michael Kaufmann (d00p)
dd3e5e9c6b fix wrong variable name typo, fixes #484
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-11-06 07:36:51 +01:00
Michael Kaufmann (d00p)
421c29c491 remove each() keyword as it is deprecated as of php-7.2, fixes #479
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-10-31 13:03:06 +01:00
Michael Kaufmann (d00p)
15b62aae04 add inserttask for config regeneration and fix aliasdomain NULL value if empty, fixes #478
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-10-06 09:29:49 +02:00
Michael Kaufmann (d00p)
181848290f move setting to enable usage of libnss-extrausers to 'system' category as mpm-itk + mod_php users might need this too
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-09-04 15:28:12 +02:00
Michael Kaufmann (d00p)
b263b211a5 generate multiline txt-record if content is too long, fixes #472
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-08-28 15:35:07 +02:00
Michael Kaufmann (d00p)
1753d2895b add simple smtp-settings test-page, fixes #464
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-08-25 10:34:59 +02:00
Michael Kaufmann (d00p)
64ebb0ca38 also add http2 flag to domain-import
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-08-24 15:27:47 +02:00
Michael Kaufmann (d00p)
bab982a0e6 add http2 support for froxlor-vhost and per-domain
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-08-24 13:21:21 +02:00
Michael Kaufmann (d00p)
c2c5178831 remove superfluous character in froxlor.sql file, fixes #471
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-08-23 14:03:39 +02:00
Michael Kaufmann (d00p)
56e8e32965 set correct permissions for extrausers files/folder, fixes #465
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-07-26 07:30:14 +02:00
Michael Kaufmann (d00p)
47cd30a45e use correct logging-level in customer_mail, thx to priority
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-07-19 12:06:36 +02:00
Michael Kaufmann
bd8f659272 Merge pull request #460 from pquerner/patch-libclass-lesscript-dontsendchallengewithouttoken
dont send uri to challenge, if no valid token could be fetched
2017-07-08 16:59:56 +02:00
Pascal Querner
82c719d786 dont send uri to challenge, if no valid token could be fetched 2017-07-07 22:50:39 +02:00
Michael Kaufmann (d00p)
dc22ff6aa3 fix rebuild of libnss-extrausers files when editing/deleting ftp account, fixes #454
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-06-20 16:48:11 +02:00
Michael Kaufmann
c68682b084 Merge pull request #450 from oliverrahner/master
nginx: add index directive to path options for secured directories
2017-06-10 11:47:53 +02:00
Oliver Rahner
aa8a7ee0a9 nginx: add index directive to path options for secured directories
`index` directives are now created for secured directory locations.
2017-06-10 10:59:41 +02:00
Michael Kaufmann (d00p)
e95a917812 allow non fqdn CNAME entries (froxlor appends zone's domain automatically if there's no trailing dot), fixes #434
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-06-04 11:29:21 +02:00
Michael Kaufmann (d00p)
332e627007 fix wildcard entries in dns editor, fixes #447; do not add extra dot at the end of SRV entries, fixes #446
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-06-04 09:31:55 +02:00
Michael Kaufmann (d00p)
a3201481f6 beatufication in generated vhost configs
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-06-04 09:30:32 +02:00
Michael Kaufmann (d00p)
dae233dd05 allow adding domains with multiple dashes, that are NOT punycode (xn--)
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-06-04 09:17:31 +02:00
Michael Kaufmann (d00p)
9aa2cc269b rename MYSQL_PASSWORD replacer to FROXLOR_MYSQL_PASSWORD in config-templates to avoid false replacement of couriers authmysqlrc, fixes #438
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-05-12 12:23:14 +02:00
Michael Kaufmann (d00p)
434f202832 minor fixes in traffic cron
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-05-12 12:22:04 +02:00
Michael Kaufmann (d00p)
552d58848c fix sql_mode=only_full_group_by in admin_admins.php; fix wrong webserver-user when using FCGID
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-05-09 13:17:50 +02:00
Michael Kaufmann (d00p)
bea1677d5d Add setting for libnss-extrausers to frontend
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-05-05 09:44:37 +02:00
Michael Kaufmann (d00p)
a2e0de23e1 add libnss-extrausers for debian/ubuntu users
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-05-05 09:35:06 +02:00
Michael Kaufmann
ebb33c9cee Merge pull request #436 from nachtgeist/master
doc: extend notes about contributing; add issue template
2017-05-01 21:26:26 +02:00
Daniel Reichelt
22414096ad doc: extend notes about contributing; add issue template 2017-05-01 21:24:48 +02:00
Michael Kaufmann (d00p)
9db7434876 add letsencrypt, HSTS settings, oscp-stapling and phpenabled-flag to Domain-import; fixes #416
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-04-18 16:55:55 +02:00
Michael Kaufmann
9fabfd539d Merge pull request #430 from mkhon/fix-apache24-ocsp-cache-path
Fix apache24_ocsp_cache_path definition
2017-04-18 12:50:40 +02:00
Michael Kaufmann
54f6c3e019 Merge pull request #431 from shyim/mysql-warning
Fixed MySQL Warning while creating a new user
2017-04-17 12:50:16 +02:00
Soner Sayakci
5930ab1c9d Fixed MySQL Warning while creating a new user 2017-04-17 12:34:20 +02:00
Max Khon
3870cc1002 Add default value for apache24_ocsp_cache_path, otherwise saving
SSL settings for !apache24 fails on apache24_ocsp_cache_path validation.
2017-04-17 15:55:49 +07:00
Michael Kaufmann
f880e1c9f1 Merge pull request #429 from mkhon/database-charset-skip-views
Skip views when altering table charsets
2017-04-15 11:28:27 +02:00
Michael Kaufmann
9285a169dd Merge pull request #428 from mkhon/fix-customer-logs
Fix customer logs
2017-04-15 11:27:15 +02:00
Max Khon
95b7b57fc6 Skip views when altering table charsets. 2017-04-15 16:12:29 +07:00
Max Khon
872928fb38 Fix customer logs:
- SQLSTATE[HY000]: General error: mode must be an integer
- customer_logger.php:78 Undefined variable $_actions
2017-04-15 15:58:50 +07:00
Michael Kaufmann
cb2f094e3d Merge pull request #426 from nachtgeist/master
readme: add section about contributing
2017-04-13 16:39:15 +02:00
Daniel Reichelt
b11b423217 readme: add section about contributing 2017-04-13 16:38:17 +02:00
Michael Kaufmann
567827e2cb Merge pull request #422 from nachtgeist/master
add OCSP stapling support for apache2 and nginx
2017-04-11 20:39:00 +02:00
Daniel Reichelt
ec1bd6e19a add OCSP stapling support for apache2 and nginx 2017-04-11 17:09:34 +02:00
Michael Kaufmann (d00p)
d4cd827284 update wiki-urls in language files
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-04-09 10:25:39 +02:00
Michael Kaufmann
50f85fb6d0 Merge pull request #417 from ianklemm/patch-1
Correct Wiki links
2017-04-03 20:32:24 +02:00
Vengance
9cc69e5b3d Update README.md 2017-04-03 20:31:50 +02:00
Vengance
d9e8f43298 Correct Wiki links
Correct the links of the no longer existing redmine to Github´s inbuild Wiki
2017-04-03 20:21:44 +02:00
Michael Kaufmann (d00p)
ad7cf52f21 Fix rowcount value for logger
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-03-17 13:05:39 +01:00
Michael Kaufmann (d00p)
398d45deae fix typo
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-03-14 13:46:07 +01:00
Michael Kaufmann (d00p)
541ab1fe6e clearify field label for domain termination date; fixes #1728
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-03-11 07:34:13 +01:00
Michael Kaufmann (d00p)
c0fddbce81 use correct pagination in admin-log/customer-log, fixes #1726
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-03-08 14:04:40 +01:00
Michael Kaufmann (d00p)
2284706e0c do not load mod_vroot in proftpd on centos
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-03-02 07:57:47 +01:00
Michael Kaufmann (d00p)
a4f72cbb40 do not show full path of file on php-error; fixes #1720
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-02-12 16:33:00 +01:00
Michael Kaufmann
d1c776b706 Merge pull request #414 from Douks08/patch-1
Update french.lng.php
2017-02-09 14:41:56 +01:00
Douks08
8ef315014c Update french.lng.php
Modification de "billets" en "tickets" qui est plus fréquemment utilisé
2017-02-09 10:19:32 +01:00
Michael Kaufmann (d00p)
2d59e569df fix phpenabled flag for new subdomains added by customers
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-01-30 22:46:53 +01:00
Michael Kaufmann (d00p)
202eb0931f fix auto-update of database in cronjob if activated
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-01-28 21:20:37 +01:00
Michael Kaufmann (d00p)
4cd1a8d656 Merge branch 'master' of github.com:Froxlor/Froxlor 2017-01-28 21:19:51 +01:00
Vengance
01a363456e Fix libnss config (#412)
* Fix libnss config
2017-01-28 15:47:19 +01:00
Michael Kaufmann (d00p)
8f4da0638e allow underscore in dns labels, fixes #1697
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-01-25 10:42:18 +01:00
Michael Kaufmann (d00p)
3e6c3d725b set version to 0.9.38.7 for upcoming bugfix release
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-01-24 09:43:20 +01:00
Michael Kaufmann (d00p)
95a18be5c5 do not use HTTP_HOST variable if mod_rewrite is not used
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-01-24 09:41:45 +01:00
Michael Kaufmann (d00p)
8030aae37a fix directory options for deactivated users, fixes #1704
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-01-23 23:53:01 +01:00
Michael Kaufmann (d00p)
0eaa81b503 use libnss-mysl deb package from froxlor repo as debians 1.5-5 package is not suitable for jessie
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-01-23 08:17:18 +01:00
Michael Kaufmann (d00p)
c2b864a20f enable/disable php for standard-subdomain when adding a new customer according to the customer-phpenabled value, fixes #1708
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-01-23 08:14:14 +01:00
Michael Kaufmann (d00p)
e00cb8926d set mail-sender to customer mail address when using mod_php, fixes #1707
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-01-23 08:12:44 +01:00
Michael Kaufmann (d00p)
afb2bce16d fix missing german language strings, refs #1705
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-01-23 08:05:48 +01:00
Michael Kaufmann (d00p)
1033f502b1 add missing language strings, fixes #1705
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-01-19 14:09:51 +01:00
Michael Kaufmann (d00p)
ab18d94053 fix PR #407 - only works for apache-2.4 and missed the entry for customer-vhosts
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-01-17 11:29:40 +01:00
Michael Kaufmann
9afbe7fb71 Merge pull request #407 from buffcode/ssl-compression
Disable SSLCompression (CRIME attack)
2017-01-17 10:40:19 +01:00
Laurens Stötzel
5e0270e6a8 Disable SSLCompression (CRIME attack)
https://raymii.org/s/tutorials/Strong_SSL_Security_On_Apache2.html#SSL_Compression_(CRIME_attack)
2017-01-17 10:33:22 +01:00
Michael Kaufmann (d00p)
c6962b0992 fix variable-typo to make phpenabled-flag work when adding new domains, thx to micw
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-01-16 08:43:54 +01:00
Michael Kaufmann (d00p)
9fdcd09089 fix install class, set version to 0.9.38.6
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-01-15 07:44:58 +01:00
Michael Kaufmann (d00p)
338cf161d2 fix undefined index if let's encrypt is used for the froxlor-vhost
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-01-14 18:06:04 +01:00
Michael Kaufmann (d00p)
044ce6662a set version to 0.9.38.5 for upcoming release
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-01-13 19:45:17 +01:00
Michael Kaufmann (d00p)
d574233f49 also reseller/admins who can't see all customers were able to delete arbitrary ssl certificates, refs #1699
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-01-13 19:21:34 +01:00
Michael Kaufmann (d00p)
02c6545c94 update download url for libnss-mysql for debian jessie, fixies #1700
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-01-10 19:11:01 +01:00
Michael Kaufmann (d00p)
c795cd3320 check for ownership of certificate when deleting as customer, fixes #1699
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-01-10 08:37:50 +01:00
Michael Kaufmann (d00p)
1ebde2e6a4 return correct default redirectCode when none is set, thx to J-BBB
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2017-01-05 11:58:11 +01:00
Michael Kaufmann
78ee141b26 Merge pull request #405 from lobeck/hsts_link_fix
fix hsts removal links
2017-01-02 07:32:45 +01:00
Christian Becker
d11ddd910f fix hsts removal links
without a protocol, they are treated relative which is annoying
2017-01-02 03:06:18 +01:00
Michael Kaufmann (d00p)
437446c49d update phpMailer to 5.2.21
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-12-29 10:54:25 +01:00
Michael Kaufmann (d00p)
7a603596c5 validate ip address on installation 2016-12-28 20:13:15 +01:00
Michael Kaufmann
c2a91ed623 Merge pull request #403 from pissbeutel/master
Changed SOA refresh intervall to be within recommended values
2016-12-17 15:16:46 +01:00
Michael Kaufmann
3dcd2b9a3e Merge pull request #402 from stweil/doc
Fix description in README.md
2016-12-17 15:16:10 +01:00
pissbeutel
75622d4737 Changed SOA refresh intervall to be compliant within recommended values
See: https://www.denic.de/fileadmin/public/documentation/DENIC-23p.pdf

The recommended values according to DENIC are:
refresh: 3600 - 86400
retry: 900 - 28800
expire: 604800 - 3600000
negTTL: 180 - 86400
2016-12-17 15:14:02 +01:00
Stefan Weil
7a617d0aa4 Fix description in README.md
The entry is called "System", not "Server".

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-12-17 14:33:28 +01:00
Michael Kaufmann
ccca077df7 Merge pull request #401 from stweil/html
Fix HTML code (unclosed tag)
2016-12-17 13:05:56 +01:00
Stefan Weil
5c008adf16 Fix HTML code (wrong tag)
`<span>` must be terminated by `</span>`.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-12-17 12:34:15 +01:00
Michael Kaufmann (d00p)
4502f7ddf5 fix Settings::Flush(), thx to Ithariel
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-12-16 10:17:48 +01:00
Michael Kaufmann (d00p)
f9101f880b use namserver IP's for axfr/pdns-config, also add placeholder AXFRSERVERS for axfr-servers setting; fixes #1691
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-12-14 09:54:49 +01:00
Michael Kaufmann (d00p)
5ed0c3f2f3 code-formatting and put phpenabled flag on a better position
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-12-11 09:50:22 +01:00
Michael Kaufmann (d00p)
9907775c0d fix installation sql
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-12-11 09:43:05 +01:00
Michael Kaufmann
ed9d4a5744 Merge pull request #392 from negrusti/patch-1
Prevent duplicates in ipsandports table
2016-12-11 08:55:47 +01:00
Michael Kaufmann
c1aea2795e Merge branch 'master' into patch-1 2016-12-11 08:55:37 +01:00
Michael Kaufmann (d00p)
3a8996aee2 add missing fields that are only added via update
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-12-11 08:29:54 +01:00
Michael Kaufmann
e67aefe48b Merge pull request #400 from micw/feature/letsencrypt-verbesserungen
Better handling for letsencrypt errors, refs #1661
2016-12-11 08:24:10 +01:00
Michael Kaufmann
602c38dbeb Merge branch 'master' into feature/letsencrypt-verbesserungen 2016-12-11 08:23:46 +01:00
Michael Kaufmann
f1c232cef9 Merge pull request #396 from schallertd/master
Checkbox to enable/disable PHP (vhost settings + fpm pool) for an entire vhost, fixes #1671
2016-12-11 08:20:01 +01:00
Michael Kaufmann
3d4b56b233 Merge branch 'master' into master 2016-12-11 08:19:16 +01:00
Michael Kaufmann
d8994ca65b Merge pull request #399 from hypernics/alias_redirect
Change redirect host from main domain name to requested domain name, refs #1670
2016-12-11 08:05:57 +01:00
Michael Kaufmann (d00p)
18514f0180 fix undefined array when processing specialsettings, fixes #1684
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-12-10 21:43:28 +01:00
Michael Kaufmann (d00p)
001786dd97 fix incorrect User-Agent header in let's encrypt class, fixes #1683
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-12-09 13:33:57 +01:00
Michael Kaufmann (d00p)
225539d2e7 show ssl-related settings only if customer has ssl-ip assigned (not yet checked per domain); fix hsts-includeSubdomain setting for fresh installations
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-29 09:34:33 +01:00
Janos Muzsi
1b18ec45be correcting lighttpd settings 2016-11-27 23:18:23 +01:00
micw
7b6bbcec48 Fixed default LE license URL
(removed testing stuff)
2016-11-27 12:45:06 +01:00
Michael Kaufmann (d00p)
56276a19d1 set version to 0.9.38.4 for upcoming bugfix release
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-27 12:12:22 +01:00
Michael Kaufmann (d00p)
c00abc3b92 move froxlor hsts settings to 'froxlor vhost settings' to make clear it's only for froxlor anbd not a system-wide default for all domains; fix superfluous english text from german language file
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-27 11:40:33 +01:00
Michael Kaufmann (d00p)
301dadaa02 fix global hsts-includeSubdomain setting, thx to iam
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-27 10:46:50 +01:00
Michael Wyraz
559bd6d892 Better db update 2016-11-25 10:52:50 +01:00
Michael Wyraz
18b45c749d Better handling for letsencrypt errors after failed registration or changed license 2016-11-25 09:54:47 +01:00
Janos Muzsi
2c00f982d8 Change redirect host from main domain name to requested domain name 2016-11-24 22:55:57 +01:00
Michael Kaufmann (d00p)
54200427ab fix undefined variable when deleting a customer-domain as admin
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-24 10:40:28 +01:00
Michael Kaufmann (d00p)
f8996ad767 catch exception thrown by new IdnaConverter when encoding a non-valid domain, fixes #1678
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-22 15:08:42 +01:00
Michael Kaufmann (d00p)
9838ff4da5 fix hsts settings for lighttpd, fixes #1677
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-22 08:16:35 +01:00
Michael Kaufmann (d00p)
192e00c717 do not show NameVirtualHost in IP/Port overview when using apache-2.4 (as NameVirtualHost does not exist there anymore)
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-22 08:04:11 +01:00
Michael Kaufmann (d00p)
43ca4a28e4 add acme.conf alias also to froxlor vhost in case the acme-challenge path is not within the froxlor-docroot; fix empty redirect-code, fixes #1674
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-21 08:19:33 +01:00
Michael Kaufmann (d00p)
16e9fd6bd9 stay php-5.3 compatible
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-18 21:19:18 +01:00
Michael Kaufmann (d00p)
16f547bce0 last time....0.9.38.3....what a day
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-18 10:27:11 +01:00
Michael Kaufmann (d00p)
60a482dce6 damn, forgot to save the two files to handle customer-side domain-settings regarding the hsts-includeSubdomain issue; version set to 0.9.38.2
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-18 10:21:02 +01:00
Michael Kaufmann (d00p)
9540cb158c set version to 0.9.38.1 b/c of hsts includeSubdomains flag for domains not being saved; added http2-flag for nginx as setting
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-18 10:10:03 +01:00
Michael Kaufmann (d00p)
1984aced9d set db_version correctly everywhere
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-18 08:52:40 +01:00
Michael Kaufmann (d00p)
ca2949da71 Merge branch 'hypernics-nginx-http2' 2016-11-18 08:50:17 +01:00
Michael Kaufmann (d00p)
eb8449fd79 merge conflicts in update-script
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-18 08:50:03 +01:00
Michael Kaufmann (d00p)
547140bafb set version to 0.9.38 for upcoming release
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-18 08:36:35 +01:00
Janos Muzsi
d245bca445 correcting the update 2016-11-18 08:32:23 +01:00
Janos Muzsi
5f899a5510 Add support for http2 option to nginx 2016-11-17 22:50:11 +01:00
Michael Kaufmann (d00p)
432645431c allow CIDR values in AXFR setting, fixes #1672
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-15 08:03:34 +01:00
Dominic Schallert
30087548b0 Fixed the checkbox value 2016-11-13 15:33:56 +01:00
Dominic Schallert
d93cfff172 updates always at the end of the file 2016-11-13 15:18:07 +01:00
Dominic Schallert
e5053bad15 Introduced phpenabled_customer and phpenabled_vhost, updated cron scripts, updated dbversion 2016-11-13 15:15:43 +01:00
Dominic
1519db1637 Update update_0.9.inc.php 2016-11-13 14:48:50 +01:00
Dominic Schallert
b0326c640c Feature #1671 Checkbox to enable/disable PHP (vhost settings + fpm pool) for an entire vhost 2016-11-13 14:41:39 +01:00
Michael Kaufmann (d00p)
7e4164da26 do not double validate openbasedir-values, as appendOpenbasedirPath() already takes care of that; also fix /dev/urandom as openbasedir-path-value to be treated as file correctly, fixes #1669
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
2016-11-10 10:07:00 +01:00
Grigory Morozov
3ff85e167c Update update_0.9.inc.php 2016-09-27 23:08:30 +07:00
Grigory Morozov
dc428b7de2 Adding unique key to ipsandports on upgrade
Please guide on checking the correct Froxlor version, not sure how it works
2016-09-26 23:23:11 +07:00
Grigory Morozov
06a55ef91e Prevent duplicates in ipsandports table 2016-09-26 22:52:03 +07:00
600 changed files with 70497 additions and 53106 deletions

4
.codecov.yml Normal file
View File

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

57
.github/CONTRIBUTING.md vendored Normal file
View File

@@ -0,0 +1,57 @@
# Contributing
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).
## Checklist
General rules for PRs are:
* Please save us all some trouble and unnecessary round-trips by _testing_ your
changes.
* 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...
Thanks!
### Webserver changes
If you make changes to the functionality of webserver configuration, please
make sure your implementation covers all supported webservers.
### l10n
If you add new language strings, please make sure you add the english fallback
strings in
* `lng/english.lng.php`
* `install/lng/english.lng.php` (if applicable)
### 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

3
.github/FUNDING.yml vendored Normal file
View File

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

64
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,64 @@
# Bug report vs. support request
If you're unsure of whether your problem is a bug or a configuration error
* contact us via IRC in #froxlor on freenode
* or post a thread in our forum at https://forum.froxlor.org
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
# Summary
Please provide a concise summary of the problem you're experiencing...
# 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: ...
# Steps to reproduce
1.
2.
3.
# Expected behavior
1.
2.
3.
# Actual behavior
1.
2.
3.
# Log files/log entries
syslog:
<pre>
example
</pre>

38
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,38 @@
# Description
Please include a summary of the change and which issue is fixed if any. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes # (issue)
## Type of change
Please delete options that are not relevant.
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update
# How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
- [ ] Test A
- [ ] Test B
**Test Configuration**:
* Distribution:
* Webserver:
* PHP:
* etc.etc.:
# Checklist:
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] 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

3
.gitignore vendored
View File

@@ -1,7 +1,9 @@
install/update.log
templates/*
lib/userdata.inc.php
lib/userdata.inc.php.bak
logs/*
!logs/index.html
.buildpath
.project
.settings/
@@ -15,3 +17,4 @@ logs/*
!templates/Sparkle/
!templates/misc/
templates/Froxlor/assets/img/logo_custom.png
vendor/

67
.travis.yml Normal file
View File

@@ -0,0 +1,67 @@
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

90
2fa.php Normal file
View File

@@ -0,0 +1,90 @@
<?php
if (! defined('AREA')) {
header("Location: index.php");
exit();
}
use Froxlor\Database\Database;
use Froxlor\Settings;
if (Settings::Get('2fa.enabled') != '1') {
\Froxlor\UI\Response::dynamic_error("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
// and therefore does not need to require lib/init.php
if (AREA == 'admin') {
$upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `type_2fa` = :t2fa, `data_2fa` = :d2fa WHERE adminid = :id");
$uid = $userinfo['adminid'];
} elseif (AREA == 'customer') {
$upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `type_2fa` = :t2fa, `data_2fa` = :d2fa WHERE customerid = :id");
$uid = $userinfo['customerid'];
}
$success_message = "";
$tfa = new \Froxlor\FroxlorTwoFactorAuth('Froxlor');
// do the delete and then just show a success-message
if ($action == 'delete') {
Database::pexecute($upd_stmt, array(
't2fa' => 0,
'd2fa' => "",
'id' => $uid
));
\Froxlor\UI\Response::standard_success($lng['2fa']['2fa_removed']);
} elseif ($action == 'add') {
$type = isset($_POST['type_2fa']) ? $_POST['type_2fa'] : '0';
if ($type == 0 || $type == 1) {
$data = "";
}
if ($type == 2) {
// generate secret for TOTP
$data = $tfa->createSecret();
}
Database::pexecute($upd_stmt, array(
't2fa' => $type,
'd2fa' => $data,
'id' => $uid
));
\Froxlor\UI\Response::standard_success(sprintf($lng['2fa']['2fa_added'], $filename, $s));
}
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed 2fa::overview");
if ($userinfo['type_2fa'] == '0') {
// available types
$type_select_values = array(
0 => '-',
1 => 'E-Mail',
2 => 'Authenticator'
);
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') {
// email 2fa enabled
} elseif ($userinfo['type_2fa'] == '2') {
// authenticator 2fa enabled
$ga_qrcode = $tfa->getQRCodeImageAsDataUri($userinfo['loginname'], $userinfo['data_2fa']);
}
eval("echo \"" . \Froxlor\UI\Template::getTemplate("2fa/overview", true) . "\";");

View File

@@ -1,3 +1,6 @@
[![Build Status](https://travis-ci.com/Froxlor/Froxlor.svg?branch=master)](https://travis-ci.com/Froxlor/Froxlor)
[![Gitter](https://badges.gitter.im/Froxlor/community.svg)](https://gitter.im/Froxlor/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
# Froxlor
The server administration software for your needs.
@@ -11,13 +14,13 @@ Developed by experienced server administrators, this panel simplifies the effort
3. Point your browser to http://[ip-of-webserver]/froxlor
4. Follow the installer
5. Login as administrator
6. Adjust "Server > Settings" according to your needs
7. Choose your distribution under "Server > Configuration"
6. Adjust "System > Settings" according to your needs
7. Choose your distribution under "System > Configuration"
8. Follow the steps for your services
9. Have fun!
### Detailed installation
http://redmine.froxlor.org/projects/froxlor/wiki/Installationtarball
https://github.com/Froxlor/Froxlor/wiki/Install-froxlor-from-tarball
## Help
@@ -30,12 +33,12 @@ irc://chat.freenode.net/froxlor
### Forum
The community is located on http://forum.froxlor.org
The community is located on https://forum.froxlor.org/
### Wiki
More documentation may be found in the froxlor - wiki:
http://redmine.froxlor.org/projects/froxlor/wiki
https://github.com/Froxlor/Froxlor/wiki
## License
@@ -44,31 +47,21 @@ May be found in COPYING
## Downloads
### Tarball
http://files.froxlor.org/releases/froxlor-latest.tar.gz [MD5](http://files.froxlor.org/releases/froxlor-latest.tar.gz.md5) [SHA1](http://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
[HowTo](http://redmine.froxlor.org/projects/froxlor/wiki/Installationdebian)
[HowTo](https://github.com/Froxlor/Froxlor/wiki/Install-froxlor-on-debian)
/etc/apt/sources.list.d/froxlor.list
> deb http://debian.froxlor.org {wheezy|jessie} main
> deb http://debian.froxlor.org {stretch|buster} main
### Gentoo repository
[HowTo](http://redmine.froxlor.org/projects/froxlor/wiki/Installationgentoo)
[HowTo](https://github.com/Froxlor/Froxlor/wiki/Install-froxlor-on-gentoo)
http://files.froxlor.org/gentoo/repositories.xml
https://files.froxlor.org/gentoo/repositories.xml
## Let's Encrypt support
This version of Froxlor contains a test implementation of support for [Let's Encrypt](https://letsencrypt.org). This is (as Let's Encrypt is in itself)
still a beta version and may break your system. The way it currently works is by creating a (sub-)domain with the default system - certificate,
after which the Let's Encrypt cronjob orders the certificate for this (sub-)domain and inserts the certificates in the database. With the next run
of the default cronjob, the certificates will be updated on the disk and the webserver reloaded.
This has 2 known side-effects at the moment:
* The basic ip/port combinations don't work with the Froxlor - integration of Let's Encrypt, since it needs a certificate for the very first creation
* After creating a domain, it will have the default certificate for a short time (by default 5 minutes until the cronjob runs the next time)
It may be possible to fix these issues, but they are not a priority at the moment
## Contributing
[see here](.github/CONTRIBUTING.md)

View File

@@ -1,72 +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 Settings
*
*/
return array(
'groups' => array(
'version' => array(
'fields' => array(
'panel_version' => array(
'settinggroup' => 'panel',
'varname' => 'version',
'type' => 'hidden',
'default' => '',
),
'panel_frontend' => array(
'settinggroup' => 'panel',
'varname' => 'frontend',
'type' => 'hidden',
'default' => '',
),
'system_last_tasks_run' => array(
'settinggroup' => 'system',
'varname' => 'last_tasks_run',
'type' => 'hidden',
'default' => '',
'save_method' => 'storeSettingField',
),
'system_last_traffic_run' => array(
'settinggroup' => 'system',
'varname' => 'last_traffic_run',
'type' => 'hidden',
'default' => '',
),
'system_lastcronrun' => array(
'settinggroup' => 'system',
'varname' => 'lastcronrun',
'type' => 'hidden',
'default' => '',
),
'system_lastguid' => array(
'settinggroup' => 'system',
'varname' => 'lastguid',
'type' => 'hidden',
'default' => 9999,
),
'system_lastaccountnumber' => array(
'settinggroup' => 'system',
'varname' => 'lastaccountnumber',
'type' => 'hidden',
'default' => 0,
),
),
),
),
);
?>

View File

@@ -16,40 +16,51 @@
* @package Language
*
*/
return array(
'groups' => array(
'panel' => array(
'title' => $lng['admin']['panelsettings'],
'fields' => array(
'panel_standardlanguage' => array(
'label' => array('title' => $lng['login']['language'], 'description' => $lng['serversettings']['language']['description']),
'label' => array(
'title' => $lng['login']['language'],
'description' => $lng['serversettings']['language']['description']
),
'settinggroup' => 'panel',
'varname' => 'standardlanguage',
'type' => 'option',
'default' => 'English',
'option_mode' => 'one',
'option_options_method' => 'getLanguages',
'save_method' => 'storeSettingField',
'option_options_method' => array(
'\\Froxlor\\User',
'getLanguages'
),
'save_method' => 'storeSettingField'
),
'panel_default_theme' => array(
'label' => array('title' => $lng['panel']['theme'], 'description' => $lng['serversettings']['default_theme']),
'label' => array(
'title' => $lng['panel']['theme'],
'description' => $lng['serversettings']['default_theme']
),
'settinggroup' => 'panel',
'varname' => 'default_theme',
'type' => 'option',
'default' => 'Froxlor',
'default' => 'Sparkle',
'option_mode' => 'one',
'option_options_method' => 'getThemes',
'save_method' => 'storeSettingDefaultTheme',
'option_options_method' => array(
'\\Froxlor\\UI\\Template',
'getThemes'
),
'save_method' => 'storeSettingDefaultTheme'
),
'panel_allow_theme_change_customer' => array(
'label' => $lng['serversettings']['panel_allow_theme_change_customer'],
'settinggroup' => 'panel',
'varname' => 'allow_theme_change_customer',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'panel_allow_theme_change_admin' => array(
'label' => $lng['serversettings']['panel_allow_theme_change_admin'],
'settinggroup' => 'panel',
@@ -57,23 +68,23 @@ return array(
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField'
),
),
'panel_natsorting' => array(
'label' => $lng['serversettings']['natsorting'],
'settinggroup' => 'panel',
'varname' => 'natsorting',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'panel_no_robots' => array(
'label' => $lng['serversettings']['no_robots'],
'settinggroup' => 'panel',
'varname' => 'no_robots',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'default' => true,
'save_method' => 'storeSettingField'
),
'panel_paging' => array(
'label' => $lng['serversettings']['paging'],
'settinggroup' => 'panel',
@@ -81,8 +92,8 @@ return array(
'type' => 'int',
'int_min' => 0,
'default' => 0,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'panel_pathedit' => array(
'label' => $lng['serversettings']['pathedit'],
'settinggroup' => 'panel',
@@ -90,9 +101,12 @@ return array(
'type' => 'option',
'default' => 'Manual',
'option_mode' => 'one',
'option_options' => array('Manual' => $lng['serversettings']['manual'], 'Dropdown' => $lng['serversettings']['dropdown']),
'save_method' => 'storeSettingField',
'option_options' => array(
'Manual' => $lng['serversettings']['manual'],
'Dropdown' => $lng['serversettings']['dropdown']
),
'save_method' => 'storeSettingField'
),
'panel_adminmail' => array(
'label' => $lng['serversettings']['adminmail'],
'settinggroup' => 'panel',
@@ -101,16 +115,16 @@ return array(
'string_type' => 'mail',
'string_emptyallowed' => false,
'default' => '',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'panel_adminmail_defname' => array(
'label' => $lng['serversettings']['adminmail_defname'],
'settinggroup' => 'panel',
'varname' => 'adminmail_defname',
'type' => 'string',
'default' => 'Froxlor Administrator',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'panel_adminmail_return' => array(
'label' => $lng['serversettings']['adminmail_return'],
'settinggroup' => 'panel',
@@ -119,8 +133,8 @@ return array(
'string_type' => 'mail',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'panel_decimal_places' => array(
'label' => $lng['serversettings']['decimal_places'],
'settinggroup' => 'panel',
@@ -129,8 +143,8 @@ return array(
'int_min' => 0,
'int_max' => 15,
'default' => 4,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'panel_phpmyadmin_url' => array(
'label' => $lng['serversettings']['phpmyadmin_url'],
'settinggroup' => 'panel',
@@ -139,8 +153,8 @@ return array(
'string_type' => 'url',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'panel_webmail_url' => array(
'label' => $lng['serversettings']['webmail_url'],
'settinggroup' => 'panel',
@@ -149,8 +163,8 @@ return array(
'string_type' => 'url',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'panel_webftp_url' => array(
'label' => $lng['serversettings']['webftp_url'],
'settinggroup' => 'panel',
@@ -159,40 +173,40 @@ return array(
'string_type' => 'url',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'admin_show_version_login' => array(
'label' => $lng['admin']['show_version_login'],
'settinggroup' => 'admin',
'varname' => 'show_version_login',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'admin_show_version_footer' => array(
'label' => $lng['admin']['show_version_footer'],
'settinggroup' => 'admin',
'varname' => 'show_version_footer',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'admin_show_news_feed' => array(
'label' => $lng['admin']['show_news_feed'],
'settinggroup' => 'admin',
'varname' => 'show_news_feed',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'customer_show_news_feed' => array(
'label' => $lng['admin']['customer_show_news_feed'],
'settinggroup' => 'customer',
'varname' => 'show_news_feed',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'customer_news_feed_url' => array(
'label' => $lng['admin']['customer_news_feed_url'],
'settinggroup' => 'customer',
@@ -201,32 +215,32 @@ return array(
'string_type' => 'url',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'panel_allow_domain_change_admin' => array(
'label' => $lng['serversettings']['panel_allow_domain_change_admin'],
'settinggroup' => 'panel',
'varname' => 'allow_domain_change_admin',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'panel_allow_domain_change_customer' => array(
'label' => $lng['serversettings']['panel_allow_domain_change_customer'],
'settinggroup' => 'panel',
'varname' => 'allow_domain_change_customer',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'panel_phpconfigs_hidestdsubdomain' => array(
'label' => $lng['serversettings']['panel_phpconfigs_hidestdsubdomain'],
'settinggroup' => 'panel',
'varname' => 'phpconfigs_hidestdsubdomain',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'panel_customer_hide_options' => array(
'label' => $lng['serversettings']['panel_customer_hide_options'],
'settinggroup' => 'panel',
@@ -236,25 +250,25 @@ return array(
'option_mode' => 'multiple',
'option_emptyallowed' => true,
'option_options' => array(
'email' => $lng['menue']['email']['email'],
'mysql' => $lng['menue']['mysql']['mysql'],
'domains' => $lng['menue']['domains']['domains'],
'ftp' => $lng['menue']['ftp']['ftp'],
'extras' => $lng['menue']['extras']['extras'],
'extras.directoryprotection' => $lng['menue']['extras']['extras']." / ".$lng['menue']['extras']['directoryprotection'],
'extras.pathoptions' => $lng['menue']['extras']['extras']." / ".$lng['menue']['extras']['pathoptions'],
'extras.logger' => $lng['menue']['extras']['extras']." / ".$lng['menue']['logger']['logger'],
'extras.backup' => $lng['menue']['extras']['extras']." / ".$lng['menue']['extras']['backup'],
'traffic' => $lng['menue']['traffic']['traffic'],
'traffic.http' => $lng['menue']['traffic']['traffic']." / HTTP",
'traffic.ftp' => $lng['menue']['traffic']['traffic']." / FTP",
'traffic.mail' => $lng['menue']['traffic']['traffic']." / Mail",
'email' => $lng['menue']['email']['email'],
'mysql' => $lng['menue']['mysql']['mysql'],
'domains' => $lng['menue']['domains']['domains'],
'ftp' => $lng['menue']['ftp']['ftp'],
'extras' => $lng['menue']['extras']['extras'],
'extras.directoryprotection' => $lng['menue']['extras']['extras'] . " / " . $lng['menue']['extras']['directoryprotection'],
'extras.pathoptions' => $lng['menue']['extras']['extras'] . " / " . $lng['menue']['extras']['pathoptions'],
'extras.logger' => $lng['menue']['extras']['extras'] . " / " . $lng['menue']['logger']['logger'],
'extras.backup' => $lng['menue']['extras']['extras'] . " / " . $lng['menue']['extras']['backup'],
'traffic' => $lng['menue']['traffic']['traffic'],
'traffic.http' => $lng['menue']['traffic']['traffic'] . " / HTTP",
'traffic.ftp' => $lng['menue']['traffic']['traffic'] . " / FTP",
'traffic.mail' => $lng['menue']['traffic']['traffic'] . " / Mail"
),
'save_method' => 'storeSettingField',
),
),
),
),
);
'save_method' => 'storeSettingField'
)
)
)
)
);
?>

View File

@@ -16,7 +16,6 @@
* @package Settings
*
*/
return array(
'groups' => array(
'accounts' => array(
@@ -28,131 +27,144 @@ return array(
'varname' => 'sessiontimeout',
'type' => 'int',
'default' => 600,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'session_allow_multiple_login' => array(
'label' => $lng['serversettings']['session_allow_multiple_login'],
'settinggroup' => 'session',
'varname' => 'allow_multiple_login',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'login_domain_login' => array(
'label' => $lng['serversettings']['login_domain_login'],
'settinggroup' => 'login',
'varname' => 'domain_login',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'login_maxloginattempts' => array(
'label' => $lng['serversettings']['maxloginattempts'],
'settinggroup' => 'login',
'varname' => 'maxloginattempts',
'type' => 'int',
'default' => 3,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'login_deactivatetime' => array(
'label' => $lng['serversettings']['deactivatetime'],
'settinggroup' => 'login',
'varname' => 'deactivatetime',
'type' => 'int',
'default' => 900,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'2fa_enabled' => array(
'label' => $lng['2fa']['2fa_enabled'],
'settinggroup' => '2fa',
'varname' => 'enabled',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField'
),
'panel_password_min_length' => array(
'label' => $lng['serversettings']['panel_password_min_length'],
'settinggroup' => 'panel',
'varname' => 'password_min_length',
'type' => 'int',
'default' => 0,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'panel_password_alpha_lower' => array(
'label' => $lng['serversettings']['panel_password_alpha_lower'],
'settinggroup' => 'panel',
'varname' => 'password_alpha_lower',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'panel_password_alpha_upper' => array(
'label' => $lng['serversettings']['panel_password_alpha_upper'],
'settinggroup' => 'panel',
'varname' => 'password_alpha_upper',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'panel_password_numeric' => array(
'label' => $lng['serversettings']['panel_password_numeric'],
'settinggroup' => 'panel',
'varname' => 'password_numeric',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'panel_password_special_char_required' => array(
'label' => $lng['serversettings']['panel_password_special_char_required'],
'settinggroup' => 'panel',
'varname' => 'password_special_char_required',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'panel_password_special_char' => array(
'label' => $lng['serversettings']['panel_password_special_char'],
'settinggroup' => 'panel',
'varname' => 'password_special_char',
'type' => 'string',
'default' => '!?<>§$%+#=@',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'panel_password_regex' => array(
'label' => $lng['serversettings']['panel_password_regex'],
'settinggroup' => 'panel',
'varname' => 'password_regex',
'type' => 'string',
'default' => '',
/* 'plausibility_check_method' => 'checkValidRegEx', */
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'customer_accountprefix' => array(
'label' => $lng['serversettings']['accountprefix'],
'settinggroup' => 'customer',
'varname' => 'accountprefix',
'type' => 'string',
'default' => '',
'plausibility_check_method' => 'checkUsername',
'save_method' => 'storeSettingField',
'plausibility_check_method' => array(
'\\Froxlor\\Validate\\Check',
'checkUsername'
),
'save_method' => 'storeSettingField'
),
'customer_mysqlprefix' => array(
'label' => $lng['serversettings']['mysqlprefix'],
'settinggroup' => 'customer',
'varname' => 'mysqlprefix',
'type' => 'string',
'default' => '',
'plausibility_check_method' => 'checkUsername',
'save_method' => 'storeSettingField',
'plausibility_check_method' => array(
'\\Froxlor\\Validate\\Check',
'checkUsername'
),
'save_method' => 'storeSettingField'
),
'customer_ftpprefix' => array(
'label' => $lng['serversettings']['ftpprefix'],
'settinggroup' => 'customer',
'varname' => 'ftpprefix',
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'customer_ftpatdomain' => array(
'label' => $lng['serversettings']['ftpdomain'],
'settinggroup' => 'customer',
'varname' => 'ftpatdomain',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'panel_allow_preset' => array(
'label' => $lng['serversettings']['allow_password_reset'],
'settinggroup' => 'panel',
@@ -161,14 +173,14 @@ return array(
'default' => false,
'save_method' => 'storeSettingField',
'dependency' => array(
'fieldname' => 'panel_allow_preset_admin',
'fielddata' => array(
'settinggroup' => 'panel',
'varname' => 'allow_preset_admin',
),
'onlyif' => 0
)
),
'fieldname' => 'panel_allow_preset_admin',
'fielddata' => array(
'settinggroup' => 'panel',
'varname' => 'allow_preset_admin'
),
'onlyif' => 0
)
),
'panel_allow_preset_admin' => array(
'label' => $lng['serversettings']['allow_password_reset_admin'],
'settinggroup' => 'panel',
@@ -177,12 +189,12 @@ return array(
'default' => false,
'save_method' => 'storeSettingField',
'dependency' => array(
'fieldname' => 'panel_allow_preset',
'fielddata' => array(
'settinggroup' => 'panel',
'varname' => 'allow_preset',
),
'onlyif' => 1
'fieldname' => 'panel_allow_preset',
'fielddata' => array(
'settinggroup' => 'panel',
'varname' => 'allow_preset'
),
'onlyif' => 1
)
),
'system_backupenabled' => array(
@@ -193,9 +205,9 @@ return array(
'default' => false,
'cronmodule' => 'froxlor/backup',
'save_method' => 'storeSettingField'
),
),
),
)
)
)
)
);

View File

@@ -16,7 +16,6 @@
* @package Settings
*
*/
return array(
'groups' => array(
'system' => array(
@@ -30,36 +29,58 @@ return array(
'string_type' => 'dir',
'default' => '/var/customers/webs/',
'save_method' => 'storeSettingField',
'plausibility_check_method' => 'checkPathConflicts'
),
'plausibility_check_method' => array(
'\\Froxlor\\Validate\\Check',
'checkPathConflicts'
)
),
'system_documentroot_use_default_value' => array(
'label' => $lng['serversettings']['documentroot_use_default_value'],
'settinggroup' => 'system',
'varname' => 'documentroot_use_default_value',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_ipaddress' => array(
'label' => $lng['serversettings']['ipaddress'],
'settinggroup' => 'system',
'varname' => 'ipaddress',
'type' => 'option',
'option_mode' => 'one',
'option_options_method' => 'getIpAddresses',
'default' => '',
'save_method' => 'storeSettingIpAddress',
'option_options_method' => array(
'\\Froxlor\\Domain\\IpAddr',
'getIpAddresses'
),
'default' => '',
'save_method' => 'storeSettingIpAddress'
),
'system_defaultip' => array(
'label' => $lng['serversettings']['defaultip'],
'settinggroup' => 'system',
'varname' => 'defaultip',
'type' => 'option',
'option_mode' => 'multiple',
'option_options_method' => 'getIpPortCombinations',
'default' => '',
'save_method' => 'storeSettingDefaultIp',
'option_options_method' => array(
'\\Froxlor\\Domain\\IpAddr',
'getIpPortCombinations'
),
'default' => '',
'save_method' => 'storeSettingDefaultIp'
),
'system_defaultsslip' => array(
'label' => $lng['serversettings']['defaultsslip'],
'settinggroup' => 'system',
'varname' => 'defaultsslip',
'type' => 'option',
'option_mode' => 'multiple',
'option_options_method' => array(
'\\Froxlor\\Domain\\IpAddr',
'getSslIpPortCombinations'
),
'default' => '',
'save_method' => 'storeSettingDefaultSslIp'
),
'system_hostname' => array(
'label' => $lng['serversettings']['hostname'],
'settinggroup' => 'system',
@@ -67,33 +88,55 @@ return array(
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingHostname',
'plausibility_check_method' => 'checkHostname',
),
'plausibility_check_method' => array(
'\\Froxlor\\Validate\\Check',
'checkHostname'
)
),
'api_enabled' => array(
'label' => $lng['serversettings']['enable_api'],
'settinggroup' => 'api',
'varname' => 'enabled',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
),
'system_validatedomain' => array(
'label' => $lng['serversettings']['validate_domain'],
'settinggroup' => 'system',
'varname' => 'validate_domain',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_stdsubdomain' => array(
'label' => $lng['serversettings']['stdsubdomainhost'],
'settinggroup' => 'system',
'varname' => 'stdsubdomain',
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingHostname',
),
'save_method' => 'storeSettingHostname'
),
'system_mysql_access_host' => array(
'label' => $lng['serversettings']['mysql_access_host'],
'settinggroup' => 'system',
'varname' => 'mysql_access_host',
'type' => 'string',
'default' => '127.0.0.1,localhost',
'plausibility_check_method' => 'checkMysqlAccessHost',
'save_method' => 'storeSettingMysqlAccessHost',
'plausibility_check_method' => array(
'\\Froxlor\\Validate\\Check',
'checkMysqlAccessHost'
),
'save_method' => 'storeSettingMysqlAccessHost'
),
'system_nssextrausers' => array(
'label' => $lng['serversettings']['nssextrausers'],
'settinggroup' => 'system',
'varname' => 'nssextrausers',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
),
'system_index_file_extension' => array(
'label' => $lng['serversettings']['index_file_extension'],
'settinggroup' => 'system',
@@ -101,28 +144,28 @@ return array(
'type' => 'string',
'string_regexp' => '/^[a-zA-Z0-9]{1,6}$/',
'default' => 'html',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_store_index_file_subs' => array(
'label' => $lng['serversettings']['system_store_index_file_subs'],
'settinggroup' => 'system',
'varname' => 'store_index_file_subs',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_httpuser' => array(
'settinggroup' => 'system',
'varname' => 'httpuser',
'type' => 'hidden',
'default' => 'www-data',
),
'default' => 'www-data'
),
'system_httpgroup' => array(
'settinggroup' => 'system',
'varname' => 'httpgroup',
'type' => 'hidden',
'default' => 'www-data',
),
'default' => 'www-data'
),
'system_report_enable' => array(
'label' => $lng['serversettings']['report']['report'],
'settinggroup' => 'system',
@@ -130,8 +173,8 @@ return array(
'type' => 'bool',
'default' => true,
'cronmodule' => 'froxlor/reports',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_report_webmax' => array(
'label' => $lng['serversettings']['report']['webmax'],
'settinggroup' => 'system',
@@ -140,8 +183,8 @@ return array(
'int_min' => 0,
'int_max' => 150,
'default' => 90,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_report_trafficmax' => array(
'label' => $lng['serversettings']['report']['trafficmax'],
'settinggroup' => 'system',
@@ -150,8 +193,8 @@ return array(
'int_min' => 0,
'int_max' => 150,
'default' => 90,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mail_use_smtp' => array(
'label' => $lng['serversettings']['mail_use_smtp'],
@@ -159,16 +202,16 @@ return array(
'varname' => 'mail_use_smtp',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mail_smtp_host' => array(
'label' => $lng['serversettings']['mail_smtp_host'],
'settinggroup' => 'system',
'varname' => 'mail_smtp_host',
'type' => 'string',
'default' => 'localhost',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mail_smtp_port' => array(
'label' => $lng['serversettings']['mail_smtp_port'],
'settinggroup' => 'system',
@@ -177,41 +220,41 @@ return array(
'int_min' => 1,
'int_max' => 65535,
'default' => 25,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mail_smtp_usetls' => array(
'label' => $lng['serversettings']['mail_smtp_usetls'],
'settinggroup' => 'system',
'varname' => 'mail_smtp_usetls',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mail_smtp_auth' => array(
'label' => $lng['serversettings']['mail_smtp_auth'],
'settinggroup' => 'system',
'varname' => 'mail_smtp_auth',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mail_smtp_user' => array(
'label' => $lng['serversettings']['mail_smtp_user'],
'settinggroup' => 'system',
'varname' => 'mail_smtp_user',
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mail_smtp_passwd' => array(
'label' => $lng['serversettings']['mail_smtp_passwd'],
'settinggroup' => 'system',
'varname' => 'mail_smtp_passwd',
'type' => 'hiddenString',
'default' => '',
'save_method' => 'storeSettingField',
),
),
),
),
);
'save_method' => 'storeSettingField'
)
)
)
)
);

View File

@@ -11,13 +11,13 @@
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2016-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings
* @package \Froxlor\Settings
*
*/
return array(
'groups' => array(
'froxlorvhost' => array(
'title' => $lng['admin']['froxlorvhost'],
'title' => $lng['admin']['froxlorvhost'] . (call_user_func(array('\Froxlor\Settings\FroxlorVhostSettings', 'hasVhostContainerEnabled')) == false ? $lng['admin']['novhostcontainer'] : ''),
'fields' => array(
/**
* Webserver-Vhost
@@ -30,6 +30,16 @@ return array(
'default' => false,
'save_method' => 'storeSettingField'
),
'system_froxloraliases' => array(
'label' => $lng['serversettings']['froxloraliases'],
'settinggroup' => 'system',
'varname' => 'froxloraliases',
'type' => 'string',
'string_regexp' => '/^(([a-z0-9\-\._]+, ?)*[a-z0-9\-\._]+)?$/i',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField'
),
/**
* SSL / Let's Encrypt
*/
@@ -40,7 +50,10 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingClearCertificates',
'visible' => Settings::Get('system.leenabled')
'visible' => \Froxlor\Settings::Get('system.leenabled') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
), true)
),
'system_le_froxlor_redirect' => array(
'label' => $lng['serversettings']['le_froxlor_redirect'],
@@ -49,7 +62,48 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'visible' => Settings::Get('system.leenabled')
'visible' => \Froxlor\Settings::Get('system.use_ssl') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
), true)
),
'system_hsts_maxage' => array(
'label' => $lng['admin']['domain_hsts_maxage'],
'settinggroup' => 'system',
'varname' => 'hsts_maxage',
'type' => 'int',
'int_min' => 0,
'int_max' => 94608000, // 3-years
'default' => 0,
'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.use_ssl') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
), true)
),
'system_hsts_incsub' => array(
'label' => $lng['admin']['domain_hsts_incsub'],
'settinggroup' => 'system',
'varname' => 'hsts_incsub',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.use_ssl') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
), true)
),
'system_hsts_preload' => array(
'label' => $lng['admin']['domain_hsts_preload'],
'settinggroup' => 'system',
'varname' => 'hsts_preload',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.use_ssl') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
), true)
),
/**
* FCGID
@@ -64,7 +118,10 @@ return array(
'websrv_avail' => array(
'apache2'
),
'visible' => Settings::Get('system.mod_fcgid')
'visible' => \Froxlor\Settings::Get('system.mod_fcgid') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
'system_mod_fcgid_httpuser' => array(
'label' => $lng['admin']['mod_fcgid_user'],
@@ -76,7 +133,10 @@ return array(
'websrv_avail' => array(
'apache2'
),
'visible' => Settings::Get('system.mod_fcgid')
'visible' => \Froxlor\Settings::Get('system.mod_fcgid') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
'system_mod_fcgid_httpgroup' => array(
'label' => $lng['admin']['mod_fcgid_group'],
@@ -88,7 +148,10 @@ return array(
'websrv_avail' => array(
'apache2'
),
'visible' => Settings::Get('system.mod_fcgid')
'visible' => \Froxlor\Settings::Get('system.mod_fcgid') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
'system_mod_fcgid_defaultini_ownvhost' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'],
@@ -97,12 +160,18 @@ return array(
'type' => 'option',
'default' => '2',
'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs',
'option_options_method' => array(
'\\Froxlor\\Http\\PhpConfig',
'getPhpConfigs'
),
'save_method' => 'storeSettingField',
'websrv_avail' => array(
'apache2'
),
'visible' => Settings::Get('system.mod_fcgid')
'visible' => \Froxlor\Settings::Get('system.mod_fcgid') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
/**
* php-fpm
@@ -114,7 +183,10 @@ return array(
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
'visible' => Settings::Get('phpfpm.enabled')
'visible' => \Froxlor\Settings::Get('phpfpm.enabled') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
'system_phpfpm_httpuser' => array(
'label' => $lng['phpfpm']['vhost_httpuser'],
@@ -123,7 +195,10 @@ return array(
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingWebserverFcgidFpmUser',
'visible' => Settings::Get('phpfpm.enabled')
'visible' => \Froxlor\Settings::Get('phpfpm.enabled') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
'system_phpfpm_httpgroup' => array(
'label' => $lng['phpfpm']['vhost_httpgroup'],
@@ -132,7 +207,10 @@ return array(
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingField',
'visible' => Settings::Get('phpfpm.enabled')
'visible' => \Froxlor\Settings::Get('phpfpm.enabled') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
'system_phpfpm_defaultini_ownvhost' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'],
@@ -141,9 +219,15 @@ return array(
'type' => 'option',
'default' => '2',
'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs',
'option_options_method' => array(
'\\Froxlor\\Http\\PhpConfig',
'getPhpConfigs'
),
'save_method' => 'storeSettingField',
'visible' => Settings::Get('phpfpm.enabled')
'visible' => \Froxlor\Settings::Get('phpfpm.enabled') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
/**
* DNS
@@ -155,7 +239,7 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'visible' => Settings::Get('system.bind_enable')
'visible' => \Froxlor\Settings::Get('system.bind_enable')
)
)
)

View File

@@ -14,7 +14,6 @@
* @package Settings
*
*/
return array(
'groups' => array(
'crond' => array(
@@ -27,40 +26,40 @@ return array(
'type' => 'string',
'string_type' => 'file',
'default' => '/etc/cron.d/froxlor',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_croncmdline' => array(
'label' => $lng['serversettings']['system_croncmdline'],
'settinggroup' => 'system',
'varname' => 'croncmdline',
'type' => 'string',
'default' => '/usr/bin/nice -n 5 /usr/bin/php -q',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_crondreload' => array(
'label' => $lng['serversettings']['system_crondreload'],
'settinggroup' => 'system',
'varname' => 'crondreload',
'type' => 'string',
'default' => '/etc/init.d/cron reload',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_cron_allowautoupdate' => array(
'label' => $lng['serversettings']['system_cron_allowautoupdate'],
'settinggroup' => 'system',
'varname' => 'cron_allowautoupdate',
'type' => 'bool',
'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',
)
'save_method' => 'storeSettingField'
)
)
)
)

View File

@@ -13,7 +13,7 @@
* @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 Settings
* @package \Froxlor\Settings
*
*/
return array(
@@ -34,7 +34,10 @@ return array(
'nginx' => 'Nginx'
),
'save_method' => 'storeSettingField',
'plausibility_check_method' => 'checkPhpInterfaceSetting',
'plausibility_check_method' => array(
'\\Froxlor\\Validate\\Check',
'checkPhpInterfaceSetting'
),
'overview_option' => true
),
'system_apache_24' => array(
@@ -55,11 +58,35 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'visible' => (Settings::Get('system.mod_fcgid') == 0 && Settings::Get('phpfpm.enabled') == 0),
'visible' => (\Froxlor\Settings::Get('system.mod_fcgid') == 0 && \Froxlor\Settings::Get('phpfpm.enabled') == 0),
'websrv_avail' => array(
'apache2'
)
),
'system_http2_support' => array(
'label' => $lng['serversettings']['http2_support'],
'settinggroup' => 'system',
'varname' => 'http2_support',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'websrv_avail' => array(
'apache2',
'nginx'
),
'visible' => \Froxlor\Settings::Get('system.use_ssl')
),
'system_dhparams_file' => array(
'label' => $lng['serversettings']['dhparams_file'],
'settinggroup' => 'system',
'varname' => 'dhparams_file',
'type' => 'string',
'string_type' => 'file',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.use_ssl')
),
'system_httpuser' => array(
'label' => $lng['admin']['webserver_user'],
'settinggroup' => 'system',
@@ -112,6 +139,81 @@ return array(
'default' => '/var/customers/logs/',
'save_method' => 'storeSettingField'
),
'system_logfiles_script' => array(
'label' => $lng['serversettings']['logfiles_script'],
'settinggroup' => 'system',
'varname' => 'logfiles_script',
'type' => 'string',
'string_type' => '',
'default' => '',
'save_method' => 'storeSettingField',
'websrv_avail' => array(
'apache2'
)
),
'system_logfiles_piped' => array(
'label' => $lng['serversettings']['logfiles_piped'],
'settinggroup' => 'system',
'varname' => 'logfiles_piped',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'websrv_avail' => array(
'apache2'
)
),
'system_logfiles_format' => array(
'label' => $lng['serversettings']['logfiles_format'],
'settinggroup' => 'system',
'varname' => 'logfiles_format',
'type' => 'string',
'default' => '',
'string_emptyallowed' => true,
'save_method' => 'storeSettingField',
'websrv_avail' => array(
'apache2',
'nginx'
)
),
'system_logfiles_type' => array(
'label' => $lng['serversettings']['logfiles_type'],
'settinggroup' => 'system',
'varname' => 'logfiles_type',
'type' => 'option',
'default' => '1',
'option_mode' => 'one',
'option_options' => array(
'1' => 'combined',
'2' => 'vhost_combined'
),
'save_method' => 'storeSettingField',
'websrv_avail' => array(
'apache2'
)
),
'system_errorlog_level' => array(
'label' => $lng['serversettings']['errorlog_level'],
'settinggroup' => 'system',
'varname' => 'errorlog_level',
'type' => 'option',
'default' => (\Froxlor\Settings::Get('system.webserver') == 'nginx' ? 'error' : 'warn'),
'option_mode' => 'one',
'option_options' => array(
'emerg' => 'emerg',
'alert' => 'alert',
'crit' => 'crit',
'error' => 'error',
'warn' => 'warn',
'notice' => 'notice',
'info' => 'info',
'debug' => 'debug'
),
'save_method' => 'storeSettingField',
'websrv_avail' => array(
'apache2',
'nginx'
)
),
'system_customersslpath' => array(
'label' => $lng['serversettings']['customerssl_directory'],
'settinggroup' => 'system',
@@ -148,6 +250,23 @@ return array(
'default' => '',
'save_method' => 'storeSettingField'
),
'system_default_sslvhostconf' => array(
'label' => $lng['serversettings']['default_sslvhostconf'],
'settinggroup' => 'system',
'varname' => 'default_sslvhostconf',
'type' => 'text',
'default' => '',
'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.use_ssl') == 1
),
'system_include_default_vhostconf' => array(
'label' => $lng['serversettings']['includedefault_sslvhostconf'],
'settinggroup' => 'system',
'varname' => 'include_default_vhostconf',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
),
'system_apache_globaldiropt' => array(
'label' => $lng['serversettings']['apache_globaldiropt'],
'settinggroup' => 'system',
@@ -155,7 +274,7 @@ return array(
'type' => 'text',
'default' => '',
'save_method' => 'storeSettingField',
'visible' => (Settings::Get('system.mod_fcgid') == 0 && Settings::Get('phpfpm.enabled') == 0),
'visible' => (\Froxlor\Settings::Get('system.mod_fcgid') == 0 && \Froxlor\Settings::Get('phpfpm.enabled') == 0),
'websrv_avail' => array(
'apache2'
)
@@ -269,7 +388,7 @@ return array(
'type' => 'option',
'default' => '1',
'option_mode' => 'one',
'option_options_method' => 'getRedirectCodes',
'option_options_method' => array('\\Froxlor\\Domain\\Domain', 'getRedirectCodes'),
'save_method' => 'storeSettingField'
)
)

View File

@@ -13,7 +13,7 @@
* @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 Settings
* @package \Froxlor\Settings
*
*/
return array(
@@ -30,6 +30,21 @@ return array(
'save_method' => 'storeSettingField',
'overview_option' => true
),
'system_ssl_protocols' => array(
'label' => $lng['serversettings']['ssl']['ssl_protocols'],
'settinggroup' => 'system',
'varname' => 'ssl_protocols',
'type' => 'option',
'default' => 'TLSv1,TLSv1.2',
'option_mode' => 'multiple',
'option_options' => array(
'TLSv1' => 'TLSv1',
'TLSv1.1' => 'TLSv1.1',
'TLSv1.2' => 'TLSv1.2',
'TLSv1.3' => 'TLSv1.3'
),
'save_method' => 'storeSettingField'
),
'system_ssl_cipher_list' => array(
'label' => $lng['serversettings']['ssl']['ssl_cipher_list'],
'settinggroup' => 'system',
@@ -39,6 +54,16 @@ return array(
'default' => 'ECDH+AESGCM:ECDH+AES256:!aNULL:!MD5:!DSS:!DH:!AES128',
'save_method' => 'storeSettingField'
),
'system_tlsv13_cipher_list' => array(
'label' => $lng['serversettings']['ssl']['tlsv13_cipher_list'],
'settinggroup' => 'system',
'varname' => 'tlsv13_cipher_list',
'type' => 'string',
'string_emptyallowed' => true,
'default' => '',
'visible' => \Froxlor\Settings::Get('system.webserver') == "apache2" && \Froxlor\Settings::Get('system.apache24') == 1,
'save_method' => 'storeSettingField',
),
'system_ssl_cert_file' => array(
'label' => $lng['serversettings']['ssl']['ssl_cert_file'],
'settinggroup' => 'system',
@@ -79,6 +104,17 @@ return array(
'default' => '',
'save_method' => 'storeSettingField'
),
'system_apache24_ocsp_cache_path' => array(
'label' => $lng['serversettings']['ssl']['apache24_ocsp_cache_path'],
'settinggroup' => 'system',
'varname' => 'apache24_ocsp_cache_path',
'type' => 'string',
'string_type' => 'string',
'string_emptyallowed' => false,
'default' => 'shmcb:/var/run/apache2/ocsp-stapling.cache(131072)',
'visible' => \Froxlor\Settings::Get('system.webserver') == "apache2" && \Froxlor\Settings::Get('system.apache24') == 1,
'save_method' => 'storeSettingField'
),
'system_leenabled' => array(
'label' => $lng['serversettings']['leenabled'],
'settinggroup' => 'system',
@@ -95,7 +131,19 @@ return array(
'type' => 'string',
'string_type' => 'file',
'default' => '/etc/apache2/conf-enabled/acme.conf',
'save_method' => 'storeSettingField',
'save_method' => 'storeSettingField'
),
'system_leapiversion' => array(
'label' => $lng['serversettings']['leapiversion'],
'settinggroup' => 'system',
'varname' => 'leapiversion',
'type' => 'option',
'default' => '2',
'option_mode' => 'one',
'option_options' => array(
'2' => 'ACME v2'
),
'save_method' => 'storeSettingField'
),
'system_letsencryptca' => array(
'label' => $lng['serversettings']['letsencryptca'],
@@ -105,45 +153,47 @@ return array(
'default' => 'testing',
'option_mode' => 'one',
'option_options' => array(
'testing' => 'https://acme-staging.api.letsencrypt.org (Test)',
'production' => 'https://acme-v01.api.letsencrypt.org (Live)'
'testing' => 'https://acme-staging' . (\Froxlor\Settings::Get('system.leapiversion') == '2' ? '-v02' : '') . '.api.letsencrypt.org (Test)',
'production' => 'https://acme-v0' . \Froxlor\Settings::Get('system.leapiversion') . '.api.letsencrypt.org (Live)'
),
'save_method' => 'storeSettingField'
),
'system_letsencryptcountrycode' => array(
'label' => $lng['serversettings']['letsencryptcountrycode'],
'settinggroup' => 'system',
'varname' => 'letsencryptcountrycode',
'type' => 'string',
'string_emptyallowed' => false,
'default' => 'DE',
'save_method' => 'storeSettingField'
),
'system_letsencryptstate' => array(
'label' => $lng['serversettings']['letsencryptstate'],
'settinggroup' => 'system',
'varname' => 'letsencryptstate',
'type' => 'string',
'string_emptyallowed' => false,
'default' => 'Hessen',
'save_method' => 'storeSettingField'
),
'system_letsencryptchallengepath' => array(
'label' => $lng['serversettings']['letsencryptchallengepath'],
'settinggroup' => 'system',
'varname' => 'letsencryptchallengepath',
'type' => 'string',
'string_emptyallowed' => false,
'default' => FROXLOR_INSTALL_DIR,
'default' => \Froxlor\Froxlor::getInstallDir(),
'save_method' => 'storeSettingField'
),
'system_letsencryptkeysize' => array(
'label' => $lng['serversettings']['letsencryptkeysize'],
'settinggroup' => 'system',
'varname' => 'letsencryptkeysize',
'type' => 'int',
'int_min' => 2048,
'default' => 4096,
'type' => 'option',
'default' => '2048',
'option_mode' => 'one',
'option_options' => array(
'2048' => '2048',
'3072' => '3072',
'4096' => '4096',
'8192' => '8192'
),
'save_method' => 'storeSettingField'
),
'system_leecc' => array(
'label' => $lng['serversettings']['letsencryptecc'],
'settinggroup' => 'system',
'varname' => 'leecc',
'type' => 'option',
'default' => '0',
'option_mode' => 'one',
'option_options' => array(
'0' => '-',
'256' => 'ec-256',
'384' => 'ec-384'
),
'save_method' => 'storeSettingField'
),
'system_letsencryptreuseold' => array(
@@ -151,35 +201,17 @@ return array(
'settinggroup' => 'system',
'varname' => 'letsencryptreuseold',
'type' => 'bool',
'default' => false,
'default' => true,
'save_method' => 'storeSettingField'
),
'system_hsts_maxage' => array(
'label' => $lng['admin']['domain_hsts_maxage'],
'system_disable_le_selfcheck' => array(
'label' => $lng['serversettings']['disable_le_selfcheck'],
'settinggroup' => 'system',
'varname' => 'hsts_maxage',
'type' => 'int',
'int_min' => 0,
'int_max' => 94608000, // 3-years
'default' => 0,
'save_method' => 'storeSettingField'
),
'system_hsts_incsub' => array(
'label' => $lng['admin']['domain_hsts_incsub'],
'settinggroup' => 'system',
'varname' => 'hsts_incsub',
'varname' => 'disable_le_selfcheck',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
),
'system_hsts_preload' => array(
'label' => $lng['admin']['domain_hsts_preload'],
'settinggroup' => 'system',
'varname' => 'hsts_preload',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
),
)
)
)
)

View File

@@ -14,12 +14,14 @@
* @package Settings
*
*/
return array(
'groups' => array(
'fcgid' => array(
'title' => $lng['admin']['fcgid_settings'],
'websrv_avail' => array('apache2', 'lighttpd'),
'websrv_avail' => array(
'apache2',
'lighttpd'
),
'fields' => array(
'system_mod_fcgid_enabled' => array(
'label' => $lng['serversettings']['mod_fcgid'],
@@ -28,9 +30,12 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'plausibility_check_method' => 'checkFcgidPhpFpm',
'overview_option' => true
'plausibility_check_method' => array(
'\\Froxlor\\Validate\\Check',
'checkFcgidPhpFpm'
),
'overview_option' => true
),
'system_mod_fcgid_configdir' => array(
'label' => $lng['serversettings']['mod_fcgid']['configdir'],
'settinggroup' => 'system',
@@ -38,9 +43,12 @@ return array(
'type' => 'string',
'string_type' => 'confdir',
'default' => '/var/www/php-fcgi-scripts/',
'plausibility_check_method' => 'checkPathConflicts',
'save_method' => 'storeSettingField',
'plausibility_check_method' => array(
'\\Froxlor\\Validate\\Check',
'checkPathConflicts'
),
'save_method' => 'storeSettingField'
),
'system_mod_fcgid_tmpdir' => array(
'label' => $lng['serversettings']['mod_fcgid']['tmpdir'],
'settinggroup' => 'system',
@@ -48,8 +56,8 @@ return array(
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/customers/tmp/',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mod_fcgid_peardir' => array(
'label' => $lng['serversettings']['mod_fcgid']['peardir'],
'settinggroup' => 'system',
@@ -59,34 +67,39 @@ return array(
'string_delimiter' => ':',
'string_emptyallowed' => true,
'default' => '/usr/share/php/:/usr/share/php5/',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mod_fcgid_wrapper' => array(
'label' => $lng['serversettings']['mod_fcgid']['wrapper'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_wrapper',
'type' => 'option',
'option_options' => array(0 => 'ScriptAlias', 1=> 'FcgidWrapper'),
'option_options' => array(
0 => 'ScriptAlias',
1 => 'FcgidWrapper'
),
'default' => 1,
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'websrv_avail' => array(
'apache2'
)
),
'system_mod_fcgid_starter' => array(
'label' => $lng['serversettings']['mod_fcgid']['starter'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_starter',
'type' => 'int',
'default' => 0,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mod_fcgid_maxrequests' => array(
'label' => $lng['serversettings']['mod_fcgid']['maxrequests'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_maxrequests',
'type' => 'int',
'default' => 250,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mod_fcgid_defaultini' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini'],
'settinggroup' => 'system',
@@ -94,9 +107,11 @@ return array(
'type' => 'option',
'default' => '1',
'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs',
'save_method' => 'storeSettingField',
),
'option_options_method' => array(
'\\Froxlor\\Http\\PhpConfig',
'getPhpConfigs'),
'save_method' => 'storeSettingField'
),
'system_mod_fcgid_idle_timeout' => array(
'label' => $lng['serversettings']['mod_fcgid']['idle_timeout'],
'settinggroup' => 'system',
@@ -104,10 +119,10 @@ return array(
'type' => 'int',
'default' => 30,
'save_method' => 'storeSettingField'
),
)
)
)
);
)
);
?>

View File

@@ -1,166 +1,141 @@
<?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 Settings
*
*/
return array(
'groups' => array(
'phpfpm' => array(
'title' => $lng['admin']['phpfpm_settings'],
'fields' => array(
'system_phpfpm_enabled' => array(
'label' => $lng['serversettings']['phpfpm'],
'settinggroup' => 'phpfpm',
'varname' => 'enabled',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'plausibility_check_method' => 'checkFcgidPhpFpm',
'overview_option' => true
),
'system_phpfpm_defaultini' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini'],
'settinggroup' => 'phpfpm',
'varname' => 'defaultini',
'type' => 'option',
'default' => '1',
'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs',
'save_method' => 'storeSettingField'
),
'system_phpfpm_configdir' => array(
'label' => $lng['serversettings']['phpfpm_settings']['configdir'],
'settinggroup' => 'phpfpm',
'varname' => 'configdir',
'type' => 'string',
'string_type' => 'confdir',
'default' => '/etc/php-fpm.d/',
'save_method' => 'storeSettingField'
),
'system_phpfpm_aliasconfigdir' => array(
'label' => $lng['serversettings']['phpfpm_settings']['aliasconfigdir'],
'settinggroup' => 'phpfpm',
'varname' => 'aliasconfigdir',
'type' => 'string',
'string_type' => 'confdir',
'default' => '/var/www/php-fpm/',
'save_method' => 'storeSettingField'
),
'system_phpfpm_tmpdir' => array(
'label' => $lng['serversettings']['mod_fcgid']['tmpdir'],
'settinggroup' => 'phpfpm',
'varname' => 'tmpdir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/customers/tmp/',
'save_method' => 'storeSettingField'
),
'system_phpfpm_peardir' => array(
'label' => $lng['serversettings']['mod_fcgid']['peardir'],
'settinggroup' => 'phpfpm',
'varname' => 'peardir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/usr/share/php/:/usr/share/php5/',
'save_method' => 'storeSettingField'
),
'system_phpfpm_fastcgi_ipcdir' => array(
'label' => $lng['serversettings']['phpfpm_settings']['ipcdir'],
'settinggroup' => 'phpfpm',
'varname' => 'fastcgi_ipcdir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/lib/apache2/fastcgi/',
'save_method' => 'storeSettingField'
),
'system_phpfpm_reload' => array(
'label' => $lng['serversettings']['phpfpm_settings']['reload'],
'settinggroup' => 'phpfpm',
'varname' => 'reload',
'type' => 'string',
'default' => '/etc/init.d/php-fpm restart',
'save_method' => 'storeSettingField'
),
'system_phpfpm_pm' => array(
'label' => $lng['serversettings']['phpfpm_settings']['pm'],
'settinggroup' => 'phpfpm',
'varname' => 'pm',
'type' => 'option',
'default' => 'static',
'option_mode' => 'one',
'option_options' => array('static' => 'static', 'dynamic' => 'dynamic', 'ondemand' => 'ondemand'),
'save_method' => 'storeSettingField'
),
'system_phpfpm_max_children' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_children'],
'settinggroup' => 'phpfpm',
'varname' => 'max_children',
'type' => 'int',
'default' => 1,
'save_method' => 'storeSettingField'
),
'system_phpfpm_start_servers' => array(
'label' => $lng['serversettings']['phpfpm_settings']['start_servers'],
'settinggroup' => 'phpfpm',
'varname' => 'start_servers',
'type' => 'int',
'default' => 20,
'save_method' => 'storeSettingField'
),
'system_phpfpm_min_spare_servers' => array(
'label' => $lng['serversettings']['phpfpm_settings']['min_spare_servers'],
'settinggroup' => 'phpfpm',
'varname' => 'min_spare_servers',
'type' => 'int',
'default' => 5,
'save_method' => 'storeSettingField'
),
'system_phpfpm_max_spare_servers' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_spare_servers'],
'settinggroup' => 'phpfpm',
'varname' => 'max_spare_servers',
'type' => 'int',
'default' => 35,
'save_method' => 'storeSettingField'
),
'system_phpfpm_max_requests' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_requests'],
'settinggroup' => 'phpfpm',
'varname' => 'max_requests',
'type' => 'int',
'default' => 0,
'save_method' => 'storeSettingField'
),
'system_phpfpm_idle_timeout' => array(
'label' => $lng['serversettings']['phpfpm_settings']['idle_timeout'],
'settinggroup' => 'phpfpm',
'varname' => 'idle_timeout',
'type' => 'int',
'default' => 30,
'save_method' => 'storeSettingField'
),
'system_phpfpm_use_mod_proxy' => array(
'label' => $lng['phpfpm']['use_mod_proxy'],
'settinggroup' => 'phpfpm',
'varname' => 'use_mod_proxy',
'type' => 'bool',
'default' => false,
'visible' => Settings::Get('system.apache24'),
'save_method' => 'storeSettingField'
),
),
),
),
);
<?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 \Froxlor\Settings
*
*/
return array(
'groups' => array(
'phpfpm' => array(
'title' => $lng['admin']['phpfpm_settings'],
'fields' => array(
'system_phpfpm_enabled' => array(
'label' => $lng['serversettings']['phpfpm'],
'settinggroup' => 'phpfpm',
'varname' => 'enabled',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'plausibility_check_method' => array(
'\\Froxlor\\Validate\\Check',
'checkFcgidPhpFpm'
),
'overview_option' => true
),
'system_phpfpm_defaultini' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini'],
'settinggroup' => 'phpfpm',
'varname' => 'defaultini',
'type' => 'option',
'default' => '1',
'option_mode' => 'one',
'option_options_method' => array(
'\\Froxlor\\Http\\PhpConfig',
'getPhpConfigs'
),
'save_method' => 'storeSettingField'
),
'system_phpfpm_aliasconfigdir' => array(
'label' => $lng['serversettings']['phpfpm_settings']['aliasconfigdir'],
'settinggroup' => 'phpfpm',
'varname' => 'aliasconfigdir',
'type' => 'string',
'string_type' => 'confdir',
'default' => '/var/www/php-fpm/',
'save_method' => 'storeSettingField'
),
'system_phpfpm_tmpdir' => array(
'label' => $lng['serversettings']['mod_fcgid']['tmpdir'],
'settinggroup' => 'phpfpm',
'varname' => 'tmpdir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/customers/tmp/',
'save_method' => 'storeSettingField'
),
'system_phpfpm_peardir' => array(
'label' => $lng['serversettings']['mod_fcgid']['peardir'],
'settinggroup' => 'phpfpm',
'varname' => 'peardir',
'type' => 'string',
'string_type' => 'dir',
'string_delimiter' => ':',
'string_emptyallowed' => true,
'default' => '/usr/share/php/:/usr/share/php5/',
'save_method' => 'storeSettingField'
),
'system_phpfpm_envpath' => array(
'label' => $lng['serversettings']['phpfpm_settings']['envpath'],
'settinggroup' => 'phpfpm',
'varname' => 'envpath',
'type' => 'string',
'string_type' => 'dir',
'string_delimiter' => ':',
'string_emptyallowed' => true,
'default' => '/usr/local/bin:/usr/bin:/bin',
'save_method' => 'storeSettingField'
),
'system_phpfpm_fastcgi_ipcdir' => array(
'label' => $lng['serversettings']['phpfpm_settings']['ipcdir'],
'settinggroup' => 'phpfpm',
'varname' => 'fastcgi_ipcdir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/lib/apache2/fastcgi/',
'save_method' => 'storeSettingField'
),
'system_phpfpm_use_mod_proxy' => array(
'label' => $lng['phpfpm']['use_mod_proxy'],
'settinggroup' => 'phpfpm',
'varname' => 'use_mod_proxy',
'type' => 'bool',
'default' => true,
'visible' => \Froxlor\Settings::Get('system.apache24'),
'save_method' => 'storeSettingField'
),
'system_phpfpm_ini_flags' => array(
'label' => $lng['phpfpm']['ini_flags'],
'settinggroup' => 'phpfpm',
'varname' => 'ini_flags',
'type' => 'text',
'default' => '',
'save_method' => 'storeSettingField'
),
'system_phpfpm_ini_values' => array(
'label' => $lng['phpfpm']['ini_values'],
'settinggroup' => 'phpfpm',
'varname' => 'ini_values',
'type' => 'text',
'default' => '',
'save_method' => 'storeSettingField'
),
'system_phpfpm_ini_admin_flags' => array(
'label' => $lng['phpfpm']['ini_admin_flags'],
'settinggroup' => 'phpfpm',
'varname' => 'ini_admin_flags',
'type' => 'text',
'default' => '',
'save_method' => 'storeSettingField'
),
'system_phpfpm_ini_admin_values' => array(
'label' => $lng['phpfpm']['ini_admin_values'],
'settinggroup' => 'phpfpm',
'varname' => 'ini_admin_values',
'type' => 'text',
'default' => '',
'save_method' => 'storeSettingField'
)
)
)
)
);

View File

@@ -14,7 +14,6 @@
* @package Settings
*
*/
return array(
'groups' => array(
'perl' => array(
@@ -27,8 +26,10 @@ return array(
'type' => 'string',
'default' => '/usr/bin/perl',
'save_method' => 'storeSettingField',
'websrv_avail' => array('lighttpd')
),
'websrv_avail' => array(
'lighttpd'
)
),
'system_perl_suexecworkaround' => array(
'label' => $lng['serversettings']['perl']['suexecworkaround'],
'settinggroup' => 'perl',
@@ -36,8 +37,10 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'websrv_avail' => array(
'apache2'
)
),
'system_perl_suexeccgipath' => array(
'label' => $lng['serversettings']['perl']['suexeccgipath'],
'settinggroup' => 'perl',
@@ -46,8 +49,10 @@ return array(
'string_type' => 'dir',
'default' => '/var/www/cgi-bin/',
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'websrv_avail' => array(
'apache2'
)
),
'perl_server' => array(
'label' => $lng['serversettings']['perl_server'],
'settinggroup' => 'serversettings',
@@ -55,11 +60,13 @@ return array(
'type' => 'string',
'default' => 'unix:/var/run/nginx/cgiwrap-dispatch.sock',
'save_method' => 'storeSettingField',
'websrv_avail' => array('nginx')
),
),
),
),
);
'websrv_avail' => array(
'nginx'
)
)
)
)
)
);
?>

View File

@@ -16,7 +16,6 @@
* @package Settings
*
*/
return array(
'groups' => array(
'statistics' => array(
@@ -29,17 +28,21 @@ return array(
'type' => 'option',
'default' => 2,
'option_mode' => 'one',
'option_options' => array(0 => $lng['admin']['webalizer']['normal'], 1 => $lng['admin']['webalizer']['quiet'], 2 => $lng['admin']['webalizer']['veryquiet']),
'save_method' => 'storeSettingField',
'option_options' => array(
0 => $lng['admin']['webalizer']['normal'],
1 => $lng['admin']['webalizer']['quiet'],
2 => $lng['admin']['webalizer']['veryquiet']
),
'save_method' => 'storeSettingField'
),
'system_awstats_enabled' => array(
'label' => $lng['serversettings']['awstats_enabled'],
'settinggroup' => 'system',
'varname' => 'awstats_enabled',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_awstats_path' => array(
'label' => $lng['serversettings']['awstats_path'],
'settinggroup' => 'system',
@@ -47,8 +50,8 @@ return array(
'type' => 'string',
'string_type' => 'dir',
'default' => '/usr/bin/',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_awstats_awstatspath' => array(
'label' => $lng['serversettings']['awstats_awstatspath'],
'settinggroup' => 'system',
@@ -56,8 +59,8 @@ return array(
'type' => 'string',
'string_type' => 'dir',
'default' => '/usr/bin/',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_awstats_conf' => array(
'label' => $lng['serversettings']['awstats_conf'],
'settinggroup' => 'system',
@@ -65,8 +68,8 @@ return array(
'type' => 'string',
'string_type' => 'dir',
'default' => '/etc/awstats/',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_awstats_icons' => array(
'label' => $lng['serversettings']['awstats_icons'],
'settinggroup' => 'system',
@@ -74,11 +77,11 @@ return array(
'type' => 'string',
'string_type' => 'dir',
'default' => '/usr/share/awstats/icon/',
'save_method' => 'storeSettingField',
)
'save_method' => 'storeSettingField'
)
)
)
);
)
);
?>

View File

@@ -16,7 +16,6 @@
* @package Settings
*
*/
return array(
'groups' => array(
'mail' => array(
@@ -30,8 +29,8 @@ return array(
'default' => 2000,
'int_min' => 1,
'int_max' => 65535,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_vmail_gid' => array(
'label' => $lng['serversettings']['vmail_gid'],
'settinggroup' => 'system',
@@ -40,8 +39,8 @@ return array(
'default' => 2000,
'int_min' => 1,
'int_max' => 65535,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_vmail_homedir' => array(
'label' => $lng['serversettings']['vmail_homedir'],
'settinggroup' => 'system',
@@ -49,8 +48,8 @@ return array(
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/customers/mail/',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_vmail_maildirname' => array(
'label' => $lng['serversettings']['vmail_maildirname'],
'settinggroup' => 'system',
@@ -59,48 +58,48 @@ return array(
'string_type' => 'dir',
'default' => 'Maildir',
'string_emptyallowed' => true,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'panel_sendalternativemail' => array(
'label' => $lng['serversettings']['sendalternativemail'],
'settinggroup' => 'panel',
'varname' => 'sendalternativemail',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mail_quota_enabled' => array(
'label' => $lng['serversettings']['mail_quota_enabled'],
'settinggroup' => 'system',
'varname' => 'mail_quota_enabled',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mail_quota' => array(
'label' => $lng['serversettings']['mail_quota'],
'settinggroup' => 'system',
'varname' => 'mail_quota',
'type' => 'int',
'default' => 100,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_catchall_enabled' => array(
'label' => $lng['serversettings']['catchall_enabled'],
'settinggroup' => 'catchall',
'varname' => 'catchall_enabled',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingResetCatchall',
),
'save_method' => 'storeSettingResetCatchall'
),
'system_mailtraffic_enabled' => array(
'label' => $lng['serversettings']['mailtraffic_enabled'],
'settinggroup' => 'system',
'varname' => 'mailtraffic_enabled',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mdaserver' => array(
'label' => $lng['serversettings']['mdaserver'],
'settinggroup' => 'system',
@@ -108,9 +107,12 @@ return array(
'type' => 'option',
'option_mode' => 'one',
'default' => 'dovecot',
'option_options' => array('courier' => 'Courier', 'dovecot' => 'Dovecot'),
'save_method' => 'storeSettingField',
'option_options' => array(
'courier' => 'Courier',
'dovecot' => 'Dovecot'
),
'save_method' => 'storeSettingField'
),
'system_mdalog' => array(
'label' => $lng['serversettings']['mdalog'],
'settinggroup' => 'system',
@@ -119,8 +121,8 @@ return array(
'string_type' => 'file',
'default' => '/var/log/mail.log',
'string_emptyallowed' => true,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mtaserver' => array(
'label' => $lng['serversettings']['mtaserver'],
'settinggroup' => 'system',
@@ -128,9 +130,12 @@ return array(
'type' => 'option',
'option_mode' => 'one',
'default' => 'postfix',
'option_options' => array('exim4' => 'Exim4', 'postfix' => 'Postfix'),
'save_method' => 'storeSettingField',
'option_options' => array(
'exim4' => 'Exim4',
'postfix' => 'Postfix'
),
'save_method' => 'storeSettingField'
),
'system_mtalog' => array(
'label' => $lng['serversettings']['mtalog'],
'settinggroup' => 'system',
@@ -139,11 +144,11 @@ return array(
'string_type' => 'file',
'default' => '/var/log/mail.log',
'string_emptyallowed' => true,
'save_method' => 'storeSettingField',
),
),
),
),
);
'save_method' => 'storeSettingField'
)
)
)
)
);
?>

View File

@@ -16,10 +16,9 @@
* @package Settings
*
*/
return array(
'groups' => array(
'ftpserver' => array(
'ftpserver' => array(
'title' => $lng['admin']['ftpserversettings'],
'fields' => array(
'ftpserver' => array(
@@ -29,11 +28,14 @@ return array(
'type' => 'option',
'default' => 'proftpd',
'option_mode' => 'one',
'option_options' => array('proftpd' => 'Proftpd', 'pureftpd' => 'Pureftpd'),
'save_method' => 'storeSettingField',
),
),
),
'option_options' => array(
'proftpd' => 'Proftpd',
'pureftpd' => 'Pureftpd'
),
'save_method' => 'storeSettingField'
)
)
)
)
);

View File

@@ -16,7 +16,6 @@
* @package Settings
*
*/
return array(
'groups' => array(
'nameserver' => array(
@@ -30,7 +29,7 @@ return array(
'default' => true,
'save_method' => 'storeSettingField',
'overview_option' => true
),
),
'system_dnsenabled' => array(
'label' => $lng['serversettings']['dnseditorenable'],
'settinggroup' => 'system',
@@ -38,15 +37,18 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
),
),
'system_dns_server' => array(
'label' => $lng['serversettings']['dns_server'],
'settinggroup' => 'system',
'varname' => 'dns_server',
'type' => 'option',
'default' => 'bind',
'default' => 'Bind',
'option_mode' => 'one',
'option_options' => array('bind' => 'Bind9', 'pdns' => 'PowerDNS'),
'option_options' => array(
'Bind' => 'Bind9',
'PowerDNS' => 'PowerDNS'
),
'save_method' => 'storeSettingField'
),
'system_bindconf_directory' => array(
@@ -56,16 +58,16 @@ return array(
'type' => 'string',
'string_type' => 'dir',
'default' => '/etc/bind/',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_bindreload_command' => array(
'label' => $lng['serversettings']['bindreload_command'],
'settinggroup' => 'system',
'varname' => 'bindreload_command',
'type' => 'string',
'default' => '/etc/init.d/bind9 reload',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_nameservers' => array(
'label' => $lng['serversettings']['nameservers'],
'settinggroup' => 'system',
@@ -74,8 +76,8 @@ return array(
'string_regexp' => '/^(([a-z0-9\-\._]+, ?)*[a-z0-9\-\._]+)?$/i',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingFieldInsertBindTask',
),
'save_method' => 'storeSettingFieldInsertBindTask'
),
'system_mxservers' => array(
'label' => $lng['serversettings']['mxservers'],
'settinggroup' => 'system',
@@ -84,8 +86,8 @@ return array(
'string_regexp' => '/^(([0-9]+ [a-z0-9\-\._]+, ?)*[0-9]+ [a-z0-9\-\._]+)?$/i',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_axfrservers' => array(
'label' => $lng['serversettings']['axfrservers'],
'settinggroup' => 'system',
@@ -95,7 +97,7 @@ return array(
'string_delimiter' => ',',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField',
'save_method' => 'storeSettingField'
),
'system_dns_createmailentry' => array(
'label' => $lng['serversettings']['mail_also_with_mxservers'],
@@ -104,7 +106,23 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
),
),
'system_dns_createcaaentry' => array(
'label' => $lng['serversettings']['caa_entry'],
'settinggroup' => 'system',
'varname' => 'dns_createcaaentry',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField'
),
'caa_caa_entry' => array(
'label' => $lng['serversettings']['caa_entry_custom'],
'settinggroup' => 'caa',
'varname' => 'caa_entry',
'type' => 'text',
'default' => '',
'save_method' => 'storeSettingField'
),
'system_defaultttl' => array(
'label' => $lng['serversettings']['defaultttl'],
'settinggroup' => 'system',
@@ -113,9 +131,9 @@ return array(
'default' => 604800, /* 1 week */
'int_min' => 3600, /* 1 hour */
'int_max' => 2147483647, /* integer max */
'save_method' => 'storeSettingField',
),
),
),
),
);
'save_method' => 'storeSettingField'
)
)
)
)
);

View File

@@ -16,7 +16,6 @@
* @package Settings
*
*/
return array(
'groups' => array(
'logging' => array(
@@ -30,7 +29,7 @@ return array(
'default' => false,
'save_method' => 'storeSettingField',
'overview_option' => true
),
),
'logger_severity' => array(
'label' => $lng['serversettings']['logger']['severity'],
'settinggroup' => 'logger',
@@ -38,9 +37,12 @@ return array(
'type' => 'option',
'default' => 1,
'option_mode' => 'one',
'option_options' => array(1 => $lng['admin']['logger']['normal'], 2 => $lng['admin']['logger']['paranoid']),
'save_method' => 'storeSettingField',
'option_options' => array(
1 => $lng['admin']['logger']['normal'],
2 => $lng['admin']['logger']['paranoid']
),
'save_method' => 'storeSettingField'
),
'logger_logtypes' => array(
'label' => $lng['serversettings']['logger']['types'],
'settinggroup' => 'logger',
@@ -48,9 +50,13 @@ return array(
'type' => 'option',
'default' => 'syslog,mysql',
'option_mode' => 'multiple',
'option_options' => array('syslog' => 'syslog', 'file' => 'file', 'mysql' => 'mysql'),
'save_method' => 'storeSettingField',
'option_options' => array(
'syslog' => 'syslog',
'file' => 'file',
'mysql' => 'mysql'
),
'save_method' => 'storeSettingField'
),
'logger_logfile' => array(
'label' => $lng['serversettings']['logger']['logfile'],
'settinggroup' => 'logger',
@@ -59,8 +65,8 @@ return array(
'string_type' => 'file',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'logger_log_cron' => array(
'label' => $lng['serversettings']['logger']['logcron'],
'settinggroup' => 'logger',
@@ -69,15 +75,15 @@ return array(
'default' => 0,
'option_mode' => 'one',
'option_options' => array(
0 => $lng['serversettings']['logger']['logcronoption']['never'],
1 => $lng['serversettings']['logger']['logcronoption']['once'],
2 => $lng['serversettings']['logger']['logcronoption']['always']
),
'save_method' => 'storeSettingField',
0 => $lng['serversettings']['logger']['logcronoption']['never'],
1 => $lng['serversettings']['logger']['logcronoption']['once'],
2 => $lng['serversettings']['logger']['logcronoption']['always']
),
),
),
'save_method' => 'storeSettingField'
)
)
)
);
)
);
?>

View File

@@ -13,10 +13,9 @@
* @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 Settings
* @package \Froxlor\Settings
*
*/
return array(
'groups' => array(
'dkim' => array(
@@ -30,7 +29,7 @@ return array(
'default' => false,
'save_method' => 'storeSettingFieldInsertBindTask',
'overview_option' => true
),
),
'dkim_prefix' => array(
'label' => $lng['dkim']['dkim_prefix'],
'settinggroup' => 'dkim',
@@ -38,8 +37,8 @@ return array(
'type' => 'string',
'string_type' => 'dir',
'default' => '/etc/postfix/dkim/',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'dkim_domains' => array(
'label' => $lng['dkim']['dkim_domains'],
'settinggroup' => 'dkim',
@@ -47,8 +46,8 @@ return array(
'type' => 'string',
'string_regexp' => '/^[a-z0-9\._]+$/i',
'default' => 'domains',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'dkim_dkimkeys' => array(
'label' => $lng['dkim']['dkim_dkimkeys'],
'settinggroup' => 'dkim',
@@ -56,8 +55,8 @@ return array(
'type' => 'string',
'string_regexp' => '/^[a-z0-9\._]+$/i',
'default' => 'dkim-keys.conf',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'dkim_algorithm' => array(
'label' => $lng['dkim']['dkim_algorithm'],
'settinggroup' => 'dkim',
@@ -65,9 +64,13 @@ return array(
'type' => 'option',
'default' => 'all',
'option_mode' => 'multiple',
'option_options' => array('all' => 'All', 'sha1' => 'SHA1', 'sha256' => 'SHA256'),
'save_method' => 'storeSettingFieldInsertBindTask',
'option_options' => array(
'all' => 'All',
'sha1' => 'SHA1',
'sha256' => 'SHA256'
),
'save_method' => 'storeSettingFieldInsertBindTask'
),
'dkim_servicetype' => array(
'label' => $lng['dkim']['dkim_servicetype'],
'settinggroup' => 'dkim',
@@ -75,22 +78,28 @@ return array(
'type' => 'option',
'default' => '0',
'option_mode' => 'one',
'option_options' => array('0' => 'All', '1' => 'E-Mail'),
'save_method' => 'storeSettingFieldInsertBindTask',
'option_options' => array(
'0' => 'All',
'1' => 'E-Mail'
),
'save_method' => 'storeSettingFieldInsertBindTask'
),
'dkim_keylength' => array(
'label' => array(
'title' => $lng['dkim']['dkim_keylength']['title'],
'description' => sprintf($lng['dkim']['dkim_keylength']['description'], Settings::Get('dkim.dkim_prefix'))
'description' => sprintf($lng['dkim']['dkim_keylength']['description'], \Froxlor\Settings::Get('dkim.dkim_prefix'))
),
'settinggroup' => 'dkim',
'varname' => 'dkim_keylength',
'type' => 'option',
'default' => '1024',
'option_mode' => 'one',
'option_options' => array('1024' => '1024 Bit', '2048' => '2048 Bit'),
'save_method' => 'storeSettingFieldInsertBindTask',
'option_options' => array(
'1024' => '1024 Bit',
'2048' => '2048 Bit'
),
'save_method' => 'storeSettingFieldInsertBindTask'
),
'dkim_notes' => array(
'label' => $lng['dkim']['dkim_notes'],
'settinggroup' => 'dkim',
@@ -98,37 +107,19 @@ return array(
'type' => 'string',
'string_regexp' => '/^[a-z0-9\._]+$/i',
'default' => '',
'save_method' => 'storeSettingFieldInsertBindTask',
),
'dkim_add_adsp' => array(
'label' => $lng['dkim']['dkim_add_adsp'],
'settinggroup' => 'dkim',
'varname' => 'dkim_add_adsp',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingFieldInsertBindTask',
),
'dkim_add_adsppolicy' => array(
'label' => $lng['dkim']['dkim_add_adsppolicy'],
'settinggroup' => 'dkim',
'varname' => 'dkim_add_adsppolicy',
'type' => 'option',
'default' => '1',
'option_mode' => 'one',
'option_options' => array('0' => 'Unknown', '1' => 'All', '2' => 'Discardable'),
'save_method' => 'storeSettingFieldInsertBindTask',
),
'save_method' => 'storeSettingFieldInsertBindTask'
),
'dkimrestart_command' => array(
'label' => $lng['dkim']['dkimrestart_command'],
'settinggroup' => 'dkim',
'varname' => 'dkimrestart_command',
'type' => 'string',
'default' => '/etc/init.d/dkim-filter restart',
'save_method' => 'storeSettingField',
),
),
),
),
);
'save_method' => 'storeSettingField'
)
)
)
)
);
?>

View File

@@ -14,7 +14,6 @@
* @package Settings
*
*/
return array(
'groups' => array(
'spf' => array(
@@ -28,7 +27,7 @@ return array(
'default' => false,
'save_method' => 'storeSettingField',
'overview_option' => true
),
),
'spf_entry' => array(
'label' => $lng['spf']['spf_entry'],
'settinggroup' => 'spf',
@@ -36,10 +35,10 @@ return array(
'type' => 'string',
'default' => '"v=spf1 a mx -all"',
'save_method' => 'storeSettingField'
)
)
)
)
);
)
);
?>

View File

@@ -1,144 +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 Settings
*
*/
return array(
'groups' => array(
'ticket' => array(
'title' => $lng['admin']['ticketsettings'],
'fields' => array(
'ticket_enabled' => array(
'label' => $lng['serversettings']['ticket']['enable'],
'settinggroup' => 'ticket',
'varname' => 'enabled',
'type' => 'bool',
'default' => false,
'cronmodule' => 'froxlor/ticket',
'save_method' => 'storeSettingField',
'overview_option' => true
),
'ticket_noreply_email' => array(
'label' => $lng['serversettings']['ticket']['noreply_email'],
'settinggroup' => 'ticket',
'varname' => 'noreply_email',
'type' => 'string',
'string_type' => 'mail',
'default' => '',
'save_method' => 'storeSettingField',
),
'ticket_noreply_name' => array(
'label' => $lng['serversettings']['ticket']['noreply_name'],
'settinggroup' => 'ticket',
'varname' => 'noreply_name',
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
),
'ticket_reset_cycle' => array(
'label' => $lng['serversettings']['ticket']['reset_cycle'],
'settinggroup' => 'ticket',
'varname' => 'reset_cycle',
'type' => 'option',
'default' => 1,
'option_mode' => 'one',
'option_options' => array(0 => html_entity_decode($lng['admin']['tickets']['daily']), 1 => html_entity_decode($lng['admin']['tickets']['weekly']), 2 => html_entity_decode($lng['admin']['tickets']['monthly']), 3 => html_entity_decode($lng['admin']['tickets']['yearly'])),
'save_method' => 'storeSettingField',
'plausibility_check_method' => 'setCycleOfCronjob',
),
'ticket_concurrently_open' => array(
'label' => $lng['serversettings']['ticket']['concurrentlyopen'],
'settinggroup' => 'ticket',
'varname' => 'concurrently_open',
'type' => 'int',
'default' => 5,
'save_method' => 'storeSettingField',
),
'ticket_archiving_days' => array(
'label' => $lng['serversettings']['ticket']['archiving_days'],
'settinggroup' => 'ticket',
'varname' => 'archiving_days',
'type' => 'int',
'int_min' => 1,
'int_max' => 99,
'default' => 5,
'save_method' => 'storeSettingField',
),
'ticket_worktime_all' => array(
'label' => $lng['serversettings']['ticket']['worktime_all'],
'settinggroup' => 'ticket',
'varname' => 'worktime_all',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'ticket_worktime_begin' => array(
'label' => $lng['serversettings']['ticket']['worktime_begin'],
'settinggroup' => 'ticket',
'varname' => 'worktime_begin',
'type' => 'string',
'string_regexp' => '/^[012][0-9]:[0-6][0-9]$/',
'default' => '',
'save_method' => 'storeSettingField',
),
'ticket_worktime_end' => array(
'label' => $lng['serversettings']['ticket']['worktime_end'],
'settinggroup' => 'ticket',
'varname' => 'worktime_end',
'type' => 'string',
'string_regexp' => '/^[012][0-9]:[0-6][0-9]$/',
'default' => '',
'save_method' => 'storeSettingField',
),
'ticket_worktime_sat' => array(
'label' => $lng['serversettings']['ticket']['worktime_sat'],
'settinggroup' => 'ticket',
'varname' => 'worktime_sat',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'ticket_worktime_sun' => array(
'label' => $lng['serversettings']['ticket']['worktime_sun'],
'settinggroup' => 'ticket',
'varname' => 'worktime_sun',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'system_last_archive_run' => array(
'settinggroup' => 'system',
'varname' => 'last_archive_run',
'type' => 'hidden',
'default' => '',
),
'ticket_default_priority' => array(
'label' => $lng['serversettings']['ticket']['default_priority'],
'settinggroup' => 'ticket',
'varname' => 'default_priority',
'type' => 'option',
'default' => 2,
'option_mode' => 'one',
'option_options' => array(1 => $lng['ticket']['high'], 2 => $lng['ticket']['normal'], 3 => $lng['ticket']['low']),
'save_method' => 'storeSettingField',
),
),
),
)
);
?>

View File

@@ -16,7 +16,6 @@
* @package Settings
*
*/
return array(
'groups' => array(
'security' => array(
@@ -28,16 +27,16 @@ return array(
'varname' => 'unix_names',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mailpwcleartext' => array(
'label' => $lng['serversettings']['mailpwcleartext'],
'settinggroup' => 'system',
'varname' => 'mailpwcleartext',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'default' => false,
'save_method' => 'storeSettingField'
),
'system_passwordcryptfunc' => array(
'label' => $lng['serversettings']['passwordcryptfunc'],
'settinggroup' => 'system',
@@ -45,33 +44,36 @@ return array(
'type' => 'option',
'default' => 0,
'option_mode' => 'one',
'option_options_method' => 'getAvailablePasswordHashes',
'save_method' => 'storeSettingField',
'option_options_method' => array(
'\\Froxlor\\System\\Crypt',
'getAvailablePasswordHashes'
),
'save_method' => 'storeSettingField'
),
'system_allow_error_report_admin' => array(
'label' => $lng['serversettings']['allow_error_report_admin'],
'settinggroup' => 'system',
'varname' => 'allow_error_report_admin',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_allow_error_report_customer' => array(
'label' => $lng['serversettings']['allow_error_report_customer'],
'settinggroup' => 'system',
'varname' => 'allow_error_report_customer',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_allow_customer_shell' => array(
'label' => $lng['serversettings']['allow_allow_customer_shell'],
'settinggroup' => 'system',
'varname' => 'allow_customer_shell',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_available_shells' => array(
'label' => $lng['serversettings']['available_shells'],
'settinggroup' => 'system',
@@ -79,9 +81,9 @@ return array(
'type' => 'string',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField',
)
'save_method' => 'storeSettingField'
)
)
)
);
)
);

View File

@@ -13,7 +13,6 @@
* @package Settings
*
*/
return array(
'groups' => array(
'diskquota' => array(
@@ -34,7 +33,7 @@ return array(
'varname' => 'diskquota_repquota_path',
'type' => 'string',
'default' => '/usr/sbin/repquota',
'save_method' => 'storeSettingField',
'save_method' => 'storeSettingField'
),
'diskquota_quotatool_path' => array(
'label' => $lng['serversettings']['diskquota_quotatool_path']['description'],
@@ -42,7 +41,7 @@ return array(
'varname' => 'diskquota_quotatool_path',
'type' => 'string',
'default' => '/usr/bin/quotatool',
'save_method' => 'storeSettingField',
'save_method' => 'storeSettingField'
),
'diskquota_customer_partition' => array(
'label' => $lng['serversettings']['diskquota_customer_partition']['description'],
@@ -50,11 +49,11 @@ return array(
'varname' => 'diskquota_customer_partition',
'type' => 'string',
'default' => '/dev/root',
'save_method' => 'storeSettingField',
),
),
),
),
);
'save_method' => 'storeSettingField'
)
)
)
)
);
?>

View File

@@ -16,23 +16,24 @@
* @package Panel
*
*/
define('AREA', 'admin');
require './lib/init.php';
use Froxlor\Database\Database;
use Froxlor\Settings;
use Froxlor\Api\Commands\Admins as Admins;
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif(isset($_GET['id'])) {
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
if ($page == 'admins'
&& $userinfo['change_serversettings'] == '1'
) {
if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
if ($action == '') {
$log->logAction(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'],
@@ -42,7 +43,7 @@ if ($page == 'admins'
'traffic_used' => $lng['customer']['traffic'] . ' (' . $lng['panel']['used'] . ')',
'deactivated' => $lng['admin']['deactivated']
);
$paging = new paging($userinfo, TABLE_PANEL_ADMINS, $fields);
$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();
@@ -68,16 +69,16 @@ if ($page == 'admins'
// 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);
$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);
$traffic_percent = round(($row['traffic_used'] * 100) / $row['traffic'], 0);
$traffic_doublepercent = round($traffic_percent * 2, 2);
} else {
$traffic_percent = 0;
$traffic_doublepercent = 0;
@@ -91,35 +92,38 @@ if ($page == 'admins'
$traffic_percent = 100;
}
$row = str_replace_array('-1', 'UL', $row, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps subdomains tickets');
$row = htmlentities_array($row);
$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.=\"" . getTemplate("admins/admins_admin") . "\";");
$count++;
eval("\$admins.=\"" . \Froxlor\UI\Template::getTemplate("admins/admins_admin") . "\";");
$count ++;
}
$i++;
$i ++;
}
$admincount = $numrows_admins;
eval("echo \"" . getTemplate("admins/admins") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("admins/admins") . "\";");
} elseif ($action == 'su') {
} elseif($action == 'su') {
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid` = :adminid
");
$result = Database::pexecute_first($result_stmt, array('adminid' => $id));
try {
$json_result = Admins::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
$destination_admin = $result['loginname'];
if ($destination_admin != ''
&& $result['adminid'] != $userinfo['userid']
) {
if ($destination_admin != '' && $result['adminid'] != $userinfo['userid']) {
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = :userid
");
$result = Database::pexecute_first($result_stmt, array('userid' => $userinfo['userid']));
$result = Database::pexecute_first($result_stmt, array(
'userid' => $userinfo['userid']
));
$s = md5(uniqid(microtime(), 1));
$ins_stmt = Database::prepare("
@@ -137,641 +141,116 @@ if ($page == 'admins'
'lang' => $result['language']
);
Database::pexecute($ins_stmt, $ins_data);
$log->logAction(ADM_ACTION, LOG_INFO, "switched adminuser and is now '" . $destination_admin . "'");
redirectTo('admin_index.php', array('s' => $s));
$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 {
redirectTo('index.php', array('action' => 'login'));
\Froxlor\UI\Response::redirectTo('index.php', array(
'action' => 'login'
));
}
} elseif ($action == 'delete'
&& $id != 0
) {
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid` = :adminid
");
$result = Database::pexecute_first($result_stmt, array('adminid' => $id));
} elseif ($action == 'delete' && $id != 0) {
try {
$json_result = Admins::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if ($result['loginname'] != '') {
if ($result['adminid'] == $userinfo['userid']) {
standard_error('youcantdeleteyourself');
\Froxlor\UI\Response::standard_error('youcantdeleteyourself');
}
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$del_stmt = Database::prepare("
DELETE FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid` = :adminid
");
Database::pexecute($del_stmt, array('adminid' => $id));
$del_stmt = Database::prepare("
DELETE FROM `" . TABLE_PANEL_TRAFFIC_ADMINS . "` WHERE `adminid` = :adminid
");
Database::pexecute($del_stmt, array('adminid' => $id));
$upd_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET
`adminid` = :userid WHERE `adminid` = :adminid
");
Database::pexecute($upd_stmt, array('userid' => $userinfo['userid'], 'adminid' => $id));
$upd_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_DOMAINS . "` SET
`adminid` = :userid WHERE `adminid` = :adminid
");
Database::pexecute($upd_stmt, array('userid' => $userinfo['userid'], 'adminid' => $id));
$log->logAction(ADM_ACTION, LOG_INFO, "deleted admin '" . $result['loginname'] . "'");
updateCounters();
redirectTo($filename, array('page' => $page, 's' => $s));
if (isset($_POST['send']) && $_POST['send'] == 'send') {
Admins::getLocal($userinfo, array(
'id' => $id
))->delete();
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
ask_yesno('admin_admin_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['loginname']);
\Froxlor\UI\HTML::askYesNo('admin_admin_reallydelete', $filename, array(
'id' => $id,
'page' => $page,
'action' => $action
), $result['loginname']);
}
}
} elseif ($action == 'add') {
} elseif($action == 'add') {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$name = validate($_POST['name'], 'name');
$email = $idna_convert->encode(validate($_POST['email'], 'email'));
$custom_notes = validate(str_replace("\r\n", "\n", $_POST['custom_notes']), 'custom_notes', '/^[^\0]*$/');
$custom_notes_show = 0;
if (isset($_POST['custom_notes_show'])) {
$custom_notes_show = intval_ressource($_POST['custom_notes_show']);
if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
Admins::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$loginname = validate($_POST['loginname'], 'loginname');
$password = validate($_POST['admin_password'], 'password');
$password = validatePassword($password);
$def_language = validate($_POST['def_language'], 'default language');
$customers = intval_ressource($_POST['customers']);
if (isset($_POST['customers_ul'])) {
$customers = -1;
}
$domains = intval_ressource($_POST['domains']);
if (isset($_POST['domains_ul'])) {
$domains = -1;
}
$subdomains = intval_ressource($_POST['subdomains']);
if (isset($_POST['subdomains_ul'])) {
$subdomains = -1;
}
$emails = intval_ressource($_POST['emails']);
if (isset($_POST['emails_ul'])) {
$emails = -1;
}
$email_accounts = intval_ressource($_POST['email_accounts']);
if (isset($_POST['email_accounts_ul'])) {
$email_accounts = -1;
}
$email_forwarders = intval_ressource($_POST['email_forwarders']);
if (isset($_POST['email_forwarders_ul'])) {
$email_forwarders = -1;
}
if (Settings::Get('system.mail_quota_enabled') == '1') {
$email_quota = validate($_POST['email_quota'], 'email_quota', '/^\d+$/', 'vmailquotawrong', array('0', ''));
if (isset($_POST['email_quota_ul'])) {
$email_quota = -1;
}
} else {
$email_quota = -1;
}
$ftps = intval_ressource($_POST['ftps']);
if (isset($_POST['ftps_ul'])) {
$ftps = -1;
}
if (Settings::Get('ticket.enabled') == 1) {
$tickets = intval_ressource($_POST['tickets']);
if (isset($_POST['tickets_ul'])) {
$tickets = -1;
}
} else {
$tickets = 0;
}
$mysqls = intval_ressource($_POST['mysqls']);
if (isset($_POST['mysqls_ul'])) {
$mysqls = -1;
}
$customers_see_all = 0;
if (isset($_POST['customers_see_all'])) {
$customers_see_all = intval($_POST['customers_see_all']);
}
$domains_see_all = 0;
if (isset($_POST['domains_see_all'])) {
$domains_see_all = intval($_POST['domains_see_all']);
}
$caneditphpsettings = 0;
if (isset($_POST['caneditphpsettings'])) {
$caneditphpsettings = intval($_POST['caneditphpsettings']);
}
$change_serversettings = 0;
if (isset($_POST['change_serversettings'])) {
$change_serversettings = intval($_POST['change_serversettings']);
}
$diskspace = intval_ressource($_POST['diskspace']);
if (isset($_POST['diskspace_ul'])) {
$diskspace = -1;
}
$traffic = doubleval_ressource($_POST['traffic']);
if (isset($_POST['traffic_ul'])) {
$traffic = -1;
}
$tickets_see_all = 0;
if (isset($_POST['tickets_see_all'])) {
$tickets_see_all = intval($_POST['tickets_see_all']);
}
$diskspace = $diskspace * 1024;
$traffic = $traffic * 1024 * 1024;
$ipaddress = intval_ressource($_POST['ipaddress']);
// Check if the account already exists
$loginname_check_stmt = Database::prepare("
SELECT `loginname` FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `loginname` = :login
");
$loginname_check = Database::pexecute_first($loginname_check_stmt, array('login' => $loginname));
$loginname_check_admin_stmt = Database::prepare("
SELECT `loginname` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `loginname` = :login
");
$loginname_check_admin = Database::pexecute_first($loginname_check_admin_stmt, array('login' => $loginname));
if ($loginname == '') {
standard_error(array('stringisempty', 'myloginname'));
}
elseif (strtolower($loginname_check['loginname']) == strtolower($loginname)
|| strtolower($loginname_check_admin['loginname']) == strtolower($loginname)
) {
standard_error('loginnameexists', $loginname);
}
// Accounts which match systemaccounts are not allowed, filtering them
elseif (preg_match('/^' . preg_quote(Settings::Get('customer.accountprefix'), '/') . '([0-9]+)/', $loginname)) {
standard_error('loginnameissystemaccount', Settings::Get('customer.accountprefix'));
}
elseif (!validateUsername($loginname)) {
standard_error('loginnameiswrong', $loginname);
}
elseif ($name == '') {
standard_error(array('stringisempty', 'myname'));
}
elseif ($email == '') {
standard_error(array('stringisempty', 'emailadd'));
}
elseif ($password == '') {
standard_error(array('stringisempty', 'mypassword'));
}
elseif (!validateEmail($email)) {
standard_error('emailiswrong', $email);
} else {
if ($customers_see_all != '1') {
$customers_see_all = '0';
}
if ($domains_see_all != '1') {
$domains_see_all = '0';
}
if ($caneditphpsettings != '1') {
$caneditphpsettings = '0';
}
if ($change_serversettings != '1') {
$change_serversettings = '0';
}
if ($tickets_see_all != '1') {
$tickets_see_all = '0';
}
$_theme = Settings::Get('panel.default_theme');
$ins_data = array(
'loginname' => $loginname,
'password' => makeCryptPassword($password),
'name' => $name,
'email' => $email,
'lang' => $def_language,
'change_serversettings' => $change_serversettings,
'customers' => $customers,
'customers_see_all' => $customers_see_all,
'domains' => $domains,
'domains_see_all' => $domains_see_all,
'caneditphpsettings' => $caneditphpsettings,
'diskspace' => $diskspace,
'traffic' => $traffic,
'subdomains' => $subdomains,
'emails' => $emails,
'accounts' => $email_accounts,
'forwarders' => $email_forwarders,
'quota' => $email_quota,
'ftps' => $ftps,
'tickets' => $tickets,
'tickets_see_all' => $tickets_see_all,
'mysqls' => $mysqls,
'ip' => $ipaddress,
'theme' => $_theme,
'custom_notes' => $custom_notes,
'custom_notes_show' => $custom_notes_show
);
$ins_stmt = Database::prepare("
INSERT INTO `" . TABLE_PANEL_ADMINS . "` SET
`loginname` = :loginname,
`password` = :password,
`name` = :name,
`email` = :email,
`def_language` = :lang,
`change_serversettings` = :change_serversettings,
`customers` = :customers,
`customers_see_all` = :customers_see_all,
`domains` = :domains,
`domains_see_all` = :domains_see_all,
`caneditphpsettings` = :caneditphpsettings,
`diskspace` = :diskspace,
`traffic` = :traffic,
`subdomains` = :subdomains,
`emails` = :emails,
`email_accounts` = :accounts,
`email_forwarders` = :forwarders,
`email_quota` = :quota,
`ftps` = :ftps,
`tickets` = :tickets,
`tickets_see_all` = :tickets_see_all,
`mysqls` = :mysqls,
`ip` = :ip,
`theme` = :theme,
`custom_notes` = :custom_notes,
`custom_notes_show` = :custom_notes_show
");
Database::pexecute($ins_stmt, $ins_data);
$adminid = Database::lastInsertId();
$log->logAction(ADM_ACTION, LOG_INFO, "added admin '" . $loginname . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
}
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
$language_options = '';
while (list($language_file, $language_name) = each($languages)) {
$language_options.= makeoption($language_name, $language_file, $userinfo['language'], true);
foreach ($languages as $language_file => $language_name) {
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $userinfo['language'], true);
}
$ipaddress = makeoption($lng['admin']['allips'], "-1");
$ipaddress = \Froxlor\UI\HTML::makeoption($lng['admin']['allips'], "-1");
$ipsandports_stmt = Database::query("
SELECT `id`, `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` GROUP BY `ip` ORDER BY `ip` ASC
");
while ($row = $ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
$ipaddress.= makeoption($row['ip'], $row['id']);
$ipaddress .= \Froxlor\UI\HTML::makeoption($row['ip'], $row['id']);
}
$customers_ul = makecheckbox('customers_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$diskspace_ul = makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$traffic_ul = makecheckbox('traffic_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$domains_ul = makecheckbox('domains_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$subdomains_ul = makecheckbox('subdomains_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$emails_ul = makecheckbox('emails_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$email_accounts_ul = makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$email_forwarders_ul = makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$email_quota_ul = makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$ftps_ul = makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$tickets_ul = makecheckbox('tickets_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$mysqls_ul = makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$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_form = htmlform::genHTMLForm($admin_add_data);
$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'];
$image = $admin_add_data['admin_add']['image'];
eval("echo \"" . getTemplate("admins/admins_add") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("admins/admins_add") . "\";");
}
} elseif($action == 'edit'
&& $id != 0
) {
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid` = :adminid
");
$result = Database::pexecute_first($result_stmt, array('adminid' => $id));
} elseif ($action == 'edit' && $id != 0) {
try {
$json_result = Admins::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if ($result['loginname'] != '') {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$name = validate($_POST['name'], 'name');
$email = $idna_convert->encode(validate($_POST['email'], 'email'));
$custom_notes = validate(str_replace("\r\n", "\n", $_POST['custom_notes']), 'custom_notes', '/^[^\0]*$/');
$custom_notes_show = $result['custom_notes_show'];
if (isset($_POST['custom_notes_show'])) {
$custom_notes_show = intval_ressource($_POST['custom_notes_show']);
if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
Admins::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
if ($result['adminid'] == $userinfo['userid']) {
$password = '';
$def_language = $result['def_language'];
$deactivated = $result['deactivated'];
$customers = $result['customers'];
$domains = $result['domains'];
$subdomains = $result['subdomains'];
$emails = $result['emails'];
$email_accounts = $result['email_accounts'];
$email_forwarders = $result['email_forwarders'];
$email_quota = $result['email_quota'];
$ftps = $result['ftps'];
$tickets = $result['tickets'];
$mysqls = $result['mysqls'];
$tickets_see_all = $result['tickets_see_all'];
$customers_see_all = $result['customers_see_all'];
$domains_see_all = $result['domains_see_all'];
$caneditphpsettings = $result['caneditphpsettings'];
$change_serversettings = $result['change_serversettings'];
$diskspace = $result['diskspace'];
$traffic = $result['traffic'];
$ipaddress = $result['ip'];
} else {
$password = validate($_POST['admin_password'], 'new password');
$def_language = validate($_POST['def_language'], 'default language');
$deactivated = isset($_POST['deactivated']) ? 1 : 0;
$customers = intval_ressource($_POST['customers']);
if (isset($_POST['customers_ul'])) {
$customers = -1;
}
$domains = intval_ressource($_POST['domains']);
if (isset($_POST['domains_ul'])) {
$domains = -1;
}
$subdomains = intval_ressource($_POST['subdomains']);
if (isset($_POST['subdomains_ul'])) {
$subdomains = -1;
}
$emails = intval_ressource($_POST['emails']);
if (isset($_POST['emails_ul'])) {
$emails = -1;
}
$email_accounts = intval_ressource($_POST['email_accounts']);
if (isset($_POST['email_accounts_ul'])) {
$email_accounts = -1;
}
$email_forwarders = intval_ressource($_POST['email_forwarders']);
if (isset($_POST['email_forwarders_ul'])) {
$email_forwarders = -1;
}
if (Settings::Get('system.mail_quota_enabled') == '1') {
$email_quota = validate($_POST['email_quota'], 'email_quota', '/^\d+$/', 'vmailquotawrong', array('0', ''));
if (isset($_POST['email_quota_ul'])) {
$email_quota = -1;
}
} else {
$email_quota = -1;
}
$ftps = intval_ressource($_POST['ftps']);
if (isset($_POST['ftps_ul'])) {
$ftps = -1;
}
if (Settings::Get('ticket.enabled') == 1) {
$tickets = intval_ressource($_POST['tickets']);
if (isset($_POST['tickets_ul'])) {
$tickets = -1;
}
} else {
$tickets = 0;
}
$mysqls = intval_ressource($_POST['mysqls']);
if (isset($_POST['mysqls_ul'])) {
$mysqls = -1;
}
$customers_see_all = 0;
if (isset($_POST['customers_see_all'])) {
$customers_see_all = intval($_POST['customers_see_all']);
}
$domains_see_all = 0;
if (isset($_POST['domains_see_all'])) {
$domains_see_all = intval($_POST['domains_see_all']);
}
$caneditphpsettings = 0;
if (isset($_POST['caneditphpsettings'])) {
$caneditphpsettings = intval($_POST['caneditphpsettings']);
}
$change_serversettings = 0;
if (isset($_POST['change_serversettings'])) {
$change_serversettings = isset($_POST['change_serversettings']) ? 1 : 0;
}
$tickets_see_all = 0;
if (isset($_POST['tickets_see_all'])) {
$tickets_see_all = intval($_POST['tickets_see_all']);
}
$diskspace = intval($_POST['diskspace']);
if (isset($_POST['diskspace_ul'])) {
$diskspace = -1;
}
$traffic = doubleval_ressource($_POST['traffic']);
if (isset($_POST['traffic_ul'])) {
$traffic = -1;
}
$diskspace = $diskspace * 1024;
$traffic = $traffic * 1024 * 1024;
$ipaddress = intval_ressource($_POST['ipaddress']);
}
if ($name == '') {
standard_error(array('stringisempty', 'myname'));
} elseif($email == '') {
standard_error(array('stringisempty', 'emailadd'));
} elseif(!validateEmail($email)) {
standard_error('emailiswrong', $email);
} else {
if ($password != '') {
$password = validatePassword($password);
$password = makeCryptPassword($password);
} else {
$password = $result['password'];
}
if ($deactivated != '1') {
$deactivated = '0';
}
if ($customers_see_all != '1') {
$customers_see_all = '0';
}
if ($domains_see_all != '1') {
$domains_see_all = '0';
}
if ($caneditphpsettings != '1') {
$caneditphpsettings = '0';
}
if ($change_serversettings != '1') {
$change_serversettings = '0';
}
if ($tickets_see_all != '1') {
$tickets_see_all = '0';
}
// check if a resource was set to something lower
// than actually used by the admin/reseller
$res_warning = "";
if ($customers != $result['customers'] && $customers != -1 && $customers < $result['customers_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'customers');
}
if ($domains != $result['domains'] && $domains != -1 && $domains < $result['domains_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'domains');
}
if ($diskspace != $result['diskspace'] && ($diskspace / 1024) != -1 && $diskspace < $result['diskspace_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'diskspace');
}
if ($traffic != $result['traffic'] && ($traffic / 1024 / 1024) != -1 && $traffic < $result['traffic_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'traffic');
}
if ($emails != $result['emails'] && $emails != -1 && $emails < $result['emails_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'emails');
}
if ($email_accounts != $result['email_accounts'] && $email_accounts != -1 && $email_accounts < $result['email_accounts_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'email accounts');
}
if ($email_forwarders != $result['email_forwarders'] && $email_forwarders != -1 && $email_forwarders < $result['email_forwarders_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'email forwarders');
}
if ($email_quota != $result['email_quota'] && $email_quota != -1 && $email_quota < $result['email_quota_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'email quota');
}
if ($ftps != $result['ftps'] && $ftps != -1 && $ftps < $result['ftps_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'ftps');
}
if ($tickets != $result['tickets'] && $tickets != -1 && $tickets < $result['tickets_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'tickets');
}
if ($mysqls != $result['mysqls'] && $mysqls != -1 && $mysqls < $result['mysqls_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'mysqls');
}
if ($res_warning != "") {
$link = '';
$error = $res_warning;
eval("echo \"" . getTemplate('misc/error', '1') . "\";");
exit;
}
$upd_data = array(
'password' => $password,
'name' => $name,
'email' => $email,
'lang' => $def_language,
'change_serversettings' => $change_serversettings,
'customers' => $customers,
'customers_see_all' => $customers_see_all,
'domains' => $domains,
'domains_see_all' => $domains_see_all,
'caneditphpsettings' => $caneditphpsettings,
'diskspace' => $diskspace,
'traffic' => $traffic,
'subdomains' => $subdomains,
'emails' => $emails,
'accounts' => $email_accounts,
'forwarders' => $email_forwarders,
'quota' => $email_quota,
'ftps' => $ftps,
'tickets' => $tickets,
'tickets_see_all' => $tickets_see_all,
'mysqls' => $mysqls,
'ip' => $ipaddress,
'deactivated' => $deactivated,
'custom_notes' => $custom_notes,
'custom_notes_show' => $custom_notes_show,
'adminid' => $id
);
$upd_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_ADMINS . "` SET
`password` = :password,
`name` = :name,
`email` = :email,
`def_language` = :lang,
`change_serversettings` = :change_serversettings,
`customers` = :customers,
`customers_see_all` = :customers_see_all,
`domains` = :domains,
`domains_see_all` = :domains_see_all,
`caneditphpsettings` = :caneditphpsettings,
`diskspace` = :diskspace,
`traffic` = :traffic,
`subdomains` = :subdomains,
`emails` = :emails,
`email_accounts` = :accounts,
`email_forwarders` = :forwarders,
`email_quota` = :quota,
`ftps` = :ftps,
`tickets` = :tickets,
`tickets_see_all` = :tickets_see_all,
`mysqls` = :mysqls,
`ip` = :ip,
`deactivated` = :deactivated,
`custom_notes` = :custom_notes,
`custom_notes_show` = :custom_notes_show
WHERE `adminid` = :adminid
");
Database::pexecute($upd_stmt, $upd_data);
$log->logAction(ADM_ACTION, LOG_INFO, "edited admin '#" . $id . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
}
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
$dec_places = Settings::Get('panel.decimal_places');
@@ -779,89 +258,84 @@ if ($page == 'admins'
$result['diskspace'] = round($result['diskspace'] / 1024, $dec_places);
$result['email'] = $idna_convert->decode($result['email']);
$customers_ul = makecheckbox('customers_ul', $lng['customer']['unlimited'], '-1', false, $result['customers'], true, true);
$customers_ul = \Froxlor\UI\HTML::makecheckbox('customers_ul', $lng['customer']['unlimited'], '-1', false, $result['customers'], true, true);
if ($result['customers'] == '-1') {
$result['customers'] = '';
}
$diskspace_ul = makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, $result['diskspace'], true, true);
$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 = makecheckbox('traffic_ul', $lng['customer']['unlimited'], '-1', false, $result['traffic'], true, true);
$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 = makecheckbox('domains_ul', $lng['customer']['unlimited'], '-1', false, $result['domains'], true, true);
$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 = makecheckbox('subdomains_ul', $lng['customer']['unlimited'], '-1', false, $result['subdomains'], true, true);
$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 = makecheckbox('emails_ul', $lng['customer']['unlimited'], '-1', false, $result['emails'], true, true);
$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 = makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, $result['email_accounts'], true, true);
$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 = makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, $result['email_forwarders'], true, true);
$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 = makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, $result['email_quota'], true, true);
$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 = makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, $result['ftps'], true, true);
$ftps_ul = \Froxlor\UI\HTML::makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, $result['ftps'], true, true);
if ($result['ftps'] == '-1') {
$result['ftps'] = '';
}
$tickets_ul = makecheckbox('tickets_ul', $lng['customer']['unlimited'], '-1', false, $result['tickets'], true, true);
if ($result['tickets'] == '-1') {
$result['tickets'] = '';
}
$mysqls_ul = makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, $result['mysqls'], true, true);
$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 = '';
while (list($language_file, $language_name) = each($languages)) {
$language_options.= makeoption($language_name, $language_file, $result['def_language'], true);
foreach ($languages as $language_file => $language_name) {
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $result['def_language'], true);
}
$ipaddress = makeoption($lng['admin']['allips'], "-1", $result['ip']);
$ipaddress = \Froxlor\UI\HTML::makeoption($lng['admin']['allips'], "-1", $result['ip']);
$ipsandports_stmt = Database::query("
SELECT `id`, `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` GROUP BY `ip` ORDER BY `ip`, `port` ASC
SELECT `id`, `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` GROUP BY `id`, `ip` ORDER BY `ip`, `port` ASC
");
while ($row = $ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
$ipaddress.= makeoption($row['ip'], $row['id'], $result['ip']);
$ipaddress .= \Froxlor\UI\HTML::makeoption($row['ip'], $row['id'], $result['ip']);
}
$result = htmlentities_array($result);
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
$admin_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/admin/formfield.admin_edit.php';
$admin_edit_form = htmlform::genHTMLForm($admin_edit_data);
$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'];
$image = $admin_edit_data['admin_edit']['image'];
eval("echo \"" . getTemplate("admins/admins_edit") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("admins/admins_edit") . "\";");
}
}
}

View File

@@ -1,415 +1,440 @@
<?php
/*
+----------------------------------------------------------------------+
| APC |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2011 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Ralf Becker <beckerr@php.net> |
| Rasmus Lerdorf <rasmus@php.net> |
| Ilia Alshanetsky <ilia@prohost.org> |
+----------------------------------------------------------------------+
All other licensing and usage conditions are those of the PHP Group.
Based on https://github.com/krakjoe/apcu/blob/master/apc.php
Implemented into Froxlor: Janos Muzsi <muzsij@hypernics.hu>
* +----------------------------------------------------------------------+
* | APC |
* +----------------------------------------------------------------------+
* | Copyright (c) 2006-2011 The PHP Group |
* +----------------------------------------------------------------------+
* | This source file is subject to version 3.01 of the PHP license, |
* | that is bundled with this package in the file LICENSE, and is |
* | available through the world-wide-web at the following url: |
* | http://www.php.net/license/3_01.txt |
* | If you did not receive a copy of the PHP license and are unable to |
* | obtain it through the world-wide-web, please send a note to |
* | license@php.net so we can mail you a copy immediately. |
* +----------------------------------------------------------------------+
* | Authors: Ralf Becker <beckerr@php.net> |
* | Rasmus Lerdorf <rasmus@php.net> |
* | Ilia Alshanetsky <ilia@prohost.org> |
* +----------------------------------------------------------------------+
*
* All other licensing and usage conditions are those of the PHP Group.
*
* Based on https://github.com/krakjoe/apcu/blob/master/apc.php
* Implemented into Froxlor: Janos Muzsi <muzsij@hypernics.hu>
*
*/
define('AREA', 'admin');
require './lib/init.php';
$horizontal_bar_size = 950; // 1280px window width
if ($action == 'delete' &&
function_exists('apcu_clear_cache') &&
$userinfo['change_serversettings'] == '1'
) {
apcu_clear_cache();
$log->logAction(ADM_ACTION, LOG_INFO, "cleared APCu cache");
header('Location: ' . $linker->getLink(array('section' => 'apcuinfo', 'page' => 'showinfo')));
exit();
if ($action == 'delete' && function_exists('apcu_clear_cache') && $userinfo['change_serversettings'] == '1') {
apcu_clear_cache();
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "cleared APCu cache");
header('Location: ' . $linker->getLink(array(
'section' => 'apcuinfo',
'page' => 'showinfo'
)));
exit();
}
if (!function_exists('apcu_cache_info') ||
!function_exists('apcu_sma_info')
) {
standard_error($lng['error']['no_apcuinfo']);
if (! function_exists('apcu_cache_info') || ! function_exists('apcu_sma_info')) {
\Froxlor\UI\Response::standard_error($lng['error']['no_apcuinfo']);
}
if ($page == 'showinfo'
) {
$cache = apcu_cache_info();
$mem = apcu_sma_info();
$time = time();
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_apcuinfo");
if ($page == 'showinfo') {
$cache = apcu_cache_info();
$mem = apcu_sma_info();
$time = time();
$log->logAction(\Froxlor\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']);
$passtime = $time - $cache['start_time'] > 0 ? $time - $cache['start_time'] : 1; // zero division
$mem_size = $mem['num_seg'] * $mem['seg_size'];
$mem_avail = $mem['avail_mem'];
$mem_used = $mem_size - $mem_avail;
$seg_size = bsize($mem['seg_size']);
$sharedmem = sprintf($lng['apcuinfo']['sharedmemval'], $mem['num_seg'], $seg_size, $cache['memory_type']);
$req_rate_user = sprintf("%.2f", $cache['num_hits'] ? (($cache['num_hits'] + $cache['num_misses']) / $passtime) : 0);
$hit_rate_user = sprintf("%.2f", $cache['num_hits'] ? (($cache['num_hits']) / $passtime) : 0);
$miss_rate_user = sprintf("%.2f", $cache['num_misses'] ? (($cache['num_misses']) / $passtime) : 0);
$insert_rate_user = sprintf("%.2f", $cache['num_inserts'] ? (($cache['num_inserts']) / $passtime) : 0);
$apcversion = phpversion('apcu');
$phpversion = phpversion();
$number_vars = $cache['num_entries'];
$starttime = date('Y-m-d H:i:s', $cache['start_time']);
$uptime_duration = duration($cache['start_time']);
$size_vars = bsize($cache['mem_size']);
// check for possible empty values that are used in the templates
if (!isset($cache['file_upload_progress'])) {
$cache['file_upload_progress'] = $lng['logger']['unknown'];
}
// check for possible empty values that are used in the templates
if (! isset($cache['file_upload_progress'])) {
$cache['file_upload_progress'] = $lng['logger']['unknown'];
}
if (!isset($cache['num_expunges'])) {
$cache['num_expunges'] = $lng['logger']['unknown'];
}
if (! isset($cache['num_expunges'])) {
$cache['num_expunges'] = $lng['logger']['unknown'];
}
$runtimelines = '';
foreach (ini_get_all('apcu') as $name => $v) {
$value = $v['local_value'];
eval("\$runtimelines.=\"" . getTemplate("settings/apcuinfo/runtime_line") . "\";");
}
$runtimelines = '';
foreach (ini_get_all('apcu') as $name => $v) {
$value = $v['local_value'];
eval("\$runtimelines.=\"" . \Froxlor\UI\Template::getTemplate("settings/apcuinfo/runtime_line") . "\";");
}
$freemem = bsize($mem_avail) . sprintf(" (%.1f%%)", $mem_avail * 100 / $mem_size);
$usedmem = bsize($mem_used) . sprintf(" (%.1f%%)", $mem_used * 100 / $mem_size);
$hits = $cache['num_hits'] . @sprintf(" (%.1f%%)", $cache['num_hits'] * 100 / ($cache['num_hits'] + $cache['num_misses']));
$misses = $cache['num_misses'] . @sprintf(" (%.1f%%)", $cache['num_misses'] * 100 / ($cache['num_hits'] + $cache['num_misses']));
$freemem = bsize($mem_avail) . sprintf(" (%.1f%%)", $mem_avail * 100 / $mem_size);
$usedmem = bsize($mem_used) . sprintf(" (%.1f%%)", $mem_used * 100 / $mem_size);
$hits = $cache['num_hits'] . @sprintf(" (%.1f%%)", $cache['num_hits'] * 100 / ($cache['num_hits'] + $cache['num_misses']));
$misses = $cache['num_misses'] . @sprintf(" (%.1f%%)", $cache['num_misses'] * 100 / ($cache['num_hits'] + $cache['num_misses']));
// Fragementation: (freeseg - 1) / total_seg
$nseg = $freeseg = $fragsize = $freetotal = 0;
for ($i = 0; $i < $mem['num_seg']; $i++) {
$ptr = 0;
foreach ($mem['block_lists'][$i] as $block) {
if ($block['offset'] != $ptr) {
++$nseg;
}
$ptr = $block['offset'] + $block['size'];
/* Only consider blocks <5M for the fragmentation % */
if ($block['size'] < (5 * 1024 * 1024))
$fragsize+=$block['size'];
$freetotal+=$block['size'];
}
$freeseg += count($mem['block_lists'][$i]);
}
// Fragementation: (freeseg - 1) / total_seg
$nseg = $freeseg = $fragsize = $freetotal = 0;
for ($i = 0; $i < $mem['num_seg']; $i ++) {
$ptr = 0;
foreach ($mem['block_lists'][$i] as $block) {
if ($block['offset'] != $ptr) {
++ $nseg;
}
$ptr = $block['offset'] + $block['size'];
/* Only consider blocks <5M for the fragmentation % */
if ($block['size'] < (5 * 1024 * 1024))
$fragsize += $block['size'];
$freetotal += $block['size'];
}
$freeseg += count($mem['block_lists'][$i]);
}
if ($freeseg > 1) {
$frag = sprintf("%.2f%% (%s out of %s in %d fragments)", ($fragsize / $freetotal) * 100, bsize($fragsize), bsize($freetotal), $freeseg);
} else {
$frag = "0%";
}
if ($freeseg > 1) {
$frag = sprintf("%.2f%% (%s out of %s in %d fragments)", ($fragsize / $freetotal) * 100, bsize($fragsize), bsize($freetotal), $freeseg);
} else {
$frag = "0%";
}
foreach (ini_get_all('apcu') as $name => $v) {
$value = $v['local_value'];
}
foreach (ini_get_all('apcu') as $name => $v) {
$value = $v['local_value'];
}
$img_src1 = '';
$img_src2 = '';
$img_src3 = '';
if (graphics_avail()) {
$img_src = $linker->getLink(array('section' => 'apcuinfo', 'page' => 'img1', 'action' => mt_rand(0, 1000000)));
eval("\$img_src1=\"" . getTemplate("settings/apcuinfo/img_line") . "\";");
$img_src = $linker->getLink(array('section' => 'apcuinfo', 'page' => 'img2', 'action' => mt_rand(0, 1000000)));
eval("\$img_src2=\"" . getTemplate("settings/apcuinfo/img_line") . "\";");
$img_src = $linker->getLink(array('section' => 'apcuinfo', 'page' => 'img3', 'action' => mt_rand(0, 1000000)));
eval("\$img_src3=\"" . getTemplate("settings/apcuinfo/img_line") . "\";");
}
$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 \"" . getTemplate("settings/apcuinfo/showinfo") . "\";");
} elseif ($page == 'img1'
) {
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/apcuinfo/showinfo") . "\";");
} elseif ($page == 'img1') {
$mem = apcu_sma_info();
$mem = apcu_sma_info();
$size = 460;
$image = imagecreate($size + 5, $size + 5);
$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);
$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);
imagecolortransparent($image, $col_white);
$s = $mem['num_seg'] * $mem['seg_size'];
$a = $mem['avail_mem'];
$x = $y = $size / 2;
$fuzz = 0.000001;
$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])));
}
// 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'
) {
header("Content-type: image/png");
imagepng($image);
exit();
} elseif ($page == 'img2') {
$cache = apcu_cache_info();
$cache = apcu_cache_info();
$size = $horizontal_bar_size;
$image = imagecreate($size + 5, 140);
$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);
$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);
imagecolortransparent($image, $col_white);
$s = $cache['num_hits'] + $cache['num_misses'];
$a = $cache['num_hits'];
$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) */);
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'
) {
header("Content-type: image/png");
imagepng($image);
exit();
} elseif ($page == 'img3') {
$mem = apcu_sma_info();
$mem = apcu_sma_info();
$size = $horizontal_bar_size;
$image = imagecreate($size, 70);
$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);
$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);
imagecolortransparent($image, $col_white);
$s = $mem['num_seg'] * $mem['seg_size'];
$a = $mem['avail_mem'];
$x = 10;
$y = 0;
$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++);
}
}
}
// 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;
header("Content-type: image/png");
imagepng($image);
exit();
}
function graphics_avail() {
return extension_loaded('gd');
function graphics_avail()
{
return extension_loaded('gd');
}
// pretty printer for byte values
//
function bsize($s) {
foreach (array('', 'K', 'M', 'G') as $i => $k) {
if ($s < 1024)
break;
$s/=1024;
}
return sprintf("%5.1f %sBytes", $s, $k);
function bsize($s)
{
foreach (array(
'',
'K',
'M',
'G'
) as $i => $k) {
if ($s < 1024)
break;
$s /= 1024;
}
return sprintf("%5.1f %sBytes", $s, $k);
}
function duration($ts) {
global $time;
$years = (int) ((($time - $ts) / (7 * 86400)) / 52.177457);
$rem = (int) (($time - $ts) - ($years * 52.177457 * 7 * 86400));
$weeks = (int) (($rem) / (7 * 86400));
$days = (int) (($rem) / 86400) - $weeks * 7;
$hours = (int) (($rem) / 3600) - $days * 24 - $weeks * 7 * 24;
$mins = (int) (($rem) / 60) - $hours * 60 - $days * 24 * 60 - $weeks * 7 * 24 * 60;
$str = '';
if ($years == 1)
$str .= "$years year, ";
if ($years > 1)
$str .= "$years years, ";
if ($weeks == 1)
$str .= "$weeks week, ";
if ($weeks > 1)
$str .= "$weeks weeks, ";
if ($days == 1)
$str .= "$days day,";
if ($days > 1)
$str .= "$days days,";
if ($hours == 1)
$str .= " $hours hour and";
if ($hours > 1)
$str .= " $hours hours and";
if ($mins == 1)
$str .= " 1 minute";
else
$str .= " $mins minutes";
return $str;
function duration($ts)
{
global $time;
$years = (int) ((($time - $ts) / (7 * 86400)) / 52.177457);
$rem = (int) (($time - $ts) - ($years * 52.177457 * 7 * 86400));
$weeks = (int) (($rem) / (7 * 86400));
$days = (int) (($rem) / 86400) - $weeks * 7;
$hours = (int) (($rem) / 3600) - $days * 24 - $weeks * 7 * 24;
$mins = (int) (($rem) / 60) - $hours * 60 - $days * 24 * 60 - $weeks * 7 * 24 * 60;
$str = '';
if ($years == 1)
$str .= "$years year, ";
if ($years > 1)
$str .= "$years years, ";
if ($weeks == 1)
$str .= "$weeks week, ";
if ($weeks > 1)
$str .= "$weeks weeks, ";
if ($days == 1)
$str .= "$days day,";
if ($days > 1)
$str .= "$days days,";
if ($hours == 1)
$str .= " $hours hour and";
if ($hours > 1)
$str .= " $hours hours and";
if ($mins == 1)
$str .= " 1 minute";
else
$str .= " $mins minutes";
return $str;
}
function block_sort($array1, $array2) {
if ($array1['offset'] > $array2['offset']) {
return 1;
} else {
return -1;
}
function 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);
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);
}
}
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);
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);
}
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;
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) {
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);
}
}
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

@@ -17,84 +17,92 @@
* @since 0.9.35
*
*/
define('AREA', 'admin');
require './lib/init.php';
use Froxlor\Http\HttpClient;
// define update-uri
define('UPDATE_URI', "https://version.froxlor.org/Froxlor/legacy/" . $version);
define('UPDATE_URI', "https://version.froxlor.org/Froxlor/api/" . $version);
define('RELEASE_URI', "https://autoupdate.froxlor.org/froxlor-{version}.zip");
define('CHECKSUM_URI', "https://autoupdate.froxlor.org/froxlor-{version}.zip.sha256");
// check for allow_url_fopen
if (ini_get('allow_url_fopen') === false) {
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 1));
}
// check for archive-stuff
if (! extension_loaded('zip')) {
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 2));
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s,
'page' => 'error',
'errno' => 2
));
}
// 0.10.x requires 7.0 at least
if (version_compare("7.0.0", PHP_VERSION, ">=")) {
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s,
'page' => 'error',
'errno' => 10
));
}
// display initial version check
if ($page == 'overview') {
// log our actions
$log->logAction(ADM_ACTION, LOG_NOTICE, "checking auto-update");
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "checking auto-update");
// check for new version
$latestversion = @file(UPDATE_URI);
try {
$latestversion = HttpClient::urlGet(UPDATE_URI, true, 3);
} catch (\Exception $e) {
\Froxlor\UI\Response::dynamic_error("Version-check currently unavailable, please try again later");
}
$latestversion = explode('|', $latestversion);
if (isset($latestversion[0])) {
$latestversion = explode('|', $latestversion[0]);
if (is_array($latestversion) && count($latestversion) >= 1) {
$_version = $latestversion[0];
$_message = isset($latestversion[1]) ? $latestversion[1] : '';
$_link = isset($latestversion[2]) ? $latestversion[2] : htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes');
if (is_array($latestversion)
&& count($latestversion) >= 1
) {
$_version = $latestversion[0];
$_message = isset($latestversion[1]) ? $latestversion[1] : '';
$_link = isset($latestversion[2]) ? $latestversion[2] : htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes');
// add the branding so debian guys are not gettings confused
// about their version-number
$version_label = $_version . $branding;
$version_link = $_link;
$message_addinfo = $_message;
// 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;
}
// not numeric -> error-message
if (!preg_match('/^((\d+\\.)(\d+\\.)(\d+\\.)?(\d+)?(\-(svn|dev|rc)(\d+))?)$/', $_version)) {
// check for customized version to not output
// "There is a newer version of froxlor" besides the error-message
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 3));
} elseif (version_compare2($version, $_version) == -1) {
// there is a newer version - yay
$isnewerversion = 1;
} else {
// nothing new
$isnewerversion = 0;
}
// anzeige über version-status mit ggfls. formular
// zum update schritt #1 -> download
if ($isnewerversion == 1) {
$text = 'There is a newer version available. Update to version <b>'.$_version.'</b> now?<br/>(Your current version is: '.$version.')';
$hiddenparams = '<input type="hidden" name="newversion" value="'.$_version.'" />';
$yesfile = $filename.'?s='.$s.'&amp;page=getdownload';
eval("echo \"" . getTemplate("misc/question_yesno", true) . "\";");
exit;
}
elseif ($isnewerversion == 0) {
// all good
standard_success ('noupdatesavail');
} else {
standard_error ('customized_version');
}
// anzeige über version-status mit ggfls. formular
// zum update schritt #1 -> download
if ($isnewerversion == 1) {
$text = 'There is a newer version available. Update to version <b>' . $_version . '</b> now?<br/>(Your current version is: ' . $version . ')';
$hiddenparams = '<input type="hidden" name="newversion" value="' . $_version . '" />';
$yesfile = $filename . '?s=' . $s . '&amp;page=getdownload';
eval("echo \"" . \Froxlor\UI\Template::getTemplate("misc/question_yesno", true) . "\";");
exit();
} elseif ($isnewerversion == 0) {
// all good
\Froxlor\UI\Response::standard_success('noupdatesavail');
} else {
\Froxlor\UI\Response::standard_error('customized_version');
}
}
// error (something weird came from version.froxlor.org)
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 5));
}
// download the new archive
} // download the new archive
elseif ($page == 'getdownload') {
// retrieve the new version from the form
@@ -107,36 +115,35 @@ elseif ($page == 'getdownload') {
$toLoad = str_replace('{version}', $newversion, RELEASE_URI);
$toCheck = str_replace('{version}', $newversion, CHECKSUM_URI);
// get archive data
$newArchive = @file_get_contents($toLoad);
// check for local destination folder
if (!is_dir(FROXLOR_INSTALL_DIR.'/updates/')) {
mkdir(FROXLOR_INSTALL_DIR.'/updates/');
if (! is_dir(\Froxlor\Froxlor::getInstallDir() . '/updates/')) {
mkdir(\Froxlor\Froxlor::getInstallDir() . '/updates/');
}
// name archive
$localArchive = FROXLOR_INSTALL_DIR.'/updates/'.basename($toLoad);
$localArchive = \Froxlor\Froxlor::getInstallDir() . '/updates/' . basename($toLoad);
$log->logAction(ADM_ACTION, LOG_NOTICE, "Downloading ".$toLoad." to ".$localArchive);
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "Downloading " . $toLoad . " to " . $localArchive);
// remove old archive
if (file_exists($localArchive)) {
@unlink($localArchive);
}
// store archive
$fh = fopen($localArchive, 'w');
if (!fwrite($fh, $newArchive)) {
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 4));
// get archive data
try {
HttpClient::fileGet($toLoad, $localArchive);
} catch (Exception $e) {
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s,
'page' => 'error',
'errno' => 4
));
}
// close file-handle
fclose($fh);
// validate the integrity of the downloaded file
$_shouldsum = @file_get_contents($toCheck);
if (!empty($_shouldsum)) {
$_shouldsum = HttpClient::urlGet($toCheck);
if (! empty($_shouldsum)) {
$_t = explode(" ", $_shouldsum);
$shouldsum = $_t[0];
} else {
@@ -145,58 +152,76 @@ elseif ($page == 'getdownload') {
$filesum = hash_file('sha256', $localArchive);
if ($filesum != $shouldsum) {
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 9));
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s,
'page' => 'error',
'errno' => 9
));
}
// to the next step
redirectTo($filename, array('s' => $s, 'page' => 'extract', 'archive' => basename($localArchive)));
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s,
'page' => 'extract',
'archive' => basename($localArchive)
));
}
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 6));
}
// extract and install new version
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s,
'page' => 'error',
'errno' => 6
));
} // extract and install new version
elseif ($page == 'extract') {
$toExtract = isset($_GET['archive']) ? $_GET['archive'] : null;
$localArchive = FROXLOR_INSTALL_DIR.'/updates/'.$toExtract;
$localArchive = \Froxlor\Froxlor::getInstallDir() . '/updates/' . $toExtract;
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
// decompress from zip
$zip = new ZipArchive;
$zip = new ZipArchive();
$res = $zip->open($localArchive);
if ($res === true) {
$log->logAction(ADM_ACTION, LOG_NOTICE, "Extracting ".$localArchive." to ".FROXLOR_INSTALL_DIR);
$zip->extractTo(FROXLOR_INSTALL_DIR);
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "Extracting " . $localArchive . " to " . \Froxlor\Froxlor::getInstallDir());
$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
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 8));
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s,
'page' => 'error',
'errno' => 8
));
}
// redirect to update-page?
redirectTo('admin_updates.php', array('s' => $s));
\Froxlor\UI\Response::redirectTo('admin_updates.php', array(
's' => $s
));
}
if (!file_exists($localArchive)) {
redirectTo($filename, array('s' => $s, 'page' => 'error', 'errno' => 7));
if (! file_exists($localArchive)) {
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s,
'page' => 'error',
'errno' => 7
));
}
$text = 'Extract downloaded archive "'.$toExtract.'"?';
$text = 'Extract downloaded archive "' . $toExtract . '"?';
$hiddenparams = '';
$yesfile = $filename.'?s='.$s.'&amp;page=extract&amp;archive='.$toExtract;
eval("echo \"" . getTemplate("misc/question_yesno", true) . "\";");
}
// display error
$yesfile = $filename . '?s=' . $s . '&amp;page=extract&amp;archive=' . $toExtract;
eval("echo \"" . \Froxlor\UI\Template::getTemplate("misc/question_yesno", true) . "\";");
} // display error
elseif ($page == 'error') {
// retrieve error-number via url-parameter
$errno = isset($_GET['errno']) ? (int)$_GET['errno'] : 0;
$errno = isset($_GET['errno']) ? (int) $_GET['errno'] : 0;
// 1 = no allow_url_fopen
// 2 = no Zlib
// 3 = custom version detected
// 4 = could not store archive to local hdd
@@ -205,5 +230,6 @@ elseif ($page == 'error') {
// 7 = local archive does not exist
// 8 = could not extract archive
// 9 = checksum mismatch
standard_error ('autoupdate_'.$errno);
// 10 = <php-7.0
\Froxlor\UI\Response::standard_error('autoupdate_' . $errno);
}

View File

@@ -18,37 +18,58 @@
define('AREA', 'admin');
require './lib/init.php';
use Froxlor\Settings;
if ($userinfo['change_serversettings'] == '1') {
$customer_tmpdir = '/tmp/';
if (Settings::Get('system.mod_fcgid') == '1' && Settings::Get('system.mod_fcgid_tmpdir') != '')
{
$customer_tmpdir = Settings::Get('system.mod_fcgid_tmpdir');
if ($action == 'setconfigured') {
Settings::Set('panel.is_configured', '1', true);
\Froxlor\UI\Response::redirectTo('admin_configfiles.php', array(
's' => $s
));
}
elseif (Settings::Get('phpfpm.enabled') == '1' && Settings::Get('phpfpm.tmpdir') != '')
{
$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>' => 'MYSQL_PASSWORD',
'<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>' => makeCorrectDir($customer_tmpdir),
'<BASE_PATH>' => makeCorrectDir(FROXLOR_INSTALL_DIR),
'<BIND_CONFIG_PATH>' => makeCorrectDir(Settings::Get('system.bindconf_directory')),
'<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>' => makeCorrectDir(Settings::Get('system.logfiles_directory')),
'<FPM_IPCDIR>' => makeCorrectDir(Settings::Get('phpfpm.fastcgi_ipcdir')),
'<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')
);
@@ -64,11 +85,17 @@ if ($userinfo['change_serversettings'] == '1') {
$services = "";
$daemons = "";
$config_dir = makeCorrectDir(FROXLOR_INSTALL_DIR . '/lib/configfiles/');
$config_dir = \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir() . '/lib/configfiles/');
if ($distribution != "") {
if (! file_exists($config_dir . '/' . $distribution . ".xml")) {
trigger_error("Unknown distribution, are you playing around with the URL?");
exit();
}
// create configparser object
$configfiles = new ConfigParser($config_dir . '/' . $distribution . ".xml");
$configfiles = new \Froxlor\Config\ConfigParser($config_dir . '/' . $distribution . ".xml");
// get distro-info
$dist_display = getCompleteDistroName($configfiles);
@@ -78,6 +105,11 @@ if ($userinfo['change_serversettings'] == '1') {
if ($service != "") {
if (! isset($services[$service])) {
trigger_error("Unknown service, are you playing around with the URL?");
exit();
}
$daemons = $services[$service]->getDaemons();
if ($daemon == "") {
@@ -86,12 +118,12 @@ if ($userinfo['change_serversettings'] == '1') {
if ($dd->default) {
$title = $title . " (" . strtolower($lng['panel']['default']) . ")";
}
$daemons_select .= makeoption($title, $di);
$daemons_select .= \Froxlor\UI\HTML::makeoption($title, $di);
}
}
} else {
foreach ($services as $si => $sd) {
$services_select .= makeoption($sd->title, $si);
$services_select .= \Froxlor\UI\HTML::makeoption($sd->title, $si);
}
}
} else {
@@ -103,7 +135,7 @@ if ($userinfo['change_serversettings'] == '1') {
// read in all the distros
foreach ($distros as $_distribution) {
// get configparser object
$dist = new ConfigParser($_distribution);
$dist = new \Froxlor\Config\ConfigParser($_distribution);
// get distro-info
$dist_display = getCompleteDistroName($dist);
// store in tmp array
@@ -115,12 +147,17 @@ if ($userinfo['change_serversettings'] == '1') {
foreach ($distributions_select_data as $dist_display => $dist_index) {
// create select-box-option
$distributions_select .= makeoption($dist_display, $dist_index);
$distributions_select .= \Froxlor\UI\HTML::makeoption($dist_display, $dist_index);
}
}
if ($distribution != "" && $service != "" && $daemon != "") {
if (! isset($daemons[$daemon])) {
trigger_error("Unknown daemon, are you playing around with the URL?");
exit();
}
$confarr = $daemons[$daemon]->getConfig();
$configpage = '';
@@ -133,49 +170,49 @@ if ($userinfo['change_serversettings'] == '1') {
$lasttype = '';
$commands = '';
foreach ($confarr as $idx => $action) {
if ($lasttype != '' && $lasttype != $action['type']) {
foreach ($confarr as $_action) {
if ($lasttype != '' && $lasttype != $_action['type']) {
$commands = trim($commands);
$numbrows = count(explode("\n", $commands));
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_commands") . "\";");
eval("\$configpage.=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_commands") . "\";");
$lasttype = '';
$commands = '';
}
switch ($action['type']) {
switch ($_action['type']) {
case "install":
$commands .= strtr($action['content'], $replace_arr) . "\n";
$commands .= strtr($_action['content'], $replace_arr) . "\n";
$lasttype = "install";
break;
case "command":
$commands .= strtr($action['content'], $replace_arr) . "\n";
$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('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);
$commands_file = getFileContentContainer($fileaction['content'], $replace_arr, $_action['name'], $distro_editor);
}
}
}
$realname = $action['name'];
$realname = $_action['name'];
$commands = trim($commands_pre);
if ($commands != "") {
$numbrows = count(explode("\n", $commands));
eval("\$commands_pre=\"" . getTemplate("configfiles/configfiles_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=\"" . getTemplate("configfiles/configfiles_commands") . "\";");
eval("\$commands_post=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_commands") . "\";");
}
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_subfileblock") . "\";");
eval("\$configpage.=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_subfileblock") . "\";");
$commands = '';
$commands_pre = '';
$commands_post = '';
@@ -185,15 +222,17 @@ if ($userinfo['change_serversettings'] == '1') {
$commands = trim($commands);
if ($commands != '') {
$numbrows = count(explode("\n", $commands));
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_commands") . "\";");
eval("\$configpage.=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_commands") . "\";");
}
eval("echo \"" . getTemplate("configfiles/configfiles") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles") . "\";");
} else {
eval("echo \"" . getTemplate("configfiles/wizard") . "\";");
$basedir = \Froxlor\Froxlor::getInstallDir();
eval("echo \"" . \Froxlor\UI\Template::getTemplate("configfiles/wizard") . "\";");
}
} else {
die('not allowed to see this page');
// redirect or similar here
\Froxlor\UI\Response::redirectTo('admin_index.php', array(
's' => $s
));
}
// helper functions
@@ -205,7 +244,7 @@ function getFileContentContainer($file_content, &$replace_arr, $realname, $distr
$file_content = strtr($file_content, $replace_arr);
$file_content = htmlspecialchars($file_content);
$numbrows = count(explode("\n", $file_content));
eval("\$files=\"" . getTemplate("configfiles/configfiles_file") . "\";");
eval("\$files=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_file") . "\";");
}
return $files;
}

View File

@@ -14,26 +14,28 @@
* @package Panel
*
*/
define('AREA', 'admin');
require './lib/init.php';
use Froxlor\Database\Database;
use Froxlor\Api\Commands\Cronjobs as Cronjobs;
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif(isset($_GET['id'])) {
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
if ($page == 'cronjobs' || $page == 'overview') {
if ($action == '') {
$log->logAction(ADM_ACTION, LOG_NOTICE, 'viewed admin_cronjobs');
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'viewed admin_cronjobs');
$fields = array(
'c.lastrun' => $lng['cron']['lastrun'],
'c.interval' => $lng['cron']['interval'],
'c.isactive' => $lng['cron']['isactive']
);
$paging = new paging($userinfo, TABLE_PANEL_CRONRUNS, $fields);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_CRONRUNS, $fields);
$crons = '';
$result_stmt = Database::prepare("SELECT `c`.* FROM `" . TABLE_PANEL_CRONRUNS . "` `c` ORDER BY `module` ASC, `cronfile` ASC");
@@ -52,57 +54,49 @@ if ($page == 'cronjobs' || $page == 'overview') {
if ($cmod != $row['module']) {
$_mod = explode("/", $row['module']);
$module = ucfirst($_mod[1]);
eval("\$crons.=\"" . getTemplate('cronjobs/cronjobs_cronjobmodule') . "\";");
eval("\$crons.=\"" . \Froxlor\UI\Template::getTemplate('cronjobs/cronjobs_cronjobmodule') . "\";");
$cmod = $row['module'];
}
if ($paging->checkDisplay($i)) {
$row = htmlentities_array($row);
$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'];
$row['isactive'] = ((int) $row['isactive'] == 1) ? $lng['panel']['yes'] : $lng['panel']['no'];
$description = $lng['crondesc'][$row['desc_lng_key']];
eval("\$crons.=\"" . getTemplate('cronjobs/cronjobs_cronjob') . "\";");
$count++;
eval("\$crons.=\"" . \Froxlor\UI\Template::getTemplate('cronjobs/cronjobs_cronjob') . "\";");
$count ++;
}
$i++;
$i ++;
}
eval("echo \"" . getTemplate('cronjobs/cronjobs') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('cronjobs/cronjobs') . "\";");
} elseif ($action == 'new') {
/*
* @TODO later
*/
} elseif ($action == 'edit' && $id != 0) {
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_CRONRUNS . "` WHERE `id`= :id");
Database::pexecute($result_stmt, array('id' => $id));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
try {
$json_result = Cronjobs::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if ($result['cronfile'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$isactive = isset($_POST['isactive']) ? 1 : 0;
$interval_value = validate($_POST['interval_value'], 'interval_value', '/^([0-9]+)$/Di', 'stringisempty');
$interval_interval = validate($_POST['interval_interval'], 'interval_interval');
if ($isactive != 1) {
$isactive = 0;
try {
Cronjobs::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$interval = $interval_value . ' ' . strtoupper($interval_interval);
$upd = Database::prepare("
UPDATE `" . TABLE_PANEL_CRONRUNS . "`
SET `isactive` = :isactive, `interval` = :int
WHERE `id` = :id"
);
Database::pexecute($upd, array('isactive' => $isactive, 'int' => $interval, 'id' => $id));
// insert task to re-generate the cron.d-file
inserttask('99');
redirectTo($filename, array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
// interval
@@ -110,11 +104,11 @@ if ($page == 'cronjobs' || $page == 'overview') {
$interval_value = $interval_nfo[0];
$interval_interval = '';
$interval_interval .= makeoption($lng['cronmgmt']['minutes'], 'MINUTE', $interval_nfo[1]);
$interval_interval .= makeoption($lng['cronmgmt']['hours'], 'HOUR', $interval_nfo[1]);
$interval_interval .= makeoption($lng['cronmgmt']['days'], 'DAY', $interval_nfo[1]);
$interval_interval .= makeoption($lng['cronmgmt']['weeks'], 'WEEK', $interval_nfo[1]);
$interval_interval .= makeoption($lng['cronmgmt']['months'], 'MONTH', $interval_nfo[1]);
$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;
@@ -122,17 +116,16 @@ if ($page == 'cronjobs' || $page == 'overview') {
$change_cronfile = true;
}
$cronjobs_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/cronjobs/formfield.cronjobs_edit.php';
$cronjobs_edit_form = htmlform::genHTMLForm($cronjobs_edit_data);
$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'];
$image = $cronjobs_edit_data['cronjobs_edit']['image'];
eval("echo \"" . getTemplate('cronjobs/cronjob_edit') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('cronjobs/cronjob_edit') . "\";");
}
}
}
elseif ($action == 'delete' && $id != 0) {
} elseif ($action == 'delete' && $id != 0) {
/*
* @TODO later
*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -16,42 +16,47 @@
* @package Panel
*
*/
define('AREA', 'admin');
require './lib/init.php';
if ($action == 'logout') {
use Froxlor\Database\Database;
use Froxlor\Settings;
use Froxlor\Api\Commands\Froxlor as Froxlor;
use Froxlor\Api\Commands\Admins as Admins;
$log->logAction(ADM_ACTION, LOG_NOTICE, "logged out");
if ($action == 'logout') {
$params = array('adminid' => (int)$userinfo['adminid']);
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "logged out");
$params = array(
'adminid' => (int) $userinfo['adminid']
);
if (Settings::Get('session.allow_multiple_login') == '1') {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :adminid
AND `adminsession` = '1'
AND `hash` = :hash"
);
AND `hash` = :hash");
$params['hash'] = $s;
} else {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :adminid
AND `adminsession` = '1'"
);
AND `adminsession` = '1'");
}
Database::pexecute($stmt, $params);
redirectTo('index.php');
\Froxlor\UI\Response::redirectTo('index.php');
}
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif(isset($_GET['id'])) {
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
if ($page == 'overview') {
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_index");
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_index");
$overview_stmt = Database::prepare("SELECT COUNT(*) AS `number_customers`,
SUM(`diskspace_used`) AS `diskspace_used`,
SUM(`mysqls_used`) AS `mysqls_used`,
@@ -60,11 +65,12 @@ if ($page == 'overview') {
SUM(`email_forwarders_used`) AS `email_forwarders_used`,
SUM(`email_quota_used`) AS `email_quota_used`,
SUM(`ftps_used`) AS `ftps_used`,
SUM(`tickets_used`) AS `tickets_used`,
SUM(`subdomains_used`) AS `subdomains_used`,
SUM(`traffic_used`) AS `traffic_used`
FROM `" . TABLE_PANEL_CUSTOMERS . "`" . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = :adminid "));
$overview = Database::pexecute_first($overview_stmt, array('adminid' => $userinfo['adminid']));
$overview = Database::pexecute_first($overview_stmt, array(
'adminid' => $userinfo['adminid']
));
$dec_places = Settings::Get('panel.decimal_places');
$overview['traffic_used'] = round($overview['traffic_used'] / (1024 * 1024), $dec_places);
@@ -72,9 +78,10 @@ if ($page == 'overview') {
$number_domains_stmt = Database::prepare("
SELECT COUNT(*) AS `number_domains` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `parentdomainid`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :adminid")
);
$number_domains = Database::pexecute_first($number_domains_stmt, array('adminid' => $userinfo['adminid']));
WHERE `parentdomainid`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :adminid"));
$number_domains = Database::pexecute_first($number_domains_stmt, array(
'adminid' => $userinfo['adminid']
));
$overview['number_domains'] = $number_domains['number_domains'];
@@ -82,52 +89,23 @@ if ($page == 'overview') {
$mysqlserverversion = Database::getAttribute(PDO::ATTR_SERVER_VERSION);
$webserverinterface = strtoupper(@php_sapi_name());
if ((isset($_GET['lookfornewversion']) && $_GET['lookfornewversion'] == 'yes')
|| (isset($lookfornewversion) && $lookfornewversion == 'yes')
) {
$update_check_uri = 'http://version.froxlor.org/Froxlor/legacy/' . $version;
if (ini_get('allow_url_fopen')) {
$latestversion = @file($update_check_uri);
if (isset($latestversion[0])) {
$latestversion = explode('|', $latestversion[0]);
if (is_array($latestversion)
&& count($latestversion) >= 1
) {
$_version = $latestversion[0];
$_message = isset($latestversion[1]) ? $latestversion[1] : '';
$_link = isset($latestversion[2]) ? $latestversion[2] : htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes');
// add the branding so debian guys are not gettings confused
// about their version-number
$lookfornewversion_lable = $_version.$branding;
$lookfornewversion_link = $_link;
$lookfornewversion_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
$isnewerversion = 2;
} elseif (version_compare2($version, $_version) == -1) {
$isnewerversion = 1;
} else {
$isnewerversion = 0;
}
} else {
redirectTo($update_check_uri.'/pretty', NULL, false);
}
} else {
redirectTo($update_check_uri.'/pretty', NULL, false);
}
} else {
redirectTo($update_check_uri.'/pretty', NULL, false);
if ((isset($_GET['lookfornewversion']) && $_GET['lookfornewversion'] == 'yes') || (isset($lookfornewversion) && $lookfornewversion == 'yes')) {
try {
$json_result = Froxlor::getLocal($userinfo)->checkUpdate();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
$lookfornewversion_lable = $result['version'];
$lookfornewversion_link = $result['link'];
$lookfornewversion_message = $result['message'];
$lookfornewversion_addinfo = $result['additional_info'];
$isnewerversion = $result['isnewerversion'];
} else {
$lookfornewversion_lable = $lng['admin']['lookfornewversion']['clickhere'];
$lookfornewversion_link = htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes');
$lookfornewversion_message = '';
$lookfornewversion_addinfo = '';
$isnewerversion = 0;
}
@@ -137,19 +115,19 @@ if ($page == 'overview') {
$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 = str_replace_array('-1', $lng['customer']['unlimited'], $userinfo, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps tickets subdomains');
$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']) : '';
$cron_last_runs = getCronjobsLastRun();
$outstanding_tasks = getOutstandingTasks();
$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 = "";
for ($i = 0; $i < sizeof($meminfo); ++$i) {
for ($i = 0; $i < sizeof($meminfo); ++ $i) {
if (substr($meminfo[$i], 0, 3) === "Mem") {
$memory.= $meminfo[$i] . PHP_EOL;
$memory .= $meminfo[$i] . PHP_EOL;
}
}
@@ -159,7 +137,7 @@ if ($page == 'overview') {
} else {
$load = @file_get_contents('/proc/loadavg');
if (!$load) {
if (! $load) {
$load = $lng['admin']['noloadavailable'];
}
}
@@ -177,10 +155,7 @@ if ($page == 'overview') {
// First: With exec (let's hope it's enabled for the Froxlor - vHost)
$uptime_array = explode(" ", @file_get_contents("/proc/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
$seconds = round($uptime_array[0], 0);
$minutes = $seconds / 60;
@@ -198,79 +173,82 @@ if ($page == 'overview') {
$uptime = '';
}
eval("echo \"" . getTemplate("index/index") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/index") . "\";");
} elseif ($page == 'change_password') {
} elseif($page == 'change_password') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$old_password = \Froxlor\Validate\Validate::validate($_POST['old_password'], 'old password');
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$old_password = validate($_POST['old_password'], 'old password');
if (!validatePasswordLogin($userinfo,$old_password,TABLE_PANEL_ADMINS,'adminid')) {
standard_error('oldpasswordnotcorrect');
if (! \Froxlor\System\Crypt::validatePasswordLogin($userinfo, $old_password, TABLE_PANEL_ADMINS, 'adminid')) {
\Froxlor\UI\Response::standard_error('oldpasswordnotcorrect');
}
$new_password = validate($_POST['new_password'], 'new password');
$new_password_confirm = validate($_POST['new_password_confirm'], 'new password confirm');
$new_password = \Froxlor\Validate\Validate::validate($_POST['new_password'], 'new password');
$new_password_confirm = \Froxlor\Validate\Validate::validate($_POST['new_password_confirm'], 'new password confirm');
if ($old_password == '') {
standard_error(array('stringisempty', 'oldpassword'));
} elseif($new_password == '') {
standard_error(array('stringisempty', 'newpassword'));
} elseif($new_password_confirm == '') {
standard_error(array('stringisempty', 'newpasswordconfirm'));
} elseif($new_password != $new_password_confirm) {
standard_error('newpasswordconfirmerror');
} else {
$chgpwd_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_ADMINS . "`
SET `password`= :newpasswd
WHERE `adminid`= :adminid"
);
Database::pexecute($chgpwd_stmt, array(
'newpasswd' => makeCryptPassword($new_password),
'adminid' => (int)$userinfo['adminid']
\Froxlor\UI\Response::standard_error(array(
'stringisempty',
'oldpassword'
));
} elseif ($new_password == '') {
\Froxlor\UI\Response::standard_error(array(
'stringisempty',
'newpassword'
));
} elseif ($new_password_confirm == '') {
\Froxlor\UI\Response::standard_error(array(
'stringisempty',
'newpasswordconfirm'
));
} elseif ($new_password != $new_password_confirm) {
\Froxlor\UI\Response::standard_error('newpasswordconfirmerror');
} else {
try {
Admins::getLocal($userinfo, array(
'id' => $userinfo['adminid'],
'admin_password' => $new_password
))->update();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'changed password');
\Froxlor\UI\Response::redirectTo($filename, Array(
's' => $s
));
$log->logAction(ADM_ACTION, LOG_NOTICE, 'changed password');
redirectTo($filename, Array('s' => $s));
}
} else {
eval("echo \"" . getTemplate("index/change_password") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/change_password") . "\";");
}
} elseif ($page == 'change_language') {
} elseif($page == 'change_language') {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$def_language = validate($_POST['def_language'], 'default language');
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$def_language = \Froxlor\Validate\Validate::validate($_POST['def_language'], 'default language');
if (isset($languages[$def_language])) {
$lng_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_ADMINS . "`
SET `def_language`= :deflng
WHERE `adminid`= :adminid"
);
Database::pexecute($lng_stmt, array(
'deflng' => $def_language,
'adminid' => (int)$userinfo['adminid']
));
try {
Admins::getLocal($userinfo, array(
'id' => $userinfo['adminid'],
'def_language' => $def_language
))->update();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
// also update current session
$lng_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_SESSIONS . "`
SET `language`= :lng
WHERE `hash`= :hash"
);
WHERE `hash`= :hash");
Database::pexecute($lng_stmt, array(
'lng' => $def_language,
'hash' => $s
));
}
$log->logAction(ADM_ACTION, LOG_NOTICE, "changed his/her default language to '" . $def_language . "'");
redirectTo($filename, array('s' => $s));
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "changed his/her default language to '" . $def_language . "'");
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} else {
$language_options = '';
@@ -280,43 +258,39 @@ if ($page == 'overview') {
$default_lang = $userinfo['def_language'];
}
while (list($language_file, $language_name) = each($languages)) {
$language_options.= makeoption($language_name, $language_file, $default_lang, true);
foreach ($languages as $language_file => $language_name) {
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $default_lang, true);
}
eval("echo \"" . getTemplate("index/change_language") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/change_language") . "\";");
}
} elseif ($page == 'change_theme') {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$theme = validate($_POST['theme'], 'theme');
$theme_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_ADMINS . "`
SET `theme`= :theme
WHERE `adminid`= :adminid"
);
Database::pexecute($theme_stmt, array(
'theme' => $theme,
'adminid' => (int)$userinfo['adminid']
));
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$theme = \Froxlor\Validate\Validate::validate($_POST['theme'], 'theme');
try {
Admins::getLocal($userinfo, array(
'id' => $userinfo['adminid'],
'theme' => $theme
))->update();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
// also update current session
$theme_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_SESSIONS . "`
SET `theme`= :theme
WHERE `hash`= :hash"
);
WHERE `hash`= :hash");
Database::pexecute($theme_stmt, array(
'theme' => $theme,
'hash' => $s
));
$log->logAction(ADM_ACTION, LOG_NOTICE, "changed his/her theme to '" . $theme . "'");
redirectTo($filename, array('s' => $s));
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "changed his/her theme to '" . $theme . "'");
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} else {
$theme_options = '';
@@ -326,27 +300,22 @@ if ($page == 'overview') {
$default_theme = $userinfo['theme'];
}
$themes_avail = getThemes();
$themes_avail = \Froxlor\UI\Template::getThemes();
foreach ($themes_avail as $t => $d) {
$theme_options.= makeoption($d, $t, $default_theme, true);
$theme_options .= \Froxlor\UI\HTML::makeoption($d, $t, $default_theme, true);
}
eval("echo \"" . getTemplate("index/change_theme") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/change_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') {
// only show this if we really have an exception to report
if (isset($_GET['errorid'])
&& $_GET['errorid'] != ''
) {
if (isset($_GET['errorid']) && $_GET['errorid'] != '') {
$errid = $_GET['errorid'];
// read error file
$err_dir = makeCorrectDir(FROXLOR_INSTALL_DIR."/logs/");
$err_file = makeCorrectFile($err_dir."/".$errid."_sql-error.log");
$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)) {
@@ -356,28 +325,26 @@ if ($page == 'overview') {
$_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_INSTALL_DIR))),
'file' => str_replace("\n", "", substr($error[3], 5 + strlen(\Froxlor\Froxlor::getInstallDir()))),
'line' => str_replace("\n", "", substr($error[4], 5)),
'trace' => str_replace(FROXLOR_INSTALL_DIR, "", substr($error[5], 6))
'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 .= $_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 .= "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'
) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
// send mail and say thanks
$_mailerror = false;
try {
@@ -386,7 +353,7 @@ if ($page == 'overview') {
$mail->MsgHTML($mail_html);
$mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team');
$mail->Send();
} catch(phpmailerException $e) {
} catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
@@ -396,21 +363,30 @@ if ($page == 'overview') {
if ($_mailerror) {
// error when reporting an error...LOLFUQ
standard_error('send_report_error', $mailerr_msg);
\Froxlor\UI\Response::standard_error('send_report_error', $mailerr_msg);
}
// finally remove error from fs
@unlink($err_file);
redirectTo($filename, array('s' => $s));
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
}
// show a nice summary of the error-report
// before actually sending anything
eval("echo \"" . getTemplate("index/send_error_report") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/send_error_report") . "\";");
} else {
redirectTo($filename, array('s' => $s));
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
}
} else {
redirectTo($filename, array('s' => $s));
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
}
} elseif ($page == 'apikeys' && Settings::Get('api.enabled') == 1) {
require_once __DIR__ . '/api_keys.php';
} elseif ($page == '2fa' && Settings::Get('2fa.enabled') == 1) {
require_once __DIR__ . '/2fa.php';
}

View File

@@ -16,19 +16,20 @@
* @package Panel
*
*/
define('AREA', 'admin');
require './lib/init.php';
use Froxlor\Database\Database;
use Froxlor\Settings;
use Froxlor\Api\Commands\IpsAndPorts as IpsAndPorts;
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif(isset($_GET['id'])) {
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
if ($page == 'ipsandports'
|| $page == 'overview'
) {
if ($page == 'ipsandports' || $page == 'overview') {
// Do not display attributes that are not used by the current webserver
$websrv = Settings::Get('system.webserver');
$is_nginx = ($websrv == 'nginx');
@@ -37,12 +38,12 @@ if ($page == 'ipsandports'
if ($action == '') {
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_ipsandports");
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_ipsandports");
$fields = array(
'ip' => $lng['admin']['ipsandports']['ip'],
'port' => $lng['admin']['ipsandports']['port']
);
$paging = new paging($userinfo, TABLE_PANEL_IPSANDPORTS, $fields);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_IPSANDPORTS, $fields);
$ipsandports = '';
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` " . $paging->getSqlWhere(false) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
Database::pexecute($result_stmt);
@@ -57,381 +58,103 @@ if ($page == 'ipsandports'
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
if ($paging->checkDisplay($i)) {
$row = htmlentities_array($row);
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
if (filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$row['ip'] = '[' . $row['ip'] . ']';
}
eval("\$ipsandports.=\"" . getTemplate("ipsandports/ipsandports_ipandport") . "\";");
$count++;
eval("\$ipsandports.=\"" . \Froxlor\UI\Template::getTemplate("ipsandports/ipsandports_ipandport") . "\";");
$count ++;
}
$i++;
$i ++;
}
eval("echo \"" . getTemplate("ipsandports/ipsandports") . "\";");
} elseif($action == 'delete'
&& $id != 0
) {
$result_stmt = Database::prepare("SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = :id");
$result = Database::pexecute_first($result_stmt, array('id' => $id));
if (isset($result['id'])
&& $result['id'] == $id
) {
$result_checkdomain_stmt = Database::prepare("
SELECT `id_domain` as `id` FROM `" . TABLE_DOMAINTOIP . "` WHERE `id_ipandports` = :id"
);
$result_checkdomain = Database::pexecute_first($result_checkdomain_stmt, array('id' => $id));
if ($result_checkdomain['id'] == '') {
if (!in_array($result['id'], explode(',', Settings::Get('system.defaultip')))) {
$result_sameipotherport_stmt = Database::prepare("
SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
WHERE `ip` = :ip AND `id` <> :id"
);
$result_sameipotherport = Database::pexecute_first($result_sameipotherport_stmt, array('id' => $id, 'ip' => $result['ip']));
if (($result['ip'] != Settings::Get('system.ipaddress'))
|| ($result['ip'] == Settings::Get('system.ipaddress')
&& $result_sameipotherport['id'] != '')
) {
$result_stmt = Database::prepare("
SELECT `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
WHERE `id` = :id"
);
$result = Database::pexecute_first($result_stmt, array('id' => $id));
if ($result['ip'] != '') {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$del_stmt = Database::prepare("
DELETE FROM `" . TABLE_PANEL_IPSANDPORTS . "`
WHERE `id` = :id"
);
Database::pexecute($del_stmt, array('id' => $id));
// also, remove connections to domains (multi-stack)
$del_stmt = Database::prepare("
DELETE FROM `".TABLE_DOMAINTOIP."` WHERE `id_ipandports` = :id"
);
Database::pexecute($del_stmt, array('id' => $id));
$log->logAction(ADM_ACTION, LOG_WARNING, "deleted IP/port '" . $result['ip'] . ":" . $result['port'] . "'");
inserttask('1');
// Using nameserver, insert a task which rebuilds the server config
inserttask('4');
redirectTo($filename, array('page' => $page, 's' => $s));
} else {
ask_yesno('admin_ip_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['ip'] . ':' . $result['port']);
}
}
} else {
standard_error('cantdeletesystemip');
}
} else {
standard_error('cantdeletedefaultip');
}
} else {
standard_error('ipstillhasdomains');
}
eval("echo \"" . \Froxlor\UI\Template::getTemplate("ipsandports/ipsandports") . "\";");
} elseif ($action == 'delete' && $id != 0) {
try {
$json_result = IpsAndPorts::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
} elseif($action == 'add') {
if (isset($result['id']) && $result['id'] == $id) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$ip = validate_ip($_POST['ip']);
$port = validate($_POST['port'], 'port', '/^(([1-9])|([1-9][0-9])|([1-9][0-9][0-9])|([1-9][0-9][0-9][0-9])|([1-5][0-9][0-9][0-9][0-9])|(6[0-4][0-9][0-9][0-9])|(65[0-4][0-9][0-9])|(655[0-2][0-9])|(6553[0-5]))$/Di', array('stringisempty', 'myport'));
$listen_statement = isset($_POST['listen_statement']) ? 1 : 0;
$namevirtualhost_statement = isset($_POST['namevirtualhost_statement']) ? 1 : 0;
$vhostcontainer = isset($_POST['vhostcontainer']) ? 1 : 0;
$specialsettings = validate(str_replace("\r\n", "\n", $_POST['specialsettings']), 'specialsettings', '/^[^\0]*$/');
$vhostcontainer_servername_statement = isset($_POST['vhostcontainer_servername_statement']) ? 1 : 0;
$default_vhostconf_domain = validate(str_replace("\r\n", "\n", $_POST['default_vhostconf_domain']), 'default_vhostconf_domain', '/^[^\0]*$/');
$docroot = validate($_POST['docroot'], 'docroot');
if ((int)Settings::Get('system.use_ssl') == 1) {
$ssl = isset($_POST['ssl']) ? intval($_POST['ssl']) : 0;
$ssl_cert_file = validate($_POST['ssl_cert_file'], 'ssl_cert_file');
$ssl_key_file = validate($_POST['ssl_key_file'], 'ssl_key_file');
$ssl_ca_file = validate($_POST['ssl_ca_file'], 'ssl_ca_file');
$ssl_cert_chainfile = validate($_POST['ssl_cert_chainfile'], 'ssl_cert_chainfile');
} else {
$ssl = 0;
$ssl_cert_file = '';
$ssl_key_file = '';
$ssl_ca_file = '';
$ssl_cert_chainfile = '';
}
if ($listen_statement != '1') {
$listen_statement = '0';
}
if ($namevirtualhost_statement != '1') {
$namevirtualhost_statement = '0';
}
if ($vhostcontainer != '1') {
$vhostcontainer = '0';
}
if ($vhostcontainer_servername_statement != '1') {
$vhostcontainer_servername_statement = '0';
}
if ($ssl != '1') {
$ssl = '0';
}
if ($ssl_cert_file != '') {
$ssl_cert_file = makeCorrectFile($ssl_cert_file);
}
if ($ssl_key_file != '') {
$ssl_key_file = makeCorrectFile($ssl_key_file);
}
if ($ssl_ca_file != '') {
$ssl_ca_file = makeCorrectFile($ssl_ca_file);
}
if ($ssl_cert_chainfile != '') {
$ssl_cert_chainfile = makeCorrectFile($ssl_cert_chainfile);
}
if (strlen(trim($docroot)) > 0) {
$docroot = makeCorrectDir($docroot);
} else {
$docroot = '';
}
$result_checkfordouble_stmt = Database::prepare("
SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
WHERE `ip` = :ip AND `port` = :port"
);
$result_checkfordouble = Database::pexecute_first($result_checkfordouble_stmt, array('ip' => $ip, 'port' => $port));
if ($result_checkfordouble['id'] != '') {
standard_error('myipnotdouble');
} else {
$ins_stmt = Database::prepare("
INSERT INTO `" . TABLE_PANEL_IPSANDPORTS . "`
SET
`ip` = :ip, `port` = :port, `listen_statement` = :ls,
`namevirtualhost_statement` = :nvhs, `vhostcontainer` = :vhc,
`vhostcontainer_servername_statement` = :vhcss,
`specialsettings` = :ss, `ssl` = :ssl,
`ssl_cert_file` = :ssl_cert, `ssl_key_file` = :ssl_key,
`ssl_ca_file` = :ssl_ca, `ssl_cert_chainfile` = :ssl_chain,
`default_vhostconf_domain` = :dvhd, `docroot` = :docroot;
");
$ins_data = array(
'ip' => $ip,
'port' => $port,
'ls' => $listen_statement,
'nvhs' => $namevirtualhost_statement,
'vhc' => $vhostcontainer,
'vhcss' => $vhostcontainer_servername_statement,
'ss' => $specialsettings,
'ssl' => $ssl,
'ssl_cert' => $ssl_cert_file,
'ssl_key' => $ssl_key_file,
'ssl_ca' => $ssl_ca_file,
'ssl_chain' => $ssl_cert_chainfile,
'dvhd' => $default_vhostconf_domain,
'docroot' => $docroot
);
Database::pexecute($ins_stmt, $ins_data);
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$ip = '[' . $ip . ']';
try {
IpsAndPorts::getLocal($userinfo, array(
'id' => $id
))->delete();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$log->logAction(ADM_ACTION, LOG_WARNING, "added IP/port '" . $ip . ":" . $port . "'");
inserttask('1');
// Using nameserver, insert a task which rebuilds the server config
inserttask('4');
redirectTo($filename, Array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
\Froxlor\UI\HTML::askYesNo('admin_ip_reallydelete', $filename, array(
'id' => $id,
'page' => $page,
'action' => $action
), $result['ip'] . ':' . $result['port']);
}
}
} elseif ($action == 'add') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
IpsAndPorts::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
$ipsandports_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/ipsandports/formfield.ipsandports_add.php';
$ipsandports_add_form = htmlform::genHTMLForm($ipsandports_add_data);
$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'];
$image = $ipsandports_add_data['ipsandports_add']['image'];
eval("echo \"" . getTemplate("ipsandports/ipsandports_add") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("ipsandports/ipsandports_add") . "\";");
}
} elseif($action == 'edit'
&& $id != 0
) {
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = :id"
);
$result = Database::pexecute_first($result_stmt, array('id' => $id));
} elseif ($action == 'edit' && $id != 0) {
try {
$json_result = IpsAndPorts::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if ($result['ip'] != '') {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$ip = validate_ip($_POST['ip']);
$port = validate($_POST['port'], 'port', '/^(([1-9])|([1-9][0-9])|([1-9][0-9][0-9])|([1-9][0-9][0-9][0-9])|([1-5][0-9][0-9][0-9][0-9])|(6[0-4][0-9][0-9][0-9])|(65[0-4][0-9][0-9])|(655[0-2][0-9])|(6553[0-5]))$/Di', array('stringisempty', 'myport'));
$listen_statement = isset($_POST['listen_statement']) ? 1 : 0;
$namevirtualhost_statement = isset($_POST['namevirtualhost_statement']) ? 1 : 0;
$vhostcontainer = isset($_POST['vhostcontainer']) ? 1 : 0;
$specialsettings = validate(str_replace("\r\n", "\n", $_POST['specialsettings']), 'specialsettings', '/^[^\0]*$/');
$vhostcontainer_servername_statement = isset($_POST['vhostcontainer_servername_statement']) ? 1 : 0;
$default_vhostconf_domain = validate(str_replace("\r\n", "\n", $_POST['default_vhostconf_domain']), 'default_vhostconf_domain', '/^[^\0]*$/');
$docroot = validate($_POST['docroot'], 'docroot');
$result_checkfordouble_stmt = Database::prepare("
SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
WHERE `ip` = :ip AND `port` = :port"
);
$result_checkfordouble = Database::pexecute_first($result_checkfordouble_stmt, array('ip' => $ip, 'port' => $port));
$result_sameipotherport_stmt = Database::prepare("
SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
WHERE `ip` = :ip AND `id` <> :id"
);
$result_sameipotherport = Database::pexecute_first($result_sameipotherport_stmt, array('ip' => $ip, 'id' => $id));
if ((int)Settings::Get('system.use_ssl') == 1
&& isset($_POST['ssl'])
&& $_POST['ssl'] != 0
) {
$ssl = 1;
$ssl_cert_file = validate($_POST['ssl_cert_file'], 'ssl_cert_file');
$ssl_key_file = validate($_POST['ssl_key_file'], 'ssl_key_file');
$ssl_ca_file = validate($_POST['ssl_ca_file'], 'ssl_ca_file');
$ssl_cert_chainfile = validate($_POST['ssl_cert_chainfile'], 'ssl_cert_chainfile');
} else {
$ssl = 0;
$ssl_cert_file = '';
$ssl_key_file = '';
$ssl_ca_file = '';
$ssl_cert_chainfile = '';
if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
IpsAndPorts::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
if ($listen_statement != '1') {
$listen_statement = '0';
}
if ($namevirtualhost_statement != '1') {
$namevirtualhost_statement = '0';
}
if ($vhostcontainer != '1') {
$vhostcontainer = '0';
}
if ($vhostcontainer_servername_statement != '1') {
$vhostcontainer_servername_statement = '0';
}
if ($ssl != '1') {
$ssl = '0';
}
if ($ssl_cert_file != '') {
$ssl_cert_file = makeCorrectFile($ssl_cert_file);
}
if ($ssl_key_file != '') {
$ssl_key_file = makeCorrectFile($ssl_key_file);
}
if ($ssl_ca_file != '') {
$ssl_ca_file = makeCorrectFile($ssl_ca_file);
}
if ($ssl_cert_chainfile != '') {
$ssl_cert_chainfile = makeCorrectFile($ssl_cert_chainfile);
}
if (strlen(trim($docroot)) > 0) {
$docroot = makeCorrectDir($docroot);
} else {
$docroot = '';
}
if ($result['ip'] != $ip
&& $result['ip'] == Settings::Get('system.ipaddress')
&& $result_sameipotherport['id'] == ''
) {
standard_error('cantchangesystemip');
} elseif($result_checkfordouble['id'] != ''
&& $result_checkfordouble['id'] != $id
) {
standard_error('myipnotdouble');
} else {
$upd_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_IPSANDPORTS . "`
SET
`ip` = :ip, `port` = :port, `listen_statement` = :ls,
`namevirtualhost_statement` = :nvhs, `vhostcontainer` = :vhc,
`vhostcontainer_servername_statement` = :vhcss,
`specialsettings` = :ss, `ssl` = :ssl,
`ssl_cert_file` = :ssl_cert, `ssl_key_file` = :ssl_key,
`ssl_ca_file` = :ssl_ca, `ssl_cert_chainfile` = :ssl_chain,
`default_vhostconf_domain` = :dvhd, `docroot` = :docroot
WHERE `id` = :id;
");
$upd_data = array(
'ip' => $ip,
'port' => $port,
'ls' => $listen_statement,
'nvhs' => $namevirtualhost_statement,
'vhc' => $vhostcontainer,
'vhcss' => $vhostcontainer_servername_statement,
'ss' => $specialsettings,
'ssl' => $ssl,
'ssl_cert' => $ssl_cert_file,
'ssl_key' => $ssl_key_file,
'ssl_ca' => $ssl_ca_file,
'ssl_chain' => $ssl_cert_chainfile,
'dvhd' => $default_vhostconf_domain,
'docroot' => $docroot,
'id' => $id
);
Database::pexecute($upd_stmt, $upd_data);
$log->logAction(ADM_ACTION, LOG_WARNING, "changed IP/port from '" . $result['ip'] . ":" . $result['port'] . "' to '" . $ip . ":" . $port . "'");
inserttask('1');
// Using nameserver, insert a task which rebuilds the server config
inserttask('4');
redirectTo($filename, Array('page' => $page, 's' => $s));
}
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
$result = htmlentities_array($result);
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
$ipsandports_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/ipsandports/formfield.ipsandports_edit.php';
$ipsandports_edit_form = htmlform::genHTMLForm($ipsandports_edit_data);
$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'];
$image = $ipsandports_edit_data['ipsandports_edit']['image'];
eval("echo \"" . getTemplate("ipsandports/ipsandports_edit") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("ipsandports/ipsandports_edit") . "\";");
}
}
}

View File

@@ -16,13 +16,12 @@
* @package Panel
*
*/
define('AREA', 'admin');
require './lib/init.php';
if ($page == 'log'
&& $userinfo['change_serversettings'] == '1'
) {
use Froxlor\Database\Database;
if ($page == 'log' && $userinfo['change_serversettings'] == '1') {
if ($action == '') {
$fields = array(
'date' => $lng['logger']['date'],
@@ -30,11 +29,11 @@ if ($page == 'log'
'user' => $lng['logger']['user'],
'text' => $lng['logger']['action']
);
$paging = new paging($userinfo, TABLE_PANEL_LOG, $fields, null, null, 0, 'desc');
$result_stmt = Database::query('
SELECT * FROM `' . TABLE_PANEL_LOG . '` ' . $paging->getSqlWhere(false) . ' ' . $paging->getSqlOrderBy() . ' ' . $paging->getSqlLimit()
);
$logs_count = Database::num_rows();
$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);
@@ -44,17 +43,13 @@ if ($page == 'log'
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
if (!isset($clog[$row['action']])
|| !is_array($clog[$row['action']])
) {
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'
) {
if ($paging->sortfield == 'date' && $paging->sortorder == 'desc') {
krsort($clog);
} else {
ksort($clog);
@@ -67,66 +62,70 @@ if ($page == 'log'
foreach ($clog as $action => $logrows) {
$_action = 0;
foreach ($logrows as $row) {
if ($paging->checkDisplay($i)) {
$row = htmlentities_array($row);
$row['date'] = date("d.m.y H:i:s", $row['date']);
// if ($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 USR_ACTION:
$_action = $lng['admin']['customer'];
break;
case RES_ACTION:
$_action = $lng['logger']['reseller'];
break;
case ADM_ACTION:
$_action = $lng['logger']['admin'];
break;
case CRON_ACTION:
$_action = $lng['logger']['cron'];
break;
case LOGIN_ACTION:
$_action = $lng['logger']['login'];
break;
case LOG_ERROR:
$_action = $lng['logger']['intern'];
break;
default:
$_action = $lng['logger']['unknown'];
break;
}
$row['action'] = $_action;
eval("\$log.=\"" . getTemplate('logger/logger_action') . "\";");
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;
}
$log_count++;
$row['type'] = getLogLevelDesc($row['type']);
eval("\$log.=\"" . getTemplate('logger/logger_log') . "\";");
$count++;
$_action = $action;
$row['action'] = $_action;
eval("\$log.=\"" . \Froxlor\UI\Template::getTemplate('logger/logger_action') . "\";");
}
$i++;
$log_count ++;
$row['type'] = \Froxlor\FroxlorLogger::getInstanceOf()->getLogLevelDesc($row['type']);
eval("\$log.=\"" . \Froxlor\UI\Template::getTemplate('logger/logger_log') . "\";");
$count ++;
$_action = $action;
// }
$i ++;
}
$i++;
$i ++;
}
eval("echo \"" . getTemplate('logger/logger') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('logger/logger') . "\";");
} elseif ($action == 'truncate') {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$truncatedate = time() - (60 * 10);
$trunc_stmt = Database::prepare("
DELETE FROM `" . TABLE_PANEL_LOG . "` WHERE `date` < :trunc"
);
Database::pexecute($trunc_stmt, array('trunc' => $truncatedate));
$log->logAction(ADM_ACTION, LOG_WARNING, 'truncated the system-log (mysql)');
redirectTo($filename, array('page' => $page, 's' => $s));
DELETE FROM `" . TABLE_PANEL_LOG . "` WHERE `date` < :trunc");
Database::pexecute($trunc_stmt, array(
'trunc' => $truncatedate
));
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, 'truncated the system-log (mysql)');
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
ask_yesno('logger_reallytruncate', $filename, array('page' => $page, 'action' => $action), TABLE_PANEL_LOG);
\Froxlor\UI\HTML::askYesNo('logger_reallytruncate', $filename, array(
'page' => $page,
'action' => $action
), TABLE_PANEL_LOG);
}
}
}

View File

@@ -16,10 +16,11 @@
* @package Panel
*
*/
define('AREA', 'admin');
require './lib/init.php';
use Froxlor\Database\Database;
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif (isset($_GET['id'])) {
@@ -28,36 +29,33 @@ if (isset($_POST['id'])) {
if ($page == 'message') {
if ($action == '') {
$log->logAction(ADM_ACTION, LOG_NOTICE, 'viewed panel_message');
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'viewed panel_message');
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
if ($_POST['receipient'] == 0
&& $userinfo['customers_see_all'] == '1'
) {
$log->logAction(ADM_ACTION, LOG_NOTICE, 'sending messages to admins');
if (isset($_POST['send']) && $_POST['send'] == 'send') {
if ($_POST['receipient'] == 0 && $userinfo['customers_see_all'] == '1') {
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'sending messages to admins');
$result = Database::query('SELECT `name`, `email` FROM `' . TABLE_PANEL_ADMINS . "`");
} elseif ($_POST['receipient'] == 1) {
if ($userinfo['customers_see_all'] == '1') {
$log->logAction(ADM_ACTION, LOG_NOTICE, 'sending messages to ALL customers');
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'sending messages to ALL customers');
$result = Database::query('SELECT `firstname`, `name`, `company`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "`");
} else {
$log->logAction(ADM_ACTION, LOG_NOTICE, 'sending messages to customers');
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'sending messages to customers');
$result = Database::prepare('
SELECT `firstname`, `name`, `company`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "`
WHERE `adminid` = :adminid"
);
Database::pexecute($result, array('adminid' => $userinfo['adminid']));
WHERE `adminid` = :adminid");
Database::pexecute($result, array(
'adminid' => $userinfo['adminid']
));
}
} else {
standard_error('noreceipientsgiven');
\Froxlor\UI\Response::standard_error('noreceipientsgiven');
}
$subject = $_POST['subject'];
$message = wordwrap($_POST['message'], 70);
if (!empty($message)) {
if (! empty($message)) {
$mailcounter = 0;
$mail->Body = $message;
$mail->Subject = $subject;
@@ -66,28 +64,37 @@ if ($page == 'message') {
$row['firstname'] = isset($row['firstname']) ? $row['firstname'] : '';
$row['company'] = isset($row['company']) ? $row['company'] : '';
$mail->AddAddress($row['email'], getCorrectUserSalutation(array('firstname' => $row['firstname'], 'name' => $row['name'], 'company' => $row['company'])));
$mail->AddAddress($row['email'], \Froxlor\User::getCorrectUserSalutation(array(
'firstname' => $row['firstname'],
'name' => $row['name'],
'company' => $row['company']
)));
$mail->From = $userinfo['email'];
$mail->FromName = (isset($userinfo['firstname']) ? $userinfo['firstname'] . ' ' : '') . $userinfo['name'];
if (!$mail->Send()) {
if (! $mail->Send()) {
if ($mail->ErrorInfo != '') {
$mailerr_msg = $mail->ErrorInfo;
} else {
$mailerr_msg = $row['email'];
}
$log->logAction(ADM_ACTION, LOG_ERR, 'Error sending mail: ' . $mailerr_msg);
standard_error('errorsendingmail', $row['email']);
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_ERR, 'Error sending mail: ' . $mailerr_msg);
\Froxlor\UI\Response::standard_error('errorsendingmail', $row['email']);
}
$mailcounter++;
$mailcounter ++;
$mail->ClearAddresses();
}
redirectTo($filename, array('page' => $page, 's' => $s, 'action' => 'showsuccess', 'sentitems' => $mailcounter));
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s,
'action' => 'showsuccess',
'sentitems' => $mailcounter
));
} else {
standard_error('nomessagetosend');
\Froxlor\UI\Response::standard_error('nomessagetosend');
}
}
}
@@ -95,14 +102,13 @@ if ($page == 'message') {
if ($action == 'showsuccess') {
$success = 1;
$sentitems = isset($_GET['sentitems']) ? (int)$_GET['sentitems'] : 0;
$sentitems = isset($_GET['sentitems']) ? (int) $_GET['sentitems'] : 0;
if ($sentitems == 0) {
$successmessage = $lng['message']['noreceipients'];
} else {
$successmessage = str_replace('%s', $sentitems, $lng['message']['success']);
}
} else {
$success = 0;
$sentitems = 0;
@@ -113,9 +119,9 @@ if ($page == 'message') {
$receipients = '';
if ($userinfo['customers_see_all'] == '1') {
$receipients.= makeoption($lng['panel']['reseller'], 0);
$receipients .= \Froxlor\UI\HTML::makeoption($lng['panel']['reseller'], 0);
}
$receipients .= makeoption($lng['panel']['customer'], 1);
eval("echo \"" . getTemplate('message/message') . "\";");
$receipients .= \Froxlor\UI\HTML::makeoption($lng['panel']['customer'], 1);
eval("echo \"" . \Froxlor\UI\Template::getTemplate('message/message') . "\";");
}

View File

@@ -17,142 +17,140 @@
* Based on https://github.com/amnuts/opcache-gui
*
*/
define('AREA', 'admin');
require './lib/init.php';
if ($action == 'reset' &&
function_exists('opcache_reset') &&
$userinfo['change_serversettings'] == '1'
) {
opcache_reset();
$log->logAction(ADM_ACTION, LOG_INFO, "reseted OPcache");
header('Location: ' . $linker->getLink(array('section' => 'opcacheinfo', 'page' => 'showinfo')));
exit();
if ($action == 'reset' && function_exists('opcache_reset') && $userinfo['change_serversettings'] == '1') {
opcache_reset();
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "reseted OPcache");
header('Location: ' . $linker->getLink(array(
'section' => 'opcacheinfo',
'page' => 'showinfo'
)));
exit();
}
if (!function_exists('opcache_get_configuration')
) {
standard_error($lng['error']['no_opcacheinfo']);
if (! function_exists('opcache_get_configuration')) {
\Froxlor\UI\Response::standard_error($lng['error']['no_opcacheinfo']);
}
if ($page == 'showinfo'
) {
$opcache_info = opcache_get_configuration();
$opcache_status = opcache_get_status(false);
$time = time();
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed OPcache info");
$runtimelines = '';
if (isset($opcache_info['directives']) && is_array($opcache_info['directives'])) {
foreach ($opcache_info['directives'] as $name => $value) {
$linkname= str_replace('_', '-', $name);
if ($name=='opcache.optimization_level' && is_integer($value)) {
$value='0x'.dechex($value);
}
if ($name=='opcache.memory_consumption' && is_integer($value) && $value%(1024*1024)==0) {
$value=$value/(1024*1024);
}
if ($value===null || $value==='') {
$value=$lng['opcacheinfo']['novalue'];
}
if ($value===true) {
$value=$lng['opcacheinfo']['true'];
}
if ($value===false) {
$value=$lng['opcacheinfo']['false'];
}
if (is_integer($value)) {
$value=number_format($value,0,'.',' ');
}
$name=str_replace('_', ' ', $name);
eval("\$runtimelines.=\"" . getTemplate("settings/opcacheinfo/runtime_line") . "\";");
}
}
$cachehits=@$opcache_status['opcache_statistics']['hits'] ?: 0;
$cachemiss=@$opcache_status['opcache_statistics']['misses'] ?: 0;
$blacklistmiss=@$opcache_status['opcache_statistics']['blacklist_misses'] ?: 0;
$cachetotal=$cachehits+$cachemiss+$blacklistmiss;
$general=array(
'version' => (isset($opcache_info['version']['opcache_product_name']) ? $opcache_info['version']['opcache_product_name'].' ' : '').$opcache_info['version']['version'],
'phpversion' => phpversion(),
'start_time' => @$opcache_status['opcache_statistics']['start_time'] ? date('Y-m-d H:i:s',$opcache_status['opcache_statistics']['start_time']) : '',
'last_restart_time' => @$opcache_status['opcache_statistics']['last_restart_time'] ? date('Y-m-d H:i:s',$opcache_status['opcache_statistics']['last_restart_time']) : $lng['opcacheinfo']['never'],
'oom_restarts' => number_format(@$opcache_status['opcache_statistics']['oom_restarts'] ?: 0,0,'.',' '),
'hash_restarts' => number_format(@$opcache_status['opcache_statistics']['hash_restarts'] ?: 0,0,'.',' '),
'manual_restarts' => number_format(@$opcache_status['opcache_statistics']['manual_restarts'] ?: 0,0,'.',' '),
'status' => (@$opcache_status['restart_in_progress'] ? $lng['opcacheinfo']['restartinprogress'] :
(@$opcache_status['restart_pending'] ? $lng['opcacheinfo']['restartpending'] :
(@$opcache_status['cache_full'] ? $lng['opcacheinfo']['cachefull'] :
(@$opcache_status['opcache_enabled'] ? $lng['opcacheinfo']['enabled'] : $lng['opcacheinfo']['novalue'])))),
'cachedscripts' => number_format(@$opcache_status['opcache_statistics']['num_cached_scripts'] ?: 0,0,'.',' '),
'cachehits' => number_format($cachehits,0,'.',' ') . ($cachetotal>0 ? sprintf(" (%.1f %%)", $cachehits/($cachetotal)*100) : ''),
'cachemiss' => number_format($cachemiss,0,'.',' ') . ($cachetotal>0 ? sprintf(" (%.1f %%)", $cachemiss/($cachetotal)*100) : ''),
'blacklistmiss' => number_format($blacklistmiss,0,'.',' ') . ($cachetotal>0 ? sprintf(" (%.1f %%)", $blacklistmiss/($cachetotal)*100) : ''),
);
$usedmem=@$opcache_status['memory_usage']['used_memory'] ?: 0;
$usedmemstr=bsize($usedmem);
$freemem=@$opcache_status['memory_usage']['free_memory'] ?: 0;
$freememstr=bsize($freemem);
$totalmem=$usedmem+$freemem;
$wastedmem=@$opcache_status['memory_usage']['wasted_memory'] ?: 0;
$wastedmemstr=bsize($wastedmem);
if ($totalmem) {
$memory=array(
'total' => bsize($totalmem),
'used' => $usedmemstr . ($totalmem>0 ? sprintf(" (%.1f %%)", $usedmem/($totalmem)*100) : ''),
'free' => $freememstr . ($totalmem>0 ? sprintf(" (%.1f %%)", $freemem/($totalmem)*100) : ''),
'wasted' => $wastedmemstr . ($totalmem>0 ? sprintf(" (%.1f %%)", $wastedmem/($totalmem)*100) : ''),
);
}
if (isset($opcache_status['interned_strings_usage'])) {
$usedstring=@$opcache_status['interned_strings_usage']['used_memory'] ?: 0;
$usedstringstr=bsize($usedstring);
$freestring=@$opcache_status['interned_strings_usage']['free_memory'] ?: 0;
$freestringstr=bsize($freestring);
$totalstring=$usedstring+$freestring;
$stringbuffer=array(
'total' => bsize($totalstring),
'used' => $usedstringstr . ($totalstring>0 ? sprintf(" (%.1f %%)", $usedstring/$totalstring*100) : ''),
'free' => $freestringstr . ($totalstring>0 ? sprintf(" (%.1f %%)", $freestring/$totalstring*100) : ''),
'strcount' => number_format(@$opcache_status['interned_strings_usage']['number_of_strings'] ?: 0,0,'.',' '),
);
}
if ($page == 'showinfo') {
$usedkey=@$opcache_status['opcache_statistics']['num_cached_keys'] ?: 0;
$usedkeystr=number_format($usedkey,0,'.',' ');
$totalkey=@$opcache_status['opcache_statistics']['max_cached_keys'] ?: 0;
$wastedkey=$usedkey - (@$opcache_status['opcache_statistics']['num_cached_scripts'] ?: 0);
if (isset($opcache_status['opcache_statistics'])) {
$keystat=array(
'total' => number_format($totalkey,0,'.',' '),
'used' => $usedkeystr . ($totalkey>0 ? sprintf(" (%.1f %%)", $usedkey/($totalkey)*100) : ''),
'wasted' => number_format($wastedkey,0,'.',' ') . ($totalkey>0 ? sprintf(" (%.1f %%)", $wastedkey/($totalkey)*100) : ''),
);
}
$blacklistlines = '';
if (isset($opcache_info['blacklist']) && is_array($opcache_info['blacklist'])) {
foreach ($opcache_info['blacklist'] as $value) {
eval("\$blacklistlines.=\"" . getTemplate("settings/opcacheinfo/blacklist_line") . "\";");
}
}
eval("echo \"" . getTemplate("settings/opcacheinfo/showinfo") . "\";");
$opcache_info = opcache_get_configuration();
$opcache_status = opcache_get_status(false);
$time = time();
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed OPcache info");
$runtimelines = '';
if (isset($opcache_info['directives']) && is_array($opcache_info['directives'])) {
foreach ($opcache_info['directives'] as $name => $value) {
$linkname = str_replace('_', '-', $name);
if ($name == 'opcache.optimization_level' && is_integer($value)) {
$value = '0x' . dechex($value);
}
if ($name == 'opcache.memory_consumption' && is_integer($value) && $value % (1024 * 1024) == 0) {
$value = $value / (1024 * 1024);
}
if ($value === null || $value === '') {
$value = $lng['opcacheinfo']['novalue'];
}
if ($value === true) {
$value = $lng['opcacheinfo']['true'];
}
if ($value === false) {
$value = $lng['opcacheinfo']['false'];
}
if (is_integer($value)) {
$value = number_format($value, 0, '.', ' ');
}
$name = str_replace('_', ' ', $name);
eval("\$runtimelines.=\"" . \Froxlor\UI\Template::getTemplate("settings/opcacheinfo/runtime_line") . "\";");
}
}
$cachehits = @$opcache_status['opcache_statistics']['hits'] ?: 0;
$cachemiss = @$opcache_status['opcache_statistics']['misses'] ?: 0;
$blacklistmiss = @$opcache_status['opcache_statistics']['blacklist_misses'] ?: 0;
$cachetotal = $cachehits + $cachemiss + $blacklistmiss;
$general = array(
'version' => (isset($opcache_info['version']['opcache_product_name']) ? $opcache_info['version']['opcache_product_name'] . ' ' : '') . $opcache_info['version']['version'],
'phpversion' => phpversion(),
'start_time' => @$opcache_status['opcache_statistics']['start_time'] ? date('Y-m-d H:i:s', $opcache_status['opcache_statistics']['start_time']) : '',
'last_restart_time' => @$opcache_status['opcache_statistics']['last_restart_time'] ? date('Y-m-d H:i:s', $opcache_status['opcache_statistics']['last_restart_time']) : $lng['opcacheinfo']['never'],
'oom_restarts' => number_format(@$opcache_status['opcache_statistics']['oom_restarts'] ?: 0, 0, '.', ' '),
'hash_restarts' => number_format(@$opcache_status['opcache_statistics']['hash_restarts'] ?: 0, 0, '.', ' '),
'manual_restarts' => number_format(@$opcache_status['opcache_statistics']['manual_restarts'] ?: 0, 0, '.', ' '),
'status' => (@$opcache_status['restart_in_progress'] ? $lng['opcacheinfo']['restartinprogress'] : (@$opcache_status['restart_pending'] ? $lng['opcacheinfo']['restartpending'] : (@$opcache_status['cache_full'] ? $lng['opcacheinfo']['cachefull'] : (@$opcache_status['opcache_enabled'] ? $lng['opcacheinfo']['enabled'] : $lng['opcacheinfo']['novalue'])))),
'cachedscripts' => number_format(@$opcache_status['opcache_statistics']['num_cached_scripts'] ?: 0, 0, '.', ' '),
'cachehits' => number_format($cachehits, 0, '.', ' ') . ($cachetotal > 0 ? sprintf(" (%.1f %%)", $cachehits / ($cachetotal) * 100) : ''),
'cachemiss' => number_format($cachemiss, 0, '.', ' ') . ($cachetotal > 0 ? sprintf(" (%.1f %%)", $cachemiss / ($cachetotal) * 100) : ''),
'blacklistmiss' => number_format($blacklistmiss, 0, '.', ' ') . ($cachetotal > 0 ? sprintf(" (%.1f %%)", $blacklistmiss / ($cachetotal) * 100) : '')
);
$usedmem = @$opcache_status['memory_usage']['used_memory'] ?: 0;
$usedmemstr = bsize($usedmem);
$freemem = @$opcache_status['memory_usage']['free_memory'] ?: 0;
$freememstr = bsize($freemem);
$totalmem = $usedmem + $freemem;
$wastedmem = @$opcache_status['memory_usage']['wasted_memory'] ?: 0;
$wastedmemstr = bsize($wastedmem);
if ($totalmem) {
$memory = array(
'total' => bsize($totalmem),
'used' => $usedmemstr . ($totalmem > 0 ? sprintf(" (%.1f %%)", $usedmem / ($totalmem) * 100) : ''),
'free' => $freememstr . ($totalmem > 0 ? sprintf(" (%.1f %%)", $freemem / ($totalmem) * 100) : ''),
'wasted' => $wastedmemstr . ($totalmem > 0 ? sprintf(" (%.1f %%)", $wastedmem / ($totalmem) * 100) : '')
);
}
if (isset($opcache_status['interned_strings_usage'])) {
$usedstring = @$opcache_status['interned_strings_usage']['used_memory'] ?: 0;
$usedstringstr = bsize($usedstring);
$freestring = @$opcache_status['interned_strings_usage']['free_memory'] ?: 0;
$freestringstr = bsize($freestring);
$totalstring = $usedstring + $freestring;
$stringbuffer = array(
'total' => bsize($totalstring),
'used' => $usedstringstr . ($totalstring > 0 ? sprintf(" (%.1f %%)", $usedstring / $totalstring * 100) : ''),
'free' => $freestringstr . ($totalstring > 0 ? sprintf(" (%.1f %%)", $freestring / $totalstring * 100) : ''),
'strcount' => number_format(@$opcache_status['interned_strings_usage']['number_of_strings'] ?: 0, 0, '.', ' ')
);
}
$usedkey = @$opcache_status['opcache_statistics']['num_cached_keys'] ?: 0;
$usedkeystr = number_format($usedkey, 0, '.', ' ');
$totalkey = @$opcache_status['opcache_statistics']['max_cached_keys'] ?: 0;
$wastedkey = $usedkey - (@$opcache_status['opcache_statistics']['num_cached_scripts'] ?: 0);
if (isset($opcache_status['opcache_statistics'])) {
$keystat = array(
'total' => number_format($totalkey, 0, '.', ' '),
'used' => $usedkeystr . ($totalkey > 0 ? sprintf(" (%.1f %%)", $usedkey / ($totalkey) * 100) : ''),
'wasted' => number_format($wastedkey, 0, '.', ' ') . ($totalkey > 0 ? sprintf(" (%.1f %%)", $wastedkey / ($totalkey) * 100) : '')
);
}
$blacklistlines = '';
if (isset($opcache_info['blacklist']) && is_array($opcache_info['blacklist'])) {
foreach ($opcache_info['blacklist'] as $value) {
eval("\$blacklistlines.=\"" . \Froxlor\UI\Template::getTemplate("settings/opcacheinfo/blacklist_line") . "\";");
}
}
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/opcacheinfo/showinfo") . "\";");
}
function bsize($s) {
foreach (array('', 'K', 'M', 'G') as $i => $k) {
if ($s < 1024)
break;
$s/=1024;
}
return sprintf("%5.1f %sBytes", $s, $k);
function bsize($s)
{
foreach (array(
'',
'K',
'M',
'G'
) as $i => $k) {
if ($s < 1024)
break;
$s /= 1024;
}
return sprintf("%5.1f %sBytes", $s, $k);
}

View File

@@ -16,10 +16,13 @@
* @package Panel
*
*/
define('AREA', 'admin');
require './lib/init.php';
use Froxlor\Database\Database;
use Froxlor\Api\Commands\PhpSettings as PhpSettings;
use Froxlor\Api\Commands\FpmDaemons as FpmDaemons;
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif (isset($_GET['id'])) {
@@ -30,315 +33,302 @@ if ($page == 'overview') {
if ($action == '') {
try {
$json_result = PhpSettings::getLocal($userinfo, array(
'with_subdomains' => true
))->listing();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
$tablecontent = '';
$count = 0;
$result = Database::query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "`");
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$domainresult = false;
$query_params = array('id' => $row['id']);
$query = "SELECT * FROM `".TABLE_PANEL_DOMAINS."`
WHERE `phpsettingid` = :id
AND `parentdomainid` = '0'";
if ((int)$userinfo['domains_see_all'] == 0) {
$query .= " AND `adminid` = :adminid";
$query_params['adminid'] = $userinfo['adminid'];
}
if ((int)Settings::Get('panel.phpconfigs_hidestdsubdomain') == 1) {
$ssdids_res = Database::query("
SELECT DISTINCT `standardsubdomain` FROM `".TABLE_PANEL_CUSTOMERS."`
WHERE `standardsubdomain` > 0 ORDER BY `standardsubdomain` ASC;"
);
$ssdids = array();
while ($ssd = $ssdids_res->fetch(PDO::FETCH_ASSOC)) {
$ssdids[] = $ssd['standardsubdomain'];
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>";
}
if (count($ssdids) > 0) {
$query .= " AND `id` NOT IN (".implode(', ', $ssdids).")";
$domains = "";
$subdomains_count = count($row['subdomains']);
foreach ($row['domains'] as $configdomain) {
$domains .= $configdomain . "<br>";
}
}
$domainresult_stmt = Database::prepare($query);
Database::pexecute($domainresult_stmt, $query_params);
$domains = '';
if (Database::num_rows() > 0) {
while ($row2 = $domainresult_stmt->fetch(PDO::FETCH_ASSOC)) {
$domains.= $row2['domain'] . '<br/>';
$count ++;
if ($subdomains_count == 0 && empty($domains)) {
$domains = $lng['admin']['phpsettings']['notused'];
}
eval("\$tablecontent.=\"" . \Froxlor\UI\Template::getTemplate("phpconfig/overview_overview") . "\";");
}
// check whether we use that config as froxor-vhost config
if (Settings::Get('system.mod_fcgid_defaultini_ownvhost') == $row['id']
|| Settings::Get('phpfpm.vhost_defaultini') == $row['id']
) {
$domains .= Settings::Get('system.hostname');
}
if ($domains == '') {
$domains = $lng['admin']['phpsettings']['notused'];
}
// check whether this is our default config
if ((Settings::Get('system.mod_fcgid') == '1'
&& Settings::Get('system.mod_fcgid_defaultini') == $row['id'])
|| (Settings::Get('phpfpm.enabled') == '1'
&& Settings::Get('phpfpm.defaultini') == $row['id'])
) {
$row['description'] = '<b>'.$row['description'].'</b>';
}
$count ++;
eval("\$tablecontent.=\"" . getTemplate("phpconfig/overview_overview") . "\";");
}
$log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting overview has been viewed by '" . $userinfo['loginname'] . "'");
eval("echo \"" . getTemplate("phpconfig/overview") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/overview") . "\";");
}
if ($action == 'add') {
if ((int)$userinfo['change_serversettings'] == 1) {
if ((int) $userinfo['change_serversettings'] == 1) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$description = validate($_POST['description'], 'description');
$phpsettings = validate(str_replace("\r\n", "\n", $_POST['phpsettings']), 'phpsettings', '/^[^\0]*$/');
if (Settings::Get('system.mod_fcgid') == 1) {
$binary = makeCorrectFile(validate($_POST['binary'], 'binary'));
$file_extensions = validate($_POST['file_extensions'], 'file_extensions', '/^[a-zA-Z0-9\s]*$/');
$mod_fcgid_starter = validate($_POST['mod_fcgid_starter'], 'mod_fcgid_starter', '/^[0-9]*$/', '', array('-1', ''));
$mod_fcgid_maxrequests = validate($_POST['mod_fcgid_maxrequests'], 'mod_fcgid_maxrequests', '/^[0-9]*$/', '', array('-1', ''));
$mod_fcgid_umask = validate($_POST['mod_fcgid_umask'], 'mod_fcgid_umask', '/^[0-9]*$/');
// disable fpm stuff
$fpm_enableslowlog = 0;
$fpm_reqtermtimeout = 0;
$fpm_reqslowtimeout = 0;
if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
PhpSettings::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
elseif (Settings::Get('phpfpm.enabled') == 1) {
$fpm_enableslowlog = isset($_POST['phpfpm_enable_slowlog']) ? (int)$_POST['phpfpm_enable_slowlog'] : 0;
$fpm_reqtermtimeout = validate($_POST['phpfpm_reqtermtimeout'], 'phpfpm_reqtermtimeout', '/^([0-9]+)(|s|m|h|d)$/');
$fpm_reqslowtimeout = validate($_POST['phpfpm_reqslowtimeout'], 'phpfpm_reqslowtimeout', '/^([0-9]+)(|s|m|h|d)$/');
// disable fcgid stuff
$binary = '/usr/bin/php-cgi';
$file_extensions = 'php';
$mod_fcgid_starter = 0;
$mod_fcgid_maxrequests = 0;
$mod_fcgid_umask = "022";
}
if (strlen($description) == 0
|| strlen($description) > 50
) {
standard_error('descriptioninvalid');
}
$ins_stmt = Database::prepare("
INSERT INTO `" . TABLE_PANEL_PHPCONFIGS . "` SET
`description` = :desc,
`binary` = :binary,
`file_extensions` = :fext,
`mod_fcgid_starter` = :starter,
`mod_fcgid_maxrequests` = :mreq,
`mod_fcgid_umask` = :umask,
`fpm_slowlog` = :fpmslow,
`fpm_reqterm` = :fpmreqterm,
`fpm_reqslow` = :fpmreqslow,
`phpsettings` = :phpsettings"
);
$ins_data = array(
'desc' => $description,
'binary' => $binary,
'fext' => $file_extensions,
'starter' => $mod_fcgid_starter,
'mreq' => $mod_fcgid_maxrequests,
'umask' => $mod_fcgid_umask,
'fpmslow' => $fpm_enableslowlog,
'fpmreqterm' => $fpm_reqtermtimeout,
'fpmreqslow' => $fpm_reqslowtimeout,
'phpsettings' => $phpsettings
);
Database::pexecute($ins_stmt, $ins_data);
inserttask('1');
$log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with description '" . $description . "' has been created by '" . $userinfo['loginname'] . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
$result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = 1");
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$phpconfig_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php';
$phpconfig_add_form = htmlform::genHTMLForm($phpconfig_add_data);
$fpmconfigs = '';
$configs = Database::query("SELECT * FROM `" . TABLE_PANEL_FPMDAEMONS . "` ORDER BY `description` ASC");
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
$fpmconfigs .= \Froxlor\UI\HTML::makeoption($row['description'], $row['id'], 1, true, true);
}
$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_form = \Froxlor\UI\HtmlForm::genHTMLForm($phpconfig_add_data);
$title = $phpconfig_add_data['phpconfig_add']['title'];
$image = $phpconfig_add_data['phpconfig_add']['image'];
eval("echo \"" . getTemplate("phpconfig/overview_add") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/overview_add") . "\";");
}
} else {
standard_error('nopermissionsorinvalidid');
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
}
}
if ($action == 'delete') {
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :id"
);
$result = Database::pexecute_first($result_stmt, array('id' => $id));
if ((Settings::Get('system.mod_fcgid') == '1'
&& Settings::Get('system.mod_fcgid_defaultini_ownvhost') == $id)
|| (Settings::Get('phpfpm.enabled') == '1'
&& Settings::Get('phpfpm.vhost_defaultini') == $id)
) {
standard_error('cannotdeletehostnamephpconfig');
try {
$json_result = PhpSettings::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if ((Settings::Get('system.mod_fcgid') == '1'
&& Settings::Get('system.mod_fcgid_defaultini') == $id)
|| (Settings::Get('phpfpm.enabled') == '1'
&& Settings::Get('phpfpm.defaultini') == $id)
) {
standard_error('cannotdeletedefaultphpconfig');
}
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'
) {
// set php-config to default for all domains using the
// config that is to be deleted
$upd_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_DOMAINS . "` SET
`phpsettingid` = '1' WHERE `phpsettingid` = :id"
);
Database::pexecute($upd_stmt, array('id' => $id));
$del_stmt = Database::prepare("
DELETE FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :id"
);
Database::pexecute($del_stmt, array('id' => $id));
inserttask('1');
$log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with id #" . (int)$id . " has been deleted by '" . $userinfo['loginname'] . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
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') {
try {
PhpSettings::getLocal($userinfo, array(
'id' => $id
))->delete();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
ask_yesno('phpsetting_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['description']);
\Froxlor\UI\HTML::askYesNo('phpsetting_reallydelete', $filename, array(
'id' => $id,
'page' => $page,
'action' => $action
), $result['description']);
}
} else {
standard_error('nopermissionsorinvalidid');
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
}
}
if ($action == 'edit') {
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :id"
);
$result = Database::pexecute_first($result_stmt, array('id' => $id));
try {
$json_result = PhpSettings::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$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'
) {
$description = validate($_POST['description'], 'description');
$phpsettings = validate(str_replace("\r\n", "\n", $_POST['phpsettings']), 'phpsettings', '/^[^\0]*$/');
if (Settings::Get('system.mod_fcgid') == 1) {
$binary = makeCorrectFile(validate($_POST['binary'], 'binary'));
$file_extensions = validate($_POST['file_extensions'], 'file_extensions', '/^[a-zA-Z0-9\s]*$/');
$mod_fcgid_starter = validate($_POST['mod_fcgid_starter'], 'mod_fcgid_starter', '/^[0-9]*$/', '', array('-1', ''));
$mod_fcgid_maxrequests = validate($_POST['mod_fcgid_maxrequests'], 'mod_fcgid_maxrequests', '/^[0-9]*$/', '', array('-1', ''));
$mod_fcgid_umask = validate($_POST['mod_fcgid_umask'], 'mod_fcgid_umask', '/^[0-9]*$/');
// disable fpm stuff
$fpm_enableslowlog = 0;
$fpm_reqtermtimeout = 0;
$fpm_reqslowtimeout = 0;
if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
PhpSettings::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
elseif (Settings::Get('phpfpm.enabled') == 1) {
$fpm_enableslowlog = isset($_POST['phpfpm_enable_slowlog']) ? (int)$_POST['phpfpm_enable_slowlog'] : 0;
$fpm_reqtermtimeout = validate($_POST['phpfpm_reqtermtimeout'], 'phpfpm_reqtermtimeout', '/^([0-9]+)(|s|m|h|d)$/');
$fpm_reqslowtimeout = validate($_POST['phpfpm_reqslowtimeout'], 'phpfpm_reqslowtimeout', '/^([0-9]+)(|s|m|h|d)$/');
// disable fcgid stuff
$binary = '/usr/bin/php-cgi';
$file_extensions = 'php';
$mod_fcgid_starter = 0;
$mod_fcgid_maxrequests = 0;
$mod_fcgid_umask = "022";
}
if (strlen($description) == 0
|| strlen($description) > 50
) {
standard_error('descriptioninvalid');
}
$upd_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_PHPCONFIGS . "` SET
`description` = :desc,
`binary` = :binary,
`file_extensions` = :fext,
`mod_fcgid_starter` = :starter,
`mod_fcgid_maxrequests` = :mreq,
`mod_fcgid_umask` = :umask,
`fpm_slowlog` = :fpmslow,
`fpm_reqterm` = :fpmreqterm,
`fpm_reqslow` = :fpmreqslow,
`phpsettings` = :phpsettings
WHERE `id` = :id"
);
$upd_data = array(
'desc' => $description,
'binary' => $binary,
'fext' => $file_extensions,
'starter' => $mod_fcgid_starter,
'mreq' => $mod_fcgid_maxrequests,
'umask' => $mod_fcgid_umask,
'fpmslow' => $fpm_enableslowlog,
'fpmreqterm' => $fpm_reqtermtimeout,
'fpmreqslow' => $fpm_reqslowtimeout,
'phpsettings' => $phpsettings,
'id' => $id
);
Database::pexecute($upd_stmt, $upd_data);
inserttask('1');
$log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with description '" . $description . "' has been changed by '" . $userinfo['loginname'] . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
$phpconfig_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php';
$phpconfig_edit_form = htmlform::genHTMLForm($phpconfig_edit_data);
$fpmconfigs = '';
$configs = Database::query("SELECT * FROM `" . TABLE_PANEL_FPMDAEMONS . "` ORDER BY `description` ASC");
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
$fpmconfigs .= \Froxlor\UI\HTML::makeoption($row['description'], $row['id'], $result['fpmsettingid'], true, true);
}
$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_form = \Froxlor\UI\HtmlForm::genHTMLForm($phpconfig_edit_data);
$title = $phpconfig_edit_data['phpconfig_edit']['title'];
$image = $phpconfig_edit_data['phpconfig_edit']['image'];
eval("echo \"" . getTemplate("phpconfig/overview_edit") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/overview_edit") . "\";");
}
} else {
standard_error('nopermissionsorinvalidid');
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
}
}
} elseif ($page == 'fpmdaemons') {
if ($action == '') {
try {
$json_result = FpmDaemons::getLocal($userinfo)->listing();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
$tablecontent = '';
$count = 0;
if (isset($result['count']) && $result['count'] > 0) {
foreach ($result['list'] as $row) {
$configs = "";
foreach ($row['configs'] as $configused) {
$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 ((int) $userinfo['change_serversettings'] == 1) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
FpmDaemons::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} 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_form = \Froxlor\UI\HtmlForm::genHTMLForm($fpmconfig_add_data);
$title = $fpmconfig_add_data['fpmconfig_add']['title'];
$image = $fpmconfig_add_data['fpmconfig_add']['image'];
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/fpmconfig_add") . "\";");
}
} else {
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
}
}
if ($action == 'delete') {
try {
$json_result = FpmDaemons::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if ($id == 1) {
\Froxlor\UI\Response::standard_error('cannotdeletedefaultphpconfig');
}
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') {
try {
FpmDaemons::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
\Froxlor\UI\HTML::askYesNo('fpmsetting_reallydelete', $filename, array(
'id' => $id,
'page' => $page,
'action' => $action
), $result['description']);
}
} else {
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
}
}
if ($action == 'edit') {
try {
$json_result = FpmDaemons::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if ($result['id'] != 0 && $result['id'] == $id && (int) $userinfo['change_serversettings'] == 1) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
FpmDaemons::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} 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_form = \Froxlor\UI\HtmlForm::genHTMLForm($fpmconfig_edit_data);
$title = $fpmconfig_edit_data['fpmconfig_edit']['title'];
$image = $fpmconfig_edit_data['fpmconfig_edit']['image'];
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/fpmconfig_edit") . "\";");
}
} else {
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
}
}
}

325
admin_plans.php Normal file
View File

@@ -0,0 +1,325 @@
<?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 Panel
*
*/
define('AREA', 'admin');
require './lib/init.php';
use Froxlor\Api\Commands\HostingPlans;
use Froxlor\Database\Database;
use Froxlor\Settings;
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
if ($page == '' || $page == 'overview') {
if ($action == '') {
$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 {
$json_result = HostingPlans::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if ($result['id'] != 0 && $result['id'] == $id && (int) $userinfo['adminid'] == $result['adminid']) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
HostingPlans::getLocal($userinfo, array(
'id' => $id
))->delete();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
\Froxlor\UI\HTML::askYesNo('plan_reallydelete', $filename, array(
'id' => $id,
'page' => $page,
'action' => $action
), $result['name']);
}
} else {
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
}
} elseif ($action == 'add') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
HostingPlans::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
$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);
$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("
SELECT c.*, fc.description as interpreter
FROM `" . TABLE_PANEL_PHPCONFIGS . "` c
LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fc ON fc.id = c.fpmsettingid
");
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
if ((int) Settings::Get('phpfpm.enabled') == 1) {
$phpconfigs[] = array(
'label' => $row['description'] . " [" . $row['interpreter'] . "]<br />",
'value' => $row['id']
);
} else {
$phpconfigs[] = array(
'label' => $row['description'] . "<br />",
'value' => $row['id']
);
}
}
// dummy to avoid unknown variables
$language_options = null;
$gender_options = null;
$hosting_plans = null;
$plans_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/plans/formfield.plans_add.php';
$cust_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_add.php';
// unset unneeded stuff
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_cpre']);
// merge
$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'];
$image = $plans_add_data['plans_add']['image'];
eval("echo \"" . \Froxlor\UI\Template::getTemplate("plans/plans_add") . "\";");
}
} elseif ($action == 'edit' && $id != 0) {
try {
$json_result = HostingPlans::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if ($result['name'] != '') {
$result['value'] = json_decode($result['value'], true);
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
foreach ($result['value'] as $index => $value) {
$result[$index] = $value;
}
$result['allowed_phpconfigs'] = json_encode($result['allowed_phpconfigs']);
if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
HostingPlans::getLocal($userinfo, array(
'id' => $id
))->update();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
$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'] = '';
}
$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("
SELECT c.*, fc.description as interpreter
FROM `" . TABLE_PANEL_PHPCONFIGS . "` c
LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fc ON fc.id = c.fpmsettingid
");
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
if ((int) Settings::Get('phpfpm.enabled') == 1) {
$phpconfigs[] = array(
'label' => $row['description'] . " [" . $row['interpreter'] . "]<br />",
'value' => $row['id']
);
} else {
$phpconfigs[] = array(
'label' => $row['description'] . "<br />",
'value' => $row['id']
);
}
}
$result['imap'] = $result['email_imap'];
$result['pop3'] = $result['email_pop3'];
// dummy to avoid unknown variables
$result['loginname'] = null;
$result['documentroot'] = null;
$result['standardsubdomain'] = null;
$result['deactivated'] = null;
$language_options = null;
$result['firstname'] = null;
$gender_options = null;
$result['company'] = null;
$result['street'] = null;
$result['zipcode'] = null;
$result['city'] = null;
$result['phone'] = null;
$result['fax'] = null;
$result['email'] = null;
$result['customernumber'] = null;
$result['custom_notes'] = null;
$result['custom_notes_show'] = null;
$hosting_plans = null;
$admin_select_cnt = null;
$admin_select = null;
$plans_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/plans/formfield.plans_edit.php';
$cust_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_edit.php';
// unset unneeded stuff
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_cpre']);
// merge
$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'];
$image = $plans_edit_data['plans_edit']['image'];
eval("echo \"" . \Froxlor\UI\Template::getTemplate("plans/plans_edit") . "\";");
}
}
} elseif ($action == 'jqGetPlanValues') {
$planid = isset($_POST['planid']) ? (int) $_POST['planid'] : 0;
try {
$json_result = HostingPlans::getLocal($userinfo, array(
'id' => $planid
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
echo $result['value'];
exit();
}
}

View File

@@ -16,6 +16,9 @@
* @package Panel
*
*/
use Froxlor\Database\Database;
use Froxlor\Settings;
use Froxlor\Api\Commands\Froxlor;
define('AREA', 'admin');
require './lib/init.php';
@@ -27,12 +30,10 @@ $sql_root = Database::getSqlData();
Database::needRoot(false);
if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$settings_data = loadConfigArrayDir('./actions/admin/settings/');
$settings = loadSettings($settings_data);
$settings_data = \Froxlor\PhpHelper::loadConfigArrayDir('./actions/admin/settings/');
Settings::loadSettingsInto($settings_data);
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$_part = isset($_GET['part']) ? $_GET['part'] : '';
if ($_part == '') {
@@ -48,7 +49,6 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$settings_part = true;
}
$only_enabledisable = false;
} else {
$settings_all = false;
$settings_part = false;
@@ -56,30 +56,28 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
}
// check if the session timeout is too low #815
if (isset($_POST['session_sessiontimeout'])
&& $_POST['session_sessiontimeout'] < 60
) {
standard_error($lng['error']['session_timeout'], $lng['error']['session_timeout_desc']);
if (isset($_POST['session_sessiontimeout']) && $_POST['session_sessiontimeout'] < 60) {
\Froxlor\UI\Response::standard_error($lng['error']['session_timeout'], $lng['error']['session_timeout_desc']);
}
if (processFormEx(
$settings_data,
$_POST,
array('filename' => $filename, 'action' => $action, 'page' => $page),
$_part,
$settings_all,
$settings_part,
$only_enabledisable
)
) {
$log->logAction(ADM_ACTION, LOG_INFO, "rebuild configfiles due to changed setting");
inserttask('1');
if (\Froxlor\UI\Form::processFormEx($settings_data, $_POST, array(
'filename' => $filename,
'action' => $action,
'page' => $page
), $_part, $settings_all, $settings_part, $only_enabledisable)) {
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "rebuild configfiles due to changed setting");
\Froxlor\System\Cronjob::inserttask('1');
// Using nameserver, insert a task which rebuilds the server config
inserttask('4');
\Froxlor\System\Cronjob::inserttask('4');
// cron.d file
\Froxlor\System\Cronjob::inserttask('99');
standard_success('settingssaved', '', array('filename' => $filename, 'action' => $action, 'page' => $page));
\Froxlor\UI\Response::standard_success('settingssaved', '', array(
'filename' => $filename,
'action' => $action,
'page' => $page
));
}
} else {
$_part = isset($_GET['part']) ? $_GET['part'] : '';
@@ -87,39 +85,36 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$_part = isset($_POST['part']) ? $_POST['part'] : '';
}
$fields = buildFormEx($settings_data, $_part);
$fields = \Froxlor\UI\Form::buildFormEx($settings_data, $_part);
$settings_page = '';
if ($_part == '') {
eval("\$settings_page .= \"" . getTemplate("settings/settings_overview") . "\";");
eval("\$settings_page .= \"" . \Froxlor\UI\Template::getTemplate("settings/settings_overview") . "\";");
} else {
eval("\$settings_page .= \"" . getTemplate("settings/settings") . "\";");
eval("\$settings_page .= \"" . \Froxlor\UI\Template::getTemplate("settings/settings") . "\";");
}
eval("echo \"" . getTemplate("settings/settings_form_begin") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/settings_form_begin") . "\";");
eval("echo \$settings_page;");
eval("echo \"" . getTemplate("settings/settings_form_end") . "\";");
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();
phpinfo();
$phpinfo = array('phpinfo' => array());
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
)
) {
$phpinfo = array(
'phpinfo' => array()
);
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) {
$end = array_keys($phpinfo);
$end = end($end);
if (strlen($match[1])) {
$phpinfo[$match[1]] = array();
} elseif (isset($match[3])) {
$phpinfo[$end][$match[2]] = isset($match[4]) ? array($match[3], $match[4]) : $match[3];
$phpinfo[$end][$match[2]] = isset($match[4]) ? array(
$match[3],
$match[4]
) : $match[3];
} else {
$phpinfo[$end][] = $match[2];
}
@@ -129,114 +124,99 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$phpinfoentries = "";
foreach ($section as $key => $val) {
if (is_array($val)) {
eval("\$phpinfoentries .= \"" . getTemplate("settings/phpinfo/phpinfo_3") . "\";");
eval("\$phpinfoentries .= \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo/phpinfo_3") . "\";");
} elseif (is_string($key)) {
eval("\$phpinfoentries .= \"" . getTemplate("settings/phpinfo/phpinfo_2") . "\";");
eval("\$phpinfoentries .= \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo/phpinfo_2") . "\";");
} else {
eval("\$phpinfoentries .= \"" . getTemplate("settings/phpinfo/phpinfo_1") . "\";");
eval("\$phpinfoentries .= \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo/phpinfo_1") . "\";");
}
}
// first header -> show actual php version
if (strtolower($name) == "phpinfo") {
$name = "PHP ".PHP_VERSION;
$name = "PHP " . PHP_VERSION;
}
eval("\$phpinfohtml .= \"" . getTemplate("settings/phpinfo/phpinfo_table") . "\";");
eval("\$phpinfohtml .= \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo/phpinfo_table") . "\";");
}
$phpinfo = $phpinfohtml;
} else {
standard_error($lng['error']['no_phpinfo']);
\Froxlor\UI\Response::standard_error($lng['error']['no_phpinfo']);
}
eval("echo \"" . getTemplate("settings/phpinfo") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo") . "\";");
} elseif ($page == 'rebuildconfigs' && $userinfo['change_serversettings'] == '1') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
} elseif($page == 'rebuildconfigs'
&& $userinfo['change_serversettings'] == '1'
) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$log->logAction(ADM_ACTION, LOG_INFO, "rebuild configfiles");
inserttask('1');
inserttask('10');
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "rebuild configfiles");
\Froxlor\System\Cronjob::inserttask('1');
\Froxlor\System\Cronjob::inserttask('10');
// Using nameserver, insert a task which rebuilds the server config
inserttask('4');
\Froxlor\System\Cronjob::inserttask('4');
// cron.d file
inserttask('99');
standard_success('rebuildingconfigs', '', array('filename' => 'admin_index.php'));
\Froxlor\System\Cronjob::inserttask('99');
\Froxlor\UI\Response::standard_success('rebuildingconfigs', '', array(
'filename' => 'admin_index.php'
));
} else {
ask_yesno('admin_configs_reallyrebuild', $filename, array('page' => $page));
\Froxlor\UI\HTML::askYesNo('admin_configs_reallyrebuild', $filename, array(
'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(ADM_ACTION, LOG_INFO, "updated resource-counters");
$updatecounters = updateCounters(true);
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "updated resource-counters");
$updatecounters = \Froxlor\User::updateCounters(true);
$customers = '';
foreach ($updatecounters['customers'] as $customerid => $customer) {
eval("\$customers.=\"" . getTemplate("settings/updatecounters_row_customer") . "\";");
eval("\$customers.=\"" . \Froxlor\UI\Template::getTemplate("settings/updatecounters_row_customer") . "\";");
}
$admins = '';
foreach ($updatecounters['admins'] as $adminid => $admin) {
eval("\$admins.=\"" . getTemplate("settings/updatecounters_row_admin") . "\";");
eval("\$admins.=\"" . \Froxlor\UI\Template::getTemplate("settings/updatecounters_row_admin") . "\";");
}
eval("echo \"" . getTemplate("settings/updatecounters") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/updatecounters") . "\";");
} else {
ask_yesno('admin_counters_reallyupdate', $filename, array('page' => $page));
\Froxlor\UI\HTML::askYesNo('admin_counters_reallyupdate', $filename, array(
'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(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_PANEL_SETTINGS . "` SET `value` = '0' WHERE `settinggroup` = 'system' AND `varname` = 'mailpwcleartext'");
redirectTo($filename, array('s' => $s));
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} else {
ask_yesno('admin_cleartextmailpws_reallywipe', $filename, array('page' => $page));
\Froxlor\UI\HTML::askYesNo('admin_cleartextmailpws_reallywipe', $filename, array(
'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(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
Database::query("UPDATE `" . TABLE_MAIL_USERS . "` SET `quota` = '0';");
Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_quota_used` = '0'");
redirectTo($filename, array('s' => $s));
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} else {
ask_yesno('admin_quotas_reallywipe', $filename, array('page' => $page));
\Froxlor\UI\HTML::askYesNo('admin_quotas_reallywipe', $filename, array(
'page' => $page
));
}
} elseif ($page == 'enforcequotas'
&& $userinfo['change_serversettings'] == '1'
) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
} elseif ($page == 'enforcequotas' && $userinfo['change_serversettings'] == '1') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
// Fetch all accounts
$result_stmt = Database::query("SELECT `quota`, `customerid` FROM `" . TABLE_MAIL_USERS . "`");
@@ -250,7 +230,10 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
while ($array = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$difference = Settings::Get('system.mail_quota') - $array['quota'];
Database::pexecute($upd_stmt, array('diff' => $difference, 'customerid' => $customerid));
Database::pexecute($upd_stmt, array(
'diff' => $difference,
'customerid' => $customerid
));
}
}
@@ -258,27 +241,29 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$upd_stmt = Database::prepare("
UPDATE `" . TABLE_MAIL_USERS . "` SET `quota` = :quota
");
Database::pexecute($upd_stmt, array('quota' => Settings::Get('system.mail_quota')));
Database::pexecute($upd_stmt, array(
'quota' => Settings::Get('system.mail_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`");
$log->logAction(ADM_ACTION, LOG_WARNING, 'enforcing mailquota to all customers: ' . Settings::Get('system.mail_quota') . ' MB');
redirectTo($filename, array('s' => $s));
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, 'enforcing mailquota to all customers: ' . Settings::Get('system.mail_quota') . ' MB');
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} else {
ask_yesno('admin_quotas_reallyenforce', $filename, array('page' => $page));
\Froxlor\UI\HTML::askYesNo('admin_quotas_reallyenforce', $filename, array(
'page' => $page
));
}
} elseif ($page == 'integritycheck'
&& $userinfo['change_serversettings'] == '1'
) {
$integrity = new IntegrityCheck();
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
} elseif ($page == 'integritycheck' && $userinfo['change_serversettings'] == '1') {
$integrity = new \Froxlor\Database\IntegrityCheck();
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$integrity->fixAll();
} elseif(isset($_GET['action'])
&& $_GET['action'] == "fix") {
ask_yesno('admin_integritycheck_reallyfix', $filename, array('page' => $page));
} elseif (isset($_GET['action']) && $_GET['action'] == "fix") {
\Froxlor\UI\HTML::askYesNo('admin_integritycheck_reallyfix', $filename, array(
'page' => $page
));
}
$integritycheck = '';
@@ -286,7 +271,114 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$displayid = $id + 1;
$result = $integrity->$check();
$checkdesc = $lng['integrity_check'][$check];
eval("\$integritycheck.=\"" . getTemplate("settings/integritycheck_row") . "\";");
eval("\$integritycheck.=\"" . \Froxlor\UI\Template::getTemplate("settings/integritycheck_row") . "\";");
}
eval("echo \"" . getTemplate("settings/integritycheck") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/integritycheck") . "\";");
} elseif ($page == 'importexport' && $userinfo['change_serversettings'] == '1') {
// check for json-stuff
if (! extension_loaded('json')) {
\Froxlor\UI\Response::standard_error('jsonextensionnotfound');
}
if (isset($_GET['action']) && $_GET['action'] == "export") {
// export
try {
$json_result = Froxlor::getLocal($userinfo)->exportSettings();
$json_export = json_decode($json_result, true)['data'];
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
header('Content-disposition: attachment; filename=Froxlor_settings-' . $version . '-' . $dbversion . '_' . date('d.m.Y') . '.json');
header('Content-type: application/json');
echo $json_export;
exit();
} elseif (isset($_GET['action']) && $_GET['action'] == "import") {
// import
if (isset($_POST['send']) && $_POST['send'] == 'send') {
// get uploaded file
if (isset($_FILES["import_file"]["tmp_name"])) {
$imp_content = file_get_contents($_FILES["import_file"]["tmp_name"]);
try {
Froxlor::getLocal($userinfo, array(
'json_str' => $imp_content
))->importSettings();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
\Froxlor\UI\Response::standard_success('settingsimported', '', array(
'filename' => 'admin_settings.php'
));
}
\Froxlor\UI\Response::dynamic_error("Upload failed");
}
} else {
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/importexport/index") . "\";");
}
} elseif ($page == 'testmail') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$test_addr = isset($_POST['test_addr']) ? $_POST['test_addr'] : null;
/**
* Initialize the mailingsystem
*/
$testmail = new \PHPMailer\PHPMailer\PHPMailer(true);
$testmail->CharSet = "UTF-8";
if (Settings::Get('system.mail_use_smtp')) {
$testmail->isSMTP();
$testmail->Host = Settings::Get('system.mail_smtp_host');
$testmail->SMTPAuth = Settings::Get('system.mail_smtp_auth') == '1' ? true : false;
$testmail->Username = Settings::Get('system.mail_smtp_user');
$testmail->Password = Settings::Get('system.mail_smtp_passwd');
if (Settings::Get('system.mail_smtp_usetls')) {
$testmail->SMTPSecure = 'tls';
} else {
$testmail->SMTPAutoTLS = false;
}
$testmail->Port = Settings::Get('system.mail_smtp_port');
}
$_mailerror = false;
if (\PHPMailer\PHPMailer\PHPMailer::ValidateAddress(Settings::Get('panel.adminmail')) !== false) {
// set return-to address and custom sender-name, see #76
$testmail->SetFrom(Settings::Get('panel.adminmail'), Settings::Get('panel.adminmail_defname'));
if (Settings::Get('panel.adminmail_return') != '') {
$testmail->AddReplyTo(Settings::Get('panel.adminmail_return'), Settings::Get('panel.adminmail_defname'));
}
try {
$testmail->Subject = "Froxlor Test-Mail";
$mail_body = "Yay, this worked :)";
$testmail->AltBody = $mail_body;
$testmail->MsgHTML(str_replace("\n", "<br />", $mail_body));
$testmail->AddAddress($test_addr);
$testmail->Send();
} catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
$mailerr_msg = $e->getMessage();
$_mailerror = true;
}
if (! $_mailerror) {
// success
$mail->ClearAddresses();
\Froxlor\UI\Response::standard_success('testmailsent', '', array(
'filename' => 'admin_settings.php',
'page' => 'testmail'
));
}
} else {
// invalid sender e-mail
$mailerr_msg = "Invalid sender e-mail address: " . Settings::Get('panel.adminmail');
$_mailerror = true;
}
}
$mail_smtp_user = Settings::Get('system.mail_smtp_user');
$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") . "\";");
}

View File

@@ -16,23 +16,23 @@
* @package Panel
*
*/
define('AREA', 'admin');
require './lib/init.php';
use Froxlor\Database\Database;
use Froxlor\Settings;
if (isset($_POST['subjectid'])) {
$subjectid = intval($_POST['subjectid']);
$mailbodyid = intval($_POST['mailbodyid']);
} elseif(isset($_GET['subjectid'])) {
} elseif (isset($_GET['subjectid'])) {
$subjectid = intval($_GET['subjectid']);
$mailbodyid = intval($_GET['mailbodyid']);
}
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif(isset($_GET['id'])) {
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
@@ -45,21 +45,8 @@ $available_templates = array(
);
// only show templates of features that are enabled #1191
if ((int)Settings::Get('system.report_enable') == 1) {
array_push($available_templates,
'trafficmaxpercent',
'diskmaxpercent'
);
}
if ((int)Settings::Get('ticket.enabled') == 1) {
array_push($available_templates,
'new_ticket_by_customer',
'new_ticket_for_customer',
'new_ticket_by_staff',
'new_reply_ticket_by_customer',
'new_reply_ticket_by_staff'
);
if ((int) Settings::Get('system.report_enable') == 1) {
array_push($available_templates, 'trafficmaxpercent', 'diskmaxpercent');
}
$file_templates = array(
@@ -67,8 +54,8 @@ $file_templates = array(
);
if ($action == '') {
//email templates
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_templates");
// email templates
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_templates");
if (Settings::Get('panel.sendalternativemail') == 1) {
$available_templates[] = 'pop_success_alternative';
@@ -78,9 +65,10 @@ if ($action == '') {
$result_stmt = Database::prepare("
SELECT `id`, `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `templategroup`='mails'
ORDER BY `language`, `varname`"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid']));
ORDER BY `language`, `varname`");
Database::pexecute($result_stmt, array(
'adminid' => $userinfo['adminid']
));
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$parts = array();
@@ -94,20 +82,22 @@ if ($action == '') {
$subjectid = $email['subject'];
$mailbodyid = $email['mailbody'];
$template = $lng['admin']['templates'][$action];
eval("\$templates.=\"" . getTemplate("templates/templates_template") . "\";");
eval("\$templates.=\"" . \Froxlor\UI\Template::getTemplate("templates/templates_template") . "\";");
}
}
$add = false;
while (list($language_file, $language_name) = each($languages)) {
foreach ($languages as $language_file => $language_name) {
$templates_done = array();
$result_stmt = Database::prepare("
SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `language`= :lang
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'lang' => $language_name));
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'");
Database::pexecute($result_stmt, array(
'adminid' => $userinfo['adminid'],
'lang' => $language_name
));
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$templates_done[] = str_replace('_subject', '', $row['varname']);
@@ -118,111 +108,115 @@ if ($action == '') {
}
}
//filetemplates
// filetemplates
$filetemplates = '';
$filetemplateadd = false;
$result_stmt = Database::prepare("
SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `templategroup`='files'"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid']));
WHERE `adminid` = :adminid AND `templategroup`='files'");
Database::pexecute($result_stmt, array(
'adminid' => $userinfo['adminid']
));
if (Database::num_rows() != count($file_templates)) {
$filetemplateadd = true;
}
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
eval("\$filetemplates.=\"" . getTemplate("templates/templates_filetemplate") . "\";");
eval("\$filetemplates.=\"" . \Froxlor\UI\Template::getTemplate("templates/templates_filetemplate") . "\";");
}
eval("echo \"" . getTemplate("templates/templates") . "\";");
} elseif($action == 'delete'
&& $subjectid != 0
&& $mailbodyid != 0
) {
//email templates
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/templates") . "\";");
} elseif ($action == 'delete' && $subjectid != 0 && $mailbodyid != 0) {
// email templates
$result_stmt = Database::prepare("
SELECT `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :id"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'id' => $subjectid));
WHERE `adminid` = :adminid AND `id` = :id");
Database::pexecute($result_stmt, array(
'adminid' => $userinfo['adminid'],
'id' => $subjectid
));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if ($result['varname'] != '') {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$del_stmt = Database::prepare("
DELETE FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid
AND (`id` = :ida OR `id` = :idb)"
);
AND (`id` = :ida OR `id` = :idb)");
Database::pexecute($del_stmt, array(
'adminid' => $userinfo['adminid'],
'ida' => $subjectid,
'idb' => $mailbodyid
));
$log->logAction(ADM_ACTION, LOG_INFO, "deleted template '" . $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])] . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "deleted template '" . $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])] . "'");
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
ask_yesno('admin_template_reallydelete', $filename, array('subjectid' => $subjectid, 'mailbodyid' => $mailbodyid, 'page' => $page, 'action' => $action), $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])]);
\Froxlor\UI\HTML::askYesNo('admin_template_reallydelete', $filename, array(
'subjectid' => $subjectid,
'mailbodyid' => $mailbodyid,
'page' => $page,
'action' => $action
), $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])]);
}
}
} elseif($action == 'deletef'
&& $id != 0
) {
//file templates
} elseif ($action == 'deletef' && $id != 0) {
// file templates
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :id"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'id' => $id));
WHERE `adminid` = :adminid AND `id` = :id");
Database::pexecute($result_stmt, array(
'adminid' => $userinfo['adminid'],
'id' => $id
));
if (Database::num_rows() > 0) {
$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("
DELETE FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :id"
);
Database::pexecute($del_stmt, array('adminid' => $userinfo['adminid'], 'id' => $id));
$log->logAction(ADM_ACTION, LOG_INFO, "deleted template '" . $lng['admin']['templates'][$row['varname']] . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
WHERE `adminid` = :adminid AND `id` = :id");
Database::pexecute($del_stmt, array(
'adminid' => $userinfo['adminid'],
'id' => $id
));
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "deleted template '" . $lng['admin']['templates'][$row['varname']] . "'");
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
ask_yesno('admin_template_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $lng['admin']['templates'][$row['varname']]);
\Froxlor\UI\HTML::askYesNo('admin_template_reallydelete', $filename, array(
'id' => $id,
'page' => $page,
'action' => $action
), $lng['admin']['templates'][$row['varname']]);
}
} else {
standard_error('templatenotfound');
\Froxlor\UI\Response::standard_error('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'
) {
//email templates
$language = htmlentities(validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect'));
$template = validate($_POST['template'], 'template');
if (isset($_POST['prepare']) && $_POST['prepare'] == 'prepare') {
// email templates
$language = htmlentities(\Froxlor\Validate\Validate::validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect'));
$template = \Froxlor\Validate\Validate::validate($_POST['template'], 'template');
$lng_bak = $lng;
foreach ($langs['English'] as $key => $value) {
include_once makeSecurePath($value['file']);
include_once \Froxlor\FileDir::makeSecurePath($value['file']);
}
if ($language != 'English') {
foreach ($langs[$language] as $key => $value) {
include makeSecurePath($value['file']);
include \Froxlor\FileDir::makeSecurePath($value['file']);
}
}
@@ -231,38 +225,36 @@ if ($action == '') {
$lng = $lng_bak;
$template_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/templates/formfield.template_add.php';
$template_add_form = htmlform::genHTMLForm($template_add_data);
$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'];
$image = $template_add_data['template_add']['image'];
eval("echo \"" . getTemplate("templates/templates_add_2") . "\";");
} elseif(isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
//email templates
$language = htmlentities(validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect'));
$template = validate($_POST['template'], 'template');
$subject = validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate');
$mailbody = validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate');
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/templates_add_2") . "\";");
} elseif (isset($_POST['send']) && $_POST['send'] == 'send') {
// email templates
$language = htmlentities(\Froxlor\Validate\Validate::validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect'));
$template = \Froxlor\Validate\Validate::validate($_POST['template'], 'template');
$subject = \Froxlor\Validate\Validate::validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate');
$mailbody = \Froxlor\Validate\Validate::validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate');
$templates = array();
$result_stmt = Database::prepare("
SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `language` = :lang
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'lang' => $language));
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'");
Database::pexecute($result_stmt, array(
'adminid' => $userinfo['adminid'],
'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 = array_diff($available_templates, $templates);
if (array_search($template, $templates) === false) {
standard_error('templatenotfound');
\Froxlor\UI\Response::standard_error('templatenotfound');
} else {
$ins_stmt = Database::prepare("
INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` SET
@@ -270,14 +262,13 @@ if ($action == '') {
`language` = :lang,
`templategroup` = 'mails',
`varname` = :var,
`value` = :value"
);
`value` = :value");
// mail-subject
$ins_data = array(
'adminid' => $userinfo['adminid'],
'lang' => $language,
'var' => $template.'_subject',
'var' => $template . '_subject',
'value' => $subject
);
Database::pexecute($ins_stmt, $ins_data);
@@ -286,21 +277,21 @@ if ($action == '') {
$ins_data = array(
'adminid' => $userinfo['adminid'],
'lang' => $language,
'var' => $template.'_mailbody',
'var' => $template . '_mailbody',
'value' => $mailbody
);
Database::pexecute($ins_stmt, $ins_data);
$log->logAction(ADM_ACTION, LOG_INFO, "added template '" . $language . ' - ' . $template . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "added template '" . $language . ' - ' . $template . "'");
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
}
} elseif(isset($_POST['filesend'])
&& $_POST['filesend'] == 'filesend'
) {
//file templates
$template = validate($_POST['template'], 'template');
$filecontent = validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset');
} elseif (isset($_POST['filesend']) && $_POST['filesend'] == 'filesend') {
// file templates
$template = \Froxlor\Validate\Validate::validate($_POST['template'], 'template');
$filecontent = \Froxlor\Validate\Validate::validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset');
$ins_stmt = Database::prepare("
INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` SET
@@ -308,8 +299,7 @@ if ($action == '') {
`language` = '',
`templategroup` = 'files',
`varname` = :var,
`value` = :value"
);
`value` = :value");
$ins_data = array(
'adminid' => $userinfo['adminid'],
@@ -318,24 +308,28 @@ if ($action == '') {
);
Database::pexecute($ins_stmt, $ins_data);
$log->logAction(ADM_ACTION, LOG_INFO, "added template '" . $template . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "added template '" . $template . "'");
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} elseif (! isset($_GET['files'])) {
} elseif(!isset($_GET['files'])) {
//email templates
// email templates
$add = false;
$language_options = '';
$template_options = '';
while (list($language_file, $language_name) = each($languages)) {
foreach ($languages as $language_file => $language_name) {
$templates = array();
$result_stmt = Database::prepare("
SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `language` = :lang
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'lang' => $language_name));
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'");
Database::pexecute($result_stmt, array(
'adminid' => $userinfo['adminid'],
'lang' => $language_name
));
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$templates[] = str_replace('_subject', '', $row['varname']);
@@ -343,33 +337,32 @@ if ($action == '') {
if (count(array_diff($available_templates, $templates)) > 0) {
$add = true;
$language_options.= makeoption($language_name, $language_file, $userinfo['language'], true, true);
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $userinfo['language'], true, true);
$templates = array_diff($available_templates, $templates);
foreach ($templates as $template) {
$template_options.= makeoption($lng['admin']['templates'][$template], $template, NULL, true, true, $language_file) . "\n";
$template_options .= \Froxlor\UI\HTML::makeoption($lng['admin']['templates'][$template], $template, NULL, true, true, $language_file) . "\n";
}
}
}
if ($add) {
eval("echo \"" . getTemplate("templates/templates_add_1") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/templates_add_1") . "\";");
} else {
standard_error('alltemplatesdefined');
\Froxlor\UI\Response::standard_error('alltemplatesdefined');
}
} else {
//filetemplates
// filetemplates
$result_stmt = Database::prepare("
SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `templategroup`='files'"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid']));
WHERE `adminid` = :adminid AND `templategroup`='files'");
Database::pexecute($result_stmt, array(
'adminid' => $userinfo['adminid']
));
if (Database::num_rows() == count($file_templates)) {
standard_error('alltemplatesdefined');
\Froxlor\UI\Response::standard_error('alltemplatesdefined');
} else {
$templatesdefined = array();
@@ -380,44 +373,39 @@ if ($action == '') {
}
foreach (array_diff($file_templates, $templatesdefined) as $template) {
$free_templates.= makeoption($lng['admin']['templates'][$template], $template, '', true);
$free_templates .= \Froxlor\UI\HTML::makeoption($lng['admin']['templates'][$template], $template, '', true);
}
$filetemplate_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/templates/formfield.filetemplate_add.php';
$filetemplate_add_form = htmlform::genHTMLForm($filetemplate_add_data);
$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'];
$image = $filetemplate_add_data['filetemplate_add']['image'];
eval("echo \"" . getTemplate("templates/filetemplates_add") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/filetemplates_add") . "\";");
}
}
} elseif($action == 'edit'
&& $subjectid != 0
&& $mailbodyid != 0
) {
//email templates
} elseif ($action == 'edit' && $subjectid != 0 && $mailbodyid != 0) {
// email templates
$result_stmt = Database::prepare("
SELECT `language`, `varname`, `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :subjectid"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'subjectid' => $subjectid));
WHERE `adminid` = :adminid AND `id` = :subjectid");
Database::pexecute($result_stmt, array(
'adminid' => $userinfo['adminid'],
'subjectid' => $subjectid
));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if ($result['varname'] != '') {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$subject = validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate');
$mailbody = validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate');
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$subject = \Froxlor\Validate\Validate::validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate');
$mailbody = \Froxlor\Validate\Validate::validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate');
$upd_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET
`value` = :value
WHERE `adminid` = :adminid AND `id` = :id"
);
WHERE `adminid` = :adminid AND `id` = :id");
// subject
Database::pexecute($upd_stmt, array(
'value' => $subject,
@@ -431,85 +419,85 @@ if ($action == '') {
'id' => $mailbodyid
));
$log->logAction(ADM_ACTION, LOG_INFO, "edited template '" . $result['varname'] . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "edited template '" . $result['varname'] . "'");
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
$result = htmlentities_array($result);
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
$template = $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])];
$subject = $result['value'];
$result_stmt = Database::prepare("
SELECT `language`, `varname`, `value`
FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `id` = :id"
);
Database::pexecute($result_stmt, array('id' => $mailbodyid));
WHERE `id` = :id");
Database::pexecute($result_stmt, array(
'id' => $mailbodyid
));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$template_name = str_replace('_mailbody', '', $result['varname']);
// don't escape the already escaped language-string so save up before htmlentities()
$language = $result['language'];
$result = htmlentities_array($result);
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
$mailbody = $result['value'];
$template_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/templates/formfield.template_edit.php';
$template_edit_form = htmlform::genHTMLForm($template_edit_data);
$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'];
$image = $template_edit_data['template_edit']['image'];
eval("echo \"" . getTemplate("templates/templates_edit") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/templates_edit") . "\";");
}
}
} elseif($action == 'editf'
&& $id != 0
) {
//file templates
} elseif ($action == 'editf' && $id != 0) {
// file templates
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :id"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'id' => $id));
WHERE `adminid` = :adminid AND `id` = :id");
Database::pexecute($result_stmt, array(
'adminid' => $userinfo['adminid'],
'id' => $id
));
if(Database::num_rows() > 0) {
if (Database::num_rows() > 0) {
$row = $result_stmt->fetch(PDO::FETCH_ASSOC);
//filetemplates
if (isset($_POST['filesend'])
&& $_POST['filesend'] == 'filesend'
) {
$filecontent = validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset');
// filetemplates
if (isset($_POST['filesend']) && $_POST['filesend'] == 'filesend') {
$filecontent = \Froxlor\Validate\Validate::validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset');
$upd_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET
`value` = :value
WHERE `adminid` = :adminid AND `id` = :id"
);
WHERE `adminid` = :adminid AND `id` = :id");
Database::pexecute($upd_stmt, array(
'value' => $filecontent,
'adminid' => $userinfo['adminid'],
'id' => $id
));
$log->logAction(ADM_ACTION, LOG_INFO, "edited template '" . $row['varname'] . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "edited template '" . $row['varname'] . "'");
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
$row = htmlentities_array($row);
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
$filetemplate_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/templates/formfield.filetemplate_edit.php';
$filetemplate_edit_form = htmlform::genHTMLForm($filetemplate_edit_data);
$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'];
$image = $filetemplate_edit_data['filetemplate_edit']['image'];
eval("echo \"" . getTemplate("templates/filetemplates_edit") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/filetemplates_edit") . "\";");
}
} else {
standard_error('templatenotfound');
\Froxlor\UI\Response::standard_error('templatenotfound');
}
}

View File

@@ -1,909 +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 Panel
*
*/
define('AREA', 'admin');
require './lib/init.php';
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif(isset($_GET['id'])) {
$id = intval($_GET['id']);
// only check if this is not a category-id
if (!isset($_GET['page']) || (isset($_GET['page']) && $_GET['page'] != 'categories')) {
if (!$userinfo['customers_see_all']) {
/*
* Check if the current user is allowed to see the current ticket.
*/
$stmt = Database::prepare("
SELECT `id` FROM `panel_tickets`
WHERE `id` = :id AND `adminid` = :adminid
");
$result = Database::pexecute_first($stmt, array('id' => $id, 'adminid' => $userinfo['adminid']));
if ($result == null) {
// no rights to see the requested ticket
standard_error(array('ticketnotaccessible'));
}
}
}
}
if ($page == 'tickets'
&& $userinfo['customers'] != '0'
) {
// Let's see how many customers we have
$countcustomers_stmt = Database::prepare("
SELECT COUNT(`customerid`) as `countcustomers`
FROM `" . TABLE_PANEL_CUSTOMERS . "` " .
($userinfo['customers_see_all'] ? '' : "WHERE `adminid` = :adminid")
);
$countcustomers = Database::pexecute_first($countcustomers_stmt, array('adminid' => $userinfo['adminid']));
$countcustomers = (int)$countcustomers['countcustomers'];
if ($action == '') {
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_tickets");
$fields = array(
'status' => $lng['ticket']['status'],
'lastchange' => $lng['ticket']['lastchange'],
'subject' => $lng['ticket']['subject'],
'lastreplier' => $lng['ticket']['lastreplier']
);
$paging = new paging($userinfo, TABLE_PANEL_TICKETS, $fields, null, null, 1, 'desc');
$result_stmt = Database::prepare("
SELECT `main`.`id`, `main`.`customerid`, (
SELECT COUNT(`sub`.`id`)
FROM `" . TABLE_PANEL_TICKETS . "` `sub`
WHERE `sub`.`answerto` = `main`.`id`) as `ticket_answers`,
`main`.`lastchange`, `main`.`subject`, `main`.`status`, `main`.`lastreplier`, `main`.`priority`
FROM `" . TABLE_PANEL_TICKETS . "` as `main`
WHERE `main`.`answerto` = '0' AND `archived` = '0' " .
($userinfo['customers_see_all'] ? '' : " AND `adminid` = :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);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$ctickets = array();
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
if (!isset($ctickets[$row['customerid']])
|| !is_array($ctickets[$row['customerid']])
) {
$ctickets[$row['customerid']] = array();
}
$ctickets[$row['customerid']][$row['id']] = $row;
}
if ($paging->sortfield == 'customerid'
&& $paging->sortorder == 'desc'
) {
krsort($ctickets);
} else {
ksort($ctickets);
}
$i = 0;
$count = 0;
$tickets_count = 0;
$tickets = '';
foreach ($ctickets as $cid => $ticketrows) {
$_cid = 0;
foreach ($ticketrows as $row) {
if ($paging->checkDisplay($i)) {
$row = htmlentities_array($row);
$row['lastchange'] = date("d.m.y H:i", $row['lastchange']);
if ($_cid != $row['customerid']) {
$cid = $row['customerid'];
$usr_stmt = Database::prepare('
SELECT `customerid`, `firstname`, `name`, `company`, `loginname`
FROM `' . TABLE_PANEL_CUSTOMERS . '`
WHERE `customerid` = :cid'
);
$usr = Database::pexecute_first($usr_stmt, array('cid' => $cid));
if (isset($usr['loginname'])) {
$customer = getCorrectFullUserDetails($usr);
$customerloginname = $usr['loginname'];
$customerid = $usr['customerid'];
} else {
$customer = $lng['ticket']['nonexistingcustomer'];
}
eval("\$tickets.=\"" . getTemplate("tickets/tickets_customer") . "\";");
}
$tickets_count++;
if ($row['status'] >= 0
&& $row['status'] <= 2
) {
$reopen = 0;
} else {
$reopen = 1;
}
$row['status'] = ticket::getStatusText($lng, $row['status']);
$row['priority'] = ticket::getPriorityText($lng, $row['priority']);
if ($row['lastreplier'] == '1') {
$row['lastreplier'] = $lng['ticket']['staff'];
$cananswer = 0;
} else {
$row['lastreplier'] = $lng['ticket']['customer'];
$cananswer = 1;
}
$row['subject'] = html_entity_decode($row['subject']);
if (strlen($row['subject']) > 30) {
$ts = wordwrap($row['subject'], 30, "|");
$ts = explode("|", $ts);
$row['subject'] = $ts[0]. '...';
}
eval("\$tickets.=\"" . getTemplate("tickets/tickets_tickets") . "\";");
$count++;
$_cid = $row['customerid'];
}
$i++;
}
}
eval("echo \"" . getTemplate("tickets/tickets") . "\";");
} elseif($action == 'new') {
if ($userinfo['tickets_used'] < $userinfo['tickets']
|| $userinfo['tickets'] == '-1'
) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$newticket = ticket::getInstanceOf($userinfo, -1);
$newticket->Set('subject', validate($_POST['subject'], 'subject'), true, false);
$newticket->Set('priority', validate($_POST['priority'], 'priority'), true, false);
$newticket->Set('category', validate($_POST['category'], 'category'), true, false);
$newticket->Set('customer', (int)$_POST['customer'], true, false);
$newticket->Set('message', validate(htmlentities(str_replace("\r\n", "\n", $_POST['message'])), 'message', '/^[^\0]*$/'), true, false);
if ($newticket->Get('subject') == null) {
standard_error(array('stringisempty', 'mysubject'));
} elseif($newticket->Get('message') == null) {
standard_error(array('stringisempty', 'mymessage'));
} else {
$now = time();
$newticket->Set('admin', $userinfo['adminid'], true, true);
$newticket->Set('dt', $now, true, true);
$newticket->Set('lastchange', $now, true, true);
$newticket->Set('ip', $_SERVER['REMOTE_ADDR'], true, true);
$newticket->Set('status', '0', true, true);
$newticket->Set('lastreplier', '1', true, true);
$newticket->Set('by', '1', true, true);
$newticket->Insert();
$newticket->sendMail((int)$newticket->Get('customer'), 'new_ticket_by_staff_subject', $lng['mails']['new_ticket_by_staff']['subject'], 'new_ticket_by_staff_mailbody', $lng['mails']['new_ticket_by_staff']['mailbody']);
$log->logAction(ADM_ACTION, LOG_NOTICE, "opened a new ticket for customer #" . $newticket->Get('customer') . " - '" . $newticket->Get('subject') . "'");
redirectTo($filename, Array('page' => $page, 's' => $s));
}
} else {
$categories = '';
$where = '';
if ($userinfo['tickets_see_all'] != '1') {
$where = 'WHERE `adminid` = :adminid';
}
$result_stmt = Database::prepare('
SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '`
'.$where.' ORDER BY `logicalorder`, `name` ASC'
);
$result = Database::pexecute_first($result_stmt, array('adminid' => $userinfo['adminid']));
if (isset($result['name'])
&& $result['name'] != ''
) {
$result2_stmt = Database::prepare('
SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '`
'.$where.' ORDER BY `logicalorder`, `name` ASC'
);
Database::pexecute($result2_stmt, array('adminid' => $userinfo['adminid']));
while ($row = $result2_stmt->fetch(PDO::FETCH_ASSOC)) {
$categories.= makeoption($row['name'], $row['id']);
}
} else {
$categories = makeoption($lng['ticket']['no_cat'], '0');
}
$customers = '';
$result_customers_stmt = Database::prepare("
SELECT `customerid`, `loginname`, `name`, `firstname`, `company`
FROM `" . TABLE_PANEL_CUSTOMERS . "` " .
($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = :adminid")."
ORDER BY `name` ASC"
);
Database::pexecute($result_customers_stmt, array('adminid' => $userinfo['adminid']));
while ($row_customer = $result_customers_stmt->fetch(PDO::FETCH_ASSOC)) {
$customers.= makeoption(getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid']);
}
$def_prio = Settings::Get('ticket.default_priority');
$priorities = makeoption($lng['ticket']['high'], '1', $def_prio);
$priorities.= makeoption($lng['ticket']['normal'], '2', $def_prio);
$priorities.= makeoption($lng['ticket']['low'], '3', $def_prio);
$ticket_new_data = include_once dirname(__FILE__).'/lib/formfields/admin/tickets/formfield.ticket_new.php';
$ticket_new_form = htmlform::genHTMLForm($ticket_new_data);
$title = $ticket_new_data['ticket_new']['title'];
$image = $ticket_new_data['ticket_new']['image'];
eval("echo \"" . getTemplate("tickets/tickets_new") . "\";");
}
} else {
standard_error('nomoreticketsavailable');
}
} elseif($action == 'answer'
&& $id != 0
) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$replyticket = ticket::getInstanceOf($userinfo, -1);
$replyticket->Set('subject', validate($_POST['subject'], 'subject'), true, false);
$replyticket->Set('priority', validate($_POST['priority'], 'priority'), true, false);
$replyticket->Set('message', validate(htmlentities(str_replace("\r\n", "\n", $_POST['message'])), 'message', '/^[^\0]*$/'), true, false);
if ($replyticket->Get('message') == null) {
standard_error(array('stringisempty', 'mymessage'));
} else {
$now = time();
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
$replyticket->Set('customer', $mainticket->Get('customer'), true, true);
$replyticket->Set('lastchange', $now, true, true);
$replyticket->Set('ip', $_SERVER['REMOTE_ADDR'], true, true);
$replyticket->Set('status', '1', true, true);
$replyticket->Set('answerto', (int)$id, true, false);
$replyticket->Set('by', '1', true, true);
$replyticket->Insert();
// Update priority if changed
if ($replyticket->Get('priority') != $mainticket->Get('priority')) {
$mainticket->Set('priority', $replyticket->Get('priority'), true);
}
$mainticket->Set('lastchange', $now);
$mainticket->Set('lastreplier', '1');
$mainticket->Set('status', '2');
$mainticket->Update();
$mainticket->sendMail((int)$mainticket->Get('customer'), 'new_reply_ticket_by_staff_subject', $lng['mails']['new_reply_ticket_by_staff']['subject'], 'new_reply_ticket_by_staff_mailbody', $lng['mails']['new_reply_ticket_by_staff']['mailbody']);
$log->logAction(ADM_ACTION, LOG_NOTICE, "answered ticket '" . $mainticket->Get('subject') . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
}
} else {
$ticket_replies = '';
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
$dt = date("d.m.Y H:i\h", $mainticket->Get('dt'));
$status = ticket::getStatusText($lng, $mainticket->Get('status'));
if ($mainticket->Get('status') >= 0
&& $mainticket->Get('status') <= 2
) {
$isclosed = 0;
} else {
$isclosed = 1;
}
if ($mainticket->Get('by') == '1') {
$by = $lng['ticket']['staff'];
} else {
$cid = $mainticket->Get('customer');
$usr_stmt = Database::prepare('
SELECT `customerid`, `firstname`, `name`, `company`, `loginname`
FROM `' . TABLE_PANEL_CUSTOMERS . '`
WHERE `customerid` = :cid'
);
$usr = Database::pexecute_first($usr_stmt, array('cid' => $cid));
$by = '<a href="'.$linker->getLink(array('section' => 'customers', 'page' => 'customers', 'action' => 'su', 'id' => $cid)).'" rel="external">';
$by .= getCorrectFullUserDetails($usr).'</a>';
}
$subject = $mainticket->Get('subject');
$message = $mainticket->Get('message');
eval("\$ticket_replies.=\"" . getTemplate("tickets/tickets_tickets_main") . "\";");
$result_stmt = Database::prepare('
SELECT `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` WHERE `id` = :cid'
);
$row = Database::pexecute_first($result_stmt, array('cid' => $mainticket->Get('category')));
$andere_stmt = Database::prepare('
SELECT * FROM `' . TABLE_PANEL_TICKETS . '`
WHERE `answerto` = :id ORDER BY `lastchange` ASC'
);
Database::pexecute($andere_stmt, array('id' => $id));
$numrows_andere = Database::num_rows();
while ($row2 = $andere_stmt->fetch(PDO::FETCH_ASSOC)) {
$subticket = ticket::getInstanceOf($userinfo, (int)$row2['id']);
$lastchange = date("d.m.Y H:i\h", $subticket->Get('lastchange'));
if ($subticket->Get('by') == '1') {
$by = $lng['ticket']['staff'];
} else {
$cid = $subticket->Get('customer');
$usr_stmt = Database::prepare('
SELECT `customerid`, `firstname`, `name`, `company`, `loginname`
FROM `' . TABLE_PANEL_CUSTOMERS . '`
WHERE `customerid` = :cid'
);
$usr = Database::pexecute_first($usr_stmt, array('cid' => $cid));
$by = '<a href="'.$linker->getLink(array('section' => 'customers', 'page' => 'customers', 'action' => 'su', 'id' => $cid)).'" rel="external">';
$by .= getCorrectFullUserDetails($usr).'</a>';
}
$subject = $subticket->Get('subject');
$message = $subticket->Get('message');
$row2 = htmlentities_array($row2);
eval("\$ticket_replies.=\"" . getTemplate("tickets/tickets_tickets_list") . "\";");
}
$priorities = makeoption($lng['ticket']['high'], '1', $mainticket->Get('priority'), true, true);
$priorities.= makeoption($lng['ticket']['normal'], '2', $mainticket->Get('priority'), true, true);
$priorities.= makeoption($lng['ticket']['low'], '3', $mainticket->Get('priority'), true, true);
$subject = htmlentities($mainticket->Get('subject'));
$ticket_replies_count = $numrows_andere + 1;
// don't forget the main-ticket!
$ticket_reply_data = include_once dirname(__FILE__).'/lib/formfields/admin/tickets/formfield.ticket_reply.php';
$ticket_reply_form = htmlform::genHTMLForm($ticket_reply_data);
$title = $ticket_reply_data['ticket_reply']['title'];
$image = $ticket_reply_data['ticket_reply']['image'];
eval("echo \"" . getTemplate("tickets/tickets_reply") . "\";");
}
} elseif($action == 'close'
&& $id != 0
) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$now = time();
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
$mainticket->Set('lastchange', $now, true, true);
$mainticket->Set('lastreplier', '1', true, true);
$mainticket->Set('status', '3', true, true);
$mainticket->Update();
$log->logAction(ADM_ACTION, LOG_NOTICE, "closed ticket '" . $mainticket->Get('subject') . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
} else {
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
ask_yesno('ticket_reallyclose', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject'));
}
} elseif($action == 'reopen'
&& $id != 0
) {
$now = time();
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
$mainticket->Set('lastchange', $now, true, true);
$mainticket->Set('lastreplier', '1', true, true);
$mainticket->Set('status', '0', true, true);
$mainticket->Update();
$log->logAction(ADM_ACTION, LOG_NOTICE, "reopened ticket '" . $mainticket->Get('subject') . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
} elseif($action == 'archive'
&& $id != 0
) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$now = time();
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
$mainticket->Set('lastchange', $now, true, true);
$mainticket->Set('lastreplier', '1', true, true);
$mainticket->Set('status', '3', true, true);
$mainticket->Update();
$mainticket->Archive();
$log->logAction(ADM_ACTION, LOG_NOTICE, "archived ticket '" . $mainticket->Get('subject') . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
} else {
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
ask_yesno('ticket_reallyarchive', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject'));
}
} elseif($action == 'delete'
&& $id != 0
) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
$log->logAction(ADM_ACTION, LOG_INFO, "deleted ticket '" . $mainticket->Get('subject') . "'");
$mainticket->Delete();
redirectTo($filename, array('page' => $page, 's' => $s));
} else {
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
ask_yesno('ticket_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject'));
}
}
} elseif($page == 'categories'
&& $userinfo['customers'] != '0'
) {
if ($action == '') {
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_tickets::categories");
$fields = array(
'name' => $lng['ticket']['category'],
'logicalorder' => $lng['ticket']['logicalorder']
);
$where = '1'; // WHERE 1 is like no 'where-clause'
if ($userinfo['tickets_see_all'] != '1') {
$where = " `main`.`adminid` = :adminid";
}
$paging = new paging($userinfo, TABLE_PANEL_TICKET_CATS, $fields);
$result_stmt = Database::prepare("
SELECT `main`.`id`, `main`.`name`, `main`.`logicalorder`, (
SELECT COUNT(`sub`.`id`) FROM `" . TABLE_PANEL_TICKETS . "` `sub`
WHERE `sub`.`category` = `main`.`id`
AND `sub`.`answerto` = '0'
AND `sub`.`adminid` = :adminid
) as `ticketcount`, (
SELECT COUNT(`sub2`.`id`) FROM `" . TABLE_PANEL_TICKETS . "` `sub2`
WHERE `sub2`.`category` = `main`.`id`
AND `sub2`.`answerto` = '0'
AND (`sub2`.`status` = '0' OR `sub2`.`status` = '1' OR `sub2`.`status` = '2')
AND `sub2`.`adminid` = :adminid
) as `ticketcountnotclosed`
FROM `" . TABLE_PANEL_TICKET_CATS . "` `main`
WHERE " . $where . $paging->getSqlWhere(true) . " " .
$paging->getSqlOrderBy() . " " . $paging->getSqlLimit()
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid']));
$numrows = Database::num_rows();
$paging->setEntries($numrows);
$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;
$ticketcategories = '';
$categories_count = $numrows;
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
if ($paging->checkDisplay($i)) {
$row = htmlentities_array($row);
$closedtickets_count = ($row['ticketcount'] - $row['ticketcountnotclosed']);
eval("\$ticketcategories.=\"" . getTemplate("tickets/tickets_categories") . "\";");
$count++;
}
$i++;
}
eval("echo \"" . getTemplate("tickets/categories") . "\";");
} elseif($action == 'addcategory') {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$category = validate($_POST['category'], 'category');
$order = validate($_POST['logicalorder'], 'logicalorder');
if ($order < 1 || $order >= 1000) {
// use the latest available
$order = ticket::getHighestOrderNumber($userinfo['adminid']) + 1;
}
if ($category == '') {
standard_error(array('stringisempty', 'mycategory'));
} else {
ticket::addCategory($category, $userinfo['adminid'], $order);
$log->logAction(ADM_ACTION, LOG_INFO, "added ticket-category '" . $category . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
}
} else {
$order = ticket::getHighestOrderNumber($userinfo['adminid']) + 1;
$category_new_data = include_once dirname(__FILE__).'/lib/formfields/admin/tickets/formfield.category_new.php';
$category_new_form = htmlform::genHTMLForm($category_new_data);
$title = $category_new_data['category_new']['title'];
$image = $category_new_data['category_new']['image'];
eval("echo \"" . getTemplate("tickets/tickets_newcategory") . "\";");
}
} elseif($action == 'editcategory'
&& $id != 0
) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$category = validate($_POST['category'], 'category');
$order = validate($_POST['logicalorder'], 'logicalorder');
if ($order < 1 || $order >= 1000) {
$order = 1;
}
if ($category == '') {
standard_error(array('stringisempty', 'mycategory'));
} else {
ticket::editCategory($category, $id, $order);
$log->logAction(ADM_ACTION, LOG_INFO, "edited ticket-category '" . $category . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
}
} else {
$row_stmt = Database::prepare('
SELECT * FROM `' . TABLE_PANEL_TICKET_CATS . '` WHERE `id` = :id'
);
$row = Database::pexecute_first($row_stmt, array('id' => $id));
$row = htmlentities_array($row);
$category_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/tickets/formfield.category_edit.php';
$category_edit_form = htmlform::genHTMLForm($category_edit_data);
$title = $category_edit_data['category_edit']['title'];
$image = $category_edit_data['category_edit']['image'];
eval("echo \"" . getTemplate("tickets/tickets_editcategory") . "\";");
}
} elseif($action == 'deletecategory'
&& $id != 0
) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
if (ticket::deleteCategory($id) == false) {
standard_error('categoryhastickets');
}
$log->logAction(ADM_ACTION, LOG_INFO, "deleted ticket-category #" . $id);
redirectTo($filename, array('page' => $page, 's' => $s));
} else {
$name = ticket::getCategoryName($id);
ask_yesno('ticket_reallydeletecat', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $name);
}
}
} elseif($page == 'archive'
&& $userinfo['customers'] != '0'
) {
if ($action == '') {
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_tickets::archive");
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$priority = array();
$categories = array();
$subject = validate($_POST['subject'], 'subject');
$priority[0] = isset($_POST['priority1']) ? $_POST['priority1'] : '';
$priority[1] = isset($_POST['priority2']) ? $_POST['priority2'] : '';
$priority[2] = isset($_POST['priority3']) ? $_POST['priority3'] : '';
$fromdate = validate($_POST['fromdate'], 'fromdate');
$todate = validate($_POST['todate'], 'todate');
$message = validate($_POST['message'], 'message');
$customer = validate($_POST['customer'], 'customer');
$cat_stmt = Database::query('SELECT COUNT(`id`) as `ccount` FROM `' . TABLE_PANEL_TICKET_CATS . '`');
$cat = $cat_stmt->fetch(PDO::FETCH_ASSOC);
for ($x = 0;$x < $cat['ccount'];$x++) {
$categories[$x] = isset($_POST['category' . $x]) ? $_POST['category' . $x] : '';
}
$archive_search = ticket::getArchiveSearchStatement($subject, $priority, $fromdate, $todate, $message, $customer, $userinfo['adminid'], $categories);
$query = $archive_search[0];
$archive_params = $archive_search[1];
$fields = array(
'lastchange' => $lng['ticket']['lastchange'],
'subject' => $lng['ticket']['subject'],
'lastreplier' => $lng['ticket']['lastreplier']
);
$paging = new paging($userinfo, TABLE_PANEL_TICKETS, $fields);
$result_stmt = Database::prepare($query . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
Database::pexecute($result_stmt, $archive_params);
$sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$ctickets = array();
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
if (!isset($ctickets[$row['customerid']])
|| !is_array($ctickets[$row['customerid']])
) {
$ctickets[$row['customerid']] = array();
}
$ctickets[$row['customerid']][$row['id']] = $row;
}
if ($paging->sortfield == 'customerid'
&& $paging->sortorder == 'desc'
) {
krsort($ctickets);
} else {
ksort($ctickets);
}
$i = 0;
$count = 0;
$tickets_count = 0;
$tickets = '';
foreach ($ctickets as $cid => $ticketrows) {
if ($paging->sortfield == 'lastchange'
&& $paging->sortorder == 'desc'
) {
krsort($ticketrows);
} else {
ksort($ticketrows);
}
$_cid = -1;
foreach ($ticketrows as $ticket) {
if ($paging->checkDisplay($i)) {
$ticket['lastchange'] = date("d.m.y H:i", $ticket['lastchange']);
if ($_cid != $ticket['customerid']) {
$cid = $ticket['customerid'];
$usr_stmt = Database::prepare('
SELECT `customerid`, `firstname`, `name`, `company`, `loginname`
FROM `' . TABLE_PANEL_CUSTOMERS . '`
WHERE `customerid` = :cid'
);
$usr = Database::pexecute_first($usr_stmt, array('cid' => $cid));
if (isset($usr['loginname'])) {
$customer = getCorrectFullUserDetails($usr);
$customerloginname = $usr['loginname'];
$customerid = $usr['customerid'];
} else {
$customer = $lng['ticket']['nonexistingcustomer'];
$customerid = 0;
$customerloginname = '';
}
eval("\$tickets.=\"" . getTemplate("tickets/tickets_customer") . "\";");
}
$tickets_count++;
switch ($ticket['priority'])
{
case 1: $ticket['display'] = 'high';
break;
case 2: $ticket['display'] = 'normal';
break;
case 3: $ticket['display'] = 'low';
break;
default: $ticket['display'] = 'unknown';
}
$ticket['priority'] = ticket::getPriorityText($lng, $ticket['priority']);
if ($ticket['lastreplier'] == '1') {
$ticket['lastreplier'] = $lng['ticket']['staff'];
} else {
$ticket['lastreplier'] = $lng['ticket']['customer'];
}
if (strlen($ticket['subject']) > 20) {
$ticket['subject'] = substr($ticket['subject'], 0, 17) . '...';
}
$ticket = htmlentities_array($ticket);
eval("\$tickets.=\"" . getTemplate("tickets/archived_tickets") . "\";");
$count++;
$_cid = $ticket['customerid'];
}
}
$i++;
}
eval("echo \"" . getTemplate("tickets/archivesearch") . "\";");
} else {
$archived = array();
$archived = ticket::getLastArchived(6, $userinfo['adminid']);
$tickets = '';
if ($archived !== false) {
foreach ($archived as $id => $ticket) {
$ticket['lastchange'] = date("d.m.y H:i", $ticket['lastchange']);
$ticket['priority'] = ticket::getPriorityText($lng, $ticket['priority']);
if ($ticket['lastreplier'] == '1') {
$ticket['lastreplier'] = $lng['ticket']['staff'];
} else {
$ticket['lastreplier'] = $lng['ticket']['customer'];
}
if (strlen($ticket['subject']) > 20) {
$ticket['subject'] = substr($ticket['subject'], 0, 17) . '...';
}
eval("\$tickets.=\"" . getTemplate("tickets/archived_tickets") . "\";");
}
}
$priorities_options = makecheckbox('priority1', $lng['ticket']['high'], '1');
$priorities_options.= makecheckbox('priority2', $lng['ticket']['normal'], '2');
$priorities_options.= makecheckbox('priority3', $lng['ticket']['low'], '3');
$category_options = '';
$ccount = 0;
$result = Database::query('SELECT * FROM `' . TABLE_PANEL_TICKET_CATS . '` ORDER BY `name` ASC');
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$category_options.= makecheckbox('category' . $ccount, $row['name'], $row['id'], true);
$ccount++;
}
$customers = makeoption($lng['ticket']['nocustomer'], '-1', '-1');
$result_customers_stmt = Database::prepare("
SELECT `customerid`, `loginname`, `name`, `firstname`, `company`
FROM `" . TABLE_PANEL_CUSTOMERS . "` " .
($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = :adminid")."
ORDER BY `name` ASC"
);
Database::pexecute($result_customers_stmt, array('adminid' => $userinfo['adminid']));
while ($row_customer = $result_customers_stmt->fetch(PDO::FETCH_ASSOC)) {
$customers.= makeoption(getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid']);
}
eval("echo \"" . getTemplate("tickets/archive") . "\";");
}
} elseif($action == 'view'
&& $id != 0
) {
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed archived-ticket #" . $id);
$ticket_replies = '';
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
$lastchange = date("d.m.Y H:i\h", $mainticket->Get('lastchange'));
$dt = date("d.m.Y H:i\h", $mainticket->Get('dt'));
$status = ticket::getStatusText($lng, $mainticket->Get('status'));
$isclosed = 1;
if ($mainticket->Get('by') == '1') {
$by = $lng['ticket']['staff'];
} else {
$cid = $mainticket->Get('customer');
$usr_stmt = Database::prepare('
SELECT `customerid`, `firstname`, `name`, `company`, `loginname`
FROM `' . TABLE_PANEL_CUSTOMERS . '`
WHERE `customerid` = :cid'
);
$usr = Database::pexecute_first($usr_stmt, array('cid' => $cid));
if (isset($usr['loginname'])) {
$customer = getCorrectFullUserDetails($usr);
$customerloginname = ' ('.$usr['loginname'].')';
$customerid = $usr['customerid'];
} else {
$customer = $lng['ticket']['nonexistingcustomer'];
$customerid = 0;
$customerloginname = '';
}
if ($customerid != 0) {
$by = '<a href="'.$linker->getLink(array('section' => 'customers', 'page' => 'customers', 'action' => 'su', 'id' => $customerid)).'" rel="external">';
$by .= $customer.$customerloginname.'</a>';
} else {
$by = $customer;
}
}
$subject = $mainticket->Get('subject');
$message = $mainticket->Get('message');
eval("\$ticket_replies.=\"" . getTemplate("tickets/tickets_tickets_main") . "\";");
$result_stmt = Database::prepare('
SELECT `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` WHERE `id` = :cid'
);
$row = Database::pexecute_first($result_stmt, array('cid' => $mainticket->Get('category')));
$andere_stmt = Database::prepare('
SELECT * FROM `' . TABLE_PANEL_TICKETS . '` WHERE `answerto` = :id'
);
Database::pexecute($andere_stmt, array('id' => $id));
$numrows_andere = Database::num_rows();
while ($row2 = $andere_stmt->fetch(PDO::FETCH_ASSOC)) {
$subticket = ticket::getInstanceOf($userinfo, (int)$row2['id']);
$lastchange = date("d.m.Y H:i\h", $subticket->Get('lastchange'));
if ($subticket->Get('by') == '1') {
$by = $lng['ticket']['staff'];
} else {
$cid = $subticket->Get('customer');
$usr_stmt = Database::prepare('
SELECT `customerid`, `firstname`, `name`, `company`, `loginname`
FROM `' . TABLE_PANEL_CUSTOMERS . '`
WHERE `customerid` = :cid'
);
$usr = Database::pexecute_first($usr_stmt, array('cid' => $cid));
if (isset($usr['loginname'])) {
$customer = getCorrectFullUserDetails($usr);
$customerloginname = ' ('.$usr['loginname'].')';
$customerid = $usr['customerid'];
} else {
$customer = $lng['ticket']['nonexistingcustomer'];
$customerid = 0;
$customerloginname = '';
}
if ($customerid != 0) {
$by = '<a href="'.$linker->getLink(array('section' => 'customers', 'page' => 'customers', 'action' => 'su', 'id' => $customerid)).'" rel="external">';
$by .= $customer.$customerloginname.'</a>';
} else {
$by = $customer;
}
}
$subject = $subticket->Get('subject');
$message = $subticket->Get('message');
eval("\$ticket_replies.=\"" . getTemplate("tickets/tickets_tickets_list") . "\";");
}
$priorities = makeoption($lng['ticket']['high'], '1', htmlentities($mainticket->Get('priority')), true, true);
$priorities.= makeoption($lng['ticket']['normal'], '2', htmlentities($mainticket->Get('priority')), true, true);
$priorities.= makeoption($lng['ticket']['low'], '3', htmlentities($mainticket->Get('priority')), true, true);
$subject = $mainticket->Get('subject');
$ticket_replies_count = $numrows_andere + 1;
// don't forget the main-ticket!
eval("echo \"" . getTemplate("tickets/tickets_view") . "\";");
} elseif($action == 'delete'
&& $id != 0
) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
$log->logAction(ADM_ACTION, LOG_INFO, "deleted archived ticket '" . $mainticket->Get('subject') . "'");
$mainticket->Delete();
redirectTo($filename, array('page' => $page, 's' => $s));
} else {
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
ask_yesno('ticket_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject'));
}
}
} else {
standard_error('nocustomerforticket');
}

View File

@@ -15,23 +15,15 @@
* @package Panel
*
*/
define('AREA', 'admin');
require './lib/init.php';
if ($action == 'logout') {
$logout_stmt = Database::prepare("
DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :adminid
AND `adminsession` = '1'"
);
Database::pexecute($logout_stmt, array('adminid' => $userinfo['adminid']));
redirectTo('index.php');
}
use Froxlor\Database\Database;
use Froxlor\Settings;
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
} elseif(isset($_GET['id'])) {
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
@@ -48,52 +40,52 @@ $months = array(
'9' => 'sep',
'10' => 'oct',
'11' => 'nov',
'12' => 'dec',
'12' => 'dec'
);
if ($page == 'overview' || $page == 'customers') {
$customerview = 1;
$stats_tables = '';
$minyear_stmt = Database::query("SELECT `year` FROM `". TABLE_PANEL_TRAFFIC . "` ORDER BY `year` ASC LIMIT 1");
$minyear_stmt = Database::query("SELECT `year` FROM `" . TABLE_PANEL_TRAFFIC . "` ORDER BY `year` ASC LIMIT 1");
$minyear = $minyear_stmt->fetch(PDO::FETCH_ASSOC);
if (!isset($minyear['year']) || $minyear['year'] == 0) {
if (! isset($minyear['year']) || $minyear['year'] == 0) {
$maxyears = 0;
} else {
$maxyears = date("Y") - $minyear['year'];
}
for ($years = 0; $years<=$maxyears; $years++) {
for ($years = 0; $years <= $maxyears; $years ++) {
$overview['year'] = date("Y")-$years;
$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,
'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']));
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)) {
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']),
@@ -109,33 +101,35 @@ if ($page == 'overview' || $page == 'customers') {
'sep' => '-',
'oct' => '-',
'nov' => '-',
'dec' => '-',
'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']));
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']]] = size_readable($traffic_month['traffic'], 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s');
$totals[$months[(int)$traffic_month['month']]] += $traffic_month['traffic'];
$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\", \"" . getTemplate("traffic/index_table_row") . "\");");
eval("\$domain_list .= sprintf(\"%s\", \"" . \Froxlor\UI\Template::getTemplate("traffic/index_table_row") . "\");");
}
// sum up totals
$virtual_host = array(
'name' => $lng['traffic']['months']['total'],
'name' => $lng['traffic']['months']['total']
);
foreach ($totals as $month => $bytes) {
$virtual_host[$month] = ($bytes == 0 ? '-' : size_readable($bytes, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s'));
$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\", \"" . getTemplate("traffic/index_table_row") . "\");");
eval("\$stats_tables .= sprintf(\"%s\", \"" . getTemplate("traffic/index_table") . "\");");
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 \"" . getTemplate("traffic/index") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("traffic/index") . "\";");
}

View File

@@ -14,27 +14,25 @@
* @package Panel
*
*/
define('AREA', 'admin');
require './lib/init.php';
use Froxlor\Database\Database;
use Froxlor\Settings;
if ($page == 'overview') {
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_updates");
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_updates");
/**
* this is a dirty hack but syscp 1.4.2.1 does not
* have any version/dbversion in the database (don't know why)
* so we have to set them both to run a correct upgrade
*/
if (!isFroxlor()) {
if (Settings::Get('panel.version') == null
|| Settings::Get('panel.version') == ''
) {
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') == ''
) {
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
@@ -42,40 +40,33 @@ if ($page == 'overview') {
* -> bug #54
*/
$result_stmt = Database::query("
SELECT `value` FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'dbversion'"
);
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);
Settings::Set('system.dbversion', (int) $result['value'], false);
} else {
Settings::Set('system.dbversion', 0, false);
}
}
}
if (hasDbUpdates($dbversion) || hasUpdates($version)) {
if (\Froxlor\Froxlor::hasDbUpdates() || \Froxlor\Froxlor::hasUpdates()) {
$successful_update = false;
$message = '';
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'])
) {
eval("echo \"" . getTemplate('update/update_start') . "\";");
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'])) {
eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/update_start') . "\";");
include_once './install/updatesql.php';
include_once \Froxlor\Froxlor::getInstallDir() . 'install/updatesql.php';
$redirect_url = 'admin_index.php?s=' . $s;
eval("echo \"" . getTemplate('update/update_end') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/update_end') . "\";");
updateCounters();
inserttask('1');
@chmod('./lib/userdata.inc.php', 0440);
\Froxlor\User::updateCounters();
\Froxlor\System\Cronjob::inserttask('1');
@chmod(\Froxlor\Froxlor::getInstallDir() . '/lib/userdata.inc.php', 0440);
$successful_update = true;
} else {
@@ -83,27 +74,27 @@ if ($page == 'overview') {
}
}
if (!$successful_update) {
if (! $successful_update) {
$current_version = Settings::Get('panel.version');
$current_db_version = Settings::Get('panel.db_version');
if (empty($current_db_version)) {
$current_db_version = "0";
$current_db_version = "0";
}
$new_version = $version;
$new_db_version = $dbversion;
$ui_text = $lng['update']['update_information']['part_a'];
if ($version != $current_version) {
$ui_text = str_replace('%curversion', $current_version, $ui_text);
$ui_text = str_replace('%newversion', $new_version, $ui_text);
$ui_text = str_replace('%curversion', $current_version, $ui_text);
$ui_text = str_replace('%newversion', $new_version, $ui_text);
} else {
// show db version
$ui_text = str_replace('%curversion', $current_db_version, $ui_text);
$ui_text = str_replace('%newversion', $new_db_version, $ui_text);
// show db version
$ui_text = str_replace('%curversion', $current_db_version, $ui_text);
$ui_text = str_replace('%newversion', $new_db_version, $ui_text);
}
$update_information = $ui_text;
include_once './install/updates/preconfig.php';
include_once \Froxlor\Froxlor::getInstallDir() . '/install/updates/preconfig.php';
$preconfig = getPreConfig($current_version, $current_db_version);
if ($preconfig != '') {
$update_information .= '<br />' . $preconfig . $message;
@@ -111,11 +102,11 @@ if ($page == 'overview') {
$update_information .= $lng['update']['update_information']['part_b'];
eval("echo \"" . getTemplate('update/index') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/index') . "\";");
}
} else {
$success_message = $lng['update']['noupdatesavail'];
$redirect_url = 'admin_index.php?s=' . $s;
eval("echo \"" . getTemplate('update/noupdatesavail') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/noupdatesavail') . "\";");
}
}

74
api.php Normal file
View File

@@ -0,0 +1,74 @@
<?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
*
* @param int $status
* @param string $status_message
* @param mixed $data
*
* @return void
*/
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);
echo $json_response;
exit();
}

235
api_keys.php Normal file
View File

@@ -0,0 +1,235 @@
<?php
if (! defined('AREA')) {
header("Location: index.php");
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;
// This file is being included in admin_index and customer_index
// and therefore does not need to require lib/init.php
$del_stmt = Database::prepare("DELETE FROM `" . TABLE_API_KEYS . "` WHERE id = :id");
$success_message = "";
$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
if ($action == 'delete') {
if ($id > 0) {
$chk = (AREA == 'admin' && $userinfo['customers_see_all'] == '1') ? true : false;
if (AREA == 'customer') {
$chk_stmt = Database::prepare("
SELECT c.customerid FROM `" . TABLE_PANEL_CUSTOMERS . "` c
LEFT JOIN `" . TABLE_API_KEYS . "` ak ON ak.customerid = c.customerid
WHERE ak.`id` = :id AND c.`customerid` = :cid
");
$chk = Database::pexecute_first($chk_stmt, array(
'id' => $id,
'cid' => $userinfo['customerid']
));
} elseif (AREA == 'admin' && $userinfo['customers_see_all'] == '0') {
$chk_stmt = Database::prepare("
SELECT a.adminid FROM `" . TABLE_PANEL_ADMINS . "` a
LEFT JOIN `" . TABLE_API_KEYS . "` ak ON ak.adminid = a.adminid
WHERE ak.`id` = :id AND a.`adminid` = :aid
");
$chk = Database::pexecute_first($chk_stmt, array(
'id' => $id,
'aid' => $userinfo['adminid']
));
}
if ($chk !== false) {
Database::pexecute($del_stmt, array(
'id' => $id
));
$success_message = sprintf($lng['apikeys']['apikey_removed'], $id);
}
}
} elseif ($action == 'add') {
$ins_stmt = Database::prepare("
INSERT INTO `" . TABLE_API_KEYS . "` SET
`apikey` = :key, `secret` = :secret, `adminid` = :aid, `customerid` = :cid, `valid_until` = '-1', `allowed_from` = ''
");
// customer generates for himself, admins will see a customer-select-box later
if (AREA == 'admin') {
$cid = 0;
} elseif (AREA == 'customer') {
$cid = $userinfo['customerid'];
}
$key = hash('sha256', openssl_random_pseudo_bytes(64 * 64));
$secret = hash('sha512', openssl_random_pseudo_bytes(64 * 64 * 4));
Database::pexecute($ins_stmt, array(
'key' => $key,
'secret' => $secret,
'aid' => $userinfo['adminid'],
'cid' => $cid
));
$success_message = $lng['apikeys']['apikey_added'];
} elseif ($action == 'jqEditApiKey') {
$keyid = isset($_POST['id']) ? (int) $_POST['id'] : 0;
$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]);
}
}
$ip_list = array_map('inet_ntop', array_map('inet_pton', $ip_list));
$allowed_from = implode(",", array_unique($ip_list));
}
if ($valid_until <= 0 || ! is_numeric($valid_until)) {
$valid_until = - 1;
}
$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");
// select all my (accessable) certificates
$keys_stmt_query = "SELECT ak.*, c.loginname, a.loginname as adminname
FROM `" . TABLE_API_KEYS . "` ak
LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` c ON `c`.`customerid` = `ak`.`customerid`
LEFT JOIN `" . TABLE_PANEL_ADMINS . "` a ON `a`.`adminid` = `ak`.`adminid`
WHERE ";
$qry_params = array();
if (AREA == 'admin' && $userinfo['customers_see_all'] == '0') {
// admin with only customer-specific permissions
$keys_stmt_query .= "ak.adminid = :adminid ";
$qry_params['adminid'] = $userinfo['adminid'];
$fields = array(
'a.loginname' => $lng['login']['username']
);
} elseif (AREA == 'customer') {
// customer-area
$keys_stmt_query .= "ak.customerid = :cid ";
$qry_params['cid'] = $userinfo['customerid'];
$fields = array(
'c.loginname' => $lng['login']['username']
);
} else {
// admin who can see all customers / reseller / admins
$keys_stmt_query .= "1 ";
$fields = array(
'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 = Database::prepare($keys_stmt_query);
Database::pexecute($keys_stmt, $qry_params);
$all_keys = $keys_stmt->fetchAll(PDO::FETCH_ASSOC);
$apikeys = "";
if (count($all_keys) == 0) {
$count = 0;
$message = $lng['apikeys']['no_api_keys'];
$sortcode = "";
$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) {
if ($paging->checkDisplay($idx)) {
// my own key
$isMyKey = false;
if ($key['adminid'] == $userinfo['adminid'] && ((AREA == 'admin' && $key['customerid'] == 0) || (AREA == 'customer' && $key['customerid'] == $userinfo['customerid']))) {
// this is mine
$isMyKey = true;
}
$adminCustomerLink = "";
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) . "\";");

293
build.xml Normal file
View File

@@ -0,0 +1,293 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="froxlor" default="build">
<!-- Use this when the tools are managed by Composer in ${basedir}/vendor/bin -->
<property name="pdepend" value="${basedir}/vendor/bin/pdepend" />
<property name="phpcpd" value="${basedir}/vendor/bin/phpcpd" />
<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="phpmd" value="${basedir}/vendor/bin/phpmd" />
<property name="phpunit" value="${basedir}/vendor/bin/phpunit" />
<target name="full-build"
depends="prepare,composer,static-analysis,phpunit,phpdox,-check-failure"
description="Performs static analysis, runs the tests, and generates project documentation" />
<target name="full-build-parallel"
depends="prepare,composer,static-analysis-parallel,phpunit,phpdox,-check-failure"
description="Performs static analysis (executing the tools in parallel), runs the tests, and generates project documentation" />
<target name="quick-build"
depends="prepare,composer,lint,phpunit-no-coverage"
description="Performs a lint check and runs the tests (without generating code coverage reports)" />
<target name="static-analysis"
depends="composer,lint,phploc-ci,pdepend,phpmd-ci,phpcs-ci,phpcompat-ci,phpcpd-ci"
description="Performs static analysis" />
<!-- Adjust the threadCount attribute's value to the number of CPUs -->
<target name="static-analysis-parallel"
description="Performs static analysis (executing the tools in parallel)">
<parallel threadCount="2">
<sequential>
<antcall target="pdepend" />
<antcall target="phpmd-ci" />
</sequential>
<antcall target="lint" />
<antcall target="phpcpd-ci" />
<antcall target="phpcs-ci" />
<antcall target="phpcompat-ci" />
<antcall target="phploc-ci" />
</parallel>
</target>
<target name="clean" unless="clean.done"
description="Cleanup build artifacts">
<delete dir="${basedir}/build/api" />
<delete dir="${basedir}/build/coverage" />
<delete dir="${basedir}/build/logs" />
<delete dir="${basedir}/build/pdepend" />
<delete dir="${basedir}/build/phpdox" />
<property name="clean.done" value="true" />
</target>
<target name="prepare" unless="prepare.done" depends="clean"
description="Prepare for build">
<mkdir dir="${basedir}/build/api" />
<mkdir dir="${basedir}/build/coverage" />
<mkdir dir="${basedir}/build/logs" />
<mkdir dir="${basedir}/build/pdepend" />
<mkdir dir="${basedir}/build/phpdox" />
<property name="prepare.done" value="true" />
</target>
<target name="composer"
description="Installing composer dependencies" depends="prepare">
<exec executable="composer" failonerror="true">
<arg value="install" />
<arg value="--prefer-dist" />
<arg value="--no-progress" />
</exec>
</target>
<target name="lint" unless="lint.done"
description="Perform syntax check of sourcecode files">
<apply executable="php" taskname="lint">
<arg value="-l" />
<fileset dir="${basedir}/lib/Froxlor">
<include name="**/*.php" />
<modified />
</fileset>
<fileset dir="${basedir}/tests">
<include name="**/*.php" />
<modified />
</fileset>
</apply>
<property name="lint.done" value="true" />
</target>
<target name="phploc" unless="phploc.done"
description="Measure project size using PHPLOC and print human readable output. Intended for usage on the command line.">
<exec executable="${phploc}" taskname="phploc">
<arg value="--count-tests" />
<arg path="${basedir}/lib/Froxlor" />
<arg path="${basedir}/tests" />
</exec>
<property name="phploc.done" value="true" />
</target>
<target name="phploc-ci" unless="phploc.done" depends="prepare"
description="Measure project size using PHPLOC and log result in CSV and XML format. Intended for usage within a continuous integration environment.">
<exec executable="${phploc}" taskname="phploc">
<arg value="--count-tests" />
<arg value="--log-csv" />
<arg path="${basedir}/build/logs/phploc.csv" />
<arg value="--log-xml" />
<arg path="${basedir}/build/logs/phploc.xml" />
<arg path="${basedir}/lib/Froxlor" />
<arg path="${basedir}/tests" />
</exec>
<property name="phploc.done" value="true" />
</target>
<target name="pdepend" unless="pdepend.done" depends="prepare"
description="Calculate software metrics using PHP_Depend and log result in XML format. Intended for usage within a continuous integration environment.">
<exec executable="${pdepend}" taskname="pdepend">
<arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
<arg
value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
<arg
value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
<arg path="${basedir}/lib/Froxlor" />
</exec>
<property name="pdepend.done" value="true" />
</target>
<target name="phpmd" unless="phpmd.done"
description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing.">
<exec executable="${phpmd}" taskname="phpmd">
<arg path="${basedir}/lib/Froxlor" />
<arg value="text" />
<arg path="${basedir}/phpmd.xml" />
</exec>
<property name="phpmd.done" value="true" />
</target>
<target name="phpmd-ci" unless="phpmd.done" depends="prepare"
description="Perform project mess detection using PHPMD and log result in XML format. Intended for usage within a continuous integration environment.">
<exec executable="${phpmd}" taskname="phpmd">
<arg path="${basedir}/lib/Froxlor" />
<arg value="xml" />
<arg path="${basedir}/phpmd.xml" />
<arg value="--reportfile" />
<arg path="${basedir}/build/logs/pmd.xml" />
</exec>
<property name="phpmd.done" value="true" />
</target>
<target name="phpcs" unless="phpcs.done"
description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
<exec executable="${phpcs}" taskname="phpcs">
<arg value="--standard=${basedir}/phpcs.xml" />
<arg value="--extensions=php" />
<arg path="${basedir}/lib/Froxlor" />
<arg path="${basedir}/tests" />
</exec>
<property name="phpcs.done" value="true" />
</target>
<target name="phpcs-ci" unless="phpcs.done" depends="prepare"
description="Find coding standard violations using PHP_CodeSniffer and log result in XML format. Intended for usage within a continuous integration environment.">
<exec executable="${phpcs}" output="/dev/null" taskname="phpcs">
<arg value="--report=checkstyle" />
<arg
value="--report-file=${basedir}/build/logs/checkstyle-standard.xml" />
<arg value="--standard=${basedir}/phpcs.xml" />
<arg value="--extensions=php" />
<arg path="${basedir}/lib/Froxlor" />
<arg path="${basedir}/tests" />
</exec>
<property name="phpcs.done" value="true" />
</target>
<target name="phpcompat" unless="phpcompat.done"
depends="composer"
description="Find php violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
<exec executable="${phpcs}" taskname="phpcompat">
<arg
line="--standard=PHPCompatibility --runtime-set testVersion 5.6 ${basedir}/lib/Froxlor ${basedir}/tests" />
</exec>
<property name="phpcompat.done" value="true" />
</target>
<target name="phpcompat-ci" unless="phpcompat.done"
depends="composer"
description="Find php violations using PHP_CodeSniffer and log result in XML format. Intended for usage within a continuous integration environment.">
<exec executable="${phpcs}" output="/dev/null"
taskname="phpcompat">
<arg
line="--standard=PHPCompatibility --runtime-set testVersion 5.6 --report=checkstyle --report-file=${basedir}/build/logs/checkstyle-compat.xml ${basedir}/lib/Froxlor ${basedir}/tests" />
</exec>
<property name="phpcompat.done" value="true" />
</target>
<target name="phpcpd" unless="phpcpd.done"
description="Find duplicate code using PHPCPD and print human readable output. Intended for usage on the command line before committing.">
<exec executable="${phpcpd}" taskname="phpcpd">
<arg path="${basedir}/lib/Froxlor" />
</exec>
<property name="phpcpd.done" value="true" />
</target>
<target name="phpcpd-ci" unless="phpcpd.done" depends="prepare"
description="Find duplicate code using PHPCPD and log result in XML format. Intended for usage within a continuous integration environment.">
<exec executable="${phpcpd}" taskname="phpcpd">
<arg value="--log-pmd" />
<arg path="${basedir}/build/logs/pmd-cpd.xml" />
<arg path="${basedir}/lib/Froxlor" />
</exec>
<property name="phpcpd.done" value="true" />
</target>
<target name="phpunit-prepare" unless="phpunit-prepare.done" depends="composer"
description="prepare xdebug unit tests">
<exec executable="${phpunit}" resultproperty="result.phpunit-prepare"
taskname="phpunit">
<arg value="--configuration" />
<arg path="${basedir}/phpunit.xml" />
<arg value="--dump-xdebug-filter" />
<arg path="${basedir}/tests/xdebug-filter.php" />
</exec>
<property name="phpunit-prepare.done" value="true" />
</target>
<target name="phpunit" unless="phpunit.done" depends="phpunit-prepare"
description="Run unit tests with PHPUnit">
<exec executable="${phpunit}" failonerror="true" resultproperty="result.phpunit"
taskname="phpunit">
<arg value="--configuration" />
<arg path="${basedir}/phpunit.xml" />
<arg value="--testsuite" />
<arg value="froxlor" />
<arg value="--prepend" />
<arg path="${basedir}/tests/xdebug-filter.php" />
</exec>
<property name="phpunit.done" value="true" />
</target>
<target name="phpunit-no-coverage" unless="phpunit.done"
depends="composer"
description="Run unit tests with PHPUnit (without generating code coverage reports)">
<exec executable="${phpunit}" failonerror="true"
taskname="phpunit">
<arg value="--configuration" />
<arg path="${basedir}/phpunit.xml" />
<arg value="--testsuite" />
<arg value="froxlor" />
<arg value="--no-coverage" />
</exec>
<property name="phpunit.done" value="true" />
</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">
<fail message="PHPUnit did not finish successfully">
<condition>
<not>
<equals arg1="${result.phpunit}" arg2="0" />
</not>
</condition>
</fail>
</target>
</project>

80
composer.json Normal file
View File

@@ -0,0 +1,80 @@
{
"name": "froxlor/froxlor",
"description": "The server administration software for your needs. Developed by experienced server administrators, this panel simplifies the effort of managing your hosting platform.",
"keywords": [
"server",
"administration",
"php"
],
"homepage": "https://www.froxlor.org",
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "Michael Kaufmann",
"email": "team@froxlor.org",
"role": "Lead Developer"
},
{
"name": "Robert Förster",
"email": "team@froxlor.org",
"role": "Package Maintainer"
}
],
"support": {
"email": "team@froxlor.org",
"issues": "https://github.com/Froxlor/Froxlor/issues",
"forum": "https://forum.froxlor.org/",
"wiki": "https://github.com/Froxlor/Froxlor/wiki",
"irc": "irc://chat.freenode.net/froxlor",
"source": "https://github.com/Froxlor/Froxlor",
"docs": "https://github.com/Froxlor/Froxlor/wiki"
},
"require": {
"php": ">=7.0",
"ext-session": "*",
"ext-ctype": "*",
"ext-pdo": "*",
"ext-pdo_mysql": "*",
"ext-simplexml": "*",
"ext-xml": "*",
"ext-filter": "*",
"ext-posix": "*",
"ext-mbstring": "*",
"ext-curl": "*",
"ext-json": "*",
"ext-openssl": "*",
"phpmailer/phpmailer": "~6.0",
"monolog/monolog": "^1.24",
"robthree/twofactorauth": "^1.6",
"algo26-matthias/idna-convert": "^2.1"
},
"require-dev": {
"phpunit/phpunit": "^8",
"php": ">=7.3",
"ext-pcntl": "*",
"phpcompatibility/php-compatibility": "*",
"squizlabs/php_codesniffer": "*",
"pdepend/pdepend": "^2.5",
"sebastian/phpcpd": "^4.1",
"theseer/phpdox": "^0.12.0",
"phploc/phploc": "^5.0",
"phpmd/phpmd": "^2.6"
},
"suggest": {
"ext-bcmath": "*",
"ext-zip": "*",
"ext-apcu": "*",
"ext-readline": "*"
},
"autoload": {
"psr-4": {
"Froxlor\\": [
"lib/Froxlor"
]
}
},
"scripts": {
"post-install-cmd": "if [ -f ./vendor/bin/phpcs ]; then \"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility ; fi",
"post-update-cmd" : "if [ -f ./vendor/bin/phpcs ]; then \"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility ; fi"
}
}

2963
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

1896
css/jquery-ui.min.css vendored

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -19,9 +19,15 @@
define('AREA', 'customer');
require './lib/init.php';
use Froxlor\Database\Database;
use Froxlor\Settings;
use Froxlor\Api\Commands\DirOptions as DirOptions;
use Froxlor\Api\Commands\DirProtections as DirProtections;
use Froxlor\Api\Commands\CustomerBackups as CustomerBackups;
// redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','extras')) {
redirectTo('customer_index.php');
if (Settings::IsInList('panel.customer_hide_options', 'extras')) {
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
if (isset($_POST['id'])) {
@@ -31,22 +37,22 @@ if (isset($_POST['id'])) {
}
if ($page == 'overview') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras");
eval("echo \"" . getTemplate("extras/extras") . "\";");
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_extras");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/extras") . "\";");
} elseif ($page == 'htpasswds') {
// redirect if this customer sub-page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','extras.directoryprotection')) {
redirectTo('customer_index.php');
if (Settings::IsInList('panel.customer_hide_options', 'extras.directoryprotection')) {
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
if ($action == '') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras::htpasswds");
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_extras::htpasswds");
$fields = array(
'username' => $lng['login']['username'],
'path' => $lng['panel']['path']
);
$paging = new paging($userinfo, TABLE_PANEL_HTPASSWDS, $fields);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_HTPASSWDS, $fields);
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "`
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
Database::pexecute($result_stmt, array(
@@ -66,39 +72,34 @@ if ($page == 'overview') {
if (strpos($row['path'], $userinfo['documentroot']) === 0) {
$row['path'] = str_replace($userinfo['documentroot'], "/", $row['path']);
}
$row['path'] = makeCorrectDir($row['path']);
$row = htmlentities_array($row);
eval("\$htpasswds.=\"" . getTemplate("extras/htpasswds_htpasswd") . "\";");
$row['path'] = \Froxlor\FileDir::makeCorrectDir($row['path']);
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
eval("\$htpasswds.=\"" . \Froxlor\UI\Template::getTemplate("extras/htpasswds_htpasswd") . "\";");
$count ++;
}
$i ++;
}
eval("echo \"" . getTemplate("extras/htpasswds") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htpasswds") . "\";");
} elseif ($action == 'delete' && $id != 0) {
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "`
WHERE `customerid`= :customerid
AND `id`= :id");
Database::pexecute($result_stmt, array(
"customerid" => $userinfo['customerid'],
"id" => $id
));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
try {
$json_result = DirProtections::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if (isset($result['username']) && $result['username'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_HTPASSWDS . "`
WHERE `customerid`= :customerid
AND `id`= :id");
Database::pexecute($stmt, array(
"customerid" => $userinfo['customerid'],
"id" => $id
));
$log->logAction(USR_ACTION, LOG_INFO, "deleted htpasswd for '" . $result['username'] . " (" . $result['path'] . ")'");
inserttask('1');
redirectTo($filename, array(
try {
DirProtections::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -107,7 +108,7 @@ if ($page == 'overview') {
$result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']);
}
ask_yesno('extras_reallydelete', $filename, array(
\Froxlor\UI\HTML::askYesNo('extras_reallydelete', $filename, array(
'id' => $id,
'page' => $page,
'action' => $action
@@ -116,171 +117,73 @@ if ($page == 'overview') {
}
} elseif ($action == 'add') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$path = makeCorrectDir(validate($_POST['path'], 'path'));
$userpath = $path;
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path);
$username = validate($_POST['username'], 'username', '/^[a-zA-Z0-9][a-zA-Z0-9\-_]+\$?$/');
$authname = validate($_POST['directory_authname'], 'directory_authname', '/^[a-zA-Z0-9][a-zA-Z0-9\-_ ]+\$?$/');
validate($_POST['directory_password'], 'password');
$username_path_check_stmt = Database::prepare("SELECT `id`, `username`, `path` FROM `" . TABLE_PANEL_HTPASSWDS . "`
WHERE `username`= :username
AND `path`= :path
AND `customerid`= :customerid");
$params = array(
"username" => $username,
"path" => $path,
"customerid" => $userinfo['customerid']
);
Database::pexecute($username_path_check_stmt, $params);
$username_path_check = $username_path_check_stmt->fetch(PDO::FETCH_ASSOC);
if (CRYPT_STD_DES == 1) {
$saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2);
$password = crypt($_POST['directory_password'], $saltfordescrypt);
} else {
$password = crypt($_POST['directory_password']);
}
if (! $_POST['path']) {
standard_error('invalidpath');
}
if ($username == '') {
standard_error(array(
'stringisempty',
'myloginname'
));
} elseif ($username_path_check['username'] == $username && $username_path_check['path'] == $path) {
standard_error('userpathcombinationdupe');
} elseif ($_POST['directory_password'] == '') {
standard_error(array(
'stringisempty',
'mypassword'
));
} elseif ($path == '') {
standard_error('patherror');
} elseif ($_POST['directory_password'] == $username) {
standard_error('passwordshouldnotbeusername');
} else {
$stmt = Database::prepare("INSERT INTO `" . TABLE_PANEL_HTPASSWDS . "` SET
`customerid` = :customerid,
`username` = :username,
`password` = :password,
`path` = :path,
`authname` = :authname");
$params = array(
"customerid" => $userinfo['customerid'],
"username" => $username,
"password" => $password,
"path" => $path,
"authname" => $authname
);
Database::pexecute($stmt, $params);
$log->logAction(USR_ACTION, LOG_INFO, "added htpasswd for '" . $username . " (" . $path . ")'");
inserttask('1');
redirectTo($filename, array(
'page' => $page,
's' => $s
));
try {
DirProtections::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
$pathSelect = \Froxlor\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_form = htmlform::genHTMLForm($htpasswd_add_data);
$htpasswd_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($htpasswd_add_data);
$title = $htpasswd_add_data['htpasswd_add']['title'];
$image = $htpasswd_add_data['htpasswd_add']['image'];
eval("echo \"" . getTemplate("extras/htpasswds_add") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htpasswds_add") . "\";");
}
} elseif ($action == 'edit' && $id != 0) {
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "`
WHERE `customerid`= :customerid
AND `id`= :id");
Database::pexecute($result_stmt, array(
"customerid" => $userinfo['customerid'],
"id" => $id
));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
try {
$json_result = DirProtections::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if (isset($result['username']) && $result['username'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
validate($_POST['directory_password'], 'password');
$authname = validate($_POST['directory_authname'], 'directory_authname', '/^[a-zA-Z0-9][a-zA-Z0-9\-_ ]+\$?$/');
if (CRYPT_STD_DES == 1) {
$saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2);
$password = crypt($_POST['directory_password'], $saltfordescrypt);
} else {
$password = crypt($_POST['directory_password']);
}
if ($_POST['directory_password'] == $result['username']) {
standard_error('passwordshouldnotbeusername');
}
$params = array(
"customerid" => $userinfo['customerid'],
"id" => $id
);
$pwd_sql = '';
if ($_POST['directory_password'] != '') {
$pwd_sql = "`password`= :password ";
$params["password"] = $password;
}
$auth_sql = '';
if ($authname != $result['authname']) {
$auth_sql = "`authname`= :authname ";
$params["authname"] = $authname;
}
if ($pwd_sql != '' || $auth_sql != '') {
if ($pwd_sql != '' && $auth_sql != '') {
$pwd_sql .= ', ';
}
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_HTPASSWDS . "`
SET " . $pwd_sql . $auth_sql . "
WHERE `customerid`= :customerid
AND `id`= :id");
Database::pexecute($stmt, $params);
$log->logAction(USR_ACTION, LOG_INFO, "edited htpasswd for '" . $result['username'] . " (" . $result['path'] . ")'");
inserttask('1');
redirectTo($filename, array(
'page' => $page,
's' => $s
));
try {
DirProtections::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
if (strpos($result['path'], $userinfo['documentroot']) === 0) {
$result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']);
}
$result = htmlentities_array($result);
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
$htpasswd_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htpasswd_edit.php';
$htpasswd_edit_form = htmlform::genHTMLForm($htpasswd_edit_data);
$htpasswd_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($htpasswd_edit_data);
$title = $htpasswd_edit_data['htpasswd_edit']['title'];
$image = $htpasswd_edit_data['htpasswd_edit']['image'];
eval("echo \"" . getTemplate("extras/htpasswds_edit") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htpasswds_edit") . "\";");
}
}
}
} elseif ($page == 'htaccess') {
// redirect if this customer sub-page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','extras.pathoptions')) {
redirectTo('customer_index.php');
if (Settings::IsInList('panel.customer_hide_options', 'extras.pathoptions')) {
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
if ($action == '') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras::htaccess");
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_extras::htaccess");
$fields = array(
'path' => $lng['panel']['path'],
'options_indexes' => $lng['extras']['view_directory'],
@@ -289,7 +192,7 @@ if ($page == 'overview') {
'error500path' => $lng['extras']['error500path'],
'options_cgi' => $lng['extras']['execute_perl']
);
$paging = new paging($userinfo, TABLE_PANEL_HTACCESS, $fields);
$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(
@@ -304,70 +207,50 @@ if ($page == 'overview') {
$count = 0;
$htaccess = '';
$cperlenabled = customerHasPerlEnabled($userinfo['customerid']);
$cperlenabled = \Froxlor\Customer\Customer::customerHasPerlEnabled($userinfo['customerid']);
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'] = makeCorrectDir($row['path']);
$row['path'] = \Froxlor\FileDir::makeCorrectDir($row['path']);
$row['options_indexes'] = str_replace('1', $lng['panel']['yes'], $row['options_indexes']);
$row['options_indexes'] = str_replace('0', $lng['panel']['no'], $row['options_indexes']);
$row['options_cgi'] = str_replace('1', $lng['panel']['yes'], $row['options_cgi']);
$row['options_cgi'] = str_replace('0', $lng['panel']['no'], $row['options_cgi']);
$row = htmlentities_array($row);
eval("\$htaccess.=\"" . getTemplate("extras/htaccess_htaccess") . "\";");
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
eval("\$htaccess.=\"" . \Froxlor\UI\Template::getTemplate("extras/htaccess_htaccess") . "\";");
$count ++;
}
$i ++;
}
eval("echo \"" . getTemplate("extras/htaccess") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htaccess") . "\";");
} elseif ($action == 'delete' && $id != 0) {
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "`
WHERE `customerid` = :customerid
AND `id` = :id");
Database::pexecute($result_stmt, array(
"customerid" => $userinfo['customerid'],
"id" => $id
));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
try {
$json_result = DirOptions::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if (isset($result['customerid']) && $result['customerid'] != '' && $result['customerid'] == $userinfo['customerid']) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
// do we have to remove the symlink and folder in suexecpath?
if ((int) Settings::Get('perl.suexecworkaround') == 1) {
$loginname = getCustomerDetail($result['customerid'], 'loginname');
$suexecpath = makeCorrectDir(Settings::Get('perl.suexecpath') . '/' . $loginname . '/' . md5($result['path']) . '/');
$perlsymlink = makeCorrectFile($result['path'] . '/cgi-bin');
// remove symlink
if (file_exists($perlsymlink)) {
safe_exec('rm -f ' . escapeshellarg($perlsymlink));
$log->logAction(USR_ACTION, LOG_DEBUG, "deleted suexecworkaround symlink '" . $perlsymlink . "'");
}
// remove folder in suexec-path
if (file_exists($suexecpath)) {
safe_exec('rm -rf ' . escapeshellarg($suexecpath));
$log->logAction(USR_ACTION, LOG_DEBUG, "deleted suexecworkaround path '" . $suexecpath . "'");
}
try {
DirOptions::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_HTACCESS . "`
WHERE `customerid`= :customerid
AND `id`= :id");
Database::pexecute($stmt, array(
"customerid" => $userinfo['customerid'],
"id" => $id
));
$log->logAction(USR_ACTION, LOG_INFO, "deleted htaccess for '" . str_replace($userinfo['documentroot'], '/', $result['path']) . "'");
inserttask('1');
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
ask_yesno('extras_reallydelete_pathoptions', $filename, array(
\Froxlor\UI\HTML::askYesNo('extras_reallydelete_pathoptions', $filename, array(
'id' => $id,
'page' => $page,
'action' => $action
@@ -376,137 +259,45 @@ if ($page == 'overview') {
}
} elseif ($action == 'add') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$path = makeCorrectDir(validate($_POST['path'], 'path'));
$userpath = $path;
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path);
$path_dupe_check_stmt = Database::prepare("SELECT `id`, `path` FROM `" . TABLE_PANEL_HTACCESS . "`
WHERE `path`= :path
AND `customerid`= :customerid");
Database::pexecute($path_dupe_check_stmt, array(
"path" => $path,
"customerid" => $userinfo['customerid']
try {
DirOptions::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
$path_dupe_check = $path_dupe_check_stmt->fetch(PDO::FETCH_ASSOC);
if (! $_POST['path']) {
standard_error('invalidpath');
}
if (isset($_POST['options_cgi']) && (int) $_POST['options_cgi'] != 0) {
$options_cgi = '1';
} else {
$options_cgi = '0';
}
$error404path = '';
if (isset($_POST['error404path'])) {
$error404path = correctErrorDocument($_POST['error404path']);
}
$error403path = '';
if (isset($_POST['error403path'])) {
$error403path = correctErrorDocument($_POST['error403path']);
}
$error500path = '';
if (isset($_POST['error500path'])) {
$error500path = correctErrorDocument($_POST['error500path']);
}
if ($path_dupe_check['path'] == $path) {
standard_error('errordocpathdupe', $userpath);
} elseif ($path == '') {
standard_error('patherror');
} else {
$stmt = Database::prepare('INSERT INTO `' . TABLE_PANEL_HTACCESS . '` SET
`customerid` = :customerid,
`path` = :path,
`options_indexes` = :options_indexes,
`error404path` = :error404path,
`error403path` = :error403path,
`error500path` = :error500path,
`options_cgi` = :options_cgi');
$params = array(
"customerid" => $userinfo['customerid'],
"path" => $path,
"options_indexes" => $_POST['options_indexes'] == '1' ? '1' : '0',
"error403path" => $error403path,
"error404path" => $error404path,
"error500path" => $error500path,
"options_cgi" => $options_cgi
);
Database::pexecute($stmt, $params);
$log->logAction(USR_ACTION, LOG_INFO, "added htaccess for '" . $path . "'");
inserttask('1');
redirectTo($filename, array(
'page' => $page,
's' => $s
));
}
} else {
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
$cperlenabled = customerHasPerlEnabled($userinfo['customerid']);
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
$cperlenabled = \Froxlor\Customer\Customer::customerHasPerlEnabled($userinfo['customerid']);
$htaccess_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htaccess_add.php';
$htaccess_add_form = htmlform::genHTMLForm($htaccess_add_data);
$htaccess_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($htaccess_add_data);
$title = $htaccess_add_data['htaccess_add']['title'];
$image = $htaccess_add_data['htaccess_add']['image'];
eval("echo \"" . getTemplate("extras/htaccess_add") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htaccess_add") . "\";");
}
} elseif (($action == 'edit') && ($id != 0)) {
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "`
WHERE `customerid` = :customerid
AND `id` = :id");
Database::pexecute($result_stmt, array(
"customerid" => $userinfo['customerid'],
"id" => $id
));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
try {
$json_result = DirOptions::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if ((isset($result['customerid'])) && ($result['customerid'] != '') && ($result['customerid'] == $userinfo['customerid'])) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$option_indexes = intval($_POST['options_indexes']);
$options_cgi = isset($_POST['options_cgi']) ? intval($_POST['options_cgi']) : 0;
if ($option_indexes != '1') {
$option_indexes = '0';
try {
DirOptions::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
if ($options_cgi != '1') {
$options_cgi = '0';
}
$error404path = correctErrorDocument($_POST['error404path']);
$error403path = correctErrorDocument($_POST['error403path']);
$error500path = correctErrorDocument($_POST['error500path']);
if (($option_indexes != $result['options_indexes']) || ($error404path != $result['error404path']) || ($error403path != $result['error403path']) || ($error500path != $result['error500path']) || ($options_cgi != $result['options_cgi'])) {
inserttask('1');
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_HTACCESS . "`
SET `options_indexes` = :options_indexes,
`error404path` = :error404path,
`error403path` = :error403path,
`error500path` = :error500path,
`options_cgi` = :options_cgi
WHERE `customerid` = :customerid
AND `id` = :id");
$params = array(
"customerid" => $userinfo['customerid'],
"options_indexes" => $_POST['options_indexes'] == '1' ? '1' : '0',
"error403path" => $error403path,
"error404path" => $error404path,
"error500path" => $error500path,
"options_cgi" => $options_cgi,
"id" => $id
);
Database::pexecute($stmt, $params);
$log->logAction(USR_ACTION, LOG_INFO, "edited htaccess for '" . str_replace($userinfo['documentroot'], '/', $result['path']) . "'");
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -518,123 +309,92 @@ if ($page == 'overview') {
$result['error404path'] = $result['error404path'];
$result['error403path'] = $result['error403path'];
$result['error500path'] = $result['error500path'];
$cperlenabled = customerHasPerlEnabled($userinfo['customerid']);
$cperlenabled = \Froxlor\Customer\Customer::customerHasPerlEnabled($userinfo['customerid']);
/*
* $options_indexes = makeyesno('options_indexes', '1', '0', $result['options_indexes']);
* $options_cgi = makeyesno('options_cgi', '1', '0', $result['options_cgi']);
* $options_indexes = \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 = htmlentities_array($result);
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
$htaccess_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htaccess_edit.php';
$htaccess_edit_form = htmlform::genHTMLForm($htaccess_edit_data);
$htaccess_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($htaccess_edit_data);
$title = $htaccess_edit_data['htaccess_edit']['title'];
$image = $htaccess_edit_data['htaccess_edit']['image'];
eval("echo \"" . getTemplate("extras/htaccess_edit") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htaccess_edit") . "\";");
}
}
}
} elseif ($page == 'backup') {
// redirect if this customer sub-page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','extras.backup')) {
redirectTo('customer_index.php');
if (Settings::IsInList('panel.customer_hide_options', 'extras.backup')) {
\Froxlor\UI\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') {
$log->logAction(USR_ACTION, LOG_NOTICE, "customer_extras::backup - aborted scheduled backupjob");
$entry = isset($_POST['backup_job_entry']) ? (int)$_POST['backup_job_entry'] : 0;
if ($entry > 0) {
$del_stmt = Database::prepare("DELETE FROM `".TABLE_PANEL_TASKS."` WHERE `id` = :tid");
Database::pexecute($del_stmt, array('tid' => $entry));
standard_success('backupaborted');
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "customer_extras::backup - aborted scheduled backupjob");
try {
CustomerBackups::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array('page' => $page, 'action' => '', 's' => $s));
\Froxlor\UI\Response::standard_success('backupaborted');
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
'action' => '',
's' => $s
));
}
if ($action == '') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras::backup");
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_extras::backup");
// check whether there is a backup-job for this customer
$sel_stmt = Database::prepare("SELECT * FROM `".TABLE_PANEL_TASKS."` WHERE `type` = '20'");
Database::pexecute($sel_stmt);
try {
$json_result = CustomerBackups::getLocal($userinfo)->listing();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
$existing_backupJob = null;
while ($entry = $sel_stmt->fetch())
{
$data = unserialize($entry['data']);
if ($data['customerid'] == $userinfo['customerid']) {
$existing_backupJob = $entry;
break;
}
if ($result['count'] > 0) {
$existing_backupJob = array_shift($result['list']);
}
if (isset($_POST['send']) && $_POST['send'] == 'send') {
if (! $_POST['path']) {
standard_error('invalidpath');
try {
CustomerBackups::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$path = makeCorrectDir(validate($_POST['path'], 'path'));
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path);
$backup_dbs = isset($_POST['backup_dbs']) ? intval($_POST['backup_dbs']) : 0;
$backup_mail = isset($_POST['backup_mail']) ? intval($_POST['backup_mail']) : 0;
$backup_web = isset($_POST['backup_web']) ? intval($_POST['backup_web']) : 0;
if ($backup_dbs != '1') {
$backup_dbs = '0';
}
if ($backup_mail != '1') {
$backup_mail = '0';
}
if ($backup_web != '1') {
$backup_web = '0';
}
$task_data = array(
'customerid' => $userinfo['customerid'],
'uid' => $userinfo['guid'],
'gid' => $userinfo['guid'],
'loginname' => $userinfo['loginname'],
'destdir' => $path,
'backup_dbs' => $backup_dbs,
'backup_mail' => $backup_mail,
'backup_web' => $backup_web
);
// schedule backup job
inserttask('20', $task_data);
standard_success('backupscheduled');
\Froxlor\UI\Response::standard_success('backupscheduled');
} else {
if (!empty($existing_backupJob)) {
if (! empty($existing_backupJob)) {
$action = "abort";
$row = unserialize($entry['data']);
$row['path'] = makeCorrectDir(str_replace($userinfo['documentroot'], "/", $row['destdir']));
$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 = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
$backup_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.backup.php';
$backup_form = htmlform::genHTMLForm($backup_data);
$backup_form = \Froxlor\UI\HtmlForm::genHTMLForm($backup_data);
$title = $backup_data['backup']['title'];
$image = $backup_data['backup']['image'];
if (!empty($existing_backupJob)) {
if (! empty($existing_backupJob)) {
// overwrite backup_form after we took everything from it we needed
eval("\$backup_form = \"" . getTemplate("extras/backup_listexisting") . "\";");
eval("\$backup_form = \"" . \Froxlor\UI\Template::getTemplate("extras/backup_listexisting") . "\";");
}
eval("echo \"" . getTemplate("extras/backup") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/backup") . "\";");
}
}
}
else
{
standard_error('backupfunctionnotenabled');
} else {
\Froxlor\UI\Response::standard_error('backupfunctionnotenabled');
}
}

View File

@@ -16,13 +16,16 @@
* @package Panel
*
*/
define('AREA', 'customer');
require './lib/init.php';
use Froxlor\Database\Database;
use Froxlor\Settings;
use Froxlor\Api\Commands\Ftps as Ftps;
// redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','ftp')) {
redirectTo('customer_index.php');
if (Settings::IsInList('panel.customer_hide_options', 'ftp')) {
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
$id = 0;
@@ -33,22 +36,23 @@ if (isset($_POST['id'])) {
}
if ($page == 'overview') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_ftp");
eval("echo \"" . getTemplate('ftp/ftp') . "\";");
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_ftp");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/ftp') . "\";");
} elseif ($page == 'accounts') {
if ($action == '') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_ftp::accounts");
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_ftp::accounts");
$fields = array(
'username' => $lng['login']['username'],
'homedir' => $lng['panel']['path'],
'description' => $lng['panel']['ftpdesc']
);
$paging = new paging($userinfo, TABLE_FTP_USERS, $fields);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_FTP_USERS, $fields);
$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']));
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);
@@ -67,421 +71,173 @@ if ($page == 'overview') {
$row['documentroot'] = $row['homedir'];
}
$row['documentroot'] = makeCorrectDir($row['documentroot']);
$row['documentroot'] = \Froxlor\FileDir::makeCorrectDir($row['documentroot']);
$row = htmlentities_array($row);
eval("\$accounts.=\"" . getTemplate('ftp/accounts_account') . "\";");
$count++;
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
eval("\$accounts.=\"" . \Froxlor\UI\Template::getTemplate('ftp/accounts_account') . "\";");
$count ++;
}
$i++;
$i ++;
}
eval("echo \"" . getTemplate('ftp/accounts') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/accounts') . "\";");
} elseif ($action == 'delete' && $id != 0) {
$result_stmt = Database::prepare("SELECT `id`, `username`, `homedir`, `up_count`, `up_bytes`, `down_count`, `down_bytes` FROM `" . TABLE_FTP_USERS . "`
WHERE `customerid` = :customerid
AND `id` = :id"
);
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
try {
$json_result = Ftps::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if (isset($result['username']) && $result['username'] != $userinfo['loginname']) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "`
SET `up_count` = `up_count` + :up_count,
`up_bytes` = `up_bytes` + :up_bytes,
`down_count` = `down_count` + :down_count,
`down_bytes` = `down_bytes` + :down_bytes
WHERE `username` = :username"
);
$params = array(
"up_count" => $result['up_count'],
"up_bytes" => $result['up_bytes'],
"down_count" => $result['down_count'],
"down_bytes" => $result['down_bytes'],
"username" => $userinfo['loginname']
);
Database::pexecute($stmt, $params);
$result_stmt = Database::prepare("SELECT `username`, `homedir` FROM `" . TABLE_FTP_USERS . "`
WHERE `customerid` = :customerid
AND `id` = :id"
);
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$stmt = Database::prepare("DELETE FROM `" . TABLE_FTP_QUOTATALLIES . "` WHERE `name` = :name");
Database::pexecute($stmt, array("name" => $result['username']));
$stmt = Database::prepare("DELETE FROM `" . TABLE_FTP_USERS . "`
WHERE `customerid` = :customerid
AND `id` = :id"
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
$stmt = Database::prepare("
UPDATE `" . TABLE_FTP_GROUPS . "` SET
`members` = REPLACE(`members`, :username,'')
WHERE `customerid` = :customerid
");
Database::pexecute($stmt, array("username" => ",".$result['username'], "customerid" => $userinfo['customerid']));
$log->logAction(USR_ACTION, LOG_INFO, "deleted ftp-account '" . $result['username'] . "'");
$resetaccnumber = ($userinfo['ftps_used'] == '1') ? " , `ftp_lastaccountnumber`='0'" : '';
// refs #293
if (isset($_POST['delete_userfiles']) && (int)$_POST['delete_userfiles'] == 1) {
inserttask('8', $userinfo['loginname'], $result['homedir']);
try {
Ftps::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "`
SET `ftps_used` = `ftps_used` - 1 $resetaccnumber
WHERE `customerid` = :customerid"
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid']));
redirectTo($filename, array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
ask_yesno_withcheckbox('ftp_reallydelete', 'admin_customer_alsoremoveftphomedir', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['username']);
\Froxlor\UI\HTML::askYesNoWithCheckbox('ftp_reallydelete', 'admin_customer_alsoremoveftphomedir', $filename, array(
'id' => $id,
'page' => $page,
'action' => $action
), $result['username']);
}
} else {
standard_error('ftp_cantdeletemainaccount');
\Froxlor\UI\Response::standard_error('ftp_cantdeletemainaccount');
}
} elseif ($action == 'add') {
if ($userinfo['ftps_used'] < $userinfo['ftps'] || $userinfo['ftps'] == '-1') {
if (isset($_POST['send'])
&& $_POST['send'] == 'send') {
$description = validate($_POST['ftp_description'], 'description');
// @FIXME use a good path-validating regex here (refs #1231)
$path = validate($_POST['path'], 'path');
$password = validate($_POST['ftp_password'], 'password');
$password = validatePassword($password);
$shell = "/bin/false";
if (Settings::Get('system.allow_customer_shell') == '1') {
$shell = isset($_POST['shell']) ? validate($_POST['shell'], 'shell') : '/bin/false';
}
$sendinfomail = isset($_POST['sendinfomail']) ? 1 : 0;
if ($sendinfomail != 1) {
$sendinfomail = 0;
}
if (Settings::Get('customer.ftpatdomain') == '1') {
$ftpusername = validate($_POST['ftp_username'], 'username', '/^[a-zA-Z0-9][a-zA-Z0-9\-_]+\$?$/');
if ($ftpusername == '') {
standard_error(array('stringisempty', 'username'));
}
$ftpdomain = $idna_convert->encode(validate($_POST['ftp_domain'], 'domain'));
$ftpdomain_check_stmt = Database::prepare("SELECT `id`, `domain`, `customerid` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `domain` = :domain
AND `customerid` = :customerid"
);
Database::pexecute($ftpdomain_check_stmt, array("domain" => $ftpdomain, "customerid" => $userinfo['customerid']));
$ftpdomain_check = $ftpdomain_check_stmt->fetch(PDO::FETCH_ASSOC);
if ($ftpdomain_check['domain'] != $ftpdomain) {
standard_error('maindomainnonexist', $domain);
}
$username = $ftpusername . "@" . $ftpdomain;
} else {
$username = $userinfo['loginname'] . Settings::Get('customer.ftpprefix') . (intval($userinfo['ftp_lastaccountnumber']) + 1);
}
$username_check_stmt = Database::prepare("SELECT * FROM `" . TABLE_FTP_USERS . "`
WHERE `username` = :username"
);
Database::pexecute($username_check_stmt, array("username" => $username));
$username_check = $username_check_stmt->fetch(PDO::FETCH_ASSOC);
if (!empty($username_check) && $username_check['username'] = $username) {
standard_error('usernamealreadyexists', $username);
} elseif ($password == '') {
standard_error(array('stringisempty', 'mypassword'));
} elseif ($path == '') {
standard_error('patherror');
} elseif ($username == $password) {
standard_error('passwordshouldnotbeusername');
} else {
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path);
$cryptPassword = makeCryptPassword($password);
$stmt = Database::prepare("INSERT INTO `" . TABLE_FTP_USERS . "`
(`customerid`, `username`, `description`, `password`, `homedir`, `login_enabled`, `uid`, `gid`, `shell`)
VALUES (:customerid, :username, :description, :password, :homedir, 'y', :guid, :guid, :shell)"
);
$params = array(
"customerid" => $userinfo['customerid'],
"username" => $username,
"description" => $description,
"password" => $cryptPassword,
"homedir" => $path,
"guid" => $userinfo['guid'],
"shell" => $shell
);
Database::pexecute($stmt, $params);
$result_stmt = Database::prepare("SELECT `bytes_in_used` FROM `" . TABLE_FTP_QUOTATALLIES . "`
WHERE `name` = :name"
);
Database::pexecute($result_stmt, array("name" => $userinfo['loginname']));
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$stmt = Database::prepare("INSERT INTO `" . TABLE_FTP_QUOTATALLIES . "`
(`name`, `quota_type`, `bytes_in_used`, `bytes_out_used`, `bytes_xfer_used`, `files_in_used`, `files_out_used`, `files_xfer_used`)
VALUES (:name, 'user', :bytes_in_used, '0', '0', '0', '0', '0')"
);
Database::pexecute($stmt, array("name" => $username, "bytes_in_used" => $row['bytes_in_used']));
}
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_GROUPS . "`
SET `members` = CONCAT_WS(',',`members`, :username)
WHERE `customerid`= :customerid
AND `gid`= :guid"
);
$params = array(
"username" => $username,
"customerid" => $userinfo['customerid'],
"guid" => $userinfo['guid']
);
Database::pexecute($stmt, $params);
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "`
SET `ftps_used` = `ftps_used` + 1,
`ftp_lastaccountnumber` = `ftp_lastaccountnumber` + 1
WHERE `customerid` = :customerid"
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid']));
$log->logAction(USR_ACTION, LOG_INFO, "added ftp-account '" . $username . " (" . $path . ")'");
inserttask(5);
if ($sendinfomail == 1) {
$replace_arr = array(
'SALUTATION' => getCorrectUserSalutation($userinfo),
'CUST_NAME' => getCorrectUserSalutation($userinfo), // < keep this for compatibility
'USR_NAME' => $username,
'USR_PASS' => $password,
'USR_PATH' => makeCorrectDir(str_replace($userinfo['documentroot'], "/", $path))
);
$def_language = $userinfo['def_language'];
$result_stmt = Database::prepare("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid
AND `language` = :lang
AND `templategroup`='mails'
AND `varname`='new_ftpaccount_by_customer_subject'"
);
Database::pexecute($result_stmt, array("adminid" => $userinfo['adminid'], "lang" => $def_language));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$mail_subject = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['mails']['new_ftpaccount_by_customer']['subject']), $replace_arr));
$def_language = $userinfo['def_language'];
$result_stmt = Database::prepare("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid
AND `language` = :lang
AND `templategroup`='mails'
AND `varname`='new_ftpaccount_by_customer_mailbody'"
);
Database::pexecute($result_stmt, array("adminid" => $userinfo['adminid'], "lang" => $def_language));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$mail_body = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['mails']['new_ftpaccount_by_customer']['mailbody']), $replace_arr));
$_mailerror = false;
try {
$mail->Subject = $mail_subject;
$mail->AltBody = $mail_body;
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
$mail->AddAddress($userinfo['email'], getCorrectUserSalutation($userinfo));
$mail->Send();
} catch(phpmailerException $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
$mailerr_msg = $e->getMessage();
$_mailerror = true;
}
if ($_mailerror) {
$log->logAction(USR_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
standard_error('errorsendingmail', $userinfo['email']);
}
$mail->ClearAddresses();
}
redirectTo($filename, array('page' => $page, 's' => $s));
if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
Ftps::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], '/');
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], '/');
if (Settings::Get('customer.ftpatdomain') == '1') {
$domainlist = array();
$domains = '';
$result_domains_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `customerid`= :customerid"
);
Database::pexecute($result_domains_stmt, array("customerid" => $userinfo['customerid']));
WHERE `customerid`= :customerid");
Database::pexecute($result_domains_stmt, array(
"customerid" => $userinfo['customerid']
));
while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
$domainlist[] = $row_domain['domain'];
$domainlist[] = $row_domain['domain'];
}
sort($domainlist);
if (isset($domainlist[0]) && $domainlist[0] != '') {
foreach ($domainlist as $dom) {
$domains .= makeoption($idna_convert->decode($dom), $dom);
$domains .= \Froxlor\UI\HTML::makeoption($idna_convert->decode($dom), $dom);
}
}
}
if (Settings::Get('system.allow_customer_shell') == '1') {
$shells = makeoption("/bin/false", "/bin/false", "/bin/false");
$shells = \Froxlor\UI\HTML::makeoption("/bin/false", "/bin/false", "/bin/false");
$shells_avail = Settings::Get('system.available_shells');
if (!empty($shells_avail)) {
if (! empty($shells_avail)) {
$shells_avail = explode(",", $shells_avail);
$shells_avail = array_map("trim", $shells_avail);
foreach ($shells_avail as $_shell) {
$shells .= makeoption($_shell, $_shell, "/bin/false");
$shells .= \Froxlor\UI\HTML::makeoption($_shell, $_shell, "/bin/false");
}
}
}
//$sendinfomail = makeyesno('sendinfomail', '1', '0', '0');
// $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_form = htmlform::genHTMLForm($ftp_add_data);
$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'];
$image = $ftp_add_data['ftp_add']['image'];
eval("echo \"" . getTemplate('ftp/accounts_add') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/accounts_add') . "\";");
}
}
} elseif ($action == 'edit' && $id != 0) {
$result_stmt = Database::prepare("SELECT `id`, `username`, `description`, `homedir`, `uid`, `gid`, `shell` FROM `" . TABLE_FTP_USERS . "`
WHERE `customerid` = :customerid
AND `id` = :id"
);
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
try {
$json_result = Ftps::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if (isset($result['username']) && $result['username'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
// @FIXME use a good path-validating regex here (refs #1231)
$path = validate($_POST['path'], 'path');
$shell = "/bin/false";
if (Settings::Get('system.allow_customer_shell') == '1') {
$shell = isset($_POST['shell']) ? validate($_POST['shell'], 'shell') : '/bin/false';
try {
Ftps::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$_setnewpass = false;
if (isset($_POST['ftp_password']) && $_POST['ftp_password'] != '') {
$password = validate($_POST['ftp_password'], 'password');
$password = validatePassword($password);
$_setnewpass = true;
}
if ($_setnewpass) {
if ($password == '') {
standard_error(array('stringisempty', 'mypassword'));
} elseif ($result['username'] == $password) {
standard_error('passwordshouldnotbeusername');
}
$log->logAction(USR_ACTION, LOG_INFO, "updated ftp-account password for '" . $result['username'] . "'");
$cryptPassword = makeCryptPassword($password);
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "`
SET `password` = :password
WHERE `customerid` = :customerid
AND `id` = :id"
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid'], "id" => $id, "password" => $cryptPassword));
}
if ($path != '') {
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path);
if ($path != $result['homedir']) {
if (!file_exists($path)) {
// it's the task for "new ftp" but that will
// create all directories and correct their permissions
inserttask(5);
}
$log->logAction(USR_ACTION, LOG_INFO, "updated ftp-account homdir for '" . $result['username'] . "'");
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "`
SET `homedir` = :homedir
WHERE `customerid` = :customerid
AND `id` = :id"
);
$params = array(
"homedir" => $path,
"customerid" => $userinfo['customerid'],
"id" => $id
);
Database::pexecute($stmt, $params);
}
}
$log->logAction(USR_ACTION, LOG_INFO, "edited ftp-account '" . $result['username'] . "'");
$description = validate($_POST['ftp_description'], 'description');
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "`
SET `description` = :desc, `shell` = :shell
WHERE `customerid` = :customerid
AND `id` = :id"
);
Database::pexecute($stmt, array("desc" => $description, "shell" => $shell, "customerid" => $userinfo['customerid'], "id" => $id));
redirectTo($filename, array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
if (strpos($result['homedir'], $userinfo['documentroot']) === 0) {
$homedir = str_replace($userinfo['documentroot'], "/", $result['homedir']);
} else {
$homedir = $result['homedir'];
}
$homedir = makeCorrectDir($homedir);
$homedir = \Froxlor\FileDir::makeCorrectDir($homedir);
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $homedir);
$pathSelect = \Froxlor\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']));
WHERE `customerid` = :customerid");
Database::pexecute($result_domains_stmt, array(
"customerid" => $userinfo['customerid']
));
while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
$domains .= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['domain']);
$domains .= \Froxlor\UI\HTML::makeoption($idna_convert->decode($row_domain['domain']), $row_domain['domain']);
}
}
if (Settings::Get('system.allow_customer_shell') == '1') {
$shells = makeoption("/bin/false", "/bin/false", $result['shell']);
$shells = \Froxlor\UI\HTML::makeoption("/bin/false", "/bin/false", $result['shell']);
$shells_avail = Settings::Get('system.available_shells');
if (!empty($shells_avail)) {
if (! empty($shells_avail)) {
$shells_avail = explode(",", $shells_avail);
$shells_avail = array_map("trim", $shells_avail);
foreach ($shells_avail as $_shell) {
$shells .= makeoption($_shell, $_shell, $result['shell']);
$shells .= \Froxlor\UI\HTML::makeoption($_shell, $_shell, $result['shell']);
}
}
}
$ftp_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/ftp/formfield.ftp_edit.php';
$ftp_edit_form = htmlform::genHTMLForm($ftp_edit_data);
$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'];
$image = $ftp_edit_data['ftp_edit']['image'];
eval("echo \"" . getTemplate('ftp/accounts_edit') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/accounts_edit') . "\";");
}
}
}

View File

@@ -16,41 +16,47 @@
* @package Panel
*
*/
define('AREA', 'customer');
require './lib/init.php';
if ($action == 'logout') {
$log->logAction(USR_ACTION, LOG_NOTICE, 'logged out');
use Froxlor\Database\Database;
use Froxlor\Settings;
use Froxlor\Api\Commands\Customers as Customers;
$params = array("customerid" => $userinfo['customerid']);
if ($action == 'logout') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, 'logged out');
$params = array(
"customerid" => $userinfo['customerid']
);
if (Settings::Get('session.allow_multiple_login') == '1') {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :customerid
AND `adminsession` = '0'
AND `hash` = :hash"
);
AND `hash` = :hash");
$params["hash"] = $s;
} else {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :customerid
AND `adminsession` = '0'"
);
AND `adminsession` = '0'");
}
Database::pexecute($stmt, $params);
redirectTo('index.php');
\Froxlor\UI\Response::redirectTo('index.php');
}
if ($page == 'overview') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_index");
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_index");
$domain_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `customerid` = :customerid
AND `parentdomainid` = '0'
AND `id` <> :standardsubdomain
");
Database::pexecute($domain_stmt, array("customerid" => $userinfo['customerid'], "standardsubdomain" => $userinfo['standardsubdomain']));
Database::pexecute($domain_stmt, array(
"customerid" => $userinfo['customerid'],
"standardsubdomain" => $userinfo['standardsubdomain']
));
$domains = '';
$domainArray = array();
@@ -70,7 +76,10 @@ if ($page == 'overview') {
WHERE `customerid` = :customerid
AND `id` = :standardsubdomain
");
$std_domain = Database::pexecute_first($std_domain_stmt, array("customerid" => $userinfo['customerid'], "standardsubdomain" => $userinfo['standardsubdomain']));
$std_domain = Database::pexecute_first($std_domain_stmt, array(
"customerid" => $userinfo['customerid'],
"standardsubdomain" => $userinfo['standardsubdomain']
));
$stdsubdomain = $std_domain['domain'];
}
@@ -79,124 +88,149 @@ if ($page == 'overview') {
$month = date('M Y', $yesterday);
// get disk-space usages for web, mysql and mail
$usages_stmt = Database::prepare("SELECT * FROM `".TABLE_PANEL_DISKSPACE."` WHERE `customerid` = :cid ORDER BY `stamp` DESC LIMIT 1");
$usages = Database::pexecute_first($usages_stmt, array('cid' => $userinfo['customerid']));
$usages_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_DISKSPACE . "` WHERE `customerid` = :cid ORDER BY `stamp` DESC LIMIT 1");
$usages = Database::pexecute_first($usages_stmt, array(
'cid' => $userinfo['customerid']
));
if ($usages)
{
$userinfo['diskspace_used'] = round($usages['webspace'] / 1024, Settings::Get('panel.decimal_places'));
$userinfo['mailspace_used'] = round($usages['mail'] / 1024, Settings::Get('panel.decimal_places'));
$userinfo['dbspace_used'] = round($usages['mysql'] / 1024, Settings::Get('panel.decimal_places'));
$userinfo['total_used'] = round(($usages['webspace'] + $usages['mail'] + $usages['mysql']) / 1024, Settings::Get('panel.decimal_places'));
} else {
$userinfo['diskspace_used'] = 0;
$userinfo['mailspace_used'] = 0;
$userinfo['dbspace_used'] = 0;
$userinfo['total_used'] = 0;
}
$userinfo['diskspace'] = round($userinfo['diskspace'] / 1024, Settings::Get('panel.decimal_places'));
$userinfo['diskspace_used'] = round($usages['webspace'] / 1024, Settings::Get('panel.decimal_places'));
$userinfo['mailspace_used'] = round($usages['mail'] / 1024, Settings::Get('panel.decimal_places'));
$userinfo['dbspace_used'] = round($usages['mysql'] / 1024, Settings::Get('panel.decimal_places'));
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), Settings::Get('panel.decimal_places'));
$userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), Settings::Get('panel.decimal_places'));
$userinfo = str_replace_array('-1', $lng['customer']['unlimited'], $userinfo, 'diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps tickets subdomains');
$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']) : '';
$services_enabled = "";
$se = array();
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";
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";
if ($userinfo['api_allowed'] == '1')
$se[] = '<a href="customer_index.php?s='.$s.'&page=apikeys">API</a>';
$services_enabled = implode(", ", $se);
eval("echo \"" . getTemplate('index/index') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/index') . "\";");
} elseif ($page == 'change_password') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$old_password = validate($_POST['old_password'], 'old password');
if (!validatePasswordLogin($userinfo,$old_password,TABLE_PANEL_CUSTOMERS,'customerid')) {
standard_error('oldpasswordnotcorrect');
$old_password = \Froxlor\Validate\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');
}
$new_password = validatePassword($_POST['new_password'], 'new password');
$new_password_confirm = validatePassword($_POST['new_password_confirm'], 'new password confirm');
$new_password = \Froxlor\System\Crypt::validatePassword($_POST['new_password'], 'new password');
$new_password_confirm = \Froxlor\System\Crypt::validatePassword($_POST['new_password_confirm'], 'new password confirm');
if ($old_password == '') {
standard_error(array('stringisempty', 'oldpassword'));
\Froxlor\UI\Response::standard_error(array(
'stringisempty',
'oldpassword'
));
} elseif ($new_password == '') {
standard_error(array('stringisempty', 'newpassword'));
\Froxlor\UI\Response::standard_error(array(
'stringisempty',
'newpassword'
));
} elseif ($new_password_confirm == '') {
standard_error(array('stringisempty', 'newpasswordconfirm'));
\Froxlor\UI\Response::standard_error(array(
'stringisempty',
'newpasswordconfirm'
));
} elseif ($new_password != $new_password_confirm) {
standard_error('newpasswordconfirmerror');
\Froxlor\UI\Response::standard_error('newpasswordconfirmerror');
} else {
// Update user password
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "`
SET `password` = :newpassword
WHERE `customerid` = :customerid"
);
$params = array(
"newpassword" => makeCryptPassword($new_password),
"customerid" => $userinfo['customerid']
);
Database::pexecute($stmt, $params);
$log->logAction(USR_ACTION, LOG_NOTICE, 'changed password');
try {
Customers::getLocal($userinfo, array(
'id' => $userinfo['customerid'],
'new_customer_password' => $new_password
))->update();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, 'changed password');
// Update ftp password
if (isset($_POST['change_main_ftp']) && $_POST['change_main_ftp'] == 'true') {
$cryptPassword = makeCryptPassword($new_password);
$cryptPassword = \Froxlor\System\Crypt::makeCryptPassword($new_password);
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "`
SET `password` = :password
WHERE `customerid` = :customerid
AND `username` = :username"
);
AND `username` = :username");
$params = array(
"password" => $cryptPassword,
"customerid" => $userinfo['customerid'],
"username" => $userinfo['loginname']
);
Database::pexecute($stmt, $params);
$log->logAction(USR_ACTION, LOG_NOTICE, 'changed main ftp password');
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, 'changed main ftp password');
}
// Update webalizer password
if (isset($_POST['change_webalizer']) && $_POST['change_webalizer'] == 'true') {
if (CRYPT_STD_DES == 1) {
$saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2);
$new_webalizer_password = crypt($new_password, $saltfordescrypt);
} else {
$new_webalizer_password = crypt($new_password);
}
// Update statistics password
if (isset($_POST['change_stats']) && $_POST['change_stats'] == 'true') {
$new_stats_password = \Froxlor\System\Crypt::makeCryptPassword($new_password, true);
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_HTPASSWDS . "`
SET `password` = :password
WHERE `customerid` = :customerid
AND `username` = :username"
);
AND `username` = :username");
$params = array(
"password" => $new_webalizer_password,
"password" => $new_stats_password,
"customerid" => $userinfo['customerid'],
"username" => $userinfo['loginname']
);
Database::pexecute($stmt, $params);
}
redirectTo($filename, array('s' => $s));
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
}
} else {
eval("echo \"" . getTemplate('index/change_password') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/change_password') . "\";");
}
} elseif ($page == 'change_language') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$def_language = validate($_POST['def_language'], 'default language');
$def_language = \Froxlor\Validate\Validate::validate($_POST['def_language'], 'default language');
if (isset($languages[$def_language])) {
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "`
SET `def_language` = :lang
WHERE `customerid` = :customerid"
);
Database::pexecute($stmt, array("lang" => $def_language, "customerid" => $userinfo['customerid']));
try {
Customers::getLocal($userinfo, array(
'id' => $userinfo['customerid'],
'def_language' => $def_language
))->update();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($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(USR_ACTION, LOG_NOTICE, "changed default language to '" . $def_language . "'");
WHERE `hash` = :hash");
Database::pexecute($stmt, array(
"lang" => $def_language,
"hash" => $s
));
}
redirectTo($filename, array('s' => $s));
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "changed default language to '" . $def_language . "'");
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} else {
$default_lang = Settings::Get('panel.standardlanguage');
if ($userinfo['def_language'] != '') {
@@ -204,30 +238,37 @@ if ($page == 'overview') {
}
$language_options = '';
while (list($language_file, $language_name) = each($languages)) {
$language_options .= makeoption($language_name, $language_file, $default_lang, true);
foreach ($languages as $language_file => $language_name) {
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $default_lang, true);
}
eval("echo \"" . getTemplate('index/change_language') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/change_language') . "\";");
}
} elseif ($page == 'change_theme') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$theme = validate($_POST['theme'], 'theme');
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "`
SET `theme` = :theme
WHERE `customerid` = :customerid"
);
Database::pexecute($stmt, array("theme" => $theme, "customerid" => $userinfo['customerid']));
$theme = \Froxlor\Validate\Validate::validate($_POST['theme'], 'theme');
try {
Customers::getLocal($userinfo, array(
'id' => $userinfo['customerid'],
'theme' => $theme
))->update();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
// also update current session
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_SESSIONS . "`
SET `theme` = :theme
WHERE `hash` = :hash"
);
Database::pexecute($stmt, array("theme" => $theme, "hash" => $s));
WHERE `hash` = :hash");
Database::pexecute($stmt, array(
"theme" => $theme,
"hash" => $s
));
$log->logAction(USR_ACTION, LOG_NOTICE, "changed default theme to '" . $theme . "'");
redirectTo($filename, array('s' => $s));
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "changed default theme to '" . $theme . "'");
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} else {
$default_theme = Settings::Get('panel.default_theme');
if ($userinfo['theme'] != '') {
@@ -235,14 +276,13 @@ if ($page == 'overview') {
}
$theme_options = '';
$themes_avail = getThemes();
$themes_avail = \Froxlor\UI\Template::getThemes();
foreach ($themes_avail as $t => $d) {
$theme_options.= makeoption($d, $t, $default_theme, true);
$theme_options .= \Froxlor\UI\HTML::makeoption($d, $t, $default_theme, true);
}
eval("echo \"" . getTemplate('index/change_theme') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/change_theme') . "\";");
}
} elseif ($page == 'send_error_report' && Settings::Get('system.allow_error_report_customer') == '1') {
// only show this if we really have an exception to report
@@ -250,8 +290,8 @@ if ($page == 'overview') {
$errid = $_GET['errorid'];
// read error file
$err_dir = makeCorrectDir(FROXLOR_INSTALL_DIR."/logs/");
$err_file = makeCorrectFile($err_dir."/".$errid."_sql-error.log");
$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)) {
@@ -261,28 +301,26 @@ if ($page == 'overview') {
$_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_INSTALL_DIR))),
'file' => str_replace("\n", "", substr($error[3], 5 + strlen(\Froxlor\Froxlor::getInstallDir()))),
'line' => str_replace("\n", "", substr($error[4], 5)),
'trace' => str_replace(FROXLOR_INSTALL_DIR, "", substr($error[5], 6))
'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 .= $_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 .= "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'
) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
// send mail and say thanks
$_mailerror = false;
try {
@@ -291,7 +329,7 @@ if ($page == 'overview') {
$mail->MsgHTML($mail_html);
$mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team');
$mail->Send();
} catch(phpmailerException $e) {
} catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
@@ -301,21 +339,30 @@ if ($page == 'overview') {
if ($_mailerror) {
// error when reporting an error...LOLFUQ
standard_error('send_report_error', $mailerr_msg);
\Froxlor\UI\Response::standard_error('send_report_error', $mailerr_msg);
}
// finally remove error from fs
@unlink($err_file);
redirectTo($filename, array('s' => $s));
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
}
// show a nice summary of the error-report
// before actually sending anything
eval("echo \"" . getTemplate("index/send_error_report") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/send_error_report") . "\";");
} else {
redirectTo($filename, array('s' => $s));
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
}
} else {
redirectTo($filename, array('s' => $s));
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
}
} elseif ($page == 'apikeys' && Settings::Get('api.enabled') == 1) {
require_once __DIR__ . '/api_keys.php';
} elseif ($page == '2fa' && Settings::Get('2fa.enabled') == 1) {
require_once __DIR__ . '/2fa.php';
}

View File

@@ -16,17 +16,18 @@
* @package Panel
*
*/
define('AREA', 'customer');
require './lib/init.php';
use Froxlor\Database\Database;
use Froxlor\Settings;
// redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','extras.logger')) {
redirectTo('customer_index.php');
if (Settings::IsInList('panel.customer_hide_options', 'extras.logger')) {
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
if ($page == 'log'
) {
if ($page == 'log') {
if ($action == '') {
$fields = array(
'date' => $lng['logger']['date'],
@@ -34,12 +35,18 @@ if ($page == 'log'
'user' => $lng['logger']['user'],
'text' => $lng['logger']['action']
);
$paging = new paging($userinfo, TABLE_PANEL_LOG, $fields, null, null, 0, 'desc');
$result_stmt = Database::prepare('
SELECT * FROM `' . TABLE_PANEL_LOG . '` WHERE `user` = :loginname ' . $paging->getSqlWhere(true) . ' ' . $paging->getSqlOrderBy() . ' ' . $paging->getSqlLimit()
);
Database::pexecute($result_stmt, array("loginname" => $userinfo['loginname']));
$logs_count = Database::num_rows();
$paging = 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);
@@ -49,17 +56,13 @@ if ($page == 'log'
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
if (!isset($clog[$row['action']])
|| !is_array($clog[$row['action']])
) {
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'
) {
if ($paging->sortfield == 'date' && $paging->sortorder == 'desc') {
krsort($clog);
} else {
ksort($clog);
@@ -72,51 +75,50 @@ if ($page == 'log'
foreach ($clog as $action => $logrows) {
$_action = 0;
foreach ($logrows as $row) {
if ($paging->checkDisplay($i)) {
$row = htmlentities_array($row);
$row['date'] = date("d.m.y H:i:s", $row['date']);
// if ($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 USR_ACTION:
$_action = $lng['admin']['customer'];
break;
case RES_ACTION:
$_action = $lng['logger']['reseller'];
break;
case ADM_ACTION:
$_action = $lng['logger']['admin'];
break;
case CRON_ACTION:
$_action = $lng['logger']['cron'];
break;
case LOGIN_ACTION:
$_action = $lng['logger']['login'];
break;
case LOG_ERROR:
$_action = $lng['logger']['intern'];
break;
default:
$_action = $lng['logger']['unknown'];
break;
}
$row['action'] = $_action;
eval("\$log.=\"" . getTemplate('logger/logger_action') . "\";");
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;
}
$log_count++;
$row['type'] = getLogLevelDesc($row['type']);
eval("\$log.=\"" . getTemplate('logger/logger_log') . "\";");
$count++;
$_action = $action;
$row['action'] = $_action;
eval("\$log.=\"" . \Froxlor\UI\Template::getTemplate('logger/logger_action') . "\";");
}
$i++;
$log_count ++;
$row['type'] = \Froxlor\FroxlorLogger::getInstanceOf()->getLogLevelDesc($row['type']);
eval("\$log.=\"" . \Froxlor\UI\Template::getTemplate('logger/logger_log') . "\";");
$count ++;
$_action = $action;
// }
$i ++;
}
$i++;
$i ++;
}
eval("echo \"" . getTemplate('logger/logger') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('logger/logger') . "\";");
}
}

View File

@@ -16,13 +16,16 @@
* @package Panel
*
*/
define('AREA', 'customer');
require './lib/init.php';
use Froxlor\Database\Database;
use Froxlor\Settings;
use Froxlor\Api\Commands\Mysqls as Mysqls;
// redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','mysql')) {
redirectTo('customer_index.php');
if (Settings::IsInList('panel.customer_hide_options', 'mysql')) {
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
// get sql-root access data
@@ -38,23 +41,24 @@ if (isset($_POST['id'])) {
}
if ($page == 'overview') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_mysql");
$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 \"" . getTemplate('mysql/mysql') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('mysql/mysql') . "\";");
} elseif ($page == 'mysqls') {
if ($action == '') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_mysql::mysqls");
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_mysql::mysqls");
$fields = array(
'databasename' => $lng['mysql']['databasename'],
'description' => $lng['mysql']['databasedescription']
);
$paging = new paging($userinfo, TABLE_PANEL_DATABASES, $fields);
$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']));
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);
@@ -66,7 +70,7 @@ if ($page == 'overview') {
$count = 0;
$mysqls = '';
$dbservers_stmt = Database::query("SELECT COUNT(DISTINCT `dbserver`) as numservers FROM `".TABLE_PANEL_DATABASES."`");
$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'];
@@ -74,31 +78,34 @@ if ($page == 'overview') {
Database::needRoot(true);
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
if ($paging->checkDisplay($i)) {
$row = htmlentities_array($row);
$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']));
GROUP BY table_schema");
Database::pexecute($mbdata_stmt, array(
"table_schema" => $row['databasename']
));
$mbdata = $mbdata_stmt->fetch(PDO::FETCH_ASSOC);
$row['size'] = size_readable($mbdata['MB'], 'GiB', 'bi', '%01.' . (int)Settings::Get('panel.decimal_places') . 'f %s');
eval("\$mysqls.=\"" . getTemplate('mysql/mysqls_database') . "\";");
$count++;
$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++;
$i ++;
}
Database::needRoot(false);
// End root-session
eval("echo \"" . getTemplate('mysql/mysqls') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('mysql/mysqls') . "\";");
} elseif ($action == 'delete' && $id != 0) {
$result_stmt = Database::prepare('SELECT `id`, `databasename`, `description`, `dbserver` FROM `' . TABLE_PANEL_DATABASES . '`
WHERE `customerid`="' . (int)$userinfo['customerid'] . '"
AND `id`="' . (int)$id . '"'
);
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid']));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
try {
$json_result = Mysqls::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if (isset($result['databasename']) && $result['databasename'] != '') {
@@ -107,251 +114,91 @@ if ($page == 'overview') {
$sql_root = Database::getSqlData();
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;
}
if (isset($_POST['send']) && $_POST['send'] == 'send') {
// Begin root-session
Database::needRoot(true, $result['dbserver']);
$dbm = new DbManager($log);
$dbm->getManager()->deleteDatabase($result['databasename']);
$log->logAction(USR_ACTION, LOG_INFO, "deleted database '" . $result['databasename'] . "'");
Database::needRoot(false);
// End root-session
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_DATABASES . "`
WHERE `customerid` = :customerid
AND `id` = :id"
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
$resetaccnumber = ($userinfo['mysqls_used'] == '1') ? " , `mysql_lastaccountnumber` = '0' " : '';
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "`
SET `mysqls_used` = `mysqls_used` - 1 " . $resetaccnumber . "
WHERE `customerid` = :customerid"
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid']));
redirectTo($filename, array('page' => $page, 's' => $s));
try {
Mysqls::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
$dbnamedesc = $result['databasename'];
if (isset($result['description']) && $result['description'] != '') {
$dbnamedesc .= ' ('.$result['description'].')';
$dbnamedesc .= ' (' . $result['description'] . ')';
}
ask_yesno('mysql_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $dbnamedesc);
\Froxlor\UI\HTML::askYesNo('mysql_reallydelete', $filename, array(
'id' => $id,
'page' => $page,
'action' => $action
), $dbnamedesc);
}
}
} elseif ($action == 'add') {
if ($userinfo['mysqls_used'] < $userinfo['mysqls'] || $userinfo['mysqls'] == '-1') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$password = validate($_POST['mysql_password'], 'password');
$password = validatePassword($password);
$sendinfomail = isset($_POST['sendinfomail']) ? 1 : 0;
if ($sendinfomail != 1) {
$sendinfomail = 0;
}
if ($password == '') {
standard_error(array('stringisempty', 'mypassword'));
} else {
$dbserver = 0;
$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'];
if ($count_mysqlservers > 1) {
$dbserver = validate($_POST['mysql_server'], html_entity_decode($lng['mysql']['mysql_server']), '', '', 0);
Database::needRoot(true, $dbserver);
Database::needSqlData();
$sql_root = Database::getSqlData();
Database::needRoot(false);
if (!isset($sql_root) || !is_array($sql_root)) {
$dbserver = 0;
}
}
// validate description before actual adding the database, #1052
$databasedescription = validate(trim($_POST['description']), 'description');
// create database, user, set permissions, etc.pp.
$dbm = new DbManager($log);
$username = $dbm->createDatabase(
$userinfo['loginname'],
$password,
$userinfo['mysql_lastaccountnumber']
);
// we've checked against the password in dbm->createDatabase
if ($username == false) {
standard_error('passwordshouldnotbeusername');
}
// Statement modified for Database description -- PH 2004-11-29
$stmt = Database::prepare('INSERT INTO `' . TABLE_PANEL_DATABASES . '`
(`customerid`, `databasename`, `description`, `dbserver`)
VALUES (:customerid, :databasename, :description, :dbserver)'
);
$params = array(
"customerid" => $userinfo['customerid'],
"databasename" => $username,
"description" => $databasedescription,
"dbserver" => $dbserver
);
Database::pexecute($stmt, $params);
$stmt = Database::prepare('UPDATE `' . TABLE_PANEL_CUSTOMERS . '`
SET `mysqls_used` = `mysqls_used` + 1, `mysql_lastaccountnumber` = `mysql_lastaccountnumber` + 1
WHERE `customerid` = :customerid'
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid']));
if ($sendinfomail == 1) {
$pma = $lng['admin']['notgiven'];
if (Settings::Get('panel.phpmyadmin_url') != '') {
$pma = Settings::Get('panel.phpmyadmin_url');
}
Database::needRoot(true, $dbserver);
Database::needSqlData();
$sql_root = Database::getSqlData();
Database::needRoot(false);
$replace_arr = array(
'SALUTATION' => getCorrectUserSalutation($userinfo),
'CUST_NAME' => getCorrectUserSalutation($userinfo), // < keep this for compatibility
'DB_NAME' => $username,
'DB_PASS' => $password,
'DB_DESC' => $databasedescription,
'DB_SRV' => $sql_root['host'],
'PMA_URI' => $pma
);
$def_language = $userinfo['def_language'];
$result_stmt = Database::prepare("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid
AND `language` = :lang
AND `templategroup`='mails'
AND `varname`='new_database_by_customer_subject'"
);
Database::pexecute($result_stmt, array("adminid" => $userinfo['adminid'], "lang" => $def_language));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$mail_subject = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['mails']['new_database_by_customer']['subject']), $replace_arr));
$result_stmt = Database::prepare("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid`= :adminid
AND `language`= :lang
AND `templategroup` = 'mails'
AND `varname` = 'new_database_by_customer_mailbody'"
);
Database::pexecute($result_stmt, array("adminid" => $userinfo['adminid'], "lang" => $def_language));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$mail_body = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['mails']['new_database_by_customer']['mailbody']), $replace_arr));
$_mailerror = false;
try {
$mail->Subject = $mail_subject;
$mail->AltBody = $mail_body;
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
$mail->AddAddress($userinfo['email'], getCorrectUserSalutation($userinfo));
$mail->Send();
} catch(phpmailerException $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
$mailerr_msg = $e->getMessage();
$_mailerror = true;
}
if ($_mailerror) {
$log->logAction(USR_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
standard_error('errorsendingmail', $userinfo['email']);
}
$mail->ClearAddresses();
}
redirectTo($filename, array('page' => $page, 's' => $s));
try {
Mysqls::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
$dbservers_stmt = Database::query("SELECT DISTINCT `dbserver` FROM `".TABLE_PANEL_DATABASES."`");
$dbservers_stmt = Database::query("SELECT DISTINCT `dbserver` FROM `" . TABLE_PANEL_DATABASES . "`");
$mysql_servers = '';
$count_mysqlservers = 0;
while ($dbserver = $dbservers_stmt->fetch(PDO::FETCH_ASSOC)) {
Database::needRoot(true, $dbserver['dbserver']);
Database::needSqlData();
$sql_root = Database::getSqlData();
$mysql_servers .= makeoption($sql_root['caption'], $dbserver['dbserver']);
$count_mysqlservers++;
$mysql_servers .= \Froxlor\UI\HTML::makeoption($sql_root['caption'], $dbserver['dbserver']);
$count_mysqlservers ++;
}
Database::needRoot(false);
$mysql_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/mysql/formfield.mysql_add.php';
$mysql_add_form = htmlform::genHTMLForm($mysql_add_data);
$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'];
$image = $mysql_add_data['mysql_add']['image'];
eval("echo \"" . getTemplate('mysql/mysqls_add') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('mysql/mysqls_add') . "\";");
}
}
} elseif ($action == 'edit' && $id != 0) {
$result_stmt = Database::prepare("SELECT `id`, `databasename`, `description`, `dbserver` FROM `" . TABLE_PANEL_DATABASES . "`
WHERE `customerid` = :customerid
AND `id` = :id"
);
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
try {
$json_result = Mysqls::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if (isset($result['databasename']) && $result['databasename'] != '') {
if (!isset($sql_root[$result['dbserver']]) || !is_array($sql_root[$result['dbserver']])) {
$result['dbserver'] = 0;
}
if (isset($_POST['send']) && $_POST['send'] == 'send') {
// Only change Password if it is set, do nothing if it is empty! -- PH 2004-11-29
$password = validate($_POST['mysql_password'], 'password');
if ($password != '') {
// validate password
$password = validatePassword($password);
if ($password == $result['databasename']) {
standard_error('passwordshouldnotbeusername');
}
// Begin root-session
Database::needRoot(true);
foreach (array_map('trim', explode(',', Settings::Get('system.mysql_access_host'))) as $mysql_access_host) {
$stmt = Database::prepare("SET PASSWORD FOR :dbname@:host = PASSWORD(:password)");
$params = array(
"dbname" => $result['databasename'],
"host" => $mysql_access_host,
"password" => $password
);
Database::pexecute($stmt, $params);
}
$stmt = Database::prepare("FLUSH PRIVILEGES");
Database::pexecute($stmt);
Database::needRoot(false);
// End root-session
try {
$json_result = Mysqls::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
// Update the Database description -- PH 2004-11-29
$log->logAction(USR_ACTION, LOG_INFO, "edited database '" . $result['databasename'] . "'");
$databasedescription = validate($_POST['description'], 'description');
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_DATABASES . "`
SET `description` = :desc
WHERE `customerid` = :customerid
AND `id` = :id"
);
Database::pexecute($stmt, array("desc" => $databasedescription, "customerid" => $userinfo['customerid'], "id" => $id));
redirectTo($filename, array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
$dbservers_stmt = Database::query("SELECT COUNT(DISTINCT `dbserver`) as numservers FROM `".TABLE_PANEL_DATABASES."`");
$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'];
@@ -360,13 +207,13 @@ if ($page == 'overview') {
$sql_root = Database::getSqlData();
Database::needRoot(false);
$mysql_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/mysql/formfield.mysql_edit.php';
$mysql_edit_form = htmlform::genHTMLForm($mysql_edit_data);
$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'];
$image = $mysql_edit_data['mysql_edit']['image'];
eval("echo \"" . getTemplate('mysql/mysqls_edit') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('mysql/mysqls_edit') . "\";");
}
}
}

View File

@@ -1,392 +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 Panel
*
*/
define('AREA', 'customer');
require './lib/init.php';
// redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','domains')) {
redirectTo('customer_index.php');
}
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
//Check if the current user is allowed to see the current ticket.
$stmt = Database::prepare("SELECT `id` FROM `panel_tickets` WHERE `id` = :id AND `customerid` = :customerid");
$result = Database::pexecute_first($stmt, array("id" => $id, "customerid" => $userinfo['customerid']));
if ($result == null) {
// no rights to see the requested ticket
standard_error(array('ticketnotaccessible'));
}
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
if ($page == 'overview') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_tickets");
eval("echo \"" . getTemplate("tickets/ticket") . "\";");
} elseif ($page == 'tickets') {
if ($action == '') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_tickets::tickets");
$fields = array(
'status' => $lng['ticket']['status'],
'lastchange' => $lng['ticket']['lastchange'],
'subject' => $lng['ticket']['subject'],
'lastreplier' => $lng['ticket']['lastreplier']
);
$paging = new paging($userinfo, TABLE_PANEL_TICKETS, $fields);
$stmt = Database::prepare('SELECT `main`.`id`, (SELECT COUNT(`sub`.`id`) FROM `' . TABLE_PANEL_TICKETS . '` `sub`
WHERE `sub`.`answerto` = `main`.`id`) AS `ticket_answers`, `main`.`lastchange`, `main`.`subject`, `main`.`status`, `main`.`lastreplier`, `main`.`priority`
FROM `' . TABLE_PANEL_TICKETS . '` as `main`
WHERE `main`.`answerto` = "0"
AND `archived` = "0"
AND `customerid`= :customerid ' . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()
);
Database::pexecute($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;
$tickets = '';
$tickets_count = 0;
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
if ($paging->checkDisplay($i)) {
$tickets_count++;
$row = htmlentities_array($row);
$row['lastchange'] = date("d.m.y H:i", $row['lastchange']);
if ($row['status'] >= 0 && $row['status'] <= 2) {
$reopen = 0;
} else {
$reopen = 1;
}
$row['status'] = ticket::getStatusText($lng, $row['status']);
$row['priority'] = ticket::getPriorityText($lng, $row['priority']);
if ($row['lastreplier'] == '1') {
$row['lastreplier'] = $lng['ticket']['staff'];
$cananswer = 1;
} else {
$row['lastreplier'] = $lng['ticket']['customer'];
$cananswer = 0;
}
$row['subject'] = html_entity_decode($row['subject']);
if (strlen($row['subject']) > 30) {
$ts = wordwrap($row['subject'], 30, "|");
$ts = explode("|", $ts);
$row['subject'] = $ts[0]. '...';
}
eval("\$tickets.=\"" . getTemplate("tickets/tickets_tickets") . "\";");
$count++;
}
$i++;
}
$supportavailable = 0;
$time = date("Hi", time());
$day = date("w", time());
$start = substr(Settings::Get('ticket.worktime_begin'), 0, 2) . substr(Settings::Get('ticket.worktime_begin'), 3, 2);
$end = substr(Settings::Get('ticket.worktime_end'), 0, 2) . substr(Settings::Get('ticket.worktime_end'), 3, 2);
if ($time >= $start && $time <= $end) {
$supportavailable = 1;
}
if (Settings::Get('ticket.worktime_sat') == "0" && $day == "6") {
$supportavailable = 0;
}
if (Settings::Get('ticket.worktime_sun') == "0" && $day == "0") {
$supportavailable = 0;
}
if (Settings::Get('ticket.worktime_all') == "1") {
$supportavailable = 1;
}
$ticketsopen = 0;
$stmt = Database::prepare('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
WHERE `customerid` = :customerid
AND `answerto` = "0"
AND (`status` = "0" OR `status` = "1" OR `status` = "2")'
);
$opentickets = Database::pexecute_first($stmt, array("customerid" => $userinfo['customerid']));
if (Settings::Get('ticket.concurrently_open') != - 1 && Settings::Get('ticket.concurrently_open') != '') {
$notmorethanxopentickets = strtr($lng['ticket']['notmorethanxopentickets'], array('%s' => Settings::Get('ticket.concurrently_open')));
} else {
$notmorethanxopentickets = '';
}
$ticketsopen = (int)$opentickets['count'];
eval("echo \"" . getTemplate("tickets/tickets") . "\";");
} elseif ($action == 'new') {
if ($userinfo['tickets_used'] < $userinfo['tickets'] || $userinfo['tickets'] == '-1') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$newticket = ticket::getInstanceOf($userinfo, -1);
$newticket->Set('subject', validate($_POST['subject'], 'subject'), true, false);
$newticket->Set('priority', validate($_POST['priority'], 'priority'), true, false);
$newticket->Set('category', validate($_POST['category'], 'category'), true, false);
$newticket->Set('customer', (int)$userinfo['customerid'], true, false);
$newticket->Set('admin', (int)$userinfo['adminid'], true, false);
$newticket->Set('message', validate(str_replace("\r\n", "\n", $_POST['message']), 'message', '/^[^\0]*$/'), true, false);
if ($newticket->Get('subject') == null) {
standard_error(array('stringisempty', 'mysubject'));
} elseif ($newticket->Get('message') == null) {
standard_error(array('stringisempty', 'mymessage'));
} else {
$now = time();
$newticket->Set('dt', $now, true, true);
$newticket->Set('lastchange', $now, true, true);
$newticket->Set('ip', $_SERVER['REMOTE_ADDR'], true, true);
$newticket->Set('status', '0', true, true);
$newticket->Set('lastreplier', '0', true, true);
$newticket->Set('by', '0', true, true);
$newticket->Insert();
$log->logAction(USR_ACTION, LOG_NOTICE, "opened support-ticket '" . $newticket->Get('subject') . "'");
$stmt = Database::prepare('UPDATE `' . TABLE_PANEL_CUSTOMERS . '`
SET `tickets_used`=`tickets_used` + 1
WHERE `customerid`= :customerid'
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid']));
// Customer mail
$newticket->sendMail((int)$userinfo['customerid'], 'new_ticket_for_customer_subject', $lng['mails']['new_ticket_for_customer']['subject'], 'new_ticket_for_customer_mailbody', $lng['mails']['new_ticket_for_customer']['mailbody']);
// Admin mail
$newticket->sendMail(-1, 'new_ticket_by_customer_subject', $lng['mails']['new_ticket_by_customer']['subject'], 'new_ticket_by_customer_mailbody', $lng['mails']['new_ticket_by_customer']['mailbody']);
redirectTo($filename, array('page' => $page, 's' => $s));
}
} else {
$categories = '';
$result_stmt = Database::prepare('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '`
WHERE `adminid` = :adminid
ORDER BY `logicalorder`, `name` ASC'
);
$result = Database::pexecute_first($result_stmt, array("adminid" => $userinfo['adminid']));
if (isset($result['name']) && $result['name'] != '') {
$result2_stmt = Database::prepare('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '`
WHERE `adminid` = :adminid
ORDER BY `logicalorder`, `name` ASC'
);
Database::pexecute($result2_stmt, array("adminid" => $userinfo['adminid']));
while ($row = $result2_stmt->fetch(PDO::FETCH_ASSOC)) {
$categories.= makeoption($row['name'], $row['id']);
}
} else {
$categories = makeoption($lng['ticket']['no_cat'], '0');
}
$priorities = makeoption($lng['ticket']['high'], '1');
$priorities.= makeoption($lng['ticket']['normal'], '2');
$priorities.= makeoption($lng['ticket']['low'], '3');
$ticketsopen = 0;
$opentickets_stmt = Database::prepare('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
WHERE `customerid` = :customerid
AND `answerto` = "0"
AND (`status` = "0" OR `status` = "1" OR `status` = "2")'
);
$opentickets = Database::pexecute_first($opentickets_stmt, array("customerid" => $userinfo['customerid']));
if (Settings::Get('ticket.concurrently_open') != -1 && Settings::Get('ticket.concurrently_open') != '') {
$notmorethanxopentickets = strtr($lng['ticket']['notmorethanxopentickets'], array('%s' => Settings::Get('ticket.concurrently_open')));
} else {
$notmorethanxopentickets = '';
}
$ticketsopen = (int)$opentickets['count'];
$ticket_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/tickets/formfield.ticket_add.php';
$ticket_add_form = htmlform::genHTMLForm($ticket_add_data);
$title = $ticket_add_data['ticket_add']['title'];
$image = $ticket_add_data['ticket_add']['image'];
eval("echo \"" . getTemplate("tickets/tickets_new") . "\";");
}
} else {
standard_error('nomoreticketsavailable');
}
} elseif ($action == 'answer' && $id != 0) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$replyticket = ticket::getInstanceOf($userinfo, -1);
$replyticket->Set('subject', validate($_POST['subject'], 'subject'), true, false);
$replyticket->Set('priority', validate($_POST['priority'], 'priority'), true, false);
$replyticket->Set('message', validate(str_replace("\r\n", "\n", $_POST['message']), 'message', '/^[^\0]*$/'), true, false);
if ($replyticket->Get('message') == null) {
standard_error(array('stringisempty', 'mymessage'));
} else {
$now = time();
$replyticket->Set('customer', (int)$userinfo['customerid'], true, true);
$replyticket->Set('lastchange', $now, true, true);
$replyticket->Set('ip', $_SERVER['REMOTE_ADDR'], true, true);
$replyticket->Set('status', '1', true, true);
$replyticket->Set('answerto', (int)$id, true, false);
$replyticket->Set('by', '0', true, true);
$replyticket->Insert();
// Update priority if changed
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
if ($replyticket->Get('priority') != $mainticket->Get('priority')) {
$mainticket->Set('priority', $replyticket->Get('priority'), true);
}
$mainticket->Set('lastchange', $now);
$mainticket->Set('lastreplier', '0');
$mainticket->Set('status', '1');
$mainticket->Update();
$log->logAction(USR_ACTION, LOG_NOTICE, "answered support-ticket '" . $mainticket->Get('subject') . "'");
$mainticket->sendMail(-1, 'new_reply_ticket_by_customer_subject', $lng['mails']['new_reply_ticket_by_customer']['subject'], 'new_reply_ticket_by_customer_mailbody', $lng['mails']['new_reply_ticket_by_customer']['mailbody']);
redirectTo($filename, array('page' => $page, 's' => $s));
}
} else {
$ticket_replies = '';
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
$dt = date("d.m.Y H:i\h", $mainticket->Get('dt'));
$status = ticket::getStatusText($lng, $mainticket->Get('status'));
if ($mainticket->Get('status') >= 0 && $mainticket->Get('status') <= 2) {
$isclosed = 0;
} else {
$isclosed = 1;
}
if ($mainticket->Get('by') == '1') {
$by = $lng['ticket']['staff'];
} else {
$cid = $mainticket->Get('customer');
$usr_stmt = Database::prepare('SELECT `customerid`, `firstname`, `name`, `company`, `loginname`
FROM `' . TABLE_PANEL_CUSTOMERS . '`
WHERE `customerid` = :customerid '
);
$usr = Database::pexecute_first($usr_stmt, array("customerid" => $cid));
$by = getCorrectFullUserDetails($usr);
}
$subject = $mainticket->Get('subject');
$message = $mainticket->Get('message');
eval("\$ticket_replies.=\"" . getTemplate("tickets/tickets_tickets_main") . "\";");
$result_stmt = Database::prepare('SELECT `name` FROM `' . TABLE_PANEL_TICKET_CATS . '`
WHERE `id`= :id '
);
$row = Database::pexecute_first($result_stmt, array("id" => $mainticket->Get('category')));
$andere_stmt = Database::prepare('SELECT * FROM `' . TABLE_PANEL_TICKETS . '`
WHERE `answerto`= :answerto
ORDER BY `lastchange` ASC'
);
Database::pexecute($andere_stmt, array("answerto" => $id));
$numrows_andere = Database::num_rows();
while ($row2 = $andere_stmt->fetch(PDO::FETCH_ASSOC)) {
$subticket = ticket::getInstanceOf($userinfo, (int)$row2['id']);
$lastchange = date("d.m.Y H:i\h", $subticket->Get('lastchange'));
if ($subticket->Get('by') == '1') {
$by = $lng['ticket']['staff'];
} else {
$cid = $subticket->Get('customer');
$usr_stmt = Database::prepare('
SELECT `customerid`, `firstname`, `name`, `company`, `loginname`
FROM `' . TABLE_PANEL_CUSTOMERS . '`
WHERE `customerid` = :customerid '
);
$usr = Database::pexecute_first($usr_stmt, array("customerid" => $cid));
$by = getCorrectFullUserDetails($usr);
}
$subject = $subticket->Get('subject');
$message = $subticket->Get('message');
$row2 = htmlentities_array($row2);
eval("\$ticket_replies.=\"" . getTemplate("tickets/tickets_tickets_list") . "\";");
}
$priorities = makeoption($lng['ticket']['high'], '1', $mainticket->Get('priority'), true, true);
$priorities.= makeoption($lng['ticket']['normal'], '2', $mainticket->Get('priority'), true, true);
$priorities.= makeoption($lng['ticket']['low'], '3', $mainticket->Get('priority'), true, true);
$subject = htmlentities($mainticket->Get('subject'));
$ticket_replies_count = $numrows_andere + 1;
// don't forget the main-ticket!
$ticket_reply_data = include_once dirname(__FILE__).'/lib/formfields/customer/tickets/formfield.ticket_reply.php';
$ticket_reply_form = htmlform::genHTMLForm($ticket_reply_data);
$title = $ticket_reply_data['ticket_reply']['title'];
$image = $ticket_reply_data['ticket_reply']['image'];
eval("echo \"" . getTemplate("tickets/tickets_reply") . "\";");
}
} elseif ($action == 'close' && $id != 0) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$now = time();
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
$mainticket->Set('lastchange', $now, true, true);
$mainticket->Set('lastreplier', '0', true, true);
$mainticket->Set('status', '3', true, true);
$mainticket->Update();
$log->logAction(USR_ACTION, LOG_NOTICE, "closed support-ticket '" . $mainticket->Get('subject') . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
} else {
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
ask_yesno('ticket_reallyclose', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject'));
}
} elseif ($action == 'reopen' && $id != 0) {
$ticketsopen = 0;
$opentickets_stmt = Database::prepare('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
WHERE `customerid` = :customerid
AND `answerto` = "0"
AND (`status` = "0" OR `status` = "1" OR `status` = "2")'
);
$opentickets = Database::pexecute_first($opentickets_stmt, array("customerid" => $userinfo['customerid']));
$ticketsopen = (int)$opentickets['count'];
if ($ticketsopen > Settings::Get('ticket.concurrently_open') && Settings::Get('ticket.concurrently_open') != - 1 && Settings::Get('ticket.concurrently_open') != '') {
standard_error('notmorethanxopentickets', Settings::Get('ticket.concurrently_open'));
}
$now = time();
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
$mainticket->Set('lastchange', $now, true, true);
$mainticket->Set('lastreplier', '0', true, true);
$mainticket->Set('status', '0', true, true);
$mainticket->Update();
$log->logAction(USR_ACTION, LOG_NOTICE, "reopened support-ticket '" . $mainticket->Get('subject') . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
}
}

View File

@@ -16,14 +16,16 @@
* @package Panel
*
*/
define('AREA', 'customer');
$intrafficpage = 1;
require './lib/init.php';
use Froxlor\Database\Database;
use Froxlor\Settings;
// redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','traffic')) {
redirectTo('customer_index.php');
if (Settings::IsInList('panel.customer_hide_options', 'traffic')) {
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
$traffic = '';
@@ -36,8 +38,7 @@ if (isset($_POST['month']) && isset($_POST['year'])) {
} elseif (isset($_GET['month']) && isset($_GET['year'])) {
$month = intval($_GET['month']);
$year = intval($_GET['year']);
}
//BAM! $_GET???
} // BAM! $_GET???
elseif (isset($_GET['page']) && $_GET['page'] == 'current') {
if (date('d') != '01') {
$month = date('m');
@@ -53,7 +54,7 @@ elseif (isset($_GET['page']) && $_GET['page'] == 'current') {
}
}
if (!is_null($month) && !is_null($year)) {
if (! is_null($month) && ! is_null($year)) {
$traf['byte'] = 0;
$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`
FROM `" . TABLE_PANEL_TRAFFIC . "`
@@ -61,8 +62,7 @@ if (!is_null($month) && !is_null($year)) {
AND `month` = :month
AND `year` = :year
GROUP BY `day`
ORDER BY `day` DESC"
);
ORDER BY `day` DESC");
$params = array(
"customerid" => $userinfo['customerid'],
"month" => $month,
@@ -102,23 +102,24 @@ if (!is_null($month) && !is_null($year)) {
$traf['byte'] = round($traf['byte'] / 1024, Settings::Get('panel.decimal_places'));
}
eval("\$traffic.=\"" . getTemplate('traffic/traffic_month') . "\";");
eval("\$traffic.=\"" . \Froxlor\UI\Template::getTemplate('traffic/traffic_month') . "\";");
$show = $lng['traffic']['months'][intval($row['month'])] . ' ' . $row['year'];
}
$traffic_complete['http'] = size_readable($traffic_complete['http'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s');
$traffic_complete['ftp'] = size_readable($traffic_complete['ftp'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s');
$traffic_complete['mail'] = size_readable($traffic_complete['mail'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s');
$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 \"" . getTemplate('traffic/traffic_details') . "\";");
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']));
LIMIT 12");
Database::pexecute($result_stmt, array(
"customerid" => $userinfo['customerid']
));
$traffic_complete['http'] = 0;
$traffic_complete['ftp'] = 0;
$traffic_complete['mail'] = 0;
@@ -154,12 +155,12 @@ if (!is_null($month) && !is_null($year)) {
$traf['byte'] = round($traf['byte'] / (1024 * 1024), Settings::Get('panel.decimal_places'));
}
eval("\$traffic.=\"" . getTemplate('traffic/traffic_traffic') . "\";");
eval("\$traffic.=\"" . \Froxlor\UI\Template::getTemplate('traffic/traffic_traffic') . "\";");
}
$traffic_complete['http'] = size_readable($traffic_complete['http'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s');
$traffic_complete['ftp'] = size_readable($traffic_complete['ftp'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s');
$traffic_complete['mail'] = size_readable($traffic_complete['mail'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s');
$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 \"" . getTemplate('traffic/traffic') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('traffic/traffic') . "\";");
}

View File

@@ -1,6 +1,8 @@
<?php
if (! defined('AREA'))
die('You cannot access this file directly!');
if (! defined('AREA')) {
header("Location: index.php");
exit();
}
/**
* This file is part of the Froxlor project.
@@ -14,11 +16,14 @@ if (! defined('AREA'))
* @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
// 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;
@@ -29,7 +34,7 @@ $content = isset($_POST['record']['content']) ? trim($_POST['record']['content']
$ttl = isset($_POST['record']['ttl']) ? (int) $_POST['record']['ttl'] : 18000;
// get domain-name
$domain = getAllowedDomainEntry($domain_id, AREA, $userinfo, $idna_convert);
$domain = \Froxlor\Dns\Dns::getAllowedDomainEntry($domain_id, AREA, $userinfo);
// select all entries
$sel_stmt = Database::prepare("SELECT * FROM `" . TABLE_DOMAIN_DNS . "` WHERE domain_id = :did");
@@ -38,235 +43,50 @@ Database::pexecute($sel_stmt, array(
));
$dom_entries = $sel_stmt->fetchAll(PDO::FETCH_ASSOC);
$errors = array();
$errors = "";
$success_message = "";
// action for adding a new entry
if ($action == 'add_record' && ! empty($_POST)) {
// validation
if (empty($record)) {
$record = "@";
}
$record = strtolower($record);
if ($record != '@' && $record != '*') {
// validate record
if (strpos($record, '--') !== false) {
$errors[] = $lng['error']['domain_nopunycode'];
} else {
$record = $idna_convert->encode($record);
if ($type != 'SRV' && $type != 'TXT') {
$check_dom = $record . '.example.com';
if (! validateDomain($check_dom)) {
$errors[] = sprintf($lng['error']['subdomainiswrong'], $idna_convert->decode($record));
}
}
if (strlen($record) > 63) {
$errors[] = $lng['error']['dns_record_toolong'];
}
}
}
// TODO regex validate content for invalid characters
if ($ttl <= 0) {
$ttl = 18000;
}
if (empty($content)) {
$errors[] = $lng['error']['dns_content_empty'];
}
// types
if ($type == 'A' && filter_var($content, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false) {
$errors[] = $lng['error']['dns_arec_noipv4'];
} elseif ($type == 'AAAA' && filter_var($content, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false) {
$errors[] = $lng['error']['dns_aaaarec_noipv6'];
} elseif ($type == 'MX') {
if ($prio === null || $prio < 0) {
$errors[] = $lng['error']['dns_mx_prioempty'];
}
// check for trailing dot
if (substr($content, - 1) == '.') {
// remove it for checks
$content = substr($content, 0, - 1);
}
if (! validateDomain($content)) {
$errors[] = $lng['error']['dns_mx_needdom'];
} else {
// check whether there is a CNAME-record for the same resource
foreach ($dom_entries as $existing_entries) {
$fqdn = $existing_entries['record'] . '.' . $domain;
if ($existing_entries['type'] == 'CNAME' && $fqdn == $content) {
$errors[] = $lng['error']['dns_mx_noalias'];
break;
}
}
}
// append trailing dot (again)
$content .= '.';
} elseif ($type == 'CNAME') {
// check for trailing dot
if (substr($content, - 1) == '.') {
// remove it for checks
$content = substr($content, 0, - 1);
}
if (! validateDomain($content)) {
$errors[] = $lng['error']['dns_cname_invaliddom'];
} else {
// check whether there are RR-records for the same resource
foreach ($dom_entries as $existing_entries) {
if (($existing_entries['type'] == 'A' || $existing_entries['type'] == 'AAAA' || $existing_entries['type'] == 'MX' || $existing_entries['type'] == 'NS') && $existing_entries['record'] == $record) {
$errors[] = $lng['error']['dns_cname_nomorerr'];
break;
}
}
}
// append trailing dot (again)
$content .= '.';
} elseif ($type == 'NS') {
// check for trailing dot
if (substr($content, - 1) == '.') {
// remove it for checks
$content = substr($content, 0, - 1);
}
if (! validateDomain($content)) {
$errors[] = $lng['error']['dns_ns_invaliddom'];
}
// append trailing dot (again)
$content .= '.';
} elseif ($type == 'TXT' && ! empty($content)) {
// check that TXT content is enclosed in " "
$content = encloseTXTContent($content);
} elseif ($type == 'SRV') {
if ($prio === null || $prio < 0) {
$errors[] = $lng['error']['dns_srv_prioempty'];
}
// check only last part of content, as it can look like:
// _service._proto.name. TTL class SRV priority weight port target.
$_split_content = explode(" ", $content);
// SRV content must be [weight] [port] [target]
if (count($_split_content) != 3) {
$errors[] = $lng['error']['dns_srv_invalidcontent'];
}
$target = trim($_split_content[count($_split_content) - 1]);
if ($target != '.') {
// check for trailing dot
if (substr($target, - 1) == '.') {
// remove it for checks
$target = substr($target, 0, - 1);
}
}
if ($target != '.' && ! validateDomain($target)) {
$errors[] = $lng['error']['dns_srv_needdom'];
} else {
// check whether there is a CNAME-record for the same resource
foreach ($dom_entries as $existing_entries) {
$fqdn = $existing_entries['record'] . '.' . $domain;
if ($existing_entries['type'] == 'CNAME' && $fqdn == $target) {
$errors[] = $lng['error']['dns_srv_noalias'];
break;
}
}
}
// append trailing dot (again)
if ($target != '.') {
$content .= '.';
}
}
$new_entry = array(
'record' => $record,
'type' => $type,
'prio' => $prio,
'content' => $content,
'ttl' => $ttl,
'domain_id' => $domain_id
);
ksort($new_entry);
// check for duplicate
foreach ($dom_entries as $existing_entry) {
// compare serialized string of array
$check_entry = $existing_entry;
// new entry has no ID yet
unset($check_entry['id']);
// sort by key
ksort($check_entry);
// format integer fields to real integer (as they are read as string from the DB)
$check_entry['prio'] = (int) $check_entry['prio'];
$check_entry['ttl'] = (int) $check_entry['ttl'];
$check_entry['domain_id'] = (int) $check_entry['domain_id'];
// serialize both
$check_entry = serialize($check_entry);
$new = serialize($new_entry);
// compare
if ($check_entry === $new) {
$errors[] = $lng['error']['dns_duplicate_entry'];
unset($check_entry);
break;
}
}
if (empty($errors)) {
$ins_stmt = Database::prepare("
INSERT INTO `" . TABLE_DOMAIN_DNS . "` SET
`record` = :record,
`type` = :type,
`prio` = :prio,
`content` = :content,
`ttl` = :ttl,
`domain_id` = :domain_id
");
Database::pexecute($ins_stmt, $new_entry);
$new_entry_id = Database::lastInsertId();
// add temporary to the entries-array (no reread of DB necessary)
$new_entry['id'] = $new_entry_id;
$dom_entries[] = $new_entry;
// success message (inline)
try {
DomainZones::getLocal($userinfo, array(
'id' => $domain_id,
'record' => $record,
'type' => $type,
'prio' => $prio,
'content' => $content,
'ttl' => $ttl
))->add();
$success_message = $lng['success']['dns_record_added'];
$record = "";
$type = 'A';
$prio = "";
$content = "";
$ttl = "";
// re-generate bind configs
inserttask('4');
} else {
// show $errors
$errors = implode("<br>", $errors);
} catch (Exception $e) {
\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) {
$del_stmt = Database::prepare("DELETE FROM `" . TABLE_DOMAIN_DNS . "` WHERE `id` = :id");
Database::pexecute($del_stmt, array(
'id' => $entry_id
));
// remove deleted entry from internal data array (no reread of DB necessary)
$_t = $dom_entries;
foreach ($_t as $idx => $entry) {
if ($entry['id'] == $entry_id) {
unset($dom_entries[$idx]);
break;
}
try {
DomainZones::getLocal($userinfo, array(
'entry_id' => $entry_id,
'id' => $domain_id
))->delete();
} catch (Exception $e) {
$errors = str_replace("\n", "<br>", $e->getMessage());
}
unset($_t);
// success message (inline)
$success_message = $lng['success']['dns_record_deleted'];
// re-generate bind configs
inserttask('4');
if (empty($errors)) {
// remove deleted entry from internal data array (no reread of DB necessary)
$_t = $dom_entries;
foreach ($_t as $idx => $entry) {
if ($entry['id'] == $entry_id) {
unset($dom_entries[$idx]);
break;
}
}
unset($_t);
// success message (inline)
$success_message = $lng['success']['dns_record_deleted'];
}
}
}
@@ -280,7 +100,7 @@ if (! empty($dom_entries)) {
$entriescount = count($dom_entries);
foreach ($dom_entries as $entry) {
$entry['content'] = wordwrap($entry['content'], 100, '<br>', true);
eval("\$existing_entries.=\"" . getTemplate("dns_editor/entry_bit", true) . "\";");
eval("\$existing_entries.=\"" . \Froxlor\UI\Template::getTemplate("dns_editor/entry_bit", true) . "\";");
}
}
@@ -288,19 +108,32 @@ if (! empty($dom_entries)) {
$type_select_values = array(
'A',
'AAAA',
'NS',
'CAA',
'CNAME',
'DNAME',
'LOC',
'MX',
'NS',
'RP',
'SRV',
'SSHFP',
'TXT',
'CNAME'
);
asort($type_select_values);
foreach ($type_select_values as $_type) {
$type_select .= makeoption($_type, $_type, $type);
$type_select .= \Froxlor\UI\HTML::makeoption($_type, $_type, $type);
}
eval("\$record_list=\"" . getTemplate("dns_editor/list", true) . "\";");
eval("\$record_list=\"" . \Froxlor\UI\Template::getTemplate("dns_editor/list", true) . "\";");
$zone = createDomainZone($domain_id);
$zonefile = (string) $zone;
eval("echo \"" . getTemplate("dns_editor/index", true) . "\";");
try {
$json_result = DomainZones::getLocal($userinfo, array(
'id' => $domain_id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
$zonefile = implode("\n", $result);
eval("echo \"" . \Froxlor\UI\Template::getTemplate("dns_editor/index", true) . "\";");

213
doc/example/FroxlorAPI.php Normal file
View File

@@ -0,0 +1,213 @@
<?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 API-example
* @since 0.10.0
*
*/
class FroxlorAPI
{
/**
* 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->api_key = $api_key;
$this->api_secret = $api_secret;
}
/**
* 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
$request = [
'header' => [
'apikey' => $this->api_key,
'secret' => $this->api_secret
],
'body' => [
'command' => $command
]
];
// add parameter to request-body if any
if (! empty($params)) {
$request['body']['params'] = $params;
}
// 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_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
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->last_error = 'Curl execution error: ' . curl_error($ch) . "\n";
rewind($verbose);
$verboseLog = stream_get_contents($verbose);
$this->last_error .= "Verbose information: " . htmlspecialchars($verboseLog) . "\n";
}
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$header = substr($data, 0, $header_size);
$body = substr($data, $header_size);
curl_close($ch);
return array(
$header,
$body
);
}
}

View File

@@ -0,0 +1,48 @@
<?php
// include FroxlorAPI helper class
require __DIR__ . '/FroxlorAPI.php';
// 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');
// customer data
$data = [
'new_loginname' => 'test',
'email' => 'test@froxlor.org',
'firstname' => 'Test',
'name' => 'Testman',
'customernumber' => 1337,
'new_customer_password' => 's0mEcRypt1cpassword' . uniqid()
];
// send request
$fapi->request('Customers.add', $data);
// check for error
if (! empty($fapi->getLastError())) {
echo "Error: " . $fapi->getLastError();
exit();
}
// get response of request
$request = $fapi->getLastResponse();
// view response data
var_dump($request);
/*
array(60) {
["customerid"]=>
string(1) "1"
["loginname"]=>
string(4) "test"
["password"]=>
string(63) "$5$asdasdasd.asdasd"
["adminid"]=>
string(1) "1"
["name"]=>
string(7) "Testman"
["firstname"]=>
string(4) "Test"
[...]
*/

View File

@@ -0,0 +1,22 @@
<?php
// include FroxlorAPI helper class
require __DIR__ . '/FroxlorAPI.php';
// 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');
// send request
$fapi->request('Froxlor.listFunctions');
// check for error
if (! empty($fapi->getLastError())) {
echo "Error: " . $fapi->getLastError();
exit();
}
// get response of request
$request = $fapi->getLastResponse();
// view response data
var_dump($request);

706
index.php
View File

@@ -16,23 +16,102 @@
* @package Panel
*
*/
define('AREA', 'login');
require './lib/init.php';
use Froxlor\Database\Database;
use Froxlor\Settings;
use Froxlor\FroxlorLogger;
if ($action == '') {
$action = 'login';
}
if ($action == 'login') {
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
if ($action == '2fa_entercode') {
// page for entering the 2FA code after successful login
if (! isset($_SESSION) || ! isset($_SESSION['secret_2fa'])) {
// no session - redirect to index
\Froxlor\UI\Response::redirectTo('index.php');
exit();
}
// show template to enter code
eval("echo \"" . \Froxlor\UI\Template::getTemplate('2fa/entercode', true) . "\";");
} elseif ($action == '2fa_verify') {
// verify code from 2fa code-enter form
if (! isset($_SESSION) || ! isset($_SESSION['secret_2fa'])) {
// no session - redirect to index
\Froxlor\UI\Response::redirectTo('index.php');
exit();
}
$code = isset($_POST['2fa_code']) ? $_POST['2fa_code'] : null;
// verify entered code
$tfa = new \Froxlor\FroxlorTwoFactorAuth('Froxlor');
$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
// which is temporarily stored for the customer when using email-2fa
if ($result) {
// get user-data
$table = $_SESSION['uidtable_2fa'];
$field = $_SESSION['uidfield_2fa'];
$uid = $_SESSION['uid_2fa'];
$isadmin = $_SESSION['unfo_2fa'];
$sel_param = array(
'uid' => $uid
);
if ($_SESSION['secret_2fa'] == 'email') {
// 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
$sel_stmt = Database::prepare("SELECT * FROM $table WHERE `" . $field . "` = :uid AND `data_2fa` = :code");
$sel_param['code'] = $code;
} else {
// Authenticator-verification has already happened at this point, so just get the user-data
$sel_stmt = Database::prepare("SELECT * FROM $table WHERE `" . $field . "` = :uid");
}
$userinfo = Database::pexecute_first($sel_stmt, $sel_param);
// whoops, no (valid) user? Start again
if (empty($userinfo)) {
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '2'
));
}
// set fields in $userinfo required for finishLogin()
$userinfo['adminsession'] = $isadmin;
$userinfo['userid'] = $uid;
// if not successful somehow - start again
if (! finishLogin($userinfo)) {
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '2'
));
}
// when using email-2fa, remove the one-time-code
if ($userinfo['type_2fa'] == '1') {
$del_stmt = Database::prepare("UPDATE $table SET `data_2fa` = '' WHERE `" . $field . "` = :uid");
$userinfo = Database::pexecute_first($del_stmt, array(
'uid' => $uid
));
}
exit();
}
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '2'
));
exit();
} elseif ($action == 'login') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$loginname = validate($_POST['loginname'], 'loginname');
$password = validate($_POST['password'], 'password');
$loginname = \Froxlor\Validate\Validate::validate($_POST['loginname'], 'loginname');
$password = \Froxlor\Validate\Validate::validate($_POST['password'], 'password');
$stmt = Database::prepare("SELECT `loginname` AS `customer` FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE `loginname`= :loginname"
);
Database::pexecute($stmt, array("loginname" => $loginname));
WHERE `loginname`= :loginname");
Database::pexecute($stmt, array(
"loginname" => $loginname
));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if ($row['customer'] == $loginname) {
@@ -42,21 +121,26 @@ if ($action == 'login') {
$is_admin = false;
} else {
$is_admin = true;
if ((int)Settings::Get('login.domain_login') == 1) {
$domainname = $idna_convert->encode(preg_replace(array('/\:(\d)+$/', '/^https?\:\/\//'), '', $loginname));
if ((int) Settings::Get('login.domain_login') == 1) {
$domainname = $idna_convert->encode(preg_replace(array(
'/\:(\d)+$/',
'/^https?\:\/\//'
), '', $loginname));
$stmt = Database::prepare("SELECT `customerid` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `domain` = :domain"
);
Database::pexecute($stmt, array("domain" => $domainname));
WHERE `domain` = :domain");
Database::pexecute($stmt, array(
"domain" => $domainname
));
$row2 = $stmt->fetch(PDO::FETCH_ASSOC);
if (isset($row2['customerid']) && $row2['customerid'] > 0) {
$loginname = getCustomerDetail($row2['customerid'], 'loginname');
$loginname = \Froxlor\Customer\Customer::getCustomerDetail($row2['customerid'], 'loginname');
if ($loginname !== false) {
$stmt = Database::prepare("SELECT `loginname` AS `customer` FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE `loginname`= :loginname"
);
Database::pexecute($stmt, array("loginname" => $loginname));
WHERE `loginname`= :loginname");
Database::pexecute($stmt, array(
"loginname" => $loginname
));
$row3 = $stmt->fetch(PDO::FETCH_ASSOC);
if ($row3['customer'] == $loginname) {
$table = "`" . TABLE_PANEL_CUSTOMERS . "`";
@@ -69,29 +153,31 @@ if ($action == 'login') {
}
}
if ((hasUpdates($version) || hasDbUpdates($dbversion)) && $is_admin == false) {
redirectTo('index.php');
exit;
if ((\Froxlor\Froxlor::hasUpdates() || \Froxlor\Froxlor::hasDbUpdates()) && $is_admin == false) {
\Froxlor\UI\Response::redirectTo('index.php');
exit();
}
if ($is_admin) {
if (hasUpdates($version) || hasDbUpdates($dbversion)) {
if (\Froxlor\Froxlor::hasUpdates() || \Froxlor\Froxlor::hasDbUpdates()) {
$stmt = Database::prepare("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "`
WHERE `loginname`= :loginname
AND `change_serversettings` = '1'"
);
Database::pexecute($stmt, array("loginname" => $loginname));
AND `change_serversettings` = '1'");
Database::pexecute($stmt, array(
"loginname" => $loginname
));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if (!isset($row['admin'])) {
if (! isset($row['admin'])) {
// not an admin who can see updates
redirectTo('index.php');
exit;
\Froxlor\UI\Response::redirectTo('index.php');
exit();
}
} else {
$stmt = Database::prepare("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "`
WHERE `loginname`= :loginname"
);
Database::pexecute($stmt, array("loginname" => $loginname));
WHERE `loginname`= :loginname");
Database::pexecute($stmt, array(
"loginname" => $loginname
));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
}
@@ -101,202 +187,193 @@ if ($action == 'login') {
$adminsession = '1';
} else {
// Log failed login
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => $_SERVER['REMOTE_ADDR']));
$rstlog->logAction(LOGIN_ACTION, LOG_WARNING, "Unknown user '" . $loginname . "' tried to login.");
$rstlog = FroxlorLogger::getInstanceOf(array(
'loginname' => $_SERVER['REMOTE_ADDR']
));
$rstlog->logAction(\Froxlor\FroxlorLogger::LOGIN_ACTION, LOG_WARNING, "Unknown user '" . $loginname . "' tried to login.");
redirectTo('index.php', array('showmessage' => '2'));
exit;
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '2'
));
exit();
}
}
$userinfo_stmt = Database::prepare("SELECT * FROM $table
WHERE `loginname`= :loginname"
);
Database::pexecute($userinfo_stmt, array("loginname" => $loginname));
WHERE `loginname`= :loginname");
Database::pexecute($userinfo_stmt, array(
"loginname" => $loginname
));
$userinfo = $userinfo_stmt->fetch(PDO::FETCH_ASSOC);
if ($userinfo['loginfail_count'] >= Settings::Get('login.maxloginattempts') && $userinfo['lastlogin_fail'] > (time() - Settings::Get('login.deactivatetime'))) {
redirectTo('index.php', array('showmessage' => '3'));
exit;
} elseif (validatePasswordLogin($userinfo, $password, $table, $uid)) {
// only show "you're banned" if the login was successful
// because we don't want to publish that the user does exist
if ($userinfo['deactivated']) {
unset($userinfo);
redirectTo('index.php', array('showmessage' => '5'));
exit;
} else {
// login correct
// reset loginfail_counter, set lastlogin_succ
$stmt = Database::prepare("UPDATE $table
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '3'
));
exit();
} elseif (\Froxlor\System\Crypt::validatePasswordLogin($userinfo, $password, $table, $uid)) {
// only show "you're banned" if the login was successful
// because we don't want to publish that the user does exist
if ($userinfo['deactivated']) {
unset($userinfo);
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '5'
));
exit();
} else {
// login correct
// reset loginfail_counter, set lastlogin_succ
$stmt = Database::prepare("UPDATE $table
SET `lastlogin_succ`= :lastlogin_succ, `loginfail_count`='0'
WHERE `$uid`= :uid"
);
Database::pexecute($stmt, array("lastlogin_succ" => time(), "uid" => $userinfo[$uid]));
$userinfo['userid'] = $userinfo[$uid];
$userinfo['adminsession'] = $adminsession;
}
WHERE `$uid`= :uid");
Database::pexecute($stmt, array(
"lastlogin_succ" => time(),
"uid" => $userinfo[$uid]
));
$userinfo['userid'] = $userinfo[$uid];
$userinfo['adminsession'] = $adminsession;
}
} else {
// login incorrect
$stmt = Database::prepare("UPDATE $table
SET `lastlogin_fail`= :lastlogin_fail, `loginfail_count`=`loginfail_count`+1
WHERE `$uid`= :uid"
);
Database::pexecute($stmt, array("lastlogin_fail" => time(), "uid" => $userinfo[$uid]));
WHERE `$uid`= :uid");
Database::pexecute($stmt, array(
"lastlogin_fail" => time(),
"uid" => $userinfo[$uid]
));
// Log failed login
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => $_SERVER['REMOTE_ADDR']));
$rstlog->logAction(LOGIN_ACTION, LOG_WARNING, "User '" . $loginname . "' tried to login with wrong password.");
$rstlog = FroxlorLogger::getInstanceOf(array(
'loginname' => $_SERVER['REMOTE_ADDR']
));
$rstlog->logAction(\Froxlor\FroxlorLogger::LOGIN_ACTION, LOG_WARNING, "User '" . $loginname . "' tried to login with wrong password.");
unset($userinfo);
redirectTo('index.php', array('showmessage' => '2'));
exit;
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '2'
));
exit();
}
if (isset($userinfo['userid']) && $userinfo['userid'] != '') {
$s = md5(uniqid(microtime(), 1));
if (isset($_POST['language'])) {
$language = validate($_POST['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'] != '') {
$theme = $userinfo['theme'];
} else {
$theme = Settings::Get('panel.default_theme');
}
if (Settings::Get('session.allow_multiple_login') != '1') {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :uid
AND `adminsession` = :adminsession"
// 2FA activated
if (Settings::Get('2fa.enabled') == '1' && $userinfo['type_2fa'] > 0) {
// redirect to code-enter-page
$_SESSION['secret_2fa'] = ($userinfo['type_2fa'] == 2 ? $userinfo['data_2fa'] : 'email');
$_SESSION['uid_2fa'] = $userinfo[$uid];
$_SESSION['uidfield_2fa'] = $uid;
$_SESSION['uidtable_2fa'] = $table;
$_SESSION['unfo_2fa'] = $is_admin;
// send mail if type_2fa = 1 (email)
if ($userinfo['type_2fa'] == 1) {
// generate code
$tfa = new \Froxlor\FroxlorTwoFactorAuth('Froxlor');
$code = $tfa->getCode($tfa->createSecret());
// set code for user
$stmt = Database::prepare("UPDATE $table SET `data_2fa` = :d2fa WHERE `$uid` = :uid");
Database::pexecute($stmt, array(
"d2fa" => $code,
"uid" => $userinfo[$uid]
));
// build up & send email
$_mailerror = false;
$mailerr_msg = "";
$replace_arr = array(
'CODE' => $code
);
Database::pexecute($stmt, array("uid" => $userinfo['userid'], "adminsession" => $userinfo['adminsession']));
}
$mail_body = html_entity_decode(\Froxlor\PhpHelper::replaceVariables($lng['mails']['2fa']['mailbody'], $replace_arr));
// check for field 'theme' in session-table, refs #607
// Changed with #1287 to new method
$theme_field = false;
$stmt = Database::query("SHOW COLUMNS FROM panel_sessions LIKE 'theme'");
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
if ($row['Field'] == "theme") {
$has_theme = true;
try {
$mail->Subject = $lng['mails']['2fa']['subject'];
$mail->AltBody = $mail_body;
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
$mail->AddAddress($userinfo['email'], \Froxlor\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;
}
}
$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'] != "") {
parse_str(urldecode($_POST['qrystr']), $qryparams);
}
$qryparams['s'] = $s;
if ($userinfo['adminsession'] == '1') {
if (hasUpdates($version) || hasDbUpdates($dbversion)) {
redirectTo('admin_updates.php', array('s' => $s));
} else {
if (isset($_POST['script']) && $_POST['script'] != "") {
if (preg_match("/customer\_/", $_POST['script']) === 1) {
redirectTo('admin_customers.php', array("page" => "customers"));
} else {
redirectTo($_POST['script'], $qryparams);
}
} else {
redirectTo('admin_index.php', $qryparams);
}
}
} else {
if (isset($_POST['script']) && $_POST['script'] != "") {
redirectTo($_POST['script'], $qryparams);
} else {
redirectTo('customer_index.php', $qryparams);
if ($_mailerror) {
$rstlog = FroxlorLogger::getInstanceOf(array(
'loginname' => '2fa code-sending'
));
$rstlog->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '4',
'customermail' => $userinfo['email']
));
exit();
}
$mail->ClearAddresses();
}
} else {
redirectTo('index.php', array('showmessage' => '2'));
\Froxlor\UI\Response::redirectTo('index.php', array(
'action' => '2fa_entercode'
));
exit();
}
exit;
if (! finishLogin($userinfo)) {
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '2'
));
}
exit();
} else {
$language_options = '';
$language_options .= makeoption($lng['login']['profile_lng'], 'profile', 'profile', true, true);
$language_options .= \Froxlor\UI\HTML::makeoption($lng['login']['profile_lng'], 'profile', 'profile', true, true);
while (list($language_file, $language_name) = each($languages)) {
$language_options .= makeoption($language_name, $language_file, 'profile', 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;
$smessage = isset($_GET['showmessage']) ? (int) $_GET['showmessage'] : 0;
$message = '';
$successmessage = '';
switch ($smessage) {
case 1:
$successmessage = $lng['pwdreminder']['success'];
break;
case 2:
$message = $lng['error']['login'];
break;
case 3:
$message = sprintf($lng['error']['login_blocked'], Settings::Get('login.deactivatetime'));
break;
case 4:
$cmail = isset($_GET['customermail']) ? $_GET['customermail'] : 'unknown';
$message = str_replace('%s', $cmail, $lng['error']['errorsendingmail']);
break;
case 5:
$message = $lng['error']['user_banned'];
break;
case 6:
$successmessage = $lng['pwdreminder']['changed'];
break;
case 7:
$message = $lng['pwdreminder']['wrongcode'];
break;
case 8:
$message = $lng['pwdreminder']['notallowed'];
break;
case 1:
$successmessage = $lng['pwdreminder']['success'];
break;
case 2:
$message = $lng['error']['login'];
break;
case 3:
$message = sprintf($lng['error']['login_blocked'], Settings::Get('login.deactivatetime'));
break;
case 4:
$cmail = isset($_GET['customermail']) ? $_GET['customermail'] : 'unknown';
$message = str_replace('%s', $cmail, $lng['error']['errorsendingmail']);
break;
case 5:
$message = $lng['error']['user_banned'];
break;
case 6:
$successmessage = $lng['pwdreminder']['changed'];
break;
case 7:
$message = $lng['pwdreminder']['wrongcode'];
break;
case 8:
$message = $lng['pwdreminder']['notallowed'];
break;
}
$update_in_progress = '';
if (hasUpdates($version) || hasDbUpdates($dbversion)) {
if (\Froxlor\Froxlor::hasUpdates() || \Froxlor\Froxlor::hasDbUpdates()) {
$update_in_progress = $lng['update']['updateinprogress_onlyadmincanlogin'];
}
// Pass the last used page if needed
$lastscript = "";
if (isset($_REQUEST['script']) && $_REQUEST['script'] != "") {
$lastscript = $_REQUEST['script'];
if (!file_exists(__DIR__."/".$lastscript)) {
if (! file_exists(__DIR__ . "/" . $lastscript)) {
$lastscript = "";
}
}
@@ -305,7 +382,7 @@ if ($action == 'login') {
$lastqrystr = htmlspecialchars($_REQUEST['qrystr'], ENT_QUOTES);
}
eval("echo \"" . getTemplate('login') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('login') . "\";");
}
}
@@ -314,20 +391,24 @@ if ($action == 'forgotpwd') {
$message = '';
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$loginname = validate($_POST['loginname'], 'loginname');
$email = validateEmail($_POST['loginemail'], 'email');
$loginname = \Froxlor\Validate\Validate::validate($_POST['loginname'], 'loginname');
$email = \Froxlor\Validate\Validate::validateEmail($_POST['loginemail'], 'email');
$result_stmt = Database::prepare("SELECT `adminid`, `customerid`, `firstname`, `name`, `company`, `email`, `loginname`, `def_language`, `deactivated` FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE `loginname`= :loginname
AND `email`= :email"
);
Database::pexecute($result_stmt, array("loginname" => $loginname, "email" => $email));
AND `email`= :email");
Database::pexecute($result_stmt, array(
"loginname" => $loginname,
"email" => $email
));
if (Database::num_rows() == 0) {
$result_stmt = Database::prepare("SELECT `adminid`, `name`, `email`, `loginname`, `def_language`, `deactivated` FROM `" . TABLE_PANEL_ADMINS . "`
WHERE `loginname`= :loginname
AND `email`= :email"
);
Database::pexecute($result_stmt, array("loginname" => $loginname, "email" => $email));
AND `email`= :email");
Database::pexecute($result_stmt, array(
"loginname" => $loginname,
"email" => $email
));
if (Database::num_rows() > 0) {
$adminchecked = true;
@@ -341,23 +422,24 @@ if ($action == 'forgotpwd') {
/* Check whether user is banned */
if ($user['deactivated']) {
redirectTo('index.php', array('showmessage' => '8'));
exit;
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '8'
));
exit();
}
if (($adminchecked && Settings::Get('panel.allow_preset_admin') == '1') || $adminchecked == false) {
if ($user !== false) {
// build a activation code
$timestamp = time();
$first = substr(md5($user['loginname'] . $timestamp . randomStr(16)), 0, 15);
$third = substr(md5($user['email'] . $timestamp . randomStr(16)), -15);
$first = substr(md5($user['loginname'] . $timestamp . \Froxlor\PhpHelper::randomStr(16)), 0, 15);
$third = substr(md5($user['email'] . $timestamp . \Froxlor\PhpHelper::randomStr(16)), - 15);
$activationcode = $first . $timestamp . $third . substr(md5($third . $timestamp), 0, 10);
// Drop all existing activation codes for this user
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_ACTIVATION . "`
WHERE `userid` = :userid
AND `admin` = :admin"
);
AND `admin` = :admin");
$params = array(
"userid" => $adminchecked ? $user['adminid'] : $user['customerid'],
"admin" => $adminchecked ? 1 : 0
@@ -367,8 +449,7 @@ if ($action == 'forgotpwd') {
// Add new activation code to database
$stmt = Database::prepare("INSERT INTO `" . TABLE_PANEL_ACTIVATION . "`
(userid, admin, creation, activationcode)
VALUES (:userid, :admin, :creation, :activationcode)"
);
VALUES (:userid, :admin, :creation, :activationcode)");
$params = array(
"userid" => $adminchecked ? $user['adminid'] : $user['customerid'],
"admin" => $adminchecked ? 1 : 0,
@@ -377,11 +458,13 @@ if ($action == 'forgotpwd') {
);
Database::pexecute($stmt, $params);
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'));
$rstlog->logAction(USR_ACTION, LOG_WARNING, "User '" . $user['loginname'] . "' requested a link for setting a new password.");
$rstlog = FroxlorLogger::getInstanceOf(array(
'loginname' => 'password_reset'
));
$rstlog->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_WARNING, "User '" . $user['loginname'] . "' requested a link for setting a new password.");
// Set together our activation link
$protocol = empty( $_SERVER['HTTPS'] ) ? 'http' : 'https';
$protocol = empty($_SERVER['HTTPS']) ? 'http' : 'https';
// this can be a fixed value to avoid potential exploiting by modifying headers
$host = Settings::Get('system.hostname'); // $_SERVER['HTTP_HOST'];
$port = $_SERVER['SERVER_PORT'] != 80 ? ':' . $_SERVER['SERVER_PORT'] : '';
@@ -392,12 +475,12 @@ if ($action == 'forgotpwd') {
// there can be only one script to handle this so we can use a fixed value here
$script = "/index.php"; // $_SERVER['SCRIPT_NAME'];
if (Settings::Get('system.froxlordirectlyviahostname') == 0) {
$script = makeCorrectFile("/".basename(__DIR__)."/".$script);
$script = \Froxlor\FileDir::makeCorrectFile("/" . basename(__DIR__) . "/" . $script);
}
$activationlink = $protocol . '://' . $host . $port . $script . '?action=resetpwd&resetcode=' . $activationcode;
$replace_arr = array(
'SALUTATION' => getCorrectUserSalutation($user),
'SALUTATION' => \Froxlor\User::getCorrectUserSalutation($user),
'USERNAME' => $loginname,
'LINK' => $activationlink
);
@@ -407,30 +490,35 @@ if ($action == 'forgotpwd') {
WHERE `adminid`= :adminid
AND `language`= :lang
AND `templategroup`=\'mails\'
AND `varname`=\'password_reset_subject\''
);
Database::pexecute($result_stmt, array("adminid" => $user['adminid'], "lang" => $def_language));
AND `varname`=\'password_reset_subject\'');
Database::pexecute($result_stmt, array(
"adminid" => $user['adminid'],
"lang" => $def_language
));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$mail_subject = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['mails']['password_reset']['subject']), $replace_arr));
$mail_subject = html_entity_decode(\Froxlor\PhpHelper::replaceVariables((($result['value'] != '') ? $result['value'] : $lng['mails']['password_reset']['subject']), $replace_arr));
$result_stmt = Database::prepare('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '`
WHERE `adminid`= :adminid
AND `language`= :lang
AND `templategroup`=\'mails\'
AND `varname`=\'password_reset_mailbody\''
);
Database::pexecute($result_stmt, array("adminid" => $user['adminid'], "lang" => $def_language));
AND `varname`=\'password_reset_mailbody\'');
Database::pexecute($result_stmt, array(
"adminid" => $user['adminid'],
"lang" => $def_language
));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$mail_body = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['mails']['password_reset']['mailbody']), $replace_arr));
$mail_body = html_entity_decode(\Froxlor\PhpHelper::replaceVariables((($result['value'] != '') ? $result['value'] : $lng['mails']['password_reset']['mailbody']), $replace_arr));
$_mailerror = false;
$mailerr_msg = "";
try {
$mail->Subject = $mail_subject;
$mail->AltBody = $mail_body;
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
$mail->AddAddress($user['email'], getCorrectUserSalutation($user));
$mail->AddAddress($user['email'], \Froxlor\User::getCorrectUserSalutation($user));
$mail->Send();
} catch(phpmailerException $e) {
} catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
@@ -439,18 +527,27 @@ if ($action == 'forgotpwd') {
}
if ($_mailerror) {
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'));
$rstlog->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
redirectTo('index.php', array('showmessage' => '4', 'customermail' => $user['email']));
exit;
$rstlog = FroxlorLogger::getInstanceOf(array(
'loginname' => 'password_reset'
));
$rstlog->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '4',
'customermail' => $user['email']
));
exit();
}
$mail->ClearAddresses();
redirectTo('index.php', array('showmessage' => '1'));
exit;
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '1'
));
exit();
} else {
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'));
$rstlog->logAction(USR_ACTION, LOG_WARNING, "User '" . $loginname . "' requested to set a new password, but was not found in database!");
$rstlog = FroxlorLogger::getInstanceOf(array(
'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!");
$message = $lng['login']['combination_not_found'];
}
@@ -464,7 +561,7 @@ if ($action == 'forgotpwd') {
if ($adminchecked) {
if (Settings::Get('panel.allow_preset_admin') != '1') {
$message = $lng['pwdreminder']['notallowed'];
unset ($adminchecked);
unset($adminchecked);
}
} else {
if (Settings::Get('panel.allow_preset') != '1') {
@@ -472,7 +569,7 @@ if ($action == 'forgotpwd') {
}
}
eval("echo \"" . getTemplate('fpwd') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('fpwd') . "\";");
}
if ($action == 'resetpwd') {
@@ -480,9 +577,10 @@ if ($action == 'resetpwd') {
// Remove old activation codes
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_ACTIVATION . "`
WHERE creation < :oldest"
);
Database::pexecute($stmt, array("oldest" => time() - 86400));
WHERE creation < :oldest");
Database::pexecute($stmt, array(
"oldest" => time() - 86400
));
if (isset($_GET['resetcode']) && strlen($_GET['resetcode']) == 50) {
// Check if activation code is valid
@@ -494,17 +592,18 @@ if ($action == 'resetpwd') {
if (substr(md5($third . $timestamp), 0, 10) == $check && $timestamp >= time() - 86400) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$stmt = Database::prepare("SELECT `userid`, `admin` FROM `" . TABLE_PANEL_ACTIVATION . "`
WHERE `activationcode` = :activationcode"
);
$result = Database::pexecute_first($stmt, array("activationcode" => $activationcode));
WHERE `activationcode` = :activationcode");
$result = Database::pexecute_first($stmt, array(
"activationcode" => $activationcode
));
if ($result !== false) {
if ($result['admin'] == 1) {
$new_password = validate($_POST['new_password'], 'new password');
$new_password_confirm = validate($_POST['new_password_confirm'], 'new password confirm');
$new_password = \Froxlor\Validate\Validate::validate($_POST['new_password'], 'new password');
$new_password_confirm = \Froxlor\Validate\Validate::validate($_POST['new_password_confirm'], 'new password confirm');
} else {
$new_password = validatePassword($_POST['new_password'], 'new password');
$new_password_confirm = validatePassword($_POST['new_password_confirm'], 'new password confirm');
$new_password = \Froxlor\System\Crypt::validatePassword($_POST['new_password'], 'new password');
$new_password_confirm = \Froxlor\System\Crypt::validatePassword($_POST['new_password_confirm'], 'new password confirm');
}
if ($new_password == '') {
@@ -518,39 +617,148 @@ if ($action == 'resetpwd') {
if ($result['admin'] == 1) {
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_ADMINS . "`
SET `password` = :newpassword
WHERE `adminid` = :userid"
);
WHERE `adminid` = :userid");
} else {
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "`
SET `password` = :newpassword
WHERE `customerid` = :userid"
);
WHERE `customerid` = :userid");
}
Database::pexecute($stmt, array("newpassword" => makeCryptPassword($new_password), "userid" => $result['userid']));
Database::pexecute($stmt, array(
"newpassword" => \Froxlor\System\Crypt::makeCryptPassword($new_password),
"userid" => $result['userid']
));
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'));
$rstlog->logAction(USR_ACTION, LOG_NOTICE, "changed password using password reset.");
$rstlog = FroxlorLogger::getInstanceOf(array(
'loginname' => 'password_reset'
));
$rstlog->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "changed password using password reset.");
// Remove activation code from DB
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_ACTIVATION . "`
WHERE `activationcode` = :activationcode
AND `userid` = :userid"
);
Database::pexecute($stmt, array("activationcode" => $activationcode, "userid" => $result['userid']));
redirectTo('index.php', array("showmessage" => '6'));
AND `userid` = :userid");
Database::pexecute($stmt, array(
"activationcode" => $activationcode,
"userid" => $result['userid']
));
\Froxlor\UI\Response::redirectTo('index.php', array(
"showmessage" => '6'
));
}
} else {
redirectTo('index.php', array("showmessage" => '7'));
\Froxlor\UI\Response::redirectTo('index.php', array(
"showmessage" => '7'
));
}
}
eval("echo \"" . getTemplate('rpwd') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('rpwd') . "\";");
} else {
redirectTo('index.php', array("showmessage" => '7'));
\Froxlor\UI\Response::redirectTo('index.php', array(
"showmessage" => '7'
));
}
} else {
redirectTo('index.php');
\Froxlor\UI\Response::redirectTo('index.php');
}
}
function finishLogin($userinfo)
{
global $version, $dbversion, $remote_addr, $http_user_agent, $languages;
if (isset($userinfo['userid']) && $userinfo['userid'] != '') {
$s = md5(uniqid(microtime(), 1));
if (isset($_POST['language'])) {
$language = \Froxlor\Validate\Validate::validate($_POST['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'] != '') {
$theme = $userinfo['theme'];
} else {
$theme = Settings::Get('panel.default_theme');
}
if (Settings::Get('session.allow_multiple_login') != '1') {
$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'] != "") {
parse_str(urldecode($_POST['qrystr']), $qryparams);
}
$qryparams['s'] = $s;
if ($userinfo['adminsession'] == '1') {
if (\Froxlor\Froxlor::hasUpdates() || \Froxlor\Froxlor::hasDbUpdates()) {
\Froxlor\UI\Response::redirectTo('admin_updates.php', array(
's' => $s
));
} else {
if (isset($_POST['script']) && $_POST['script'] != "") {
if (preg_match("/customer\_/", $_POST['script']) === 1) {
\Froxlor\UI\Response::redirectTo('admin_customers.php', array(
"page" => "customers"
));
} else {
\Froxlor\UI\Response::redirectTo($_POST['script'], $qryparams);
}
} else {
\Froxlor\UI\Response::redirectTo('admin_index.php', $qryparams);
}
}
} else {
if (isset($_POST['script']) && $_POST['script'] != "") {
\Froxlor\UI\Response::redirectTo($_POST['script'], $qryparams);
} else {
\Froxlor\UI\Response::redirectTo('customer_index.php', $qryparams);
}
}
}
return false;
}

View File

@@ -8,7 +8,7 @@ CREATE TABLE `ftp_groups` (
PRIMARY KEY (`id`),
UNIQUE KEY `groupname` (`groupname`),
KEY `customerid` (`customerid`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -33,7 +33,7 @@ CREATE TABLE `ftp_users` (
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`),
KEY `customerid` (`customerid`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -57,7 +57,7 @@ CREATE TABLE `mail_users` (
`mboxsize` bigint(30) NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -66,14 +66,14 @@ CREATE TABLE `mail_virtual` (
`id` int(11) NOT NULL auto_increment,
`email` varchar(255) NOT NULL default '',
`email_full` varchar(255) NOT NULL default '',
`destination` text NOT NULL default '',
`destination` text,
`domainid` int(11) NOT NULL default '0',
`customerid` int(11) NOT NULL default '0',
`popaccountid` int(11) NOT NULL default '0',
`iscatchall` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `email` (`email`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_activation`;
@@ -84,7 +84,7 @@ CREATE TABLE `panel_activation` (
`creation` int(11) unsigned NOT NULL default '0',
`activationcode` varchar(50) default NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_admins`;
@@ -95,7 +95,7 @@ CREATE TABLE `panel_admins` (
`name` varchar(255) NOT NULL default '',
`email` varchar(255) NOT NULL default '',
`def_language` varchar(255) NOT NULL default '',
`ip` tinyint(4) NOT NULL default '-1',
`ip` varchar(500) NOT NULL default '-1',
`customers` int(15) NOT NULL default '0',
`customers_used` int(15) NOT NULL default '0',
`customers_see_all` tinyint(1) NOT NULL default '0',
@@ -118,9 +118,6 @@ CREATE TABLE `panel_admins` (
`email_quota_used` bigint(13) NOT NULL default '0',
`ftps` int(15) NOT NULL default '0',
`ftps_used` int(15) NOT NULL default '0',
`tickets` int(15) NOT NULL default '-1',
`tickets_used` int(15) NOT NULL default '0',
`tickets_see_all` tinyint(1) NOT NULL default '0',
`subdomains` int(15) NOT NULL default '0',
`subdomains_used` int(15) NOT NULL default '0',
`traffic` bigint(30) NOT NULL default '0',
@@ -133,9 +130,12 @@ CREATE TABLE `panel_admins` (
`theme` varchar(255) NOT NULL default 'Sparkle',
`custom_notes` text,
`custom_notes_show` tinyint(1) NOT NULL default '0',
`type_2fa` tinyint(1) NOT NULL default '0',
`data_2fa` varchar(500) NOT NULL default '',
`api_allowed` tinyint(1) NOT NULL default '1',
PRIMARY KEY (`adminid`),
UNIQUE KEY `loginname` (`loginname`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -171,8 +171,6 @@ CREATE TABLE `panel_customers` (
`email_quota_used` bigint(13) NOT NULL default '0',
`ftps` int(15) NOT NULL default '0',
`ftps_used` int(15) NOT NULL default '0',
`tickets` int(15) NOT NULL default '0',
`tickets_used` int(15) NOT NULL default '0',
`subdomains` int(15) NOT NULL default '0',
`subdomains_used` int(15) NOT NULL default '0',
`traffic` bigint(30) NOT NULL default '0',
@@ -195,11 +193,18 @@ CREATE TABLE `panel_customers` (
`theme` varchar(255) NOT NULL default 'Sparkle',
`custom_notes` text,
`custom_notes_show` tinyint(1) NOT NULL default '0',
`lepublickey` mediumtext DEFAULT NULL,
`leprivatekey` mediumtext DEFAULT NULL,
`lepublickey` mediumtext default NULL,
`leprivatekey` mediumtext default NULL,
`leregistered` tinyint(1) NOT NULL default '0',
`leaccount` varchar(255) default '',
`allowed_phpconfigs` varchar(500) NOT NULL default '',
`type_2fa` tinyint(1) NOT NULL default '0',
`data_2fa` varchar(500) NOT NULL default '',
`api_allowed` tinyint(1) NOT NULL default '1',
`logviewenabled` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`customerid`),
UNIQUE KEY `loginname` (`loginname`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -212,7 +217,7 @@ CREATE TABLE `panel_databases` (
`dbserver` int(11) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `customerid` (`customerid`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -237,11 +242,14 @@ CREATE TABLE `panel_domains` (
`dkim_pubkey` text,
`wwwserveralias` tinyint(1) NOT NULL default '1',
`parentdomainid` int(11) NOT NULL default '0',
`phpenabled` tinyint(1) NOT NULL default '0',
`openbasedir` tinyint(1) NOT NULL default '0',
`openbasedir_path` tinyint(1) NOT NULL default '0',
`speciallogfile` tinyint(1) NOT NULL default '0',
`ssl_redirect` tinyint(4) NOT NULL default '0',
`specialsettings` text,
`ssl_specialsettings` text,
`include_specialsettings` tinyint(1) NOT NULL default '0',
`deactivated` tinyint(1) NOT NULL default '0',
`bindserial` varchar(10) NOT NULL default '2000010100',
`add_date` int( 11 ) NOT NULL default '0',
@@ -255,11 +263,16 @@ CREATE TABLE `panel_domains` (
`hsts` varchar(10) NOT NULL default '0',
`hsts_sub` tinyint(1) NOT NULL default '0',
`hsts_preload` tinyint(1) NOT NULL default '0',
`ocsp_stapling` tinyint(1) DEFAULT '0',
`http2` tinyint(1) DEFAULT '0',
`notryfiles` tinyint(1) DEFAULT '0',
`writeaccesslog` tinyint(1) DEFAULT '1',
`writeerrorlog` tinyint(1) DEFAULT '1',
PRIMARY KEY (`id`),
KEY `customerid` (`customerid`),
KEY `parentdomain` (`parentdomainid`),
KEY `domain` (`domain`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -274,14 +287,19 @@ CREATE TABLE `panel_ipsandports` (
`vhostcontainer_servername_statement` tinyint(1) NOT NULL default '0',
`specialsettings` text,
`ssl` tinyint(4) NOT NULL default '0',
`ssl_cert_file` varchar(255) NOT NULL,
`ssl_key_file` varchar(255) NOT NULL,
`ssl_ca_file` varchar(255) NOT NULL,
`ssl_cert_file` varchar(255) NOT NULL default '',
`ssl_key_file` varchar(255) NOT NULL default '',
`ssl_ca_file` varchar(255) NOT NULL default '',
`default_vhostconf_domain` text,
`ssl_cert_chainfile` varchar(255) NOT NULL,
`ssl_cert_chainfile` varchar(255) NOT NULL default '',
`docroot` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
`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`),
UNIQUE KEY `ip_port` (`ip`,`port`)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -297,7 +315,7 @@ CREATE TABLE `panel_htaccess` (
`error401path` varchar(255) NOT NULL default '',
`options_cgi` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -311,7 +329,7 @@ CREATE TABLE `panel_htpasswds` (
`authname` varchar(255) NOT NULL default 'Restricted Area',
PRIMARY KEY (`id`),
KEY `customerid` (`customerid`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -340,7 +358,7 @@ CREATE TABLE `panel_settings` (
`varname` varchar(255) NOT NULL default '',
`value` text NOT NULL,
PRIMARY KEY (`settingid`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('catchall', 'catchall_enabled', '1'),
@@ -352,17 +370,6 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('customer', 'ftpatdomain', '0'),
('customer', 'show_news_feed', '0'),
('customer', 'news_feed_url', ''),
('ticket', 'noreply_email', 'NO-REPLY@SERVERNAME'),
('ticket', 'worktime_all', '1'),
('ticket', 'worktime_begin', '00:00'),
('ticket', 'worktime_end', '23:59'),
('ticket', 'worktime_sat', '0'),
('ticket', 'worktime_sun', '0'),
('ticket', 'archiving_days', '5'),
('ticket', 'enabled', '1'),
('ticket', 'concurrently_open', '5'),
('ticket', 'noreply_name', 'Hosting Support'),
('ticket', 'reset_cycle', '2'),
('logger', 'enabled', '1'),
('logger', 'log_cron', '0'),
('logger', 'logfile', ''),
@@ -376,20 +383,18 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('admin', 'show_news_feed', '0'),
('admin', 'show_version_login', '0'),
('admin', 'show_version_footer', '0'),
('caa', 'caa_entry', ''),
('spf', 'use_spf', '0'),
('spf', 'spf_entry', '"v=spf1 a mx -all"'),
('dkim', 'dkim_algorithm', 'all'),
('dkim', 'dkim_add_adsp', '1'),
('dkim', 'dkim_keylength', '1024'),
('dkim', 'dkim_servicetype', '0'),
('dkim', 'dkim_add_adsppolicy', '1'),
('dkim', 'dkim_notes', ''),
('defaultwebsrverrhandler', 'enabled', '0'),
('defaultwebsrverrhandler', 'err401', ''),
('defaultwebsrverrhandler', 'err403', ''),
('defaultwebsrverrhandler', 'err404', ''),
('defaultwebsrverrhandler', 'err500', ''),
('ticket', 'default_priority', '2'),
('customredirect', 'enabled', '1'),
('customredirect', 'default', '1'),
('perl', 'suexecworkaround', '0'),
@@ -398,25 +403,113 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('login', 'maxloginattempts', '3'),
('login', 'deactivatetime', '900'),
('phpfpm', 'enabled', '0'),
('phpfpm', 'configdir', '/etc/php-fpm.d/'),
('phpfpm', 'reload', '/etc/init.d/php-fpm restart'),
('phpfpm', 'pm', 'static'),
('phpfpm', 'max_children', '1'),
('phpfpm', 'start_servers', '20'),
('phpfpm', 'min_spare_servers', '5'),
('phpfpm', 'max_spare_servers', '35'),
('phpfpm', 'max_requests', '0'),
('phpfpm', 'tmpdir', '/var/customers/tmp/'),
('phpfpm', 'peardir', '/usr/share/php/:/usr/share/php5/'),
('phpfpm', 'envpath', '/usr/local/bin:/usr/bin:/bin'),
('phpfpm', 'enabled_ownvhost', '0'),
('phpfpm', 'vhost_httpuser', 'froxlorlocal'),
('phpfpm', 'vhost_httpgroup', 'froxlorlocal'),
('phpfpm', 'idle_timeout', '30'),
('phpfpm', 'aliasconfigdir', '/var/www/php-fpm/'),
('phpfpm', 'defaultini', '1'),
('phpfpm', 'vhost_defaultini', '2'),
('phpfpm', 'fastcgi_ipcdir', '/var/lib/apache2/fastcgi/'),
('phpfpm', 'use_mod_proxy', '0'),
('phpfpm', 'use_mod_proxy', '1'),
('phpfpm', 'ini_flags', 'asp_tags
display_errors
display_startup_errors
html_errors
log_errors
magic_quotes_gpc
magic_quotes_runtime
magic_quotes_sybase
mail.add_x_header
session.cookie_secure
session.use_cookies
short_open_tag
track_errors
xmlrpc_errors
suhosin.simulation
suhosin.session.encrypt
suhosin.session.cryptua
suhosin.session.cryptdocroot
suhosin.cookie.encrypt
suhosin.cookie.cryptua
suhosin.cookie.cryptdocroot
suhosin.executor.disable_eval
mbstring.func_overload'),
('phpfpm', 'ini_values', 'auto_append_file
auto_prepend_file
date.timezone
default_charset
error_reporting
include_path
log_errors_max_len
mail.log
max_execution_time
session.cookie_domain
session.cookie_lifetime
session.cookie_path
session.name
session.serialize_handler
upload_max_filesize
xmlrpc_error_number
session.auto_start
always_populate_raw_post_data
suhosin.session.cryptkey
suhosin.session.cryptraddr
suhosin.session.checkraddr
suhosin.cookie.cryptkey
suhosin.cookie.plainlist
suhosin.cookie.cryptraddr
suhosin.cookie.checkraddr
suhosin.executor.func.blacklist
suhosin.executor.eval.whitelist'),
('phpfpm', 'ini_admin_flags', 'allow_call_time_pass_reference
allow_url_fopen
allow_url_include
auto_detect_line_endings
cgi.fix_pathinfo
cgi.force_redirect
enable_dl
expose_php
file_uploads
ignore_repeated_errors
ignore_repeated_source
log_errors
register_argc_argv
report_memleaks
opcache.enable
opcache.consistency_checks
opcache.dups_fix
opcache.load_comments
opcache.revalidate_path
opcache.save_comments
opcache.use_cwd
opcache.validate_timestamps
opcache.fast_shutdown'),
('phpfpm', 'ini_admin_values', 'cgi.redirect_status_env
date.timezone
disable_classes
disable_functions
error_log
gpc_order
max_input_time
max_input_vars
memory_limit
open_basedir
output_buffering
post_max_size
precision
sendmail_path
session.gc_divisor
session.gc_probability
variables_order
opcache.log_verbosity_level
opcache.restrict_api
opcache.revalidate_freq
opcache.max_accelerated_files
opcache.memory_consumption
opcache.interned_strings_buffer'),
('nginx', 'fastcgiparams', '/etc/nginx/fastcgi_params'),
('system', 'lastaccountnumber', '0'),
('system', 'lastguid', '9999'),
@@ -436,9 +529,10 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('system', 'mysql_access_host', 'localhost'),
('system', 'lastcronrun', ''),
('system', 'defaultip', '1'),
('system', 'defaultsslip', ''),
('system', 'phpappendopenbasedir', '/tmp/'),
('system', 'deactivateddocroot', ''),
('system', 'mailpwcleartext', '1'),
('system', 'mailpwcleartext', '0'),
('system', 'last_tasks_run', '000000'),
('system', 'nameservers', ''),
('system', 'mxservers', ''),
@@ -476,6 +570,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('system', 'mod_fcgid_defaultini', '1'),
('system', 'ftpserver', 'proftpd'),
('system', 'dns_createmailentry', '0'),
('system', 'dns_createcaaentry', '1'),
('system', 'froxlordirectlyviahostname', '0'),
('system', 'report_enable', '1'),
('system', 'report_webmax', '90'),
@@ -496,9 +591,11 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('system', 'ssl_cert_chainfile', ''),
('system', 'ssl_cipher_list', 'ECDH+AESGCM:ECDH+AES256:!aNULL:!MD5:!DSS:!DH:!AES128'),
('system', 'nginx_php_backend', '127.0.0.1:8888'),
('system', 'http2_support', '0'),
('system', 'perl_server', 'unix:/var/run/nginx/cgiwrap-dispatch.sock'),
('system', 'phpreload_command', ''),
('system', 'apache24', '0'),
('system', 'apache24', '1'),
('system', 'apache24_ocsp_cache_path', 'shmcb:/var/run/apache2/ocsp-stapling.cache(131072)'),
('system', 'documentroot_use_default_value', '0'),
('system', 'passwordcryptfunc', '3'),
('system', 'axfrservers', ''),
@@ -526,9 +623,10 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('system', 'letsencryptkeysize', '4096'),
('system', 'letsencryptreuseold', 0),
('system', 'leenabled', '0'),
('system', 'leapiversion', '2'),
('system', 'backupenabled', '0'),
('system', 'dnsenabled', '0'),
('system', 'dns_server', 'bind'),
('system', 'dns_server', 'Bind'),
('system', 'apacheglobaldiropt', ''),
('system', 'allow_customer_shell', '0'),
('system', 'available_shells', ''),
@@ -543,8 +641,24 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('system', 'mail_smtp_user', ''),
('system', 'mail_smtp_passwd', ''),
('system', 'hsts_maxage', '0'),
('system', 'hsts_sub', '0'),
('system', 'hsts_incsub', '0'),
('system', 'hsts_preload', '0'),
('system', 'leregistered', '0'),
('system', 'leaccount', ''),
('system', 'nssextrausers', '0'),
('system', 'disable_le_selfcheck', '0'),
('system', 'ssl_protocols', 'TLSv1,TLSv1.2'),
('system', 'tlsv13_cipher_list', ''),
('system', 'logfiles_format', ''),
('system', 'logfiles_type', '1'),
('system', 'logfiles_piped', '0'),
('system', 'logfiles_script', ''),
('system', 'dhparams_file', ''),
('system', 'errorlog_level', 'warn'),
('system', 'leecc', '0'),
('system', 'froxloraliases', ''),
('api', 'enabled', '0'),
('2fa', 'enabled', '1'),
('panel', 'decimal_places', '4'),
('panel', 'adminmail', 'admin@SERVERNAME'),
('panel', 'phpmyadmin_url', ''),
@@ -576,8 +690,9 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('panel', 'password_special_char_required', '0'),
('panel', 'password_special_char', '!?<>§$%+#=@'),
('panel', 'customer_hide_options', ''),
('panel', 'version', '0.9.38-rc2'),
('panel', 'db_version', '201610070');
('panel', 'is_configured', '0'),
('panel', 'version', '0.10.2'),
('panel', 'db_version', '201910120');
DROP TABLE IF EXISTS `panel_tasks`;
@@ -586,7 +701,7 @@ CREATE TABLE `panel_tasks` (
`type` int(11) NOT NULL default '0',
`data` text,
PRIMARY KEY (`id`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
INSERT INTO `panel_tasks` (`type`) VALUES ('99');
@@ -601,7 +716,7 @@ CREATE TABLE `panel_templates` (
`value` longtext NOT NULL,
PRIMARY KEY (id),
KEY adminid (adminid)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -619,7 +734,7 @@ CREATE TABLE `panel_traffic` (
`mail` bigint(30) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `customerid` (`customerid`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -637,7 +752,7 @@ CREATE TABLE `panel_traffic_admins` (
`mail` bigint(30) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `adminid` (`adminid`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -654,7 +769,7 @@ CREATE TABLE `panel_diskspace` (
`mysql` bigint(30) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `customerid` (`customerid`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -671,7 +786,7 @@ CREATE TABLE `panel_diskspace_admins` (
`mysql` bigint(30) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `adminid` (`adminid`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -682,7 +797,7 @@ CREATE TABLE `panel_languages` (
`iso` char(3) NOT NULL DEFAULT 'foo',
`file` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -696,41 +811,6 @@ INSERT INTO `panel_languages` (`id`, `language`, `iso`, `file`) VALUES
(7, 'Svenska', 'sv', 'lng/swedish.lng.php');
DROP TABLE IF EXISTS `panel_tickets`;
CREATE TABLE `panel_tickets` (
`id` int(11) unsigned NOT NULL auto_increment,
`customerid` int(11) NOT NULL,
`adminid` int(11) NOT NULL,
`category` smallint(5) unsigned NOT NULL default '1',
`priority` enum('1','2','3') NOT NULL default '3',
`subject` varchar(70) NOT NULL,
`message` text NOT NULL,
`dt` int(15) NOT NULL,
`lastchange` int(15) NOT NULL,
`ip` varchar(39) NOT NULL default '',
`status` enum('0','1','2','3') NOT NULL default '1',
`lastreplier` enum('0','1') NOT NULL default '0',
`answerto` int(11) unsigned NOT NULL,
`by` enum('0','1') NOT NULL default '0',
`archived` enum('0','1') NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `customerid` (`customerid`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_ticket_categories`;
CREATE TABLE `panel_ticket_categories` (
`id` smallint(5) unsigned NOT NULL auto_increment,
`name` varchar(60) NOT NULL,
`adminid` int(11) NOT NULL,
`logicalorder` int(3) NOT NULL default '1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_syslog`;
CREATE TABLE IF NOT EXISTS `panel_syslog` (
`logid` bigint(20) NOT NULL auto_increment,
@@ -740,7 +820,34 @@ CREATE TABLE IF NOT EXISTS `panel_syslog` (
`user` varchar(50) NOT NULL,
`text` text NOT NULL,
PRIMARY KEY (`logid`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_fpmdaemons`;
CREATE TABLE `panel_fpmdaemons` (
`id` int(11) unsigned NOT NULL auto_increment,
`description` varchar(50) NOT NULL,
`reload_cmd` varchar(255) NOT NULL,
`config_dir` varchar(255) NOT NULL,
`pm` varchar(15) NOT NULL DEFAULT 'static',
`max_children` int(4) NOT NULL DEFAULT '1',
`start_servers` int(4) NOT NULL DEFAULT '20',
`min_spare_servers` int(4) NOT NULL DEFAULT '5',
`max_spare_servers` int(4) NOT NULL DEFAULT '35',
`max_requests` int(4) NOT NULL DEFAULT '0',
`idle_timeout` int(4) NOT NULL DEFAULT '30',
`limit_extensions` varchar(255) NOT NULL default '.php',
PRIMARY KEY (`id`),
UNIQUE KEY `reload` (`reload_cmd`),
UNIQUE KEY `config` (`config_dir`)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
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/');
DROP TABLE IF EXISTS `panel_phpconfigs`;
@@ -756,14 +863,26 @@ CREATE TABLE `panel_phpconfigs` (
`fpm_reqterm` varchar(15) NOT NULL default '60s',
`fpm_reqslow` varchar(15) NOT NULL default '5s',
`phpsettings` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
`fpmsettingid` int(11) NOT NULL DEFAULT '1',
`pass_authorizationheader` tinyint(1) NOT NULL default '0',
`override_fpmconfig` tinyint(1) NOT NULL DEFAULT '0',
`pm` varchar(15) NOT NULL DEFAULT 'static',
`max_children` int(4) NOT NULL DEFAULT '1',
`start_servers` int(4) NOT NULL DEFAULT '20',
`min_spare_servers` int(4) NOT NULL DEFAULT '5',
`max_spare_servers` int(4) NOT NULL DEFAULT '35',
`max_requests` int(4) NOT NULL DEFAULT '0',
`idle_timeout` int(4) NOT NULL DEFAULT '30',
`limit_extensions` varchar(255) NOT NULL default '.php',
PRIMARY KEY (`id`),
KEY `fpmsettingid` (`fpmsettingid`)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
INSERT INTO `panel_phpconfigs` (`id`, `description`, `binary`, `file_extensions`, `mod_fcgid_starter`, `mod_fcgid_maxrequests`, `phpsettings`) VALUES
(1, 'Default Config', '/usr/bin/php-cgi', 'php', '-1', '-1', 'allow_call_time_pass_reference = Off\r\nallow_url_fopen = Off\r\nasp_tags = Off\r\ndisable_classes =\r\ndisable_functions = curl_exec,curl_multi_exec,exec,parse_ini_file,passthru,popen,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,system\r\ndisplay_errors = Off\r\ndisplay_startup_errors = Off\r\nenable_dl = Off\r\nerror_reporting = E_ALL & ~E_NOTICE\r\nexpose_php = Off\r\nfile_uploads = On\r\ncgi.force_redirect = 1\r\ngpc_order = "GPC"\r\nhtml_errors = Off\r\nignore_repeated_errors = Off\r\nignore_repeated_source = Off\r\ninclude_path = ".:{PEAR_DIR}"\r\nlog_errors = On\r\nlog_errors_max_len = 1024\r\nmagic_quotes_gpc = Off\r\nmagic_quotes_runtime = Off\r\nmagic_quotes_sybase = Off\r\nmax_execution_time = 30\r\nmax_input_time = 60\r\nmemory_limit = 128M\r\n{OPEN_BASEDIR_C}open_basedir = "{OPEN_BASEDIR}"\r\noutput_buffering = 4096\r\npost_max_size = 16M\r\nprecision = 14\r\nregister_argc_argv = Off\r\nregister_globals = Off\r\nreport_memleaks = On\r\nsendmail_path = "/usr/sbin/sendmail -t -i -f {CUSTOMER_EMAIL}"\r\nsession.auto_start = 0\r\nsession.bug_compat_42 = 0\r\nsession.bug_compat_warn = 1\r\nsession.cache_expire = 180\r\nsession.cache_limiter = nocache\r\nsession.cookie_domain =\r\nsession.cookie_lifetime = 0\r\nsession.cookie_path = /\r\nsession.entropy_file = /dev/urandom\r\nsession.entropy_length = 16\r\nsession.gc_divisor = 1000\r\nsession.gc_maxlifetime = 1440\r\nsession.gc_probability = 1\r\nsession.name = PHPSESSID\r\nsession.referer_check =\r\nsession.save_handler = files\r\nsession.save_path = "{TMP_DIR}"\r\nsession.serialize_handler = php\r\nsession.use_cookies = 1\r\nsession.use_trans_sid = 0\r\nshort_open_tag = On\r\nsuhosin.mail.protect = 1\r\nsuhosin.simulation = Off\r\ntrack_errors = Off\r\nupload_max_filesize = 32M\r\nupload_tmp_dir = "{TMP_DIR}"\r\nvariables_order = "GPCS"\r\n;mail.add_x_header = On\r\n;mail.log = "/var/log/phpmail.log"\r\nopcache.restrict_api = "{DOCUMENT_ROOT}"\r\n'),
(2, 'Froxlor Vhost Config', '/usr/bin/php-cgi', 'php', '-1', '-1', 'allow_call_time_pass_reference = Off\r\nallow_url_fopen = On\r\nasp_tags = Off\r\ndisable_classes =\r\ndisable_functions = curl_multi_exec,exec,parse_ini_file,passthru,popen,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,system\r\ndisplay_errors = Off\r\ndisplay_startup_errors = Off\r\nenable_dl = Off\r\nerror_reporting = E_ALL & ~E_NOTICE\r\nexpose_php = Off\r\nfile_uploads = On\r\ncgi.force_redirect = 1\r\ngpc_order = "GPC"\r\nhtml_errors = Off\r\nignore_repeated_errors = Off\r\nignore_repeated_source = Off\r\ninclude_path = ".:{PEAR_DIR}"\r\nlog_errors = On\r\nlog_errors_max_len = 1024\r\nmagic_quotes_gpc = Off\r\nmagic_quotes_runtime = Off\r\nmagic_quotes_sybase = Off\r\nmax_execution_time = 60\r\nmax_input_time = 60\r\nmemory_limit = 128M\r\nnoutput_buffering = 4096\r\npost_max_size = 16M\r\nprecision = 14\r\nregister_argc_argv = Off\r\nregister_globals = Off\r\nreport_memleaks = On\r\nsendmail_path = "/usr/sbin/sendmail -t -i -f {CUSTOMER_EMAIL}"\r\nsession.auto_start = 0\r\nsession.bug_compat_42 = 0\r\nsession.bug_compat_warn = 1\r\nsession.cache_expire = 180\r\nsession.cache_limiter = nocache\r\nsession.cookie_domain =\r\nsession.cookie_lifetime = 0\r\nsession.cookie_path = /\r\nsession.entropy_file = /dev/urandom\r\nsession.entropy_length = 16\r\nsession.gc_divisor = 1000\r\nsession.gc_maxlifetime = 1440\r\nsession.gc_probability = 1\r\nsession.name = PHPSESSID\r\nsession.referer_check =\r\nsession.save_handler = files\r\nsession.save_path = "{TMP_DIR}"\r\nsession.serialize_handler = php\r\nsession.use_cookies = 1\r\nsession.use_trans_sid = 0\r\nshort_open_tag = On\r\nsuhosin.mail.protect = 1\r\nsuhosin.simulation = Off\r\ntrack_errors = Off\r\nupload_max_filesize = 32M\r\nupload_tmp_dir = "{TMP_DIR}"\r\nvariables_order = "GPCS"\r\n;mail.add_x_header = On\r\n;mail.log = "/var/log/phpmail.log"\r\nopcache.restrict_api = ""\r\n');
(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`;
@@ -771,23 +890,22 @@ CREATE TABLE IF NOT EXISTS `cronjobs_run` (
`id` bigint(20) NOT NULL auto_increment,
`module` varchar(250) NOT NULL,
`cronfile` varchar(250) NOT NULL,
`cronclass` varchar(500) NOT NULL,
`lastrun` int(15) NOT NULL DEFAULT '0',
`interval` varchar(100) NOT NULL DEFAULT '5 MINUTE',
`isactive` tinyint(1) DEFAULT '1',
`desc_lng_key` varchar(100) NOT NULL DEFAULT 'cron_unknown_desc',
PRIMARY KEY (`id`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
INSERT INTO `cronjobs_run` (`id`, `module`, `cronfile`, `interval`, `isactive`, `desc_lng_key`) VALUES
(1, 'froxlor/core', 'tasks', '5 MINUTE', '1', 'cron_tasks'),
(2, 'froxlor/core', 'traffic', '1 DAY', '1', 'cron_traffic'),
(3, 'froxlor/ticket', 'used_tickets_reset', '1 DAY', '1', 'cron_ticketsreset'),
(4, 'froxlor/ticket', 'ticketarchive', '1 MONTH', '1', 'cron_ticketarchive'),
(5, 'froxlor/reports', 'usage_report', '1 DAY', '1', 'cron_usage_report'),
(6, 'froxlor/core', 'mailboxsize', '6 HOUR', '1', 'cron_mailboxsize'),
(7, 'froxlor/letsencrypt', 'letsencrypt', '5 MINUTE', '0', 'cron_letsencrypt'),
(8, 'froxlor/backup', 'backup', '1 DAY', '1', 'cron_backup');
INSERT INTO `cronjobs_run` (`id`, `module`, `cronfile`, `cronclass`, `interval`, `isactive`, `desc_lng_key`) VALUES
(1, 'froxlor/core', 'tasks', '\\Froxlor\\Cron\\System\\TasksCron', '5 MINUTE', '1', 'cron_tasks'),
(2, 'froxlor/core', 'traffic', '\\Froxlor\\Cron\\Traffic\\TrafficCron', '1 DAY', '1', 'cron_traffic'),
(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'),
(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');
@@ -803,7 +921,7 @@ CREATE TABLE IF NOT EXISTS `ftp_quotalimits` (
`files_in_avail` int(10) unsigned NOT NULL,
`files_out_avail` int(10) unsigned NOT NULL,
`files_xfer_avail` int(10) unsigned NOT NULL
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -822,7 +940,7 @@ CREATE TABLE IF NOT EXISTS `ftp_quotatallies` (
`files_in_used` int(10) unsigned NOT NULL,
`files_out_used` int(10) unsigned NOT NULL,
`files_xfer_used` int(10) unsigned NOT NULL
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -833,7 +951,7 @@ CREATE TABLE IF NOT EXISTS `redirect_codes` (
`desc` varchar(200) NOT NULL,
`enabled` tinyint(1) DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -851,21 +969,22 @@ CREATE TABLE IF NOT EXISTS `domain_redirect_codes` (
`rid` int(5) NOT NULL,
`did` int(11) unsigned NOT NULL,
UNIQUE KEY `rc` (`rid`, `did`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `domain_ssl_settings`;
CREATE TABLE IF NOT EXISTS `domain_ssl_settings` (
`id` int(5) NOT NULL auto_increment,
`domainid` int(11) NOT NULL,
`ssl_cert_file` mediumtext NOT NULL,
`ssl_key_file` mediumtext NOT NULL,
`ssl_cert_file` mediumtext,
`ssl_key_file` mediumtext,
`ssl_ca_file` mediumtext,
`ssl_cert_chainfile` mediumtext,
`ssl_csr_file` mediumtext,
`ssl_fullchain_file` mediumtext,
`expirationdate` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_domaintoip`;
@@ -873,7 +992,7 @@ CREATE TABLE IF NOT EXISTS `panel_domaintoip` (
`id_domain` int(11) unsigned NOT NULL,
`id_ipandports` int(11) unsigned NOT NULL,
PRIMARY KEY (`id_domain`,`id_ipandports`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `domain_dns_entries`;
@@ -886,5 +1005,33 @@ CREATE TABLE `domain_dns_entries` (
`ttl` int(11) NOT NULL DEFAULT '18000',
`prio` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_plans`;
CREATE TABLE `panel_plans` (
`id` int(11) NOT NULL auto_increment,
`adminid` int(11) NOT NULL default '0',
`name` varchar(255) NOT NULL default '',
`description` text NOT NULL,
`value` longtext NOT NULL,
`ts` int(15) NOT NULL default '0',
PRIMARY KEY (id),
KEY adminid (adminid)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `api_keys`;
CREATE TABLE `api_keys` (
`id` int(11) NOT NULL auto_increment,
`adminid` int(11) NOT NULL default '0',
`customerid` int(11) NOT NULL default '0',
`apikey` varchar(500) NOT NULL default '',
`secret` varchar(500) NOT NULL default '',
`allowed_from` text NOT NULL,
`valid_until` int(15) NOT NULL default '0',
PRIMARY KEY (id),
KEY adminid (adminid),
KEY customerid (customerid)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;

View File

@@ -15,8 +15,16 @@
* @package Install
*
*/
require 'lib/class.FroxlorInstall.php';
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();
$frxinstall->run();

View File

@@ -28,7 +28,7 @@
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Install
*
*
*/
class FroxlorInstall
{
@@ -74,10 +74,17 @@ class FroxlorInstall
/**
* currently used language
*
* @var unknown
* @var string
*/
private $_activelng = 'english';
/**
* check whether to abort due to errors
*
* @var bool
*/
private $_abort = false;
/**
* Class constructor
*/
@@ -96,10 +103,8 @@ class FroxlorInstall
$this->_sendHeaders();
// check if we have a valid installation already
$this->_checkUserdataFile();
// include the functions
require $this->_basepath . '/lib/functions.php';
// include the MySQL-Table-Definitions
require $this->_basepath . '/lib/tables.inc.php';
require_once $this->_basepath . '/lib/tables.inc.php';
// include language
$this->_includeLanguageFile();
// show the action
@@ -177,10 +182,14 @@ class FroxlorInstall
}
// check system-hostname to be a FQDN
if ($this->_validate_ip($this->_data['servername'], true) !== false) {
if ($this->_validate_ip($this->_data['servername']) !== false) {
$this->_data['servername'] = '';
}
if (empty($this->_data['serverip']) || $this->_validate_ip($this->_data['serverip']) == false) {
return false;
}
if (isset($_POST['installstep']) && $_POST['installstep'] == '1' && $this->_data['admin_pass1'] == $this->_data['admin_pass2'] && $this->_data['admin_pass1'] != '' && $this->_data['admin_pass2'] != '' && $this->_data['mysql_unpriv_pass'] != '' && $this->_data['mysql_root_pass'] != '' && $this->_data['servername'] != '' && $this->_data['serverip'] != '' && $this->_data['httpuser'] != '' && $this->_data['httpgroup'] != '' && $this->_data['mysql_unpriv_user'] != $this->_data['mysql_root_user']) {
return true;
}
@@ -200,7 +209,7 @@ class FroxlorInstall
$content .= $this->_status_message('begin', $this->_lng['install']['testing_mysql']);
$options = array(
'PDO::MYSQL_ATTR_INIT_COMMAND' => 'set names utf8'
'PDO::MYSQL_ATTR_INIT_COMMAND' => 'SET names utf8'
);
$dsn = "mysql:host=" . $this->_data['mysql_host'] . ";";
$fatal_fail = false;
@@ -225,6 +234,12 @@ class FroxlorInstall
}
if (! $fatal_fail) {
$version_server = $db_root->getAttribute(PDO::ATTR_SERVER_VERSION);
$sql_mode = 'NO_ENGINE_SUBSTITUTION';
if (version_compare($version_server, '8.0.11', '<')) {
$sql_mode .= ',NO_AUTO_CREATE_USER';
}
$db_root->exec('SET sql_mode = "' . $sql_mode . '"');
// ok, if we are here, the database connection is up and running
$content .= $this->_status_message('green', "OK");
@@ -234,36 +249,43 @@ class FroxlorInstall
$content .= $this->_createDatabaseAndUser($db_root);
// importing data to new database
$content .= $this->_importDatabaseData();
// create DB object for new database
$options = array(
'PDO::MYSQL_ATTR_INIT_COMMAND' => 'set names utf8'
);
$dsn = "mysql:host=" . $this->_data['mysql_host'] . ";dbname=" . $this->_data['mysql_database'] . ";";
$another_fail = false;
try {
$db = new PDO($dsn, $this->_data['mysql_unpriv_user'], $this->_data['mysql_unpriv_pass'], $options);
} catch (PDOException $e) {
// dafuq? this should have happened in _importDatabaseData()
$content .= $this->_status_message('red', $e->getMessage());
$another_fail = true;
}
;
if (! $this->_abort) {
// create DB object for new database
$options = array(
'PDO::MYSQL_ATTR_INIT_COMMAND' => 'SET names utf8'
);
$dsn = "mysql:host=" . $this->_data['mysql_host'] . ";dbname=" . $this->_data['mysql_database'] . ";";
$another_fail = false;
try {
$db = new PDO($dsn, $this->_data['mysql_unpriv_user'], $this->_data['mysql_unpriv_pass'], $options);
$version_server = $db->getAttribute(PDO::ATTR_SERVER_VERSION);
$sql_mode = 'NO_ENGINE_SUBSTITUTION';
if (version_compare($version_server, '8.0.11', '<')) {
$sql_mode .= ',NO_AUTO_CREATE_USER';
}
$db->exec('SET sql_mode = "' . $sql_mode . '"');
} catch (PDOException $e) {
// dafuq? this should have happened in _importDatabaseData()
$content .= $this->_status_message('red', $e->getMessage());
$another_fail = true;
}
if (! $another_fail) {
// change settings accordingly
$content .= $this->_doSettings($db);
// create entries
$content .= $this->_doDataEntries($db);
$db = null;
// create config-file
$content .= $this->_createUserdataConf();
if (! $another_fail) {
// change settings accordingly
$content .= $this->_doSettings($db);
// create entries
$content .= $this->_doDataEntries($db);
$db = null;
// create config-file
$content .= $this->_createUserdataConf();
}
}
}
$content .= "</table>";
// check if we have unrecoverable errors
if ($fatal_fail || $another_fail) {
if ($fatal_fail || $another_fail || $this->_abort) {
// D'oh
$navigation = '';
$msgcolor = 'red';
@@ -310,11 +332,12 @@ class FroxlorInstall
$userdata .= "?>";
// test if we can store the userdata.inc.php in ../lib
if ($fp = @fopen(dirname(dirname(dirname(__FILE__))) . '/lib/userdata.inc.php', 'w')) {
$userdata_file = dirname(dirname(dirname(__FILE__))) . '/lib/userdata.inc.php';
if ($fp = @fopen($userdata_file, 'w')) {
$result = @fputs($fp, $userdata, strlen($userdata));
@fclose($fp);
$content .= $this->_status_message('green', 'OK');
chmod('../lib/userdata.inc.php', 0440);
chmod($userdata_file, 0440);
} elseif ($fp = @fopen('/tmp/userdata.inc.php', 'w')) {
$result = @fputs($fp, $userdata, strlen($userdata));
@fclose($fp);
@@ -384,6 +407,7 @@ class FroxlorInstall
`name` = 'Froxlor-Administrator',
`email` = :email,
`def_language` = :deflang,
`api_allowed` = 1,
`customers` = -1,
`customers_see_all` = 1,
`caneditphpsettings` = 1,
@@ -397,8 +421,6 @@ class FroxlorInstall
`email_forwarders` = -1,
`email_quota` = -1,
`ftps` = -1,
`tickets` = -1,
`tickets_see_all` = 1,
`subdomains` = -1,
`traffic` = -1048576
");
@@ -472,6 +494,7 @@ class FroxlorInstall
$this->_updateSetting($upd_stmt, '/etc/init.d/nginx reload', 'system', 'apachereload_command');
$this->_updateSetting($upd_stmt, '/etc/nginx/nginx.pem', 'system', 'ssl_cert_file');
$this->_updateSetting($upd_stmt, '/var/run/', 'phpfpm', 'fastcgi_ipcdir');
$this->_updateSetting($upd_stmt, 'error', 'system', 'errorlog_level');
}
$this->_updateSetting($upd_stmt, $this->_data['activate_newsfeed'], 'admin', 'show_news_feed');
@@ -482,10 +505,7 @@ class FroxlorInstall
// set specific times for some crons (traffic only at night, etc.)
$ts = mktime(0, 0, 0, date('m', time()), date('d', time()), date('Y', time()));
$db->query("UPDATE `" . TABLE_PANEL_CRONRUNS . "` SET `lastrun` = '" . $ts . "' WHERE `cronfile` ='cron_traffic.php';");
$ts = mktime(1, 0, 0, date('m', time()), date('d', time()), date('Y', time()));
$db->query("UPDATE `" . TABLE_PANEL_CRONRUNS . "` SET `lastrun` = '" . $ts . "' WHERE `cronfile` ='cron_used_tickets_reset.php';");
$db->query("UPDATE `" . TABLE_PANEL_CRONRUNS . "` SET `lastrun` = '" . $ts . "' WHERE `cronfile` ='cron_ticketarchive.php';");
$db->query("UPDATE `" . TABLE_PANEL_CRONRUNS . "` SET `lastrun` = '" . $ts . "' WHERE `cronfile` ='cron_traffic';");
// insert task 99 to generate a correct cron.d-file automatically
$db->query("INSERT INTO `" . TABLE_PANEL_TASKS . "` SET `type` = '99';");
@@ -507,17 +527,29 @@ class FroxlorInstall
$content = "";
$content .= $this->_status_message('begin', $this->_lng['install']['testing_new_db']);
$options = array(
'PDO::MYSQL_ATTR_INIT_COMMAND' => 'set names utf8'
'PDO::MYSQL_ATTR_INIT_COMMAND' => 'SET names utf8'
);
$dsn = "mysql:host=" . $this->_data['mysql_host'] . ";dbname=" . $this->_data['mysql_database'] . ";";
$fatal_fail = false;
try {
$db = new PDO($dsn, $this->_data['mysql_unpriv_user'], $this->_data['mysql_unpriv_pass'], $options);
$attributes = array(
'ATTR_ERRMODE' => 'ERRMODE_EXCEPTION'
);
// set attributes
foreach ($attributes as $k => $v) {
$db->setAttribute(constant("PDO::" . $k), constant("PDO::" . $v));
}
$version_server = $db->getAttribute(PDO::ATTR_SERVER_VERSION);
$sql_mode = 'NO_ENGINE_SUBSTITUTION';
if (version_compare($version_server, '8.0.11', '<')) {
$sql_mode .= ',NO_AUTO_CREATE_USER';
}
$db->exec('SET sql_mode = "' . $sql_mode . '"');
} catch (PDOException $e) {
$content .= $this->_status_message('red', $e->getMessage());
$fatal_fail = true;
}
;
if (! $fatal_fail) {
@@ -530,12 +562,21 @@ class FroxlorInstall
$sql_query = $this->_split_sql_file($sql_query, ';');
for ($i = 0; $i < sizeof($sql_query); $i ++) {
if (trim($sql_query[$i]) != '') {
$result = $db->query($sql_query[$i]);
try {
$result = $db->query($sql_query[$i]);
} catch (\PDOException $e) {
$content .= $this->_status_message('red', $e->getMessage());
$fatal_fail = true;
$this->_abort = true;
break;
}
}
}
$db = null;
$content .= $this->_status_message('green', 'OK');
if (! $fatal_fail) {
$content .= $this->_status_message('green', 'OK');
}
$db = null;
}
return $content;
@@ -603,21 +644,8 @@ class FroxlorInstall
$mysql_access_host_array[] = $this->_data['serverip'];
foreach ($mysql_access_host_array as $mysql_access_host) {
$_db = str_replace('`', '', $this->_data['mysql_database']);
$stmt = $db_root->prepare("
GRANT ALL PRIVILEGES ON `" . $_db . "`.*
TO :username@:host
IDENTIFIED BY 'password'");
$stmt->execute(array(
"username" => $this->_data['mysql_unpriv_user'],
"host" => $mysql_access_host
));
$stmt = $db_root->prepare("SET PASSWORD FOR :username@:host = PASSWORD(:password)");
$stmt->execute(array(
"username" => $this->_data['mysql_unpriv_user'],
"host" => $mysql_access_host,
"password" => $this->_data['mysql_unpriv_pass']
));
$frox_db = str_replace('`', '', $this->_data['mysql_database']);
$this->_grantDbPrivilegesTo($db_root, $frox_db, $this->_data['mysql_unpriv_user'], $this->_data['mysql_unpriv_pass'], $mysql_access_host);
}
$db_root->query("FLUSH PRIVILEGES;");
@@ -627,6 +655,38 @@ class FroxlorInstall
return $content;
}
private function _grantDbPrivilegesTo(&$db_root, $database, $username, $password, $access_host)
{
// mysql8 compatibility
if (version_compare($db_root->getAttribute(\PDO::ATTR_SERVER_VERSION), '8.0.11', '>=')) {
// create user
$stmt = $db_root->prepare("
CREATE USER '" . $username . "'@'" . $access_host . "' IDENTIFIED BY :password
");
$stmt->execute(array(
"password" => $password
));
// grant privileges
$stmt = $db_root->prepare("
GRANT ALL ON `" . $database . "`.* TO :username@:host
");
$stmt->execute(array(
"username" => $username,
"host" => $access_host
));
} else {
// grant privileges
$stmt = $db_root->prepare("
GRANT ALL PRIVILEGES ON `" . $database . "`.* TO :username@:host IDENTIFIED BY :password
");
$stmt->execute(array(
"username" => $username,
"host" => $access_host,
"password" => $password
));
}
}
/**
* Check if an old database exists and back it up if necessary
*
@@ -698,8 +758,8 @@ class FroxlorInstall
}
// language selection
$language_options = '';
while (list ($language_file, $language_name) = each($this->_languages)) {
$language_options .= makeoption($language_name, $language_file, $this->_activelng, true, true);
foreach ($this->_languages as $language_name => $language_file) {
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $this->_activelng, true, true);
}
// get language-form-template
eval("\$content .= \"" . $this->_getTemplate("lngform") . "\";");
@@ -781,7 +841,7 @@ class FroxlorInstall
}
$formdata .= $this->_getSectionItemString('servername', true, $style);
// serverip
if (! empty($_POST['installstep']) && $this->_data['serverip'] == '') {
if (! empty($_POST['installstep']) && ($this->_data['serverip'] == '' || $this->_validate_ip($this->_data['serverip']) == false)) {
$style = 'color:red;';
} else {
$style = '';
@@ -835,7 +895,7 @@ class FroxlorInstall
* optional css
* @param string $type
* optional type of input-box (default: text)
*
*
* @return string
*/
private function _getSectionItemString($fieldname = null, $required = false, $style = "", $type = 'text')
@@ -904,29 +964,17 @@ class FroxlorInstall
// check for correct php version
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpversion']);
if (version_compare("5.3.0", PHP_VERSION, ">=")) {
if (version_compare("7.0.0", PHP_VERSION, ">=")) {
$content .= $this->_status_message('red', $this->_lng['requirements']['notfound'] . ' (' . PHP_VERSION . ')');
$_die = true;
} else {
if (version_compare("5.6.0", PHP_VERSION, ">=")) {
$content .= $this->_status_message('orange', $this->_lng['requirements']['newerphpprefered'] . ' (' .PHP_VERSION . ')');
if (version_compare("7.1.0", PHP_VERSION, ">=")) {
$content .= $this->_status_message('orange', $this->_lng['requirements']['newerphpprefered'] . ' (' . PHP_VERSION . ')');
} else {
$content .= $this->_status_message('green', PHP_VERSION);
}
}
// Check if magic_quotes_runtime is active | get_magic_quotes_runtime() is always FALSE since 5.4
if (version_compare(PHP_VERSION, "5.4.0", "<")) {
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpmagic_quotes_runtime']);
if (get_magic_quotes_runtime()) {
// deactivate it
set_magic_quotes_runtime(false);
$content .= $this->_status_message('orange', $this->_lng['requirements']['not_true'] . "<br />" . $this->_lng['requirements']['phpmagic_quotes_runtime_description']);
} else {
$content .= $this->_status_message('green', 'off');
}
}
// check for php_pdo and pdo_mysql
$content .= $this->_status_message('begin', $this->_lng['requirements']['phppdo']);
@@ -937,73 +985,38 @@ class FroxlorInstall
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
}
// check for xml-extension
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpxml']);
// check for session-extension
$this->_requirementCheckFor($content, $_die, 'session', false, 'phpsession');
if (! extension_loaded('xml')) {
$content .= $this->_status_message('red', $this->_lng['requirements']['notinstalled']);
$_die = true;
} else {
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
}
// check for ctype-extension
$this->_requirementCheckFor($content, $_die, 'ctype', false, 'phpctype');
// check for SimpleXML-extension
$this->_requirementCheckFor($content, $_die, 'simplexml', false, 'phpsimplexml');
// check for xml-extension
$this->_requirementCheckFor($content, $_die, 'xml', false, 'phpxml');
// check for filter-extension
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpfilter']);
if (! extension_loaded('filter')) {
$content .= $this->_status_message('red', $this->_lng['requirements']['notinstalled']);
$_die = true;
} else {
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
}
$this->_requirementCheckFor($content, $_die, 'filter', false, 'phpfilter');
// check for posix-extension
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpposix']);
$this->_requirementCheckFor($content, $_die, 'posix', false, 'phpposix');
if (! extension_loaded('posix')) {
$content .= $this->_status_message('red', $this->_lng['requirements']['notinstalled']);
$_die = true;
} else {
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
}
// check for bstring-extension
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpmbstring']);
if (! extension_loaded('mbstring')) {
$content .= $this->_status_message('red', $this->_lng['requirements']['notinstalled']);
$_die = true;
} else {
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
}
// check for mbstring-extension
$this->_requirementCheckFor($content, $_die, 'mbstring', false, 'phpmbstring');
// check for curl extension
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpcurl']);
$this->_requirementCheckFor($content, $_die, 'curl', false, 'phpcurl');
if (! extension_loaded('curl')) {
$content .= $this->_status_message('red', $this->_lng['requirements']['notinstalled']);
$_die = true;
} else {
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
}
// check for json extension
$this->_requirementCheckFor($content, $_die, 'json', false, 'phpjson');
// check for bcmath extension
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpbcmath']);
if (! extension_loaded('bcmath')) {
$content .= $this->_status_message('orange', $this->_lng['requirements']['notinstalled'] . "<br />" . $this->_lng['requirements']['bcmathdescription']);
} else {
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
}
$this->_requirementCheckFor($content, $_die, 'bcmath', true, 'phpbcmath', 'bcmathdescription');
// check for zip extension
$content .= $this->_status_message('begin', $this->_lng['requirements']['phpzip']);
if (! extension_loaded('zip')) {
$content .= $this->_status_message('orange', $this->_lng['requirements']['notinstalled'] . "<br />" . $this->_lng['requirements']['zipdescription']);
} else {
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
}
$this->_requirementCheckFor($content, $_die, 'zip', true, 'phpzip', 'zipdescription');
// check for open_basedir
$content .= $this->_status_message('begin', $this->_lng['requirements']['openbasedir']);
@@ -1013,6 +1026,16 @@ class FroxlorInstall
} else {
$content .= $this->_status_message('green', 'off');
}
// check for mysqldump binary in order to backup existing database
$content .= $this->_status_message('begin', $this->_lng['requirements']['mysqldump']);
if (file_exists("/usr/bin/mysqldump") || file_exists("/usr/local/bin/mysqldump")) {
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
} else {
$content .= $this->_status_message('orange', $this->_lng['requirements']['notinstalled'] . "<br />" . $this->_lng['requirements']['mysqldumpmissing']);
}
$content .= "</table>";
// check if we have unrecoverable errors
@@ -1036,17 +1059,34 @@ class FroxlorInstall
);
}
private function _requirementCheckFor(&$content, &$_die, $ext = '', $optional = false, $lng_txt = "", $lng_desc = "")
{
$content .= $this->_status_message('begin', $this->_lng['requirements'][$lng_txt]);
if (! extension_loaded($ext)) {
if (! $optional) {
$content .= $this->_status_message('red', $this->_lng['requirements']['notinstalled']);
$_die = true;
} else {
$content .= $this->_status_message('orange', $this->_lng['requirements']['notinstalled'] . "<br />" . $this->_lng['requirements'][$lng_desc]);
}
} else {
$content .= $this->_status_message('green', $this->_lng['requirements']['installed']);
}
}
/**
* send no-caching headers and set the default timezone
*/
private function _sendHeaders()
{
// no caching
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");
header('Last-Modified: ' . gmdate('D, d M Y H:i:s \G\M\T', time()));
header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time()));
if (@php_sapi_name() !== 'cli') {
// no caching
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");
header('Last-Modified: ' . gmdate('D, d M Y H:i:s \G\M\T', time()));
header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time()));
}
// 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());
@@ -1063,7 +1103,7 @@ class FroxlorInstall
if (file_exists($userdata)) {
// includes the usersettings (MySQL-Username/Passwort)
// to test if Froxlor is already installed
require $this->_basepath . '/lib/userdata.inc.php';
require_once $this->_basepath . '/lib/userdata.inc.php';
if (isset($sql) && is_array($sql)) {
// use sparkle theme for the notice
@@ -1103,12 +1143,23 @@ class FroxlorInstall
}
}
$lngfile = $this->_basepath . '/install/lng/' . $this->_activelng . '.lng.php';
// require english base language as fallback
$lngfile = $this->_basepath . '/install/lng/' . $standardlanguage . '.lng.php';
if (file_exists($lngfile)) {
// includes file /lng/$language.lng.php if it exists
require $lngfile;
require_once $lngfile;
$this->_lng = $lng;
}
// require chosen language if not english
if ($this->_activelng != $standardlanguage) {
$lngfile = $this->_basepath . '/install/lng/' . $this->_activelng . '.lng.php';
if (file_exists($lngfile)) {
// includes file /lng/$language.lng.php if it exists
require_once $lngfile;
$this->_lng = $lng;
}
}
}
/**
@@ -1116,7 +1167,7 @@ class FroxlorInstall
*
* @param string $template
* name of the template including subdirectory
*
*
* @return string
*/
private function _getTemplate($template = null)
@@ -1164,14 +1215,13 @@ class FroxlorInstall
$this->_data['servername'] = $_POST['servername'];
return;
// from $_SERVER
} else
if (! empty($_SERVER['SERVER_NAME'])) {
// no ips
if ($this->_validate_ip($_SERVER['SERVER_NAME']) == false) {
$this->_data['servername'] = $_SERVER['SERVER_NAME'];
return;
}
} else if (! empty($_SERVER['SERVER_NAME'])) {
// no ips
if ($this->_validate_ip($_SERVER['SERVER_NAME']) == false) {
$this->_data['servername'] = $_SERVER['SERVER_NAME'];
return;
}
}
// empty
$this->_data['servername'] = '';
}
@@ -1204,7 +1254,7 @@ class FroxlorInstall
$this->_data['webserver'] = $_POST['webserver'];
} else {
if (strtoupper(@php_sapi_name()) == "APACHE2HANDLER" || stristr($_SERVER['SERVER_SOFTWARE'], "apache/2")) {
$this->_data['webserver'] = 'apache2';
$this->_data['webserver'] = 'apache24';
} elseif (substr(strtoupper(@php_sapi_name()), 0, 8) == "LIGHTTPD" || stristr($_SERVER['SERVER_SOFTWARE'], "lighttpd")) {
$this->_data['webserver'] = 'lighttpd';
} elseif (substr(strtoupper(@php_sapi_name()), 0, 8) == "NGINX" || stristr($_SERVER['SERVER_SOFTWARE'], "nginx")) {

View File

@@ -0,0 +1,89 @@
<?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

@@ -16,18 +16,18 @@
* @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 >= 5.3';
$lng['requirements']['newerphpprefered'] = 'Good, but php-5.6 is prefered.';
$lng['requirements']['phpmagic_quotes_runtime'] = 'magic_quotes_runtime...';
$lng['requirements']['phpmagic_quotes_runtime_description'] = 'PHP setting "magic_quotes_runtime" must be set to "Off". We have disabled it temporary for now please fix the coresponding php.ini.';
$lng['requirements']['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...';
@@ -35,10 +35,13 @@ $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';
@@ -63,7 +66,7 @@ $lng['install']['serversettings'] = 'Server settings';
$lng['install']['servername'] = 'Server name (FQDN, no ip-address)';
$lng['install']['serverip'] = 'Server IP';
$lng['install']['webserver'] = 'Webserver';
$lng['install']['apache2'] = 'Apache 2';
$lng['install']['apache2'] = 'Apache 2.2';
$lng['install']['apache24'] = 'Apache 2.4';
$lng['install']['lighttpd'] = 'LigHTTPd';
$lng['install']['nginx'] = 'NGINX';
@@ -83,8 +86,8 @@ $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 lib/.';
$lng['install']['creating_configfile_failed'] = 'Could not create lib/userdata.inc.php, please create it manually with the following content:';
$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';

View File

@@ -16,16 +16,13 @@
* @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 >= 5.3';
$lng['requirements']['phpmagic_quotes_runtime'] = 'magic_quotes_runtime...';
$lng['requirements']['phpmagic_quotes_runtime_description'] = 'Le réglage PHP "magic_quotes_runtime" doit être positionné à "Off". Nous l\'avons désactivé temporairement pour l\'instant; merci de corriger le php.ini correspondant.';
$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 ...';
@@ -79,8 +76,8 @@ $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 lib/.';
$lng['install']['creating_configfile_failed'] = 'Impossible de créer lib/userdata.inc.php, merci de le créer manuellement avec le contenu suivant:';
$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';

View File

@@ -16,18 +16,18 @@
* @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 >= 5.3';
$lng['requirements']['newerphpprefered'] = 'Passt, aber php-5.6 wird bevorzugt.';
$lng['requirements']['phpmagic_quotes_runtime'] = 'magic_quotes_runtime';
$lng['requirements']['phpmagic_quotes_runtime_description'] = 'Die PHP Einstellung "magic_quotes_runtime" muss deaktiviert sein ("Off"). Die Einstellung wurde temporär deaktiviert, bitte ändern Sie diese in der entsprechenden php.ini.';
$lng['requirements']['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...';
@@ -35,10 +35,13 @@ $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';
@@ -83,8 +86,8 @@ $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 lib/ verschieben.';
$lng['install']['creating_configfile_failed'] = 'Konnte lib/userdata.inc.php nicht erstellen, bitte manuell mit folgendem Inhalt anlegen:';
$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';

View File

@@ -0,0 +1,31 @@
#!/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,157 +0,0 @@
<?php
/**
* This file is part of the SysCP project.
* Copyright (c) 2003-2007 the SysCP 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.syscp.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Martin Burchert <eremit@syscp.org>
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
* @package System
*
*/
// some configs
$baseLanguage = 'english.lng.php';
// Check if we're in the CLI
if(@php_sapi_name() !== 'cli') {
die('This script will only work in the shell.');
}
// Check argument count
/*
if (sizeof($argv) != 2) {
print_help($argv);
exit;
}
*/
// Load the contents of the given path
$path = $argv[1];
$_f = isset($argv[2]) ? $argv[2] : null;
$files = array();
if ($dh = opendir($path)) {
while (false !== ($file = readdir($dh))) {
if ($file != "."
&& $file != ".."
&& !is_dir($file)
&& preg_match('/(.+)\.lng\.php/i', $file)
) {
if (is_null($_f) || (!is_null($_f) && ($file == $_f || $file == $baseLanguage))) {
$files[$file] = str_replace('//', '/', $path . '/' . $file);
}
}
}
closedir($dh);
} else {
print "ERROR: The path you requested cannot be read! \n ";
print "\n";
print_help($argv);
exit;
}
// check if there is the default language defined
if (!isset($files[$baseLanguage])) {
print "ERROR: The baselanguage cannot be found! \n";
print "\n";
print_help($argv);
exit;
}
// import the baselanguage
$base = import($files[$baseLanguage]);
// and unset it in the files, because we don't need to compare base to base
unset($files[$baseLanguage]);
// compare each language with the baselanguage
foreach ($files as $key => $file) {
$comp = import($file);
print "\n\nComparing " . $baseLanguage . " to " . $key . "\n";
$result = compare($base, $comp);
if (is_array($result)
&& sizeof($result) > 0
) {
print " found missing strings: \n";
foreach ($result as $value) {
print " " . $value . "\n";
}
} else {
print " no missing strings found! \n ";
}
print "\nReverse Checking " . $key . " to " . $baseLanguage . "\n";
$result = compare($comp, $base);
if (is_array($result)
&& sizeof($result) > 0
) {
print " found strings not in basefile: \n";
foreach ($result as $key => $value) {
print " " . $value . "\n";
}
} else {
print " There are no strings which are not in the basefile! \n ";
}
}
//-----------------------------------------------------------------------------------------
// FUNCTIONS
//-----------------------------------------------------------------------------------------
/**
* prints the help screen
*
* @param array $argv
*/
function print_help($argv) {
print "Usage: php " . $argv[0] . " /PATH/TO/LNG \n";
print " \n ";
}
function import($file) {
$input = file($file);
$return = array();
foreach ($input as $key => $value) {
if (!preg_match('/^\$/', $value)) {
unset($input[$key]);
} else {
// generate the key
$key = preg_replace('/^\$lng\[\'(.*)=(.*)$/U', '\\1', $value);
$key = str_replace('[\'', '/', $key);
$key = trim(str_replace('\']', '', $key));
//generate the value
$value = trim($value);
// set the result
$return[$key] = $value;
}
}
return $return;
}
function compare($array1, $array2) {
$result = array();
foreach ($array1 as $key => $value) {
if (!isset($array2[$key])) {
$result[$key] = $value;
}
}
return $result;
}

398
install/scripts/switch-server-ip.php Normal file → Executable file
View File

@@ -13,405 +13,19 @@
* @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') {
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 {
CmdLineHandler::processParameters($argc, $argv);
\Froxlor\Cli\SwitchServerIpCmd::processParameters($argc, $argv);
} catch (Exception $e) {
CmdLineHandler::printerr($e->getMessage());
}
class CmdLineHandler
{
/**
* internal variable for passed arguments
*
* @var array
*/
private static $args = null;
/**
* Action object read from commandline/config
*
* @var Action
*/
private $_action = null;
/**
* list of valid parameters/switches
*/
public static $switches = array(
/* 'd', // debug / output information for everything */
'h'
);
// same as --help
public static $params = array(
'switch',
'list',
'froxlor-dir',
'help'
);
/**
* Returns a CmdLineHandler object with given
* arguments from command line
*
* @param int $argc
* @param array $argv
*
* @return CmdLineHandler
*/
public static function processParameters($argc, $argv)
{
return new CmdLineHandler($argc, $argv);
}
/**
* returns the Action object generated in
* the class constructor
*
* @return Action
*/
public function getAction()
{
return $this->_action;
}
/**
* class constructor, validates the command line parameters
* and sets the Action-object if valid
*
* @param int $argc
* @param string[] $argv
*
* @return null
* @throws Exception
*/
private function __construct($argc, $argv)
{
self::$args = $this->_parseArgs($argv);
$this->_action = $this->_createAction();
}
/**
* Parses the arguments given via the command line;
* three types are supported:
* 1.
* --parm1 or --parm2=value
* 2. -xyz (multiple switches in one) or -a=value
* 3. parm1 parm2
*
* The 1. will be mapped as
* ["parm1"] => true, ["parm2"] => "value"
* The 2. as
* ["x"] => true, ["y"] => true, ["z"] => true, ["a"] => "value"
* And the 3. as
* [0] => "parm1", [1] => "parm2"
*
* @param array $argv
*
* @return array
*/
private function _parseArgs($argv)
{
array_shift($argv);
$o = array();
foreach ($argv as $a) {
if (substr($a, 0, 2) == '--') {
$eq = strpos($a, '=');
if ($eq !== false) {
$o[substr($a, 2, $eq - 2)] = substr($a, $eq + 1);
} else {
$k = substr($a, 2);
if (! isset($o[$k])) {
$o[$k] = true;
}
}
} else
if (substr($a, 0, 1) == '-') {
if (substr($a, 2, 1) == '=') {
$o[substr($a, 1, 1)] = substr($a, 3);
} else {
foreach (str_split(substr($a, 1)) as $k) {
if (! isset($o[$k])) {
$o[$k] = true;
}
}
}
} else {
$o[] = $a;
}
}
return $o;
}
/**
* Creates an Action-Object for the Action-Handler
*
* @return Action
* @throws Exception
*/
private function _createAction()
{
// Test for help-switch
if (empty(self::$args) || array_key_exists("help", self::$args) || array_key_exists("h", self::$args)) {
self::printHelp();
// end of execution
}
// check if no unknown parameters are present
foreach (self::$args as $arg => $value) {
if (is_numeric($arg)) {
throw new Exception("Unknown parameter '" . $value . "' in argument list");
} elseif (! in_array($arg, self::$params) && ! in_array($arg, self::$switches)) {
throw new Exception("Unknown parameter '" . $arg . "' in argument list");
}
}
// set debugger switch
if (isset(self::$args["d"]) && self::$args["d"] == true) {
// Debugger::getInstance()->setEnabled(true);
// Debugger::getInstance()->debug("debug output enabled");
}
return new Action(self::$args);
}
public static function printHelp()
{
self::println("");
self::println("Help / command line parameters:");
self::println("");
// commands
self::println("--switch\t\tlets you switch ip-address A with ip-address B");
self::println("\t\t\tExample: --switch=A,B");
self::println("\t\t\tExample: --switch=\"A1,B1 A2,B2 A3,B3 ...\"");
self::println("");
self::println("--list\t\t\tshow all currently used ip-addresses in froxlor");
self::println("");
self::println("--froxlor-dir\t\tpath to froxlor installation");
self::println("\t\t\tExample: --froxlor-dir=/var/www/froxlor/");
self::println("");
self::println("--help\t\t\tshow help screen (this)");
self::println("");
// switches
// self::println("-d\t\t\tenable debug output");
self::println("-h\t\t\tsame as --help");
self::println("");
die(); // end of execution
}
public static function println($msg = "")
{
print $msg . PHP_EOL;
}
private static function _printcolor($msg = "", $color = "0")
{
print "\033[" . $color . "m" . $msg . "\033[0m" . PHP_EOL;
}
public static function printerr($msg = "")
{
self::_printcolor($msg, "31");
}
public static function printsucc($msg = "")
{
self::_printcolor($msg, "32");
}
public static function printwarn($msg = "")
{
self::_printcolor($msg, "33");
}
}
class Action
{
private $_args = null;
private $_name = null;
private $_db = null;
public function __construct($args)
{
$this->_args = $args;
$this->_validate();
}
public function getActionName()
{
return $this->_name;
}
/**
* validates the parsed command line parameters
*
* @throws Exception
*/
private function _validate()
{
$need_config = false;
if (array_key_exists("list", $this->_args) || array_key_exists("switch", $this->_args)) {
$need_config = true;
}
$this->_checkConfigParam($need_config);
$this->_parseConfig();
if (array_key_exists("list", $this->_args)) {
$this->_listIPs();
}
if (array_key_exists("switch", $this->_args)) {
$this->_switchIPs();
}
}
private function _listIPs()
{
$sel_stmt = Database::prepare("SELECT * FROM panel_ipsandports ORDER BY ip ASC, port ASC");
Database::pexecute($sel_stmt);
$ips = $sel_stmt->fetchAll(PDO::FETCH_ASSOC);
$mask = "|%-10.10s |%-50.50s | %10.10s |\n";
printf($mask, str_repeat("-", 10), str_repeat("-", 50), str_repeat("-", 10));
printf($mask, 'id', 'IP address', 'port');
printf($mask, str_repeat("-", 10), str_repeat("-", 50), str_repeat("-", 10));
foreach ($ips as $ipdata) {
printf($mask, $ipdata['id'], $ipdata['ip'], $ipdata['port']);
}
printf($mask, str_repeat("-", 10), str_repeat("-", 50), str_repeat("-", 10));
echo PHP_EOL . PHP_EOL;
}
private function _switchIPs()
{
$ip_list = $this->_args['switch'];
if (empty($ip_list) || is_bool($ip_list)) {
throw new Exception("No paramters given for --switch action.");
}
$ips_to_switch = array();
$ip_list = explode(" ", $ip_list);
foreach ($ip_list as $ips_combo) {
$ip_pair = explode(",", $ips_combo);
if (count($ip_pair) != 2) {
throw new Exception("Invalid parameter given for --switch");
} else {
if (filter_var($ip_pair[0], FILTER_VALIDATE_IP) == false) {
throw new Exception("Invalid source ip address: " . $ip_pair[0]);
}
if (filter_var($ip_pair[1], FILTER_VALIDATE_IP) == false) {
throw new Exception("Invalid target ip address: " . $ip_pair[1]);
}
if ($ip_pair[0] == $ip_pair[1]) {
throw new Exception("Source and target ip address are equal");
}
}
$ips_to_switch[] = $ip_pair;
}
if (count($ips_to_switch) > 0) {
$upd_stmt = Database::prepare("UPDATE panel_ipsandports SET `ip` = :newip WHERE `ip` = :oldip");
// system.ipaddress
$check_sysip_stmt = Database::prepare("SELECT `value` FROM `panel_settings` WHERE `settinggroup` = 'system' and `varname` = 'ipaddress'");
$check_sysip = Database::pexecute_first($check_sysip_stmt);
// system.mysql_access_host
$check_mysqlip_stmt = Database::prepare("SELECT `value` FROM `panel_settings` WHERE `settinggroup` = 'system' and `varname` = 'mysql_access_host'");
$check_mysqlip = Database::pexecute_first($check_mysqlip_stmt);
// system.axfrservers
$check_axfrip_stmt = Database::prepare("SELECT `value` FROM `panel_settings` WHERE `settinggroup` = 'system' and `varname` = 'axfrservers'");
$check_axfrip = Database::pexecute_first($check_axfrip_stmt);
foreach ($ips_to_switch as $ip_pair) {
echo "Switching IP \033[1m" . $ip_pair[0] . "\033[0m to IP \033[1m" . $ip_pair[1] . "\033[0m" . PHP_EOL;
Database::pexecute($upd_stmt, array(
'newip' => $ip_pair[1],
'oldip' => $ip_pair[0]
));
$rows_updated = $upd_stmt->rowCount();
if ($rows_updated == 0) {
CmdLineHandler::printwarn("Note: " . $ip_pair[0] . " not updated to " . $ip_pair[1] . " (possibly no entry found in froxlor database. Use --list to see what IP addresses are added in froxlor");
}
// check whether the system.ipaddress needs updating
if ($check_sysip['value'] == $ip_pair[0]) {
$upd2_stmt = Database::prepare("UPDATE `panel_settings` SET `value` = :newip WHERE `settinggroup` = 'system' and `varname` = 'ipaddress'");
Database::pexecute($upd2_stmt, array(
'newip' => $ip_pair[1]
));
CmdLineHandler::printsucc("Updated system-ipaddress from '" . $ip_pair[0] . "' to '" . $ip_pair[1] . "'");
}
// check whether the system.mysql_access_host needs updating
if (strstr($check_mysqlip['value'], $ip_pair[0]) !== false) {
$new_mysqlip = str_replace($ip_pair[0], $ip_pair[1], $check_mysqlip['value']);
$upd2_stmt = Database::prepare("UPDATE `panel_settings` SET `value` = :newmysql WHERE `settinggroup` = 'system' and `varname` = 'mysql_access_host'");
Database::pexecute($upd2_stmt, array(
'newmysql' => $new_mysqlip
));
CmdLineHandler::printsucc("Updated mysql_access_host from '" . $check_mysqlip['value'] . "' to '" . $new_mysqlip . "'");
}
// check whether the system.axfrservers needs updating
if (strstr($check_axfrip['value'], $ip_pair[0]) !== false) {
$new_axfrip = str_replace($ip_pair[0], $ip_pair[1], $check_axfrip['value']);
$upd2_stmt = Database::prepare("UPDATE `panel_settings` SET `value` = :newaxfr WHERE `settinggroup` = 'system' and `varname` = 'axfrservers'");
Database::pexecute($upd2_stmt, array(
'newaxfr' => $new_axfrip
));
CmdLineHandler::printsucc("Updated axfrservers from '" . $check_axfrip['value'] . "' to '" . $new_axfrip . "'");
}
}
}
echo PHP_EOL;
CmdLineHandler::printwarn("*** ATTENTION *** Remember to replace IP addresses in configuration files if used anywhere.");
CmdLineHandler::printsucc("IP addresses updated");
}
private function _parseConfig()
{
define('FROXLOR_INSTALL_DIR', $this->_args['froxlor-dir']);
if (!file_exists(FROXLOR_INSTALL_DIR . '/lib/classes/database/class.Database.php')) {
throw new Exception("Could not find froxlor's Database class. Is froxlor really installed to '".FROXLOR_INSTALL_DIR."'?");
}
if (!file_exists(FROXLOR_INSTALL_DIR . '/lib/userdata.inc.php')) {
throw new Exception("Could not find froxlor's userdata.inc.php file. You should use this script only with a fully installed and setup froxlor system.");
}
require FROXLOR_INSTALL_DIR . '/lib/classes/database/class.Database.php';
}
private function _checkConfigParam($needed = false)
{
if ($needed) {
if (! isset($this->_args["froxlor-dir"])) {
throw new Exception("No configuration given (missing --froxlor-dir parameter?)");
} elseif (! is_dir($this->_args["froxlor-dir"])) {
throw new Exception("Given --froxlor-dir parameter is not a directory");
} elseif (! file_exists($this->_args["froxlor-dir"])) {
throw new Exception("Given froxlor directory cannot be found ('" . $this->_args["froxlor-dir"] . "')");
} elseif (! is_readable($this->_args["froxlor-dir"])) {
throw new Exception("Given froxlor direcotry cannot be read ('" . $this->_args["froxlor-dir"] . "')");
}
}
}
\Froxlor\Cli\SwitchServerIpCmd::printerr($e->getMessage());
}

View File

@@ -1,37 +1,65 @@
@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; }
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;
html, body {
font: 12px/18px 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial,
Verdana, sans-serif;
background-color: #f5f5f5;
color:#444;
color: #444;
-webkit-font-smoothing: subpixel-antialiased;
}
body {
margin:0;
padding:0;
margin: 0;
padding: 0;
}
.dark {
background-color: #e9edf0;
border-bottom:1px solid #d1d5d8;
border-bottom: 1px solid #d1d5d8;
}
header img {
padding:10px 0 10px 10px;
padding: 10px 0 10px 10px;
}
h1 {
display:none;
display: none;
}
h2, h3 {
@@ -41,47 +69,43 @@ h2, h3 {
}
h2 {
font-size:17px;
font-size: 17px;
}
h3 {
font-size: 15px;
}
img {
border:0;
vertical-align:middle;
border: 0;
vertical-align: middle;
}
td a {
text-decoration:none;
text-decoration: none;
}
.bradius {
border-radius: 5px 5px 5px 5px;
box-shadow: rgba(0, 0, 0, 0.34902) 0px 1px 3px 0px;
box-shadow: rgba(0, 0, 0, 0.34902) 0 1px 3px 0;
}
/* FOOTER */
footer {
clear:both;
text-align:center;
clear: both;
text-align: center;
color: #888;
font-size:10px !important;
font-size: 10px !important;
margin: 10px 0;
}
footer a,footer a:active,footer a:visited {
footer a, footer a:active, footer a:visited {
color: #888;
}
.install {
background-color:#fff;
margin: 20px;
margin-left: auto;
margin-right: auto;
margin-bottom: 12px;
background-color: #fff;
margin: 20px auto 12px;
width: 800px;
}
@@ -90,14 +114,14 @@ p {
}
.installsec {
margin-top:10px;
padding:0;
text-align:left;
margin-top: 10px;
padding: 0;
text-align: left;
}
.installsec table {
width:100%;
padding:0 10px;
width: 100%;
padding: 0 10px;
margin: 15px 0 15px 0;
}
@@ -109,42 +133,46 @@ p {
}
.installsec form {
width:800px;
margin:0 auto;
padding:10px 0 0;
text-align:left;
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;
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;
display: none;
}
.installsec label {
float:left;
margin-right:0;
margin-top:8px;
text-align:left;
float: left;
margin-right: 0;
margin-top: 8px;
text-align: left;
}
p.submit {
text-align:right;
padding-right:46px;
text-align: right;
padding-right: 46px;
}
.installsec aside {
border-top:1px solid #d1d5d8;
clear:both;
float:none;
width:auto;
border-top: 1px solid #d1d5d8;
clear: both;
float: none;
width: auto;
text-align: right;
padding: 10px;
}
@@ -152,182 +180,183 @@ p.submit {
.line {
border: 0;
width: 800px;
border-bottom:1px solid #d1d5d8;
border-bottom: 1px solid #d1d5d8;
}
.messagewrapper {
width:650px;
margin:0 auto;
padding:120px 0 0;
overflow:hidden;
width: 650px;
margin: 0 auto;
padding: 120px 0 0;
overflow: hidden;
}
.messagewrapperfull {
width:100%;
margin:0 auto;
padding:0;
overflow:hidden;
width: 100%;
margin: 0 auto;
padding: 0;
overflow: hidden;
}
.overviewsearch {
position:absolute;
top:155px;
right:36px;
font-size:80%;
position: absolute;
top: 155px;
right: 36px;
font-size: 80%;
}
.overviewadd {
padding:10px;
font-weight:700;
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;
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: 0px 0px 0px black;
text-align: left !important;
overflow: hidden;
box-shadow: 0 0 0 black;
}
.errortitle {
font-weight:700;
color:#c00!important;
font-weight: 700;
color: #c00 !important;
}
.error {
font-weight:400!important;
color:#c00!important;
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;
.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: 0px 0px 0px black;
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;
.warningtitle, .ui-dialog-titlebar {
font-weight: 700;
color: #D57D00;
}
.warning,.ui-dialog-content {
color:#D57D00!important;
.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;
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: 0px 0px 0px black;
text-align: left !important;
overflow: hidden;
box-shadow: 0 0 0 black;
}
.successtitle {
font-weight:700;
color:#060!important;
font-weight: 700;
color: #060 !important;
}
.success {
font-weight:400!important;
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;
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: 0px 0px 0px black;
text-align: left !important;
overflow: hidden;
box-shadow: 0 0 0 black;
}
.neutraltitle {
font-weight:700;
color:#3188c1!important;
font-weight: 700;
color: #3188c1 !important;
}
.neutral {
font-weight:400!important;
color:#3188c1!important;
font-weight: 400 !important;
color: #3188c1 !important;
}
/* std hyperlink */
a,a:active,a:visited {
color:#176fa1;
text-decoration:none;
a, a:active, a:visited {
color: #176fa1;
text-decoration: none;
}
a:hover {
text-decoration:underline;
text-decoration: underline;
}
.infotext {
font-size:11px;
font-size: 11px;
}
/*
* main container
*/
.main {
margin-left:240px;
margin-right:10px;
margin-top:105px;
margin-bottom:0;
background-color:#fff;
margin: 105px 10px 0 240px;
background-color: #fff;
padding: 30px 30px 30px 30px;
min-height:400px;
min-height: 400px;
}
.noborder {
width:100%;
border-spacing:0;
border-collapse:separate;
width: 100%;
border-spacing: 0;
border-collapse: separate;
border: 0;
}
.noborder td {
border:0;
border: 0;
}
table {
width:100%;
border-spacing:0;
border:1px solid #d1d5d8;
border-collapse:separate;
box-shadow:0px 0px 0px black !important;
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 0px 5px 8px;
padding: 5px 0 5px 8px;
background-color: #e9edf0;
font-weight: bold;
}
table thead:first-child th, table:first-child th {
border-top: none !important;
}
@@ -335,16 +364,21 @@ table thead:first-child th, table:first-child th {
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;
@@ -360,85 +394,83 @@ table thead:first-child th {
}
table tbody td {
border-bottom:1px dotted #ccc;
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;
border-spacing: 0;
border: 0;
border-collapse: separate;
margin: 0 0 0;
}
.formtable tbody td {
border:0;
border-bottom:1px dotted #ccc;
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;
float: none;
display: block;
padding: 0;
margin: 0;
width: 100%;
text-align: left;
}
td {
padding-top:5px;
padding-left:10px;
padding-right: 10px;
padding-bottom:5px;
padding: 5px 10px;
min-height: 20px;
}
table tfoot td {
height:25px;
height: 25px;
border-top: 1px solid #d1d5d8;
background-color: #f2f8fa;
}
.tfootleft {
text-align:left;
text-align: left;
}
.maintitle {
padding-top:20px;
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;
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;
background: #fff url(../img/text_align_left.png) no-repeat 5px 4px;
color: #333;
padding:4px 4px 2px 24px;
border:1px solid #d9d9d9;
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;
background: #fff url(../img/password.png) no-repeat 5px 4px;
}
/*
* BUTTONS
*/
input[type="button"],input[type="submit"],input[type="reset"] {
input[type="button"], input[type="submit"], input[type="reset"] {
margin: 0 5px;
padding: 5px 14px;
outline: 0;
@@ -447,47 +479,57 @@ input[type="button"],input[type="submit"],input[type="reset"] {
min-width: 80px;
height: 26px;
background-image: none;
border-width: 0px;
}
.loginsec input[type="button"], .loginsec input[type="submit"], .loginsec input[type="reset"] {
.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"]: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="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 {
input[type="submit"], input[class="yesbutton"] {
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 {
input[type="submit"]:hover, input[class="yesbutton"]:hover {
color: white;
background-color: #c53727;
}
input[class="nobutton"]:active,input[type="reset"]:active {
background-color: #dd4b39;
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;
background: #dae7ee;
padding: 0;
margin: 0 5px 0 0;
vertical-align: middle;
@@ -495,73 +537,101 @@ input[type="checkbox"] {
}
input[type="radio"] {
vertical-align: middle;
margin: 0 10px 0 10px;
height:22px;
height: 22px;
}
select {
background:#fff;
padding:4px;
background: #fff;
padding: 4px;
color: #333;
border:1px solid #d9d9d9;
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;
background: url(../../../../templates/Sparkle/assets/img/icons/down.png)
no-repeat 9px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
-moz-appearance: none;
appearance: none;
}
.maintable {
width:90%;
width: 90%;
}
.update_progess {
padding:2em;
text-align:left;
padding: 2em;
text-align: left;
}
.preconfig {
text-align:left;
margin-top:20px;
margin-bottom:5px;
margin-right:15px;
margin-left:15px;
text-align: left;
margin-top: 20px;
margin-bottom: 5px;
margin-right: 15px;
margin-left: 15px;
}
.preconfigitem {
padding:.15em;
border-bottom:1px solid #ccc;
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;
display: block;
margin-bottom: .5em;
font-size: 120%;
}
.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; }
.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;
}

View File

@@ -1,4 +1,4 @@
<p>
<label for="{$fieldname}" class="install-block {$style}">{$fieldlabel}:</label>&nbsp;
<label for="{$fieldname}" class="install-block {$style}">{$fieldlabel}:</label>
<input type="{$type}" name="{$fieldname}" id="{$fieldname}" value="{$fieldvalue}" {$required} />
</p>

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