Merge pull request #1 from Froxlor/master

up
This commit is contained in:
Daniel
2020-12-31 15:59:07 +08:00
committed by GitHub
622 changed files with 91180 additions and 53364 deletions

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 changes
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

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

@@ -0,0 +1,4 @@
# These are supported funding model platforms
github: d00p
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

13
.gitignore vendored
View File

@@ -1,6 +1,9 @@
templates/*
logs/*
install/update.log install/update.log
templates/*
lib/userdata.inc.php
lib/userdata.inc.php.bak
logs/*
!logs/index.html
.buildpath .buildpath
.project .project
.settings/ .settings/
@@ -9,3 +12,9 @@ install/update.log
.well-known .well-known
.idea .idea
*.iml *.iml
!templates/Froxlor/
!templates/Sparkle/
!templates/misc/
templates/Froxlor/assets/img/logo_custom.png
vendor/

64
.travis.yml Normal file
View File

@@ -0,0 +1,64 @@
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-no-coverage
notifications:
irc: "chat.freenode.net#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 ' . Settings::Get('system.hostname'));
// 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 # Froxlor
The server administration software for your needs. 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 3. Point your browser to http://[ip-of-webserver]/froxlor
4. Follow the installer 4. Follow the installer
5. Login as administrator 5. Login as administrator
6. Adjust "Server > Settings" according to your needs 6. Adjust "System > Settings" according to your needs
7. Choose your distribution under "Server > Configuration" 7. Choose your distribution under "System > Configuration"
8. Follow the steps for your services 8. Follow the steps for your services
9. Have fun! 9. Have fun!
### Detailed installation ### Detailed installation
http://redmine.froxlor.org/projects/froxlor/wiki/Installationtarball https://github.com/Froxlor/Froxlor/wiki/Install-froxlor-from-tarball
## Help ## Help
@@ -30,12 +33,12 @@ irc://chat.freenode.net/froxlor
### Forum ### Forum
The community is located on http://forum.froxlor.org The community is located on https://forum.froxlor.org/
### Wiki ### Wiki
More documentation may be found in the froxlor - wiki: More documentation may be found in the froxlor - wiki:
http://redmine.froxlor.org/projects/froxlor/wiki https://github.com/Froxlor/Froxlor/wiki
## License ## License
@@ -44,31 +47,28 @@ May be found in COPYING
## Downloads ## Downloads
### Tarball ### 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 ### 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 apt-get -y install apt-transport-https lsb-release ca-certificates
wget -O - https://deb.froxlor.org/froxlor.gpg | apt-key add -
echo "deb https://deb.froxlor.org/debian $(lsb_release -sc) main" > /etc/apt/sources.list.d/froxlor.list
```
### Gentoo repository ### Ubuntu repository
[HowTo](http://redmine.froxlor.org/projects/froxlor/wiki/Installationgentoo) [HowTo](https://github.com/Froxlor/Froxlor/wiki/Install-froxlor-on-ubuntu)
http://files.froxlor.org/gentoo/repositories.xml ```
apt-get -y install apt-transport-https lsb-release ca-certificates
wget -O - https://deb.froxlor.org/froxlor.gpg | apt-key add -
echo "deb https://deb.froxlor.org/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/froxlor.list
```
## Let's Encrypt support ## Contributing
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
[see here](.github/CONTRIBUTING.md)

14
SECURITY.md Normal file
View File

@@ -0,0 +1,14 @@
# Security Policy
## Supported Versions
Our main and active version is currently 0.10.x. It will receive maintenance and security updates periodically. The older version 0.9.x will not receive any kind of updates. Please update to [0.10.x](https://github.com/Froxlor/Froxlor/wiki/Updating-Froxlor)
| Version | Supported |
| ------- | ------------------ |
| 0.10.x | :white_check_mark: |
| 0.9.x | :x: |
## Reporting a Vulnerability
If you think you have found a vulnerability in froxlor, please send an email to [team@froxlor.org](mailto:team@froxlor.org) with as many information as possible. Also, please give us appropriate time to fix the issue and build update-packages before publishing anything into the wild.

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

View File

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

View File

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

View File

@@ -0,0 +1,271 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2016 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2016-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package \Froxlor\Settings
*
*/
return array(
'groups' => array(
'froxlorvhost' => array(
'title' => $lng['admin']['froxlorvhost'] . (call_user_func(array('\Froxlor\Settings\FroxlorVhostSettings', 'hasVhostContainerEnabled')) == false ? $lng['admin']['novhostcontainer'] : ''),
'fields' => array(
/**
* Webserver-Vhost
*/
'system_froxlordirectlyviahostname' => array(
'label' => $lng['serversettings']['froxlordirectlyviahostname'],
'settinggroup' => 'system',
'varname' => 'froxlordirectlyviahostname',
'type' => 'bool',
'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
*/
'system_le_froxlor_enabled' => array(
'label' => $lng['serversettings']['le_froxlor_enabled'],
'settinggroup' => 'system',
'varname' => 'le_froxlor_enabled',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingClearCertificates',
'visible' => \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'],
'settinggroup' => 'system',
'varname' => 'le_froxlor_redirect',
'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_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)
),
'system_honorcipherorder' => array(
'label' => $lng['admin']['domain_honorcipherorder'],
'settinggroup' => 'system',
'varname' => 'honorcipherorder',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.use_ssl') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
), true)
),
'system_sessiontickets' => array(
'label' => $lng['admin']['domain_sessiontickets'],
'settinggroup' => 'system',
'varname' => 'sessiontickets',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.use_ssl') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
), true)
),
/**
* FCGID
*/
'system_mod_fcgid_enabled_ownvhost' => array(
'label' => $lng['serversettings']['mod_fcgid_ownvhost'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_ownvhost',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
'websrv_avail' => array(
'apache2'
),
'visible' => \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'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_httpuser',
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingWebserverFcgidFpmUser',
'websrv_avail' => array(
'apache2'
),
'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'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_httpgroup',
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingField',
'websrv_avail' => array(
'apache2'
),
'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'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_defaultini_ownvhost',
'type' => 'option',
'default' => '2',
'option_mode' => 'one',
'option_options_method' => array(
'\\Froxlor\\Http\\PhpConfig',
'getPhpConfigs'
),
'save_method' => 'storeSettingField',
'websrv_avail' => array(
'apache2'
),
'visible' => \Froxlor\Settings::Get('system.mod_fcgid') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
/**
* php-fpm
*/
'system_phpfpm_enabled_ownvhost' => array(
'label' => $lng['phpfpm']['ownvhost'],
'settinggroup' => 'phpfpm',
'varname' => 'enabled_ownvhost',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('phpfpm.enabled') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
'system_phpfpm_httpuser' => array(
'label' => $lng['phpfpm']['vhost_httpuser'],
'settinggroup' => 'phpfpm',
'varname' => 'vhost_httpuser',
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingWebserverFcgidFpmUser',
'visible' => \Froxlor\Settings::Get('phpfpm.enabled') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
'system_phpfpm_httpgroup' => array(
'label' => $lng['phpfpm']['vhost_httpgroup'],
'settinggroup' => 'phpfpm',
'varname' => 'vhost_httpgroup',
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingField',
'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'],
'settinggroup' => 'phpfpm',
'varname' => 'vhost_defaultini',
'type' => 'option',
'default' => '2',
'option_mode' => 'one',
'option_options_method' => array(
'\\Froxlor\\Http\\PhpConfig',
'getPhpConfigs'
),
'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('phpfpm.enabled') && call_user_func(array(
'\Froxlor\Settings\FroxlorVhostSettings',
'hasVhostContainerEnabled'
))
),
/**
* DNS
*/
'system_dns_createhostnameentry' => array(
'label' => $lng['serversettings']['dns_createhostnameentry'],
'settinggroup' => 'system',
'varname' => 'dns_createhostnameentry',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.bind_enable')
)
)
)
)
);

View File

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

View File

@@ -13,10 +13,9 @@
* @author Florian Lippert <flo@syscp.org> (2003-2009) * @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package \Froxlor\Settings
* *
*/ */
return array( return array(
'groups' => array( 'groups' => array(
'webserver' => array( 'webserver' => array(
@@ -29,11 +28,18 @@ return array(
'type' => 'option', 'type' => 'option',
'default' => 'apache2', 'default' => 'apache2',
'option_mode' => 'one', 'option_mode' => 'one',
'option_options' => array('apache2' => 'Apache 2', 'lighttpd' => 'ligHTTPd', 'nginx' => 'Nginx'), 'option_options' => array(
'save_method' => 'storeSettingField', 'apache2' => 'Apache 2',
'plausibility_check_method' => 'checkPhpInterfaceSetting', 'lighttpd' => 'ligHTTPd',
'overview_option' => true 'nginx' => 'Nginx'
), ),
'save_method' => 'storeSettingField',
'plausibility_check_method' => array(
'\\Froxlor\\Validate\\Check',
'checkPhpInterfaceSetting'
),
'overview_option' => true
),
'system_apache_24' => array( 'system_apache_24' => array(
'label' => $lng['serversettings']['apache_24'], 'label' => $lng['serversettings']['apache_24'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -41,34 +47,62 @@ return array(
'type' => 'bool', 'type' => 'bool',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2') 'websrv_avail' => array(
'apache2'
)
),
'system_apache_itksupport' => array(
'label' => $lng['serversettings']['apache_itksupport'],
'settinggroup' => 'system',
'varname' => 'apacheitksupport',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'visible' => (\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'
), ),
'system_apache_itksupport' => array( 'visible' => \Froxlor\Settings::Get('system.use_ssl')
'label' => $lng['serversettings']['apache_itksupport'], ),
'settinggroup' => 'system', 'system_dhparams_file' => array(
'varname' => 'apacheitksupport', 'label' => $lng['serversettings']['dhparams_file'],
'type' => 'bool', 'settinggroup' => 'system',
'default' => false, 'varname' => 'dhparams_file',
'save_method' => 'storeSettingField', 'type' => 'string',
'visible' => (Settings::Get('system.mod_fcgid') == 0 && Settings::Get('phpfpm.enabled') == 0), 'string_type' => 'file',
'websrv_avail' => array('apache2') 'string_emptyallowed' => true,
), 'default' => '',
'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.use_ssl')
),
'system_httpuser' => array( 'system_httpuser' => array(
'label' => $lng['admin']['webserver_user'], 'label' => $lng['admin']['webserver_user'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'httpuser', 'varname' => 'httpuser',
'type' => 'string', 'type' => 'string',
'default' => 'www-data', 'default' => 'www-data',
'save_method' => 'storeSettingWebserverFcgidFpmUser', 'save_method' => 'storeSettingWebserverFcgidFpmUser'
), ),
'system_httpgroup' => array( 'system_httpgroup' => array(
'label' => $lng['admin']['webserver_group'], 'label' => $lng['admin']['webserver_group'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'httpgroup', 'varname' => 'httpgroup',
'type' => 'string', 'type' => 'string',
'default' => 'www-data', 'default' => 'www-data',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField'
), ),
'system_apacheconf_vhost' => array( 'system_apacheconf_vhost' => array(
'label' => $lng['serversettings']['apacheconf_vhost'], 'label' => $lng['serversettings']['apacheconf_vhost'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -76,8 +110,8 @@ return array(
'type' => 'string', 'type' => 'string',
'string_type' => 'filedir', 'string_type' => 'filedir',
'default' => '/etc/apache2/sites-enabled/', 'default' => '/etc/apache2/sites-enabled/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField'
), ),
'system_apacheconf_diroptions' => array( 'system_apacheconf_diroptions' => array(
'label' => $lng['serversettings']['apacheconf_diroptions'], 'label' => $lng['serversettings']['apacheconf_diroptions'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -85,8 +119,8 @@ return array(
'type' => 'string', 'type' => 'string',
'string_type' => 'filedir', 'string_type' => 'filedir',
'default' => '/etc/apache2/sites-enabled/', 'default' => '/etc/apache2/sites-enabled/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField'
), ),
'system_apacheconf_htpasswddir' => array( 'system_apacheconf_htpasswddir' => array(
'label' => $lng['serversettings']['apacheconf_htpasswddir'], 'label' => $lng['serversettings']['apacheconf_htpasswddir'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -94,8 +128,8 @@ return array(
'type' => 'string', 'type' => 'string',
'string_type' => 'confdir', 'string_type' => 'confdir',
'default' => '/etc/apache2/htpasswd/', 'default' => '/etc/apache2/htpasswd/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField'
), ),
'system_logfiles_directory' => array( 'system_logfiles_directory' => array(
'label' => $lng['serversettings']['logfiles_directory'], 'label' => $lng['serversettings']['logfiles_directory'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -103,8 +137,84 @@ return array(
'type' => 'string', 'type' => 'string',
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/var/customers/logs/', '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', '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'
), ),
'visible' => \Froxlor\Settings::Get('system.awstats_enabled') == 1
),
'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( 'system_customersslpath' => array(
'label' => $lng['serversettings']['customerssl_directory'], 'label' => $lng['serversettings']['customerssl_directory'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -112,8 +222,8 @@ return array(
'type' => 'string', 'type' => 'string',
'string_type' => 'confdir', 'string_type' => 'confdir',
'default' => '/etc/ssl/froxlor-custom/', 'default' => '/etc/ssl/froxlor-custom/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField'
), ),
'system_phpappendopenbasedir' => array( 'system_phpappendopenbasedir' => array(
'label' => $lng['serversettings']['phpappendopenbasedir'], 'label' => $lng['serversettings']['phpappendopenbasedir'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -121,8 +231,8 @@ return array(
'type' => 'string', 'type' => 'string',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField'
), ),
'system_deactivateddocroot' => array( 'system_deactivateddocroot' => array(
'label' => $lng['serversettings']['deactivateddocroot'], 'label' => $lng['serversettings']['deactivateddocroot'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -131,24 +241,53 @@ return array(
'string_type' => 'dir', 'string_type' => 'dir',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField'
), ),
'system_default_vhostconf' => array( 'system_default_vhostconf' => array(
'label' => $lng['serversettings']['default_vhostconf'], 'label' => $lng['serversettings']['default_vhostconf'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'default_vhostconf', 'varname' => 'default_vhostconf',
'type' => 'text', 'type' => 'text',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField'
),
'system_default_sslvhostconf' => array(
'label' => $lng['serversettings']['default_sslvhostconf'],
'settinggroup' => 'system',
'varname' => 'default_sslvhostconf',
'type' => 'text',
'default' => '',
'save_method' => 'storeSettingField', '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',
'varname' => 'apacheglobaldiropt',
'type' => 'text',
'default' => '',
'save_method' => 'storeSettingField',
'visible' => (\Froxlor\Settings::Get('system.mod_fcgid') == 0 && \Froxlor\Settings::Get('phpfpm.enabled') == 0),
'websrv_avail' => array(
'apache2'
)
),
'system_apachereload_command' => array( 'system_apachereload_command' => array(
'label' => $lng['serversettings']['apachereload_command'], 'label' => $lng['serversettings']['apachereload_command'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'apachereload_command', 'varname' => 'apachereload_command',
'type' => 'string', 'type' => 'string',
'default' => '/etc/init.d/apache2 reload', 'default' => '/etc/init.d/apache2 reload',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField'
), ),
'system_phpreload_command' => array( 'system_phpreload_command' => array(
'label' => $lng['serversettings']['phpreload_command'], 'label' => $lng['serversettings']['phpreload_command'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -156,8 +295,10 @@ return array(
'type' => 'string', 'type' => 'string',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('nginx') 'websrv_avail' => array(
), 'nginx'
)
),
'system_nginx_php_backend' => array( 'system_nginx_php_backend' => array(
'label' => $lng['serversettings']['nginx_php_backend'], 'label' => $lng['serversettings']['nginx_php_backend'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -165,8 +306,10 @@ return array(
'type' => 'string', 'type' => 'string',
'default' => '127.0.0.1:8888', 'default' => '127.0.0.1:8888',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('nginx') 'websrv_avail' => array(
), 'nginx'
)
),
'nginx_fastcgiparams' => array( 'nginx_fastcgiparams' => array(
'label' => $lng['serversettings']['nginx_fastcgiparams'], 'label' => $lng['serversettings']['nginx_fastcgiparams'],
'settinggroup' => 'nginx', 'settinggroup' => 'nginx',
@@ -175,16 +318,18 @@ return array(
'string_type' => 'file', 'string_type' => 'file',
'default' => '/etc/nginx/fastcgi_params', 'default' => '/etc/nginx/fastcgi_params',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('nginx') 'websrv_avail' => array(
), 'nginx'
)
),
'defaultwebsrverrhandler_enabled' => array( 'defaultwebsrverrhandler_enabled' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_enabled'], 'label' => $lng['serversettings']['defaultwebsrverrhandler_enabled'],
'settinggroup' => 'defaultwebsrverrhandler', 'settinggroup' => 'defaultwebsrverrhandler',
'varname' => 'enabled', 'varname' => 'enabled',
'type' => 'bool', 'type' => 'bool',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField'
), ),
'defaultwebsrverrhandler_err401' => array( 'defaultwebsrverrhandler_err401' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_err401'], 'label' => $lng['serversettings']['defaultwebsrverrhandler_err401'],
'settinggroup' => 'defaultwebsrverrhandler', 'settinggroup' => 'defaultwebsrverrhandler',
@@ -192,8 +337,11 @@ return array(
'type' => 'string', 'type' => 'string',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2', 'nginx') 'websrv_avail' => array(
), 'apache2',
'nginx'
)
),
'defaultwebsrverrhandler_err403' => array( 'defaultwebsrverrhandler_err403' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_err403'], 'label' => $lng['serversettings']['defaultwebsrverrhandler_err403'],
'settinggroup' => 'defaultwebsrverrhandler', 'settinggroup' => 'defaultwebsrverrhandler',
@@ -201,16 +349,19 @@ return array(
'type' => 'string', 'type' => 'string',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2', 'nginx') 'websrv_avail' => array(
), 'apache2',
'nginx'
)
),
'defaultwebsrverrhandler_err404' => array( 'defaultwebsrverrhandler_err404' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_err404'], 'label' => $lng['serversettings']['defaultwebsrverrhandler_err404'],
'settinggroup' => 'defaultwebsrverrhandler', 'settinggroup' => 'defaultwebsrverrhandler',
'varname' => 'err404', 'varname' => 'err404',
'type' => 'string', 'type' => 'string',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField'
), ),
'defaultwebsrverrhandler_err500' => array( 'defaultwebsrverrhandler_err500' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_err500'], 'label' => $lng['serversettings']['defaultwebsrverrhandler_err500'],
'settinggroup' => 'defaultwebsrverrhandler', 'settinggroup' => 'defaultwebsrverrhandler',
@@ -218,17 +369,19 @@ return array(
'type' => 'string', 'type' => 'string',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2', 'nginx') 'websrv_avail' => array(
), 'apache2',
'nginx'
)
),
'customredirect_enabled' => array( 'customredirect_enabled' => array(
'label' => $lng['serversettings']['customredirect_enabled'], 'label' => $lng['serversettings']['customredirect_enabled'],
'settinggroup' => 'customredirect', 'settinggroup' => 'customredirect',
'varname' => 'enabled', 'varname' => 'enabled',
'type' => 'bool', 'type' => 'bool',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField'
'websrv_avail' => array('apache2', 'lighttpd') ),
),
'customredirect_default' => array( 'customredirect_default' => array(
'label' => $lng['serversettings']['customredirect_default'], 'label' => $lng['serversettings']['customredirect_default'],
'settinggroup' => 'customredirect', 'settinggroup' => 'customredirect',
@@ -236,11 +389,10 @@ return array(
'type' => 'option', 'type' => 'option',
'default' => '1', 'default' => '1',
'option_mode' => 'one', 'option_mode' => 'one',
'option_options_method' => 'getRedirectCodes', 'option_options_method' => array('\\Froxlor\\Domain\\Domain', 'getRedirectCodes'),
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField'
'websrv_avail' => array('apache2', 'lighttpd')
)
) )
) )
) )
); )
);

View File

@@ -13,137 +13,215 @@
* @author Florian Lippert <flo@syscp.org> (2003-2009) * @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package \Froxlor\Settings
* *
*/ */
return array( return array(
'groups' => array( 'groups' => array(
'ssl' => array( 'ssl' => array(
'title' => $lng['admin']['sslsettings'], 'title' => $lng['admin']['sslsettings'],
'fields' => array( 'fields' => array(
'system_ssl_enabled' => array( 'system_ssl_enabled' => array(
'label' => $lng['serversettings']['ssl']['use_ssl'], 'label' => $lng['serversettings']['ssl']['use_ssl'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'use_ssl', 'varname' => 'use_ssl',
'type' => 'bool', 'type' => 'bool',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'overview_option' => true 'overview_option' => true
), ),
'system_ssl_cipher_list' => array( 'system_ssl_protocols' => array(
'label' => $lng['serversettings']['ssl']['ssl_cipher_list'], 'label' => $lng['serversettings']['ssl']['ssl_protocols'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'ssl_cipher_list', 'varname' => 'ssl_protocols',
'type' => 'string', 'type' => 'option',
'string_emptyallowed' => false, 'default' => 'TLSv1.2',
'default' => 'ECDH+AESGCM:ECDH+AES256:!aNULL:!MD5:!DSS:!DH:!AES128', 'option_mode' => 'multiple',
'save_method' => 'storeSettingField', 'option_options' => array(
), 'TLSv1' => 'TLSv1',
'system_ssl_cert_file' => array( 'TLSv1.1' => 'TLSv1.1',
'label' => $lng['serversettings']['ssl']['ssl_cert_file'], 'TLSv1.2' => 'TLSv1.2',
'settinggroup' => 'system', 'TLSv1.3' => 'TLSv1.3'
'varname' => 'ssl_cert_file', ),
'type' => 'string', 'save_method' => 'storeSettingField'
'string_type' => 'file', ),
'string_emptyallowed' => true, 'system_ssl_cipher_list' => array(
'default' => '/etc/apache2/apache2.pem', 'label' => $lng['serversettings']['ssl']['ssl_cipher_list'],
'save_method' => 'storeSettingField', 'settinggroup' => 'system',
), 'varname' => 'ssl_cipher_list',
'system_ssl_key_file' => array( 'type' => 'string',
'label' => $lng['serversettings']['ssl']['ssl_key_file'], 'string_emptyallowed' => false,
'settinggroup' => 'system', 'default' => 'ECDH+AESGCM:ECDH+AES256:!aNULL:!MD5:!DSS:!DH:!AES128',
'varname' => 'ssl_key_file', 'save_method' => 'storeSettingField'
'type' => 'string', ),
'string_type' => 'file', 'system_tlsv13_cipher_list' => array(
'string_emptyallowed' => true, 'label' => $lng['serversettings']['ssl']['tlsv13_cipher_list'],
'default' => '/etc/apache2/apache2.key', 'settinggroup' => 'system',
'save_method' => 'storeSettingField', 'varname' => 'tlsv13_cipher_list',
), 'type' => 'string',
'system_ssl_cert_chainfile' => array( 'string_emptyallowed' => true,
'label' => $lng['admin']['ipsandports']['ssl_cert_chainfile'], 'default' => '',
'settinggroup' => 'system', 'visible' => \Froxlor\Settings::Get('system.webserver') == "apache2" && \Froxlor\Settings::Get('system.apache24') == 1,
'varname' => 'ssl_cert_chainfile', 'save_method' => 'storeSettingField'
'type' => 'string', ),
'string_type' => 'file', 'system_ssl_cert_file' => array(
'string_emptyallowed' => true, 'label' => $lng['serversettings']['ssl']['ssl_cert_file'],
'default' => '', 'settinggroup' => 'system',
'save_method' => 'storeSettingField', 'varname' => 'ssl_cert_file',
), 'type' => 'string',
'system_ssl_ca_file' => array( 'string_type' => 'file',
'label' => $lng['serversettings']['ssl']['ssl_ca_file'], 'string_emptyallowed' => true,
'settinggroup' => 'system', 'default' => '/etc/apache2/apache2.pem',
'varname' => 'ssl_ca_file', 'save_method' => 'storeSettingField'
'type' => 'string', ),
'string_type' => 'file', 'system_ssl_key_file' => array(
'string_emptyallowed' => true, 'label' => $lng['serversettings']['ssl']['ssl_key_file'],
'default' => '', 'settinggroup' => 'system',
'save_method' => 'storeSettingField', 'varname' => 'ssl_key_file',
), 'type' => 'string',
'system_leenabled' => array( 'string_type' => 'file',
'label' => $lng['serversettings']['leenabled'], 'string_emptyallowed' => true,
'settinggroup' => 'system', 'default' => '/etc/apache2/apache2.key',
'varname' => 'leenabled', 'save_method' => 'storeSettingField'
'type' => 'bool', ),
'default' => false, 'system_ssl_cert_chainfile' => array(
'cronmodule' => 'froxlor/letsencrypt', 'label' => $lng['admin']['ipsandports']['ssl_cert_chainfile'],
'save_method' => 'storeSettingField' 'settinggroup' => 'system',
), 'varname' => 'ssl_cert_chainfile',
'system_letsencryptca' => array( 'type' => 'string',
'label' => $lng['serversettings']['letsencryptca'], 'string_type' => 'file',
'settinggroup' => 'system', 'string_emptyallowed' => true,
'varname' => 'letsencryptca', 'default' => '',
'type' => 'option', 'save_method' => 'storeSettingField'
'default' => 'testing', ),
'option_mode' => 'one', 'system_ssl_ca_file' => array(
'option_options' => array('testing' => 'https://acme-staging.api.letsencrypt.org (Test)', 'production' => 'https://acme-v01.api.letsencrypt.org (Live)'), 'label' => $lng['serversettings']['ssl']['ssl_ca_file'],
'save_method' => 'storeSettingField', 'settinggroup' => 'system',
), 'varname' => 'ssl_ca_file',
'system_letsencryptcountrycode' => array( 'type' => 'string',
'label' => $lng['serversettings']['letsencryptcountrycode'], 'string_type' => 'file',
'settinggroup' => 'system', 'string_emptyallowed' => true,
'varname' => 'letsencryptcountrycode', 'default' => '',
'type' => 'string', 'save_method' => 'storeSettingField'
'string_emptyallowed' => false, ),
'default' => 'DE', 'system_apache24_ocsp_cache_path' => array(
'save_method' => 'storeSettingField', 'label' => $lng['serversettings']['ssl']['apache24_ocsp_cache_path'],
), 'settinggroup' => 'system',
'system_letsencryptstate' => array( 'varname' => 'apache24_ocsp_cache_path',
'label' => $lng['serversettings']['letsencryptstate'], 'type' => 'string',
'settinggroup' => 'system', 'string_type' => 'string',
'varname' => 'letsencryptstate', 'string_emptyallowed' => false,
'type' => 'string', 'default' => 'shmcb:/var/run/apache2/ocsp-stapling.cache(131072)',
'string_emptyallowed' => false, 'visible' => \Froxlor\Settings::Get('system.webserver') == "apache2" && \Froxlor\Settings::Get('system.apache24') == 1,
'default' => 'Germany', 'save_method' => 'storeSettingField'
'save_method' => 'storeSettingField', ),
), 'system_sessionticketsenabled' => array(
'system_letsencryptchallengepath' => array( 'label' => $lng['admin']['domain_sessionticketsenabled'],
'label' => $lng['serversettings']['letsencryptchallengepath'], 'settinggroup' => 'system',
'settinggroup' => 'system', 'varname' => 'sessionticketsenabled',
'varname' => 'letsencryptchallengepath', 'type' => 'bool',
'type' => 'string', 'default' => true,
'string_emptyallowed' => false, 'save_method' => 'storeSettingField',
'default' => FROXLOR_INSTALL_DIR, 'visible' => \Froxlor\Settings::Get('system.use_ssl') && (\Froxlor\Settings::Get('system.webserver') == "nginx" || (\Froxlor\Settings::Get('system.webserver') == "apache2" && \Froxlor\Settings::Get('system.apache24') == 1))
'save_method' => 'storeSettingField', ),
), 'system_leenabled' => array(
'system_letsencryptkeysize' => array( 'label' => $lng['serversettings']['leenabled'],
'label' => $lng['serversettings']['letsencryptkeysize'], 'settinggroup' => 'system',
'settinggroup' => 'system', 'varname' => 'leenabled',
'varname' => 'letsencryptkeysize', 'type' => 'bool',
'type' => 'int', 'default' => false,
'int_min' => 2048, 'cronmodule' => 'froxlor/letsencrypt',
'default' => 4096, 'save_method' => 'storeSettingField'
'save_method' => 'storeSettingField', ),
), 'system_letsencryptacmeconf' => array(
'system_letsencryptreuseold' => array( 'label' => $lng['serversettings']['letsencryptacmeconf'],
'label' => $lng['serversettings']['letsencryptreuseold'], 'settinggroup' => 'system',
'settinggroup' => 'system', 'varname' => 'letsencryptacmeconf',
'varname' => 'letsencryptreuseold', 'type' => 'string',
'type' => 'bool', 'string_type' => 'file',
'default' => false, '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'],
'settinggroup' => 'system',
'varname' => 'letsencryptca',
'type' => 'option',
'default' => 'production',
'option_mode' => 'one',
'option_options' => array(
'testing' => 'https://acme-staging-v0' . \Froxlor\Settings::Get('system.leapiversion') . '.api.letsencrypt.org (Test)',
'production' => 'https://acme-v0' . \Froxlor\Settings::Get('system.leapiversion') . '.api.letsencrypt.org (Live)'
),
'save_method' => 'storeSettingField'
),
'system_letsencryptchallengepath' => array(
'label' => $lng['serversettings']['letsencryptchallengepath'],
'settinggroup' => 'system',
'varname' => 'letsencryptchallengepath',
'type' => 'string',
'string_emptyallowed' => false,
'default' => \Froxlor\Froxlor::getInstallDir(),
'save_method' => 'storeSettingField'
),
'system_letsencryptkeysize' => array(
'label' => $lng['serversettings']['letsencryptkeysize'],
'settinggroup' => 'system',
'varname' => 'letsencryptkeysize',
'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(
'label' => $lng['serversettings']['letsencryptreuseold'],
'settinggroup' => 'system',
'varname' => 'letsencryptreuseold',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField'
),
'system_disable_le_selfcheck' => array(
'label' => $lng['serversettings']['le_domain_dnscheck'],
'settinggroup' => 'system',
'varname' => 'le_domain_dnscheck',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField'
)
) )
) )
); )
);

View File

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

View File

@@ -11,10 +11,9 @@
* @copyright (c) the authors * @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package \Froxlor\Settings
* *
*/ */
return array( return array(
'groups' => array( 'groups' => array(
'phpfpm' => array( 'phpfpm' => array(
@@ -27,33 +26,12 @@ return array(
'type' => 'bool', 'type' => 'bool',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'plausibility_check_method' => 'checkFcgidPhpFpm', 'plausibility_check_method' => array(
'\\Froxlor\\Validate\\Check',
'checkFcgidPhpFpm'
),
'overview_option' => true 'overview_option' => true
), ),
'system_phpfpm_enabled_ownvhost' => array(
'label' => $lng['phpfpm']['ownvhost'],
'settinggroup' => 'phpfpm',
'varname' => 'enabled_ownvhost',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
),
'system_phpfpm_httpuser' => array(
'label' => $lng['phpfpm']['vhost_httpuser'],
'settinggroup' => 'phpfpm',
'varname' => 'vhost_httpuser',
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingWebserverFcgidFpmUser'
),
'system_phpfpm_httpgroup' => array(
'label' => $lng['phpfpm']['vhost_httpgroup'],
'settinggroup' => 'phpfpm',
'varname' => 'vhost_httpgroup',
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingField'
),
'system_phpfpm_defaultini' => array( 'system_phpfpm_defaultini' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini'], 'label' => $lng['serversettings']['mod_fcgid']['defaultini'],
'settinggroup' => 'phpfpm', 'settinggroup' => 'phpfpm',
@@ -61,28 +39,12 @@ return array(
'type' => 'option', 'type' => 'option',
'default' => '1', 'default' => '1',
'option_mode' => 'one', 'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs', 'option_options_method' => array(
'save_method' => 'storeSettingField' '\\Froxlor\\Http\\PhpConfig',
'getPhpConfigs'
), ),
'system_phpfpm_defaultini_ownvhost' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'],
'settinggroup' => 'phpfpm',
'varname' => 'vhost_defaultini',
'type' => 'option',
'default' => '2',
'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs',
'save_method' => 'storeSettingField' '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( 'system_phpfpm_aliasconfigdir' => array(
'label' => $lng['serversettings']['phpfpm_settings']['aliasconfigdir'], 'label' => $lng['serversettings']['phpfpm_settings']['aliasconfigdir'],
'settinggroup' => 'phpfpm', 'settinggroup' => 'phpfpm',
@@ -91,7 +53,7 @@ return array(
'string_type' => 'confdir', 'string_type' => 'confdir',
'default' => '/var/www/php-fpm/', 'default' => '/var/www/php-fpm/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ),
'system_phpfpm_tmpdir' => array( 'system_phpfpm_tmpdir' => array(
'label' => $lng['serversettings']['mod_fcgid']['tmpdir'], 'label' => $lng['serversettings']['mod_fcgid']['tmpdir'],
'settinggroup' => 'phpfpm', 'settinggroup' => 'phpfpm',
@@ -100,16 +62,29 @@ return array(
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/var/customers/tmp/', 'default' => '/var/customers/tmp/',
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ),
'system_phpfpm_peardir' => array( 'system_phpfpm_peardir' => array(
'label' => $lng['serversettings']['mod_fcgid']['peardir'], 'label' => $lng['serversettings']['mod_fcgid']['peardir'],
'settinggroup' => 'phpfpm', 'settinggroup' => 'phpfpm',
'varname' => 'peardir', 'varname' => 'peardir',
'type' => 'string', 'type' => 'string',
'string_type' => 'dir', 'string_type' => 'dir',
'string_delimiter' => ':',
'string_emptyallowed' => true,
'default' => '/usr/share/php/:/usr/share/php5/', 'default' => '/usr/share/php/:/usr/share/php5/',
'save_method' => 'storeSettingField' '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( 'system_phpfpm_fastcgi_ipcdir' => array(
'label' => $lng['serversettings']['phpfpm_settings']['ipcdir'], 'label' => $lng['serversettings']['phpfpm_settings']['ipcdir'],
'settinggroup' => 'phpfpm', 'settinggroup' => 'phpfpm',
@@ -118,83 +93,49 @@ return array(
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/var/lib/apache2/fastcgi/', 'default' => '/var/lib/apache2/fastcgi/',
'save_method' => 'storeSettingField' '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( 'system_phpfpm_use_mod_proxy' => array(
'label' => $lng['phpfpm']['use_mod_proxy'], 'label' => $lng['phpfpm']['use_mod_proxy'],
'settinggroup' => 'phpfpm', 'settinggroup' => 'phpfpm',
'varname' => 'use_mod_proxy', 'varname' => 'use_mod_proxy',
'type' => 'bool', 'type' => 'bool',
'default' => false, 'default' => true,
'visible' => Settings::Get('system.apache24'), 'visible' => \Froxlor\Settings::Get('system.apache24'),
'save_method' => 'storeSettingField' '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 * @package Settings
* *
*/ */
return array( return array(
'groups' => array( 'groups' => array(
'perl' => array( 'perl' => array(
@@ -27,8 +26,10 @@ return array(
'type' => 'string', 'type' => 'string',
'default' => '/usr/bin/perl', 'default' => '/usr/bin/perl',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('lighttpd') 'websrv_avail' => array(
), 'lighttpd'
)
),
'system_perl_suexecworkaround' => array( 'system_perl_suexecworkaround' => array(
'label' => $lng['serversettings']['perl']['suexecworkaround'], 'label' => $lng['serversettings']['perl']['suexecworkaround'],
'settinggroup' => 'perl', 'settinggroup' => 'perl',
@@ -36,8 +37,10 @@ return array(
'type' => 'bool', 'type' => 'bool',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2') 'websrv_avail' => array(
), 'apache2'
)
),
'system_perl_suexeccgipath' => array( 'system_perl_suexeccgipath' => array(
'label' => $lng['serversettings']['perl']['suexeccgipath'], 'label' => $lng['serversettings']['perl']['suexeccgipath'],
'settinggroup' => 'perl', 'settinggroup' => 'perl',
@@ -46,8 +49,10 @@ return array(
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/var/www/cgi-bin/', 'default' => '/var/www/cgi-bin/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2') 'websrv_avail' => array(
), 'apache2'
)
),
'perl_server' => array( 'perl_server' => array(
'label' => $lng['serversettings']['perl_server'], 'label' => $lng['serversettings']['perl_server'],
'settinggroup' => 'serversettings', 'settinggroup' => 'serversettings',
@@ -55,11 +60,13 @@ return array(
'type' => 'string', 'type' => 'string',
'default' => 'unix:/var/run/nginx/cgiwrap-dispatch.sock', 'default' => 'unix:/var/run/nginx/cgiwrap-dispatch.sock',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('nginx') 'websrv_avail' => array(
), 'nginx'
), )
), )
), )
); )
)
);
?> ?>

View File

@@ -16,7 +16,6 @@
* @package Settings * @package Settings
* *
*/ */
return array( return array(
'groups' => array( 'groups' => array(
'statistics' => array( 'statistics' => array(
@@ -29,17 +28,22 @@ return array(
'type' => 'option', 'type' => 'option',
'default' => 2, 'default' => 2,
'option_mode' => 'one', 'option_mode' => 'one',
'option_options' => array(0 => $lng['admin']['webalizer']['normal'], 1 => $lng['admin']['webalizer']['quiet'], 2 => $lng['admin']['webalizer']['veryquiet']), 'option_options' => array(
'save_method' => 'storeSettingField', 0 => $lng['admin']['webalizer']['normal'],
1 => $lng['admin']['webalizer']['quiet'],
2 => $lng['admin']['webalizer']['veryquiet']
), ),
'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.awstats_enabled') == 0
),
'system_awstats_enabled' => array( 'system_awstats_enabled' => array(
'label' => $lng['serversettings']['awstats_enabled'], 'label' => $lng['serversettings']['awstats_enabled'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'awstats_enabled', 'varname' => 'awstats_enabled',
'type' => 'bool', 'type' => 'bool',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField'
), ),
'system_awstats_path' => array( 'system_awstats_path' => array(
'label' => $lng['serversettings']['awstats_path'], 'label' => $lng['serversettings']['awstats_path'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -48,7 +52,8 @@ return array(
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/usr/bin/', 'default' => '/usr/bin/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), 'visible' => \Froxlor\Settings::Get('system.awstats_enabled') == 1
),
'system_awstats_awstatspath' => array( 'system_awstats_awstatspath' => array(
'label' => $lng['serversettings']['awstats_awstatspath'], 'label' => $lng['serversettings']['awstats_awstatspath'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -57,7 +62,8 @@ return array(
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/usr/bin/', 'default' => '/usr/bin/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), 'visible' => \Froxlor\Settings::Get('system.awstats_enabled') == 1
),
'system_awstats_conf' => array( 'system_awstats_conf' => array(
'label' => $lng['serversettings']['awstats_conf'], 'label' => $lng['serversettings']['awstats_conf'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -66,7 +72,8 @@ return array(
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/etc/awstats/', 'default' => '/etc/awstats/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), 'visible' => \Froxlor\Settings::Get('system.awstats_enabled') == 1
),
'system_awstats_icons' => array( 'system_awstats_icons' => array(
'label' => $lng['serversettings']['awstats_icons'], 'label' => $lng['serversettings']['awstats_icons'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -75,10 +82,20 @@ return array(
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/usr/share/awstats/icon/', 'default' => '/usr/share/awstats/icon/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
) 'visible' => \Froxlor\Settings::Get('system.awstats_enabled') == 1
),
'system_awstats_logformat' => array(
'label' => $lng['serversettings']['awstats']['logformat'],
'settinggroup' => 'system',
'varname' => 'awstats_logformat',
'type' => 'string',
'default' => '1',
'save_method' => 'storeSettingField',
'visible' => \Froxlor\Settings::Get('system.awstats_enabled') == 1
) )
) )
) )
); )
);
?> ?>

View File

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

View File

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

View File

@@ -16,7 +16,6 @@
* @package Settings * @package Settings
* *
*/ */
return array( return array(
'groups' => array( 'groups' => array(
'nameserver' => array( 'nameserver' => array(
@@ -30,7 +29,28 @@ return array(
'default' => true, 'default' => true,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'overview_option' => true 'overview_option' => true
),
'system_dnsenabled' => array(
'label' => $lng['serversettings']['dnseditorenable'],
'settinggroup' => 'system',
'varname' => 'dnsenabled',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
),
'system_dns_server' => array(
'label' => $lng['serversettings']['dns_server'],
'settinggroup' => 'system',
'varname' => 'dns_server',
'type' => 'option',
'default' => 'Bind',
'option_mode' => 'one',
'option_options' => array(
'Bind' => 'Bind9',
'PowerDNS' => 'PowerDNS'
), ),
'save_method' => 'storeSettingField'
),
'system_bindconf_directory' => array( 'system_bindconf_directory' => array(
'label' => $lng['serversettings']['bindconf_directory'], 'label' => $lng['serversettings']['bindconf_directory'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -38,16 +58,16 @@ return array(
'type' => 'string', 'type' => 'string',
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/etc/bind/', 'default' => '/etc/bind/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField'
), ),
'system_bindreload_command' => array( 'system_bindreload_command' => array(
'label' => $lng['serversettings']['bindreload_command'], 'label' => $lng['serversettings']['bindreload_command'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'bindreload_command', 'varname' => 'bindreload_command',
'type' => 'string', 'type' => 'string',
'default' => '/etc/init.d/bind9 reload', 'default' => '/etc/init.d/bind9 reload',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField'
), ),
'system_nameservers' => array( 'system_nameservers' => array(
'label' => $lng['serversettings']['nameservers'], 'label' => $lng['serversettings']['nameservers'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -56,8 +76,8 @@ return array(
'string_regexp' => '/^(([a-z0-9\-\._]+, ?)*[a-z0-9\-\._]+)?$/i', 'string_regexp' => '/^(([a-z0-9\-\._]+, ?)*[a-z0-9\-\._]+)?$/i',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingFieldInsertBindTask', 'save_method' => 'storeSettingFieldInsertBindTask'
), ),
'system_mxservers' => array( 'system_mxservers' => array(
'label' => $lng['serversettings']['mxservers'], 'label' => $lng['serversettings']['mxservers'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -66,8 +86,8 @@ return array(
'string_regexp' => '/^(([0-9]+ [a-z0-9\-\._]+, ?)*[0-9]+ [a-z0-9\-\._]+)?$/i', 'string_regexp' => '/^(([0-9]+ [a-z0-9\-\._]+, ?)*[0-9]+ [a-z0-9\-\._]+)?$/i',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField'
), ),
'system_axfrservers' => array( 'system_axfrservers' => array(
'label' => $lng['serversettings']['axfrservers'], 'label' => $lng['serversettings']['axfrservers'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -77,14 +97,6 @@ return array(
'string_delimiter' => ',', 'string_delimiter' => ',',
'string_emptyallowed' => true, 'string_emptyallowed' => true,
'default' => '', 'default' => '',
'save_method' => 'storeSettingField',
),
'system_dns_createhostnameentry' => array(
'label' => $lng['serversettings']['dns_createhostnameentry'],
'settinggroup' => 'system',
'varname' => 'dns_createhostnameentry',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField' 'save_method' => 'storeSettingField'
), ),
'system_dns_createmailentry' => array( 'system_dns_createmailentry' => array(
@@ -94,7 +106,23 @@ return array(
'type' => 'bool', 'type' => 'bool',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField' '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( 'system_defaultttl' => array(
'label' => $lng['serversettings']['defaultttl'], 'label' => $lng['serversettings']['defaultttl'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -103,11 +131,9 @@ return array(
'default' => 604800, /* 1 week */ 'default' => 604800, /* 1 week */
'int_min' => 3600, /* 1 hour */ 'int_min' => 3600, /* 1 hour */
'int_max' => 2147483647, /* integer max */ 'int_max' => 2147483647, /* integer max */
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField'
), )
), )
), )
), )
); );
?>

View File

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

View File

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

View File

@@ -14,7 +14,6 @@
* @package Settings * @package Settings
* *
*/ */
return array( return array(
'groups' => array( 'groups' => array(
'spf' => array( 'spf' => array(
@@ -28,18 +27,18 @@ return array(
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'overview_option' => true 'overview_option' => true
), ),
'spf_entry' => array( 'spf_entry' => array(
'label' => $lng['spf']['spf_entry'], 'label' => $lng['spf']['spf_entry'],
'settinggroup' => 'spf', 'settinggroup' => 'spf',
'varname' => 'spf_entry', 'varname' => 'spf_entry',
'type' => 'string', 'type' => 'string',
'default' => '@ IN TXT "v=spf1 a mx -all"', 'default' => '"v=spf1 a mx -all"',
'save_method' => 'storeSettingField' '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 * @package Settings
* *
*/ */
return array( return array(
'groups' => array( 'groups' => array(
'security' => array( 'security' => array(
@@ -28,16 +27,16 @@ return array(
'varname' => 'unix_names', 'varname' => 'unix_names',
'type' => 'bool', 'type' => 'bool',
'default' => true, 'default' => true,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField'
), ),
'system_mailpwcleartext' => array( 'system_mailpwcleartext' => array(
'label' => $lng['serversettings']['mailpwcleartext'], 'label' => $lng['serversettings']['mailpwcleartext'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mailpwcleartext', 'varname' => 'mailpwcleartext',
'type' => 'bool', 'type' => 'bool',
'default' => true, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField'
), ),
'system_passwordcryptfunc' => array( 'system_passwordcryptfunc' => array(
'label' => $lng['serversettings']['passwordcryptfunc'], 'label' => $lng['serversettings']['passwordcryptfunc'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -45,26 +44,46 @@ return array(
'type' => 'option', 'type' => 'option',
'default' => 0, 'default' => 0,
'option_mode' => 'one', 'option_mode' => 'one',
'option_options_method' => 'getAvailablePasswordHashes', 'option_options_method' => array(
'save_method' => 'storeSettingField', '\\Froxlor\\System\\Crypt',
'getAvailablePasswordHashes'
), ),
'save_method' => 'storeSettingField'
),
'system_allow_error_report_admin' => array( 'system_allow_error_report_admin' => array(
'label' => $lng['serversettings']['allow_error_report_admin'], 'label' => $lng['serversettings']['allow_error_report_admin'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'allow_error_report_admin', 'varname' => 'allow_error_report_admin',
'type' => 'bool', 'type' => 'bool',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField'
), ),
'system_allow_error_report_customer' => array( 'system_allow_error_report_customer' => array(
'label' => $lng['serversettings']['allow_error_report_customer'], 'label' => $lng['serversettings']['allow_error_report_customer'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'allow_error_report_customer', 'varname' => 'allow_error_report_customer',
'type' => 'bool', 'type' => 'bool',
'default' => false, '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'
),
'system_available_shells' => array(
'label' => $lng['serversettings']['available_shells'],
'settinggroup' => 'system',
'varname' => 'available_shells',
'type' => 'string',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField'
) )
) )
) )
); )
);

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@@ -18,200 +18,249 @@
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Settings;
if ($userinfo['change_serversettings'] == '1') { if ($userinfo['change_serversettings'] == '1') {
$replace_arr = Array( if ($action == 'setconfigured') {
'<SQL_UNPRIVILEGED_USER>' => $sql['user'], Settings::Set('panel.is_configured', '1', true);
'<SQL_UNPRIVILEGED_PASSWORD>' => 'MYSQL_PASSWORD', \Froxlor\UI\Response::redirectTo('admin_configfiles.php', array(
'<SQL_DB>' => $sql['db'], 's' => $s
'<SQL_HOST>' => $sql['host'], ));
'<SQL_SOCKET>' => isset($sql['socket']) ? $sql['socket'] : null, }
'<SERVERNAME>' => Settings::Get('system.hostname'),
'<SERVERIP>' => Settings::Get('system.ipaddress'),
'<NAMESERVERS>' => Settings::Get('system.nameservers'),
'<VIRTUAL_MAILBOX_BASE>' => Settings::Get('system.vmail_homedir'),
'<VIRTUAL_UID_MAPS>' => Settings::Get('system.vmail_uid'),
'<VIRTUAL_GID_MAPS>' => Settings::Get('system.vmail_gid'),
'<SSLPROTOCOLS>' => (Settings::Get('system.use_ssl') == '1') ? 'imaps pop3s' : '',
'<CUSTOMER_TMP>' => (Settings::Get('system.mod_fcgid_tmpdir') != '') ? makeCorrectDir(Settings::Get('system.mod_fcgid_tmpdir')) : '/tmp/',
'<BASE_PATH>' => makeCorrectDir(FROXLOR_INSTALL_DIR),
'<BIND_CONFIG_PATH>' => makeCorrectDir(Settings::Get('system.bindconf_directory')),
'<WEBSERVER_RELOAD_CMD>' => Settings::Get('system.apachereload_command'),
'<CUSTOMER_LOGS>' => makeCorrectDir(Settings::Get('system.logfiles_directory')),
'<FPM_IPCDIR>' => makeCorrectDir(Settings::Get('phpfpm.fastcgi_ipcdir')),
'<WEBSERVER_GROUP>' => Settings::Get('system.httpgroup')
);
// get distro from URL param $customer_tmpdir = '/tmp/';
$distribution = (isset($_GET['distribution']) && $_GET['distribution'] != 'choose') ? $_GET['distribution'] : ""; if (Settings::Get('system.mod_fcgid') == '1' && Settings::Get('system.mod_fcgid_tmpdir') != '') {
$service = (isset($_GET['service']) && $_GET['service'] != 'choose') ? $_GET['service'] : ""; $customer_tmpdir = Settings::Get('system.mod_fcgid_tmpdir');
$daemon = (isset($_GET['daemon']) && $_GET['daemon'] != 'choose') ? $_GET['daemon'] : ""; } elseif (Settings::Get('phpfpm.enabled') == '1' && Settings::Get('phpfpm.tmpdir') != '') {
$distributions_select = ""; $customer_tmpdir = Settings::Get('phpfpm.tmpdir');
$services_select = ""; }
$daemons_select = "";
$configfiles = ""; // try to convert namserver hosts to ip's
$services = ""; $ns_ips = "";
$daemons = ""; 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);
}
}
}
$config_dir = makeCorrectDir(FROXLOR_INSTALL_DIR . '/lib/configfiles/'); $replace_arr = Array(
'<SQL_UNPRIVILEGED_USER>' => $sql['user'],
'<SQL_UNPRIVILEGED_PASSWORD>' => 'FROXLOR_MYSQL_PASSWORD',
'<SQL_DB>' => $sql['db'],
'<SQL_HOST>' => $sql['host'],
'<SQL_SOCKET>' => isset($sql['socket']) ? $sql['socket'] : null,
'<SERVERNAME>' => Settings::Get('system.hostname'),
'<SERVERIP>' => Settings::Get('system.ipaddress'),
'<NAMESERVERS>' => Settings::Get('system.nameservers'),
'<NAMESERVERS_IP>' => $ns_ips,
'<AXFRSERVERS>' => Settings::Get('system.axfrservers'),
'<VIRTUAL_MAILBOX_BASE>' => Settings::Get('system.vmail_homedir'),
'<VIRTUAL_UID_MAPS>' => Settings::Get('system.vmail_uid'),
'<VIRTUAL_GID_MAPS>' => Settings::Get('system.vmail_gid'),
'<SSLPROTOCOLS>' => (Settings::Get('system.use_ssl') == '1') ? 'imaps pop3s' : '',
'<CUSTOMER_TMP>' => \Froxlor\FileDir::makeCorrectDir($customer_tmpdir),
'<BASE_PATH>' => \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir()),
'<BIND_CONFIG_PATH>' => \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.bindconf_directory')),
'<WEBSERVER_RELOAD_CMD>' => Settings::Get('system.apachereload_command'),
'<CUSTOMER_LOGS>' => \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.logfiles_directory')),
'<FPM_IPCDIR>' => \Froxlor\FileDir::makeCorrectDir(Settings::Get('phpfpm.fastcgi_ipcdir')),
'<WEBSERVER_GROUP>' => Settings::Get('system.httpgroup')
);
if ($distribution != "") { // get distro from URL param
// create configparser object $distribution = (isset($_GET['distribution']) && $_GET['distribution'] != 'choose') ? $_GET['distribution'] : "";
$configfiles = new ConfigParser($config_dir . '/' . $distribution . ".xml"); $service = (isset($_GET['service']) && $_GET['service'] != 'choose') ? $_GET['service'] : "";
$daemon = (isset($_GET['daemon']) && $_GET['daemon'] != 'choose') ? $_GET['daemon'] : "";
$distributions_select = "";
$services_select = "";
$daemons_select = "";
// get distro-info $configfiles = "";
$dist_display = getCompleteDistroName($configfiles); $services = "";
$daemons = "";
// get all the services from the distro $config_dir = \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir() . '/lib/configfiles/');
$services = $configfiles->getServices();
if ($service != "") { if ($distribution != "") {
$daemons = $services[$service]->getDaemons(); if (! file_exists($config_dir . '/' . $distribution . ".xml")) {
trigger_error("Unknown distribution, are you playing around with the URL?");
exit();
}
if ($daemon == "") { // create configparser object
foreach ($daemons as $di => $dd) { $configfiles = new \Froxlor\Config\ConfigParser($config_dir . '/' . $distribution . ".xml");
$title = $dd->title;
if ($dd->default) {
$title = $title." (".strtolower($lng['panel']['default']).")";
}
$daemons_select .= makeoption($title, $di);
}
}
} else {
foreach ($services as $si => $sd) {
$services_select .= makeoption($sd->title, $si);
}
}
} else {
// show list of available distro's // get distro-info
$distros = glob($config_dir . '*.xml'); $dist_display = getCompleteDistroName($configfiles);
// tmp array
$distributions_select_data = array();
// read in all the distros
foreach ($distros as $_distribution) {
// get configparser object
$dist = new ConfigParser($_distribution);
// get distro-info
$dist_display = getCompleteDistroName($dist);
// store in tmp array
$distributions_select_data[$dist_display] = str_replace(".xml", "", strtolower(basename($_distribution)));
}
// sort by distribution name // get all the services from the distro
ksort($distributions_select_data); $services = $configfiles->getServices();
foreach ($distributions_select_data as $dist_display => $dist_index) { if ($service != "") {
// create select-box-option
$distributions_select .= makeoption($dist_display, $dist_index);
}
}
if ($distribution != "" && $service != "" && $daemon != "") { if (! isset($services[$service])) {
trigger_error("Unknown service, are you playing around with the URL?");
exit();
}
$confarr = $daemons[$daemon]->getConfig(); $daemons = $services[$service]->getDaemons();
$configpage = ''; if ($daemon == "") {
foreach ($daemons as $di => $dd) {
$title = $dd->title;
if ($dd->default) {
$title = $title . " (" . strtolower($lng['panel']['default']) . ")";
}
$daemons_select .= \Froxlor\UI\HTML::makeoption($title, $di);
}
}
} else {
foreach ($services as $si => $sd) {
$services_select .= \Froxlor\UI\HTML::makeoption($sd->title, $si);
}
}
} else {
$distro_editor = $configfiles->distributionEditor; // show list of available distro's
$distros = glob($config_dir . '*.xml');
// tmp array
$distributions_select_data = array();
// read in all the distros
foreach ($distros as $_distribution) {
// get configparser object
$dist = new \Froxlor\Config\ConfigParser($_distribution);
// get distro-info
$dist_display = getCompleteDistroName($dist);
// store in tmp array
$distributions_select_data[$dist_display] = str_replace(".xml", "", strtolower(basename($_distribution)));
}
$commands_pre = ""; // sort by distribution name
$commands_file = ""; ksort($distributions_select_data);
$commands_post = "";
$lasttype = ''; foreach ($distributions_select_data as $dist_display => $dist_index) {
$commands = ''; // create select-box-option
foreach ($confarr as $idx => $action) { $distributions_select .= \Froxlor\UI\HTML::makeoption($dist_display, $dist_index);
if ($lasttype != '' && $lasttype != $action['type']) { }
$commands = trim($commands); }
$numbrows = count(explode("\n", $commands));
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_commands") . "\";"); if ($distribution != "" && $service != "" && $daemon != "") {
$lasttype = '';
$commands = ''; if (! isset($daemons[$daemon])) {
} trigger_error("Unknown daemon, are you playing around with the URL?");
switch ($action['type']) { exit();
case "install": }
$commands .= $action['content'] . "\n";
$lasttype = "install"; $confarr = $daemons[$daemon]->getConfig();
break;
case "command": $configpage = '';
$commands .= $action['content'] . "\n";
$lasttype = "command"; $distro_editor = $configfiles->distributionEditor;
break;
case "file": $commands_pre = "";
if (array_key_exists('content', $action)) { $commands_file = "";
$commands_file = getFileContentContainer($action['content'], $replace_arr, $action['name'], $distro_editor); $commands_post = "";
} elseif (array_key_exists('subcommands', $action)) {
foreach ($action['subcommands'] as $fileaction) { $lasttype = '';
if (array_key_exists('execute', $fileaction) && $fileaction['execute'] == "pre") { $commands = '';
$commands_pre .= $fileaction['content'] . "\n"; foreach ($confarr as $_action) {
} elseif (array_key_exists('execute', $fileaction) && $fileaction['execute'] == "post") { if ($lasttype != '' && $lasttype != $_action['type']) {
$commands_post .= $fileaction['content'] . "\n"; $commands = trim($commands);
} elseif ($fileaction['type'] == 'file') { $numbrows = count(explode("\n", $commands));
$commands_file = getFileContentContainer($fileaction['content'], $replace_arr, $action['name'], $distro_editor); eval("\$configpage.=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_commands") . "\";");
} $lasttype = '';
} $commands = '';
} }
$realname = $action['name']; switch ($_action['type']) {
$commands = trim($commands_pre); case "install":
if ($commands != "") { $commands .= strtr($_action['content'], $replace_arr) . "\n";
$numbrows = count(explode("\n", $commands)); $lasttype = "install";
eval("\$commands_pre=\"" . getTemplate("configfiles/configfiles_commands") . "\";"); break;
} case "command":
$commands = trim($commands_post); $commands .= strtr($_action['content'], $replace_arr) . "\n";
if ($commands != "") { $lasttype = "command";
$numbrows = count(explode("\n", $commands)); break;
eval("\$commands_post=\"" . getTemplate("configfiles/configfiles_commands") . "\";"); case "file":
} if (array_key_exists('content', $_action)) {
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_subfileblock") . "\";"); $commands_file = getFileContentContainer($_action['content'], $replace_arr, $_action['name'], $distro_editor);
$commands = ''; } elseif (array_key_exists('subcommands', $_action)) {
$commands_pre = ''; foreach ($_action['subcommands'] as $fileaction) {
$commands_post = ''; if (array_key_exists('execute', $fileaction) && $fileaction['execute'] == "pre") {
break; $commands_pre .= $fileaction['content'] . "\n";
} } elseif (array_key_exists('execute', $fileaction) && $fileaction['execute'] == "post") {
} $commands_post .= $fileaction['content'] . "\n";
$commands = trim($commands); } elseif ($fileaction['type'] == 'file') {
if ($commands != '') { $commands_file = getFileContentContainer($fileaction['content'], $replace_arr, $_action['name'], $distro_editor);
$numbrows = count(explode("\n", $commands)); }
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_commands") . "\";"); }
} }
eval("echo \"" . getTemplate("configfiles/configfiles") . "\";"); $realname = $_action['name'];
} else { $commands = trim($commands_pre);
eval("echo \"" . getTemplate("configfiles/wizard") . "\";"); if ($commands != "") {
} $numbrows = count(explode("\n", $commands));
eval("\$commands_pre=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_commands") . "\";");
}
$commands = trim($commands_post);
if ($commands != "") {
$numbrows = count(explode("\n", $commands));
eval("\$commands_post=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_commands") . "\";");
}
eval("\$configpage.=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_subfileblock") . "\";");
$commands = '';
$commands_pre = '';
$commands_post = '';
break;
}
}
$commands = trim($commands);
if ($commands != '') {
$numbrows = count(explode("\n", $commands));
eval("\$configpage.=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_commands") . "\";");
}
eval("echo \"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles") . "\";");
} else {
$basedir = \Froxlor\Froxlor::getInstallDir();
eval("echo \"" . \Froxlor\UI\Template::getTemplate("configfiles/wizard") . "\";");
}
} else { } else {
die('not allowed to see this page'); \Froxlor\UI\Response::redirectTo('admin_index.php', array(
// redirect or similar here 's' => $s
));
} }
// helper functions // helper functions
function getFileContentContainer($file_content, &$replace_arr, $realname, $distro_editor) function getFileContentContainer($file_content, &$replace_arr, $realname, $distro_editor)
{ {
$files = ""; $files = "";
$file_content = trim($file_content); $file_content = trim($file_content);
if ($file_content != '') { if ($file_content != '') {
$file_content = strtr($file_content, $replace_arr); $file_content = strtr($file_content, $replace_arr);
$file_content = htmlspecialchars($file_content); $file_content = htmlspecialchars($file_content);
$numbrows = count(explode("\n", $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; return $files;
} }
function getCompleteDistroName($cparser) function getCompleteDistroName($cparser)
{ {
// get distro-info // get distro-info
$dist_display = $cparser->distributionName; $dist_display = $cparser->distributionName;
if ($cparser->distributionCodename != '') { if ($cparser->distributionCodename != '') {
$dist_display .= " ".$cparser->distributionCodename; $dist_display .= " " . $cparser->distributionCodename;
} }
if ($cparser->distributionVersion != '') { if ($cparser->distributionVersion != '') {
$dist_display .= " (" . $cparser->distributionVersion . ")"; $dist_display .= " (" . $cparser->distributionVersion . ")";
} }
if ($cparser->deprecated) { if ($cparser->deprecated) {
$dist_display .= " [deprecated]"; $dist_display .= " [deprecated]";
} }
return $dist_display; return $dist_display;
} }

View File

@@ -14,95 +14,90 @@
* @package Panel * @package Panel
* *
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Api\Commands\Cronjobs;
if (isset($_POST['id'])) { if (isset($_POST['id'])) {
$id = intval($_POST['id']); $id = intval($_POST['id']);
} elseif(isset($_GET['id'])) { } elseif (isset($_GET['id'])) {
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
if ($page == 'cronjobs' || $page == 'overview') { if ($page == 'cronjobs' || $page == 'overview') {
if ($action == '') { if ($action == '') {
$log->logAction(ADM_ACTION, LOG_NOTICE, 'viewed admin_cronjobs'); $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'viewed admin_cronjobs');
$fields = array( $fields = array(
'c.module' => 'Module',
'c.lastrun' => $lng['cron']['lastrun'], 'c.lastrun' => $lng['cron']['lastrun'],
'c.interval' => $lng['cron']['interval'], 'c.interval' => $lng['cron']['interval'],
'c.isactive' => $lng['cron']['isactive'] 'c.isactive' => $lng['cron']['isactive']
); );
$paging = new paging($userinfo, TABLE_PANEL_CRONRUNS, $fields); try {
// get total count
$json_result = Cronjobs::getLocal($userinfo)->listingCount();
$result = json_decode($json_result, true)['data'];
// initialize pagination and filtering
$paging = new \Froxlor\UI\Pagination($userinfo, $fields, $result);
// get list
$json_result = Cronjobs::getLocal($userinfo, $paging->getApiCommandParams())->listing();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
$crons = ''; $crons = '';
$result_stmt = Database::prepare("SELECT `c`.* FROM `" . TABLE_PANEL_CRONRUNS . "` `c` ORDER BY `module` ASC, `cronfile` ASC");
Database::pexecute($result_stmt);
$paging->setEntries(Database::num_rows());
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s); $pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$i = 0;
$count = 0; $count = 0;
$cmod = ''; $cmod = '';
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { foreach ($result['list'] as $row) {
if ($cmod != $row['module']) { if ($cmod != $row['module']) {
$_mod = explode("/", $row['module']); $_mod = explode("/", $row['module']);
$module = ucfirst($_mod[1]); $module = ucfirst($_mod[1]);
eval("\$crons.=\"" . getTemplate('cronjobs/cronjobs_cronjobmodule') . "\";"); eval("\$crons.=\"" . \Froxlor\UI\Template::getTemplate('cronjobs/cronjobs_cronjobmodule') . "\";");
$cmod = $row['module']; $cmod = $row['module'];
} }
if ($paging->checkDisplay($i)) { $row = \Froxlor\PhpHelper::htmlentitiesArray($row);
$row = htmlentities_array($row); $row['lastrun'] = date('d.m.Y H:i', $row['lastrun']);
$row['isactive'] = ((int) $row['isactive'] == 1) ? $lng['panel']['yes'] : $lng['panel']['no'];
$description = $lng['crondesc'][$row['desc_lng_key']];
$row['lastrun'] = date('d.m.Y H:i', $row['lastrun']); eval("\$crons.=\"" . \Froxlor\UI\Template::getTemplate('cronjobs/cronjobs_cronjob') . "\";");
$row['isactive'] = ((int)$row['isactive'] == 1) ? $lng['panel']['yes'] : $lng['panel']['no']; $count ++;
$description = $lng['crondesc'][$row['desc_lng_key']];
eval("\$crons.=\"" . getTemplate('cronjobs/cronjobs_cronjob') . "\";");
$count++;
}
$i++;
} }
eval("echo \"" . getTemplate('cronjobs/cronjobs') . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate('cronjobs/cronjobs') . "\";");
} elseif ($action == 'new') { } elseif ($action == 'new') {
/* /*
* @TODO later * @TODO later
*/ */
} elseif ($action == 'edit' && $id != 0) { } elseif ($action == 'edit' && $id != 0) {
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_CRONRUNS . "` WHERE `id`= :id"); try {
Database::pexecute($result_stmt, array('id' => $id)); $json_result = Cronjobs::getLocal($userinfo, array(
$result = $result_stmt->fetch(PDO::FETCH_ASSOC); 'id' => $id
))->get();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if ($result['cronfile'] != '') { if ($result['cronfile'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$isactive = isset($_POST['isactive']) ? 1 : 0; try {
$interval_value = validate($_POST['interval_value'], 'interval_value', '/^([0-9]+)$/Di', 'stringisempty'); Cronjobs::getLocal($userinfo, $_POST)->update();
$interval_interval = validate($_POST['interval_interval'], 'interval_interval'); } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
if ($isactive != 1) {
$isactive = 0;
} }
\Froxlor\UI\Response::redirectTo($filename, array(
$interval = $interval_value . ' ' . strtoupper($interval_interval); 'page' => $page,
's' => $s
$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));
} else { } else {
// interval // interval
@@ -110,11 +105,11 @@ if ($page == 'cronjobs' || $page == 'overview') {
$interval_value = $interval_nfo[0]; $interval_value = $interval_nfo[0];
$interval_interval = ''; $interval_interval = '';
$interval_interval .= makeoption($lng['cronmgmt']['minutes'], 'MINUTE', $interval_nfo[1]); $interval_interval .= \Froxlor\UI\HTML::makeoption($lng['cronmgmt']['minutes'], 'MINUTE', $interval_nfo[1]);
$interval_interval .= makeoption($lng['cronmgmt']['hours'], 'HOUR', $interval_nfo[1]); $interval_interval .= \Froxlor\UI\HTML::makeoption($lng['cronmgmt']['hours'], 'HOUR', $interval_nfo[1]);
$interval_interval .= makeoption($lng['cronmgmt']['days'], 'DAY', $interval_nfo[1]); $interval_interval .= \Froxlor\UI\HTML::makeoption($lng['cronmgmt']['days'], 'DAY', $interval_nfo[1]);
$interval_interval .= makeoption($lng['cronmgmt']['weeks'], 'WEEK', $interval_nfo[1]); $interval_interval .= \Froxlor\UI\HTML::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']['months'], 'MONTH', $interval_nfo[1]);
// end of interval // end of interval
$change_cronfile = false; $change_cronfile = false;
@@ -122,17 +117,16 @@ if ($page == 'cronjobs' || $page == 'overview') {
$change_cronfile = true; $change_cronfile = true;
} }
$cronjobs_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/cronjobs/formfield.cronjobs_edit.php'; $cronjobs_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/cronjobs/formfield.cronjobs_edit.php';
$cronjobs_edit_form = htmlform::genHTMLForm($cronjobs_edit_data); $cronjobs_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($cronjobs_edit_data);
$title = $cronjobs_edit_data['cronjobs_edit']['title']; $title = $cronjobs_edit_data['cronjobs_edit']['title'];
$image = $cronjobs_edit_data['cronjobs_edit']['image']; $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 * @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 * @package Panel
* *
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; 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') { if (Settings::Get('session.allow_multiple_login') == '1') {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` $stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :adminid WHERE `userid` = :adminid
AND `adminsession` = '1' AND `adminsession` = '1'
AND `hash` = :hash" AND `hash` = :hash");
);
$params['hash'] = $s; $params['hash'] = $s;
} else { } else {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` $stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :adminid WHERE `userid` = :adminid
AND `adminsession` = '1'" AND `adminsession` = '1'");
);
} }
Database::pexecute($stmt, $params); Database::pexecute($stmt, $params);
redirectTo('index.php'); \Froxlor\UI\Response::redirectTo('index.php');
} }
if (isset($_POST['id'])) { if (isset($_POST['id'])) {
$id = intval($_POST['id']); $id = intval($_POST['id']);
} elseif(isset($_GET['id'])) { } elseif (isset($_GET['id'])) {
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
if ($page == 'overview') { 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`, $overview_stmt = Database::prepare("SELECT COUNT(*) AS `number_customers`,
SUM(`diskspace_used`) AS `diskspace_used`, SUM(`diskspace_used`) AS `diskspace_used`,
SUM(`mysqls_used`) AS `mysqls_used`, SUM(`mysqls_used`) AS `mysqls_used`,
@@ -60,11 +65,12 @@ if ($page == 'overview') {
SUM(`email_forwarders_used`) AS `email_forwarders_used`, SUM(`email_forwarders_used`) AS `email_forwarders_used`,
SUM(`email_quota_used`) AS `email_quota_used`, SUM(`email_quota_used`) AS `email_quota_used`,
SUM(`ftps_used`) AS `ftps_used`, SUM(`ftps_used`) AS `ftps_used`,
SUM(`tickets_used`) AS `tickets_used`,
SUM(`subdomains_used`) AS `subdomains_used`, SUM(`subdomains_used`) AS `subdomains_used`,
SUM(`traffic_used`) AS `traffic_used` SUM(`traffic_used`) AS `traffic_used`
FROM `" . TABLE_PANEL_CUSTOMERS . "`" . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = :adminid ")); FROM `" . TABLE_PANEL_CUSTOMERS . "`" . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = :adminid "));
$overview = Database::pexecute_first($overview_stmt, array('adminid' => $userinfo['adminid'])); $overview = Database::pexecute_first($overview_stmt, array(
'adminid' => $userinfo['adminid']
));
$dec_places = Settings::Get('panel.decimal_places'); $dec_places = Settings::Get('panel.decimal_places');
$overview['traffic_used'] = round($overview['traffic_used'] / (1024 * 1024), $dec_places); $overview['traffic_used'] = round($overview['traffic_used'] / (1024 * 1024), $dec_places);
@@ -72,9 +78,10 @@ if ($page == 'overview') {
$number_domains_stmt = Database::prepare(" $number_domains_stmt = Database::prepare("
SELECT COUNT(*) AS `number_domains` FROM `" . TABLE_PANEL_DOMAINS . "` SELECT COUNT(*) AS `number_domains` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `parentdomainid`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :adminid") WHERE `parentdomainid`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :adminid"));
); $number_domains = Database::pexecute_first($number_domains_stmt, array(
$number_domains = Database::pexecute_first($number_domains_stmt, array('adminid' => $userinfo['adminid'])); 'adminid' => $userinfo['adminid']
));
$overview['number_domains'] = $number_domains['number_domains']; $overview['number_domains'] = $number_domains['number_domains'];
@@ -82,52 +89,23 @@ if ($page == 'overview') {
$mysqlserverversion = Database::getAttribute(PDO::ATTR_SERVER_VERSION); $mysqlserverversion = Database::getAttribute(PDO::ATTR_SERVER_VERSION);
$webserverinterface = strtoupper(@php_sapi_name()); $webserverinterface = strtoupper(@php_sapi_name());
if ((isset($_GET['lookfornewversion']) && $_GET['lookfornewversion'] == 'yes') if ((isset($_GET['lookfornewversion']) && $_GET['lookfornewversion'] == 'yes') || (isset($lookfornewversion) && $lookfornewversion == 'yes')) {
|| (isset($lookfornewversion) && $lookfornewversion == 'yes') try {
) { $json_result = Froxlor::getLocal($userinfo)->checkUpdate();
$update_check_uri = 'http://version.froxlor.org/Froxlor/legacy/' . $version; } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
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);
} }
$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 { } else {
$lookfornewversion_lable = $lng['admin']['lookfornewversion']['clickhere']; $lookfornewversion_lable = $lng['admin']['lookfornewversion']['clickhere'];
$lookfornewversion_link = htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes'); $lookfornewversion_link = htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes');
$lookfornewversion_message = '';
$lookfornewversion_addinfo = ''; $lookfornewversion_addinfo = '';
$isnewerversion = 0; $isnewerversion = 0;
} }
@@ -137,12 +115,21 @@ if ($page == 'overview') {
$userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, $dec_places); $userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, $dec_places);
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $dec_places); $userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $dec_places);
$userinfo['traffic_used'] = round($userinfo['traffic_used'] / (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']) : ''; $userinfo['custom_notes'] = ($userinfo['custom_notes'] != '') ? nl2br($userinfo['custom_notes']) : '';
$cron_last_runs = getCronjobsLastRun(); $cron_last_runs = \Froxlor\System\Cronjob::getCronjobsLastRun();
$outstanding_tasks = getOutstandingTasks(); $outstanding_tasks = \Froxlor\System\Cronjob::getOutstandingTasks();
$system_hostname = gethostname();
$meminfo = explode("\n", @file_get_contents("/proc/meminfo"));
$memory = "";
for ($i = 0; $i < sizeof($meminfo); ++ $i) {
if (substr($meminfo[$i], 0, 3) === "Mem") {
$memory .= $meminfo[$i] . PHP_EOL;
}
}
if (function_exists('sys_getloadavg')) { if (function_exists('sys_getloadavg')) {
$loadArray = sys_getloadavg(); $loadArray = sys_getloadavg();
@@ -150,7 +137,7 @@ if ($page == 'overview') {
} else { } else {
$load = @file_get_contents('/proc/loadavg'); $load = @file_get_contents('/proc/loadavg');
if (!$load) { if (! $load) {
$load = $lng['admin']['noloadavailable']; $load = $lng['admin']['noloadavailable'];
} }
} }
@@ -168,10 +155,7 @@ if ($page == 'overview') {
// First: With exec (let's hope it's enabled for the Froxlor - vHost) // First: With exec (let's hope it's enabled for the Froxlor - vHost)
$uptime_array = explode(" ", @file_get_contents("/proc/uptime")); $uptime_array = explode(" ", @file_get_contents("/proc/uptime"));
if (is_array($uptime_array) if (is_array($uptime_array) && isset($uptime_array[0]) && is_numeric($uptime_array[0])) {
&& isset($uptime_array[0])
&& is_numeric($uptime_array[0])
) {
// Some calculatioon to get a nicly formatted display // Some calculatioon to get a nicly formatted display
$seconds = round($uptime_array[0], 0); $seconds = round($uptime_array[0], 0);
$minutes = $seconds / 60; $minutes = $seconds / 60;
@@ -189,79 +173,82 @@ if ($page == 'overview') {
$uptime = ''; $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']) if (! \Froxlor\System\Crypt::validatePasswordLogin($userinfo, $old_password, TABLE_PANEL_ADMINS, 'adminid')) {
&& $_POST['send'] == 'send' \Froxlor\UI\Response::standard_error('oldpasswordnotcorrect');
) {
$old_password = validate($_POST['old_password'], 'old password');
if (!validatePasswordLogin($userinfo,$old_password,TABLE_PANEL_ADMINS,'adminid')) {
standard_error('oldpasswordnotcorrect');
} }
$new_password = validate($_POST['new_password'], 'new password'); $new_password = \Froxlor\Validate\Validate::validate($_POST['new_password'], 'new password');
$new_password_confirm = validate($_POST['new_password_confirm'], 'new password confirm'); $new_password_confirm = \Froxlor\Validate\Validate::validate($_POST['new_password_confirm'], 'new password confirm');
if ($old_password == '') { if ($old_password == '') {
standard_error(array('stringisempty', 'oldpassword')); \Froxlor\UI\Response::standard_error(array(
} elseif($new_password == '') { 'stringisempty',
standard_error(array('stringisempty', 'newpassword')); 'oldpassword'
} elseif($new_password_confirm == '') { ));
standard_error(array('stringisempty', 'newpasswordconfirm')); } elseif ($new_password == '') {
} elseif($new_password != $new_password_confirm) { \Froxlor\UI\Response::standard_error(array(
standard_error('newpasswordconfirmerror'); 'stringisempty',
} else { 'newpassword'
$chgpwd_stmt = Database::prepare(" ));
UPDATE `" . TABLE_PANEL_ADMINS . "` } elseif ($new_password_confirm == '') {
SET `password`= :newpasswd \Froxlor\UI\Response::standard_error(array(
WHERE `adminid`= :adminid" 'stringisempty',
); 'newpasswordconfirm'
Database::pexecute($chgpwd_stmt, array( ));
'newpasswd' => makeCryptPassword($new_password), } elseif ($new_password != $new_password_confirm) {
'adminid' => (int)$userinfo['adminid'] \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 { } 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 = \Froxlor\Validate\Validate::validate($_POST['def_language'], 'default language');
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$def_language = validate($_POST['def_language'], 'default language');
if (isset($languages[$def_language])) { if (isset($languages[$def_language])) {
$lng_stmt = Database::prepare(" try {
UPDATE `" . TABLE_PANEL_ADMINS . "` Admins::getLocal($userinfo, array(
SET `def_language`= :deflng 'id' => $userinfo['adminid'],
WHERE `adminid`= :adminid" 'def_language' => $def_language
); ))->update();
Database::pexecute($lng_stmt, array( } catch (Exception $e) {
'deflng' => $def_language, \Froxlor\UI\Response::dynamic_error($e->getMessage());
'adminid' => (int)$userinfo['adminid'] }
));
// also update current session
$lng_stmt = Database::prepare(" $lng_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_SESSIONS . "` UPDATE `" . TABLE_PANEL_SESSIONS . "`
SET `language`= :lng SET `language`= :lng
WHERE `hash`= :hash" WHERE `hash`= :hash");
);
Database::pexecute($lng_stmt, array( Database::pexecute($lng_stmt, array(
'lng' => $def_language, 'lng' => $def_language,
'hash' => $s 'hash' => $s
)); ));
} }
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "changed his/her default language to '" . $def_language . "'");
$log->logAction(ADM_ACTION, LOG_NOTICE, "changed his/her default language to '" . $def_language . "'"); \Froxlor\UI\Response::redirectTo($filename, array(
redirectTo($filename, array('s' => $s)); 's' => $s
));
} else { } else {
$language_options = ''; $language_options = '';
@@ -271,43 +258,39 @@ if ($page == 'overview') {
$default_lang = $userinfo['def_language']; $default_lang = $userinfo['def_language'];
} }
while (list($language_file, $language_name) = each($languages)) { foreach ($languages as $language_file => $language_name) {
$language_options.= makeoption($language_name, $language_file, $default_lang, true); $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') { } elseif ($page == 'change_theme') {
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send' $theme = \Froxlor\Validate\Validate::validate($_POST['theme'], 'theme');
) { try {
$theme = validate($_POST['theme'], 'theme'); Admins::getLocal($userinfo, array(
'id' => $userinfo['adminid'],
$theme_stmt = Database::prepare(" 'theme' => $theme
UPDATE `" . TABLE_PANEL_ADMINS . "` ))->update();
SET `theme`= :theme } catch (Exception $e) {
WHERE `adminid`= :adminid" \Froxlor\UI\Response::dynamic_error($e->getMessage());
); }
Database::pexecute($theme_stmt, array(
'theme' => $theme,
'adminid' => (int)$userinfo['adminid']
));
// also update current session
$theme_stmt = Database::prepare(" $theme_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_SESSIONS . "` UPDATE `" . TABLE_PANEL_SESSIONS . "`
SET `theme`= :theme SET `theme`= :theme
WHERE `hash`= :hash" WHERE `hash`= :hash");
);
Database::pexecute($theme_stmt, array( Database::pexecute($theme_stmt, array(
'theme' => $theme, 'theme' => $theme,
'hash' => $s 'hash' => $s
)); ));
$log->logAction(ADM_ACTION, LOG_NOTICE, "changed his/her theme to '" . $theme . "'"); $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "changed his/her theme to '" . $theme . "'");
redirectTo($filename, array('s' => $s)); \Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} else { } else {
$theme_options = ''; $theme_options = '';
@@ -317,27 +300,22 @@ if ($page == 'overview') {
$default_theme = $userinfo['theme']; $default_theme = $userinfo['theme'];
} }
$themes_avail = getThemes(); $themes_avail = \Froxlor\UI\Template::getThemes();
foreach ($themes_avail as $t => $d) { 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 // only show this if we really have an exception to report
if (isset($_GET['errorid']) if (isset($_GET['errorid']) && $_GET['errorid'] != '') {
&& $_GET['errorid'] != ''
) {
$errid = $_GET['errorid']; $errid = $_GET['errorid'];
// read error file // read error file
$err_dir = makeCorrectDir(FROXLOR_INSTALL_DIR."/logs/"); $err_dir = \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir() . "/logs/");
$err_file = makeCorrectFile($err_dir."/".$errid."_sql-error.log"); $err_file = \Froxlor\FileDir::makeCorrectFile($err_dir . "/" . $errid . "_sql-error.log");
if (file_exists($err_file)) { if (file_exists($err_file)) {
@@ -347,27 +325,26 @@ if ($page == 'overview') {
$_error = array( $_error = array(
'code' => str_replace("\n", "", substr($error[1], 5)), 'code' => str_replace("\n", "", substr($error[1], 5)),
'message' => str_replace("\n", "", substr($error[2], 4)), '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)), '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 // build mail-content
$mail_body = "Dear froxlor-team,\n\n"; $mail_body = "Dear froxlor-team,\n\n";
$mail_body .= "the following error has been reported by a user:\n\n"; $mail_body .= "the following error has been reported by a user:\n\n";
$mail_body .= "-------------------------------------------------------------\n"; $mail_body .= "-------------------------------------------------------------\n";
$mail_body .= $_error['code'].' '.$_error['message']."\n\n"; $mail_body .= $_error['code'] . ' ' . $_error['message'] . "\n\n";
$mail_body .= "File: ".$_error['file'].':'.$_error['line']."\n\n"; $mail_body .= "File: " . $_error['file'] . ':' . $_error['line'] . "\n\n";
$mail_body .= "Trace:\n".trim($_error['trace'])."\n\n"; $mail_body .= "Trace:\n" . trim($_error['trace']) . "\n\n";
$mail_body .= "-------------------------------------------------------------\n\n"; $mail_body .= "-------------------------------------------------------------\n\n";
$mail_body .= "Froxlor-version: ".$version."\n\n"; $mail_body .= "Froxlor-version: " . $version . "\n";
$mail_body .= "DB-version: " . $dbversion . "\n\n";
$mail_body .= "End of report"; $mail_body .= "End of report";
$mail_html = nl2br($mail_body); $mail_html = nl2br($mail_body);
// send actual report to dev-team // send actual report to dev-team
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send'
) {
// send mail and say thanks // send mail and say thanks
$_mailerror = false; $_mailerror = false;
try { try {
@@ -376,7 +353,7 @@ if ($page == 'overview') {
$mail->MsgHTML($mail_html); $mail->MsgHTML($mail_html);
$mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team'); $mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team');
$mail->Send(); $mail->Send();
} catch(phpmailerException $e) { } catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage(); $mailerr_msg = $e->errorMessage();
$_mailerror = true; $_mailerror = true;
} catch (Exception $e) { } catch (Exception $e) {
@@ -386,21 +363,30 @@ if ($page == 'overview') {
if ($_mailerror) { if ($_mailerror) {
// error when reporting an error...LOLFUQ // 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 // finally remove error from fs
@unlink($err_file); @unlink($err_file);
redirectTo($filename, array('s' => $s)); \Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} }
// show a nice summary of the error-report // show a nice summary of the error-report
// before actually sending anything // before actually sending anything
eval("echo \"" . getTemplate("index/send_error_report") . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/send_error_report") . "\";");
} else { } else {
redirectTo($filename, array('s' => $s)); \Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} }
} else { } 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,422 +16,158 @@
* @package Panel * @package Panel
* *
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Settings;
use Froxlor\Api\Commands\IpsAndPorts;
if (isset($_POST['id'])) { if (isset($_POST['id'])) {
$id = intval($_POST['id']); $id = intval($_POST['id']);
} elseif(isset($_GET['id'])) { } elseif (isset($_GET['id'])) {
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
if ($page == 'ipsandports' if ($page == 'ipsandports' || $page == 'overview') {
|| $page == 'overview'
) {
// Do not display attributes that are not used by the current webserver // Do not display attributes that are not used by the current webserver
$websrv = Settings::Get('system.webserver'); $websrv = Settings::Get('system.webserver');
$is_nginx = ($websrv == 'nginx'); $is_nginx = ($websrv == 'nginx');
$is_apache = ($websrv == 'apache2'); $is_apache = ($websrv == 'apache2');
$is_apache24 = $is_apache && (Settings::Get('system.apache24') === '1');
if ($action == '') { if ($action == '') {
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_ipsandports"); $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_ipsandports");
$fields = array( $fields = array(
'ip' => $lng['admin']['ipsandports']['ip'], 'ip' => $lng['admin']['ipsandports']['ip'],
'port' => $lng['admin']['ipsandports']['port'] 'port' => $lng['admin']['ipsandports']['port']
); );
$paging = new paging($userinfo, TABLE_PANEL_IPSANDPORTS, $fields); try {
// get total count
$json_result = IpsAndPorts::getLocal($userinfo)->listingCount();
$result = json_decode($json_result, true)['data'];
// initialize pagination and filtering
$paging = new \Froxlor\UI\Pagination($userinfo, $fields, $result);
// get list
$json_result = IpsAndPorts::getLocal($userinfo, $paging->getApiCommandParams())->listing();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
$ipsandports = ''; $ipsandports = '';
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` " . $paging->getSqlWhere(false) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
Database::pexecute($result_stmt);
$paging->setEntries(Database::num_rows());
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s); $pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$i = 0;
$count = 0; $count = 0;
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { foreach ($result['list'] as $row) {
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
if ($paging->checkDisplay($i)) { if (filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$row = htmlentities_array($row); $row['ip'] = '[' . $row['ip'] . ']';
if (filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$row['ip'] = '[' . $row['ip'] . ']';
}
eval("\$ipsandports.=\"" . getTemplate("ipsandports/ipsandports_ipandport") . "\";");
$count++;
} }
$i++; eval("\$ipsandports.=\"" . \Froxlor\UI\Template::getTemplate("ipsandports/ipsandports_ipandport") . "\";");
$count ++;
} }
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'];
eval("echo \"" . getTemplate("ipsandports/ipsandports") . "\";"); if (isset($result['id']) && $result['id'] == $id) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
} elseif($action == 'delete' try {
&& $id != 0 IpsAndPorts::getLocal($userinfo, array(
) { 'id' => $id
$result_stmt = Database::prepare("SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = :id"); ))->delete();
$result = Database::pexecute_first($result_stmt, array('id' => $id)); } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
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');
} }
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else { } else {
standard_error('ipstillhasdomains'); \Froxlor\UI\HTML::askYesNo('admin_ip_reallydelete', $filename, array(
'id' => $id,
'page' => $page,
'action' => $action
), $result['ip'] . ':' . $result['port']);
} }
} }
} elseif ($action == 'add') {
} elseif($action == 'add') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
if (isset($_POST['send']) IpsAndPorts::getLocal($userinfo, $_POST)->add();
&& $_POST['send'] == 'send' } catch (Exception $e) {
) { \Froxlor\UI\Response::dynamic_error($e->getMessage());
$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 = '';
} }
\Froxlor\UI\Response::redirectTo($filename, array(
if ($listen_statement != '1') { 'page' => $page,
$listen_statement = '0'; 's' => $s
} ));
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 . ']';
}
$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));
}
} else { } else {
$ipsandports_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/ipsandports/formfield.ipsandports_add.php'; $ipsandports_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/ipsandports/formfield.ipsandports_add.php';
$ipsandports_add_form = htmlform::genHTMLForm($ipsandports_add_data); $ipsandports_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($ipsandports_add_data);
$title = $ipsandports_add_data['ipsandports_add']['title']; $title = $ipsandports_add_data['ipsandports_add']['title'];
$image = $ipsandports_add_data['ipsandports_add']['image']; $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) {
} elseif($action == 'edit' try {
&& $id != 0 $json_result = IpsAndPorts::getLocal($userinfo, array(
) { 'id' => $id
$result_stmt = Database::prepare(" ))->get();
SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = :id" } catch (Exception $e) {
); \Froxlor\UI\Response::dynamic_error($e->getMessage());
$result = Database::pexecute_first($result_stmt, array('id' => $id)); }
$result = json_decode($json_result, true)['data'];
if ($result['ip'] != '') { if ($result['ip'] != '') {
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send' try {
) { IpsAndPorts::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
$ip = validate_ip($_POST['ip']); \Froxlor\UI\Response::dynamic_error($e->getMessage());
$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 = '';
} }
\Froxlor\UI\Response::redirectTo($filename, array(
if ($listen_statement != '1') { 'page' => $page,
$listen_statement = '0'; 's' => $s
} ));
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));
}
} else { } 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_data = include_once dirname(__FILE__) . '/lib/formfields/admin/ipsandports/formfield.ipsandports_edit.php';
$ipsandports_edit_form = htmlform::genHTMLForm($ipsandports_edit_data); $ipsandports_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($ipsandports_edit_data);
$title = $ipsandports_edit_data['ipsandports_edit']['title']; $title = $ipsandports_edit_data['ipsandports_edit']['title'];
$image = $ipsandports_edit_data['ipsandports_edit']['image']; $image = $ipsandports_edit_data['ipsandports_edit']['image'];
eval("echo \"" . getTemplate("ipsandports/ipsandports_edit") . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate("ipsandports/ipsandports_edit") . "\";");
} }
} }
} elseif ($action == 'jqCheckIP') {
$ip = $_POST['ip'] ?? "";
if ((filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) || filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) && filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE | FILTER_FLAG_NO_PRIV_RANGE) == false) {
// returns notice if private network detected so we can display it
echo json_encode($lng['admin']['ipsandports']['ipnote']);
} else {
echo 0;
}
exit();
} }
} }

View File

@@ -16,13 +16,12 @@
* @package Panel * @package Panel
* *
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require './lib/init.php';
if ($page == 'log' use Froxlor\Api\Commands\SysLog;
&& $userinfo['change_serversettings'] == '1'
) { if ($page == 'log' && $userinfo['change_serversettings'] == '1') {
if ($action == '') { if ($action == '') {
$fields = array( $fields = array(
'date' => $lng['logger']['date'], 'date' => $lng['logger']['date'],
@@ -30,103 +29,104 @@ if ($page == 'log'
'user' => $lng['logger']['user'], 'user' => $lng['logger']['user'],
'text' => $lng['logger']['action'] 'text' => $lng['logger']['action']
); );
$paging = new paging($userinfo, TABLE_PANEL_LOG, $fields, null, null, 0, 'desc'); try {
$result_stmt = Database::query(' // get total count
SELECT * FROM `' . TABLE_PANEL_LOG . '` ' . $paging->getSqlWhere(false) . ' ' . $paging->getSqlOrderBy() . ' ' . $paging->getSqlLimit() $json_result = SysLog::getLocal($userinfo)->listingCount();
); $result = json_decode($json_result, true)['data'];
$logs_count = Database::num_rows(); // initialize pagination and filtering
$paging->setEntries($logs_count); $paging = new \Froxlor\UI\Pagination($userinfo, $fields, $result);
// get list
$json_result = SysLog::getLocal($userinfo, $paging->getApiCommandParams())->listing();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s); $pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$clog = array(); $clog = array();
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { foreach ($result['list'] as $row) {
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']] = array();
} }
$clog[$row['action']][$row['logid']] = $row; $clog[$row['action']][$row['logid']] = $row;
} }
if ($paging->sortfield == 'date' if ($paging->sortfield == 'date' && $paging->sortorder == 'desc') {
&& $paging->sortorder == 'desc'
) {
krsort($clog); krsort($clog);
} else { } else {
ksort($clog); ksort($clog);
} }
$i = 0;
$count = 0; $count = 0;
$log_count = 0; $log_count = 0;
$log = ''; $log = '';
foreach ($clog as $action => $logrows) { foreach ($clog as $action => $logrows) {
$_action = 0; $_action = 0;
foreach ($logrows as $row) { foreach ($logrows as $row) {
if ($paging->checkDisplay($i)) { // if ($paging->checkDisplay($i)) {
$row = htmlentities_array($row); $row = \Froxlor\PhpHelper::htmlentitiesArray($row);
$row['date'] = date("d.m.y H:i:s", $row['date']); $row['date'] = date("d.m.y H:i:s", $row['date']);
if ($_action != $action) { if ($_action != $action) {
switch ($action) { switch ($action) {
case USR_ACTION: case \Froxlor\FroxlorLogger::USR_ACTION:
$_action = $lng['admin']['customer']; $_action = $lng['admin']['customer'];
break; break;
case RES_ACTION: case \Froxlor\FroxlorLogger::RES_ACTION:
$_action = $lng['logger']['reseller']; $_action = $lng['logger']['reseller'];
break; break;
case ADM_ACTION: case \Froxlor\FroxlorLogger::ADM_ACTION:
$_action = $lng['logger']['admin']; $_action = $lng['logger']['admin'];
break; break;
case CRON_ACTION: case \Froxlor\FroxlorLogger::CRON_ACTION:
$_action = $lng['logger']['cron']; $_action = $lng['logger']['cron'];
break; break;
case LOGIN_ACTION: case \Froxlor\FroxlorLogger::LOGIN_ACTION:
$_action = $lng['logger']['login']; $_action = $lng['logger']['login'];
break; break;
case LOG_ERROR: case \Froxlor\FroxlorLogger::LOG_ERROR:
$_action = $lng['logger']['intern']; $_action = $lng['logger']['intern'];
break; break;
default: default:
$_action = $lng['logger']['unknown']; $_action = $lng['logger']['unknown'];
break; break;
}
$row['action'] = $_action;
eval("\$log.=\"" . getTemplate('logger/logger_action') . "\";");
} }
$log_count++; $row['action'] = $_action;
$row['type'] = getLogLevelDesc($row['type']); eval("\$log.=\"" . \Froxlor\UI\Template::getTemplate('logger/logger_action') . "\";");
eval("\$log.=\"" . getTemplate('logger/logger_log') . "\";");
$count++;
$_action = $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++;
} }
eval("echo \"" . getTemplate('logger/logger') . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate('logger/logger') . "\";");
} elseif ($action == 'truncate') { } elseif ($action == 'truncate') {
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send' try {
) { SysLog::getLocal($userinfo, array(
$truncatedate = time() - (60 * 10); 'min_to_keep' => 10
$trunc_stmt = Database::prepare(" ))->delete();
DELETE FROM `" . TABLE_PANEL_LOG . "` WHERE `date` < :trunc" } catch (Exception $e) {
); \Froxlor\UI\Response::dynamic_error($e->getMessage());
Database::pexecute($trunc_stmt, array('trunc' => $truncatedate)); }
$log->logAction(ADM_ACTION, LOG_WARNING, 'truncated the system-log (mysql)'); \Froxlor\UI\Response::redirectTo($filename, array(
redirectTo($filename, array('page' => $page, 's' => $s)); 'page' => $page,
's' => $s
));
} else { } 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 * @package Panel
* *
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Database\Database;
if (isset($_POST['id'])) { if (isset($_POST['id'])) {
$id = intval($_POST['id']); $id = intval($_POST['id']);
} elseif (isset($_GET['id'])) { } elseif (isset($_GET['id'])) {
@@ -28,36 +29,33 @@ if (isset($_POST['id'])) {
if ($page == 'message') { if ($page == 'message') {
if ($action == '') { 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']) if (isset($_POST['send']) && $_POST['send'] == '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');
if ($_POST['receipient'] == 0
&& $userinfo['customers_see_all'] == '1'
) {
$log->logAction(ADM_ACTION, LOG_NOTICE, 'sending messages to admins');
$result = Database::query('SELECT `name`, `email` FROM `' . TABLE_PANEL_ADMINS . "`"); $result = Database::query('SELECT `name`, `email` FROM `' . TABLE_PANEL_ADMINS . "`");
} elseif ($_POST['receipient'] == 1) { } elseif ($_POST['receipient'] == 1) {
if ($userinfo['customers_see_all'] == '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 . "`"); $result = Database::query('SELECT `firstname`, `name`, `company`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "`");
} else { } 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(' $result = Database::prepare('
SELECT `firstname`, `name`, `company`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "` SELECT `firstname`, `name`, `company`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "`
WHERE `adminid` = :adminid" WHERE `adminid` = :adminid");
); Database::pexecute($result, array(
Database::pexecute($result, array('adminid' => $userinfo['adminid'])); 'adminid' => $userinfo['adminid']
));
} }
} else { } else {
standard_error('noreceipientsgiven'); \Froxlor\UI\Response::standard_error('noreceipientsgiven');
} }
$subject = $_POST['subject']; $subject = $_POST['subject'];
$message = wordwrap($_POST['message'], 70); $message = wordwrap($_POST['message'], 70);
if (!empty($message)) { if (! empty($message)) {
$mailcounter = 0; $mailcounter = 0;
$mail->Body = $message; $mail->Body = $message;
$mail->Subject = $subject; $mail->Subject = $subject;
@@ -66,28 +64,37 @@ if ($page == 'message') {
$row['firstname'] = isset($row['firstname']) ? $row['firstname'] : ''; $row['firstname'] = isset($row['firstname']) ? $row['firstname'] : '';
$row['company'] = isset($row['company']) ? $row['company'] : ''; $row['company'] = isset($row['company']) ? $row['company'] : '';
$mail->AddAddress($row['email'], 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->From = $userinfo['email'];
$mail->FromName = (isset($userinfo['firstname']) ? $userinfo['firstname'] . ' ' : '') . $userinfo['name']; $mail->FromName = (isset($userinfo['firstname']) ? $userinfo['firstname'] . ' ' : '') . $userinfo['name'];
if (!$mail->Send()) { if (! $mail->Send()) {
if ($mail->ErrorInfo != '') { if ($mail->ErrorInfo != '') {
$mailerr_msg = $mail->ErrorInfo; $mailerr_msg = $mail->ErrorInfo;
} else { } else {
$mailerr_msg = $row['email']; $mailerr_msg = $row['email'];
} }
$log->logAction(ADM_ACTION, LOG_ERR, 'Error sending mail: ' . $mailerr_msg); $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_ERR, 'Error sending mail: ' . $mailerr_msg);
standard_error('errorsendingmail', $row['email']); \Froxlor\UI\Response::standard_error('errorsendingmail', $row['email']);
} }
$mailcounter++; $mailcounter ++;
$mail->ClearAddresses(); $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 { } else {
standard_error('nomessagetosend'); \Froxlor\UI\Response::standard_error('nomessagetosend');
} }
} }
} }
@@ -95,14 +102,13 @@ if ($page == 'message') {
if ($action == 'showsuccess') { if ($action == 'showsuccess') {
$success = 1; $success = 1;
$sentitems = isset($_GET['sentitems']) ? (int)$_GET['sentitems'] : 0; $sentitems = isset($_GET['sentitems']) ? (int) $_GET['sentitems'] : 0;
if ($sentitems == 0) { if ($sentitems == 0) {
$successmessage = $lng['message']['noreceipients']; $successmessage = $lng['message']['noreceipients'];
} else { } else {
$successmessage = str_replace('%s', $sentitems, $lng['message']['success']); $successmessage = str_replace('%s', $sentitems, $lng['message']['success']);
} }
} else { } else {
$success = 0; $success = 0;
$sentitems = 0; $sentitems = 0;
@@ -113,9 +119,9 @@ if ($page == 'message') {
$receipients = ''; $receipients = '';
if ($userinfo['customers_see_all'] == '1') { 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); $receipients .= \Froxlor\UI\HTML::makeoption($lng['panel']['customer'], 1);
eval("echo \"" . getTemplate('message/message') . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate('message/message') . "\";");
} }

View File

@@ -17,142 +17,140 @@
* Based on https://github.com/amnuts/opcache-gui * Based on https://github.com/amnuts/opcache-gui
* *
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require './lib/init.php';
if ($action == 'reset' && function_exists('opcache_reset') && $userinfo['change_serversettings'] == '1') {
if ($action == 'reset' && opcache_reset();
function_exists('opcache_reset') && $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "reseted OPcache");
$userinfo['change_serversettings'] == '1' header('Location: ' . $linker->getLink(array(
) { 'section' => 'opcacheinfo',
opcache_reset(); 'page' => 'showinfo'
$log->logAction(ADM_ACTION, LOG_INFO, "reseted OPcache"); )));
header('Location: ' . $linker->getLink(array('section' => 'opcacheinfo', 'page' => 'showinfo'))); exit();
exit();
} }
if (!function_exists('opcache_get_configuration') if (! function_exists('opcache_get_configuration')) {
) { \Froxlor\UI\Response::standard_error($lng['error']['no_opcacheinfo']);
standard_error($lng['error']['no_opcacheinfo']);
} }
if ($page == 'showinfo' if ($page == 'showinfo') {
) {
$opcache_info = opcache_get_configuration(); $opcache_info = opcache_get_configuration();
$opcache_status = opcache_get_status(false); $opcache_status = opcache_get_status(false);
$time = time(); $time = time();
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed OPcache info"); $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed OPcache info");
$runtimelines = ''; $runtimelines = '';
if (isset($opcache_info['directives']) && is_array($opcache_info['directives'])) { if (isset($opcache_info['directives']) && is_array($opcache_info['directives'])) {
foreach ($opcache_info['directives'] as $name => $value) { foreach ($opcache_info['directives'] as $name => $value) {
$linkname= str_replace('_', '-', $name); $linkname = str_replace('_', '-', $name);
if ($name=='opcache.optimization_level' && is_integer($value)) { if ($name == 'opcache.optimization_level' && is_integer($value)) {
$value='0x'.dechex($value); $value = '0x' . dechex($value);
} }
if ($name=='opcache.memory_consumption' && is_integer($value) && $value%(1024*1024)==0) { if ($name == 'opcache.memory_consumption' && is_integer($value) && $value % (1024 * 1024) == 0) {
$value=$value/(1024*1024); $value = $value / (1024 * 1024);
} }
if ($value===null || $value==='') { if ($value === null || $value === '') {
$value=$lng['opcacheinfo']['novalue']; $value = $lng['opcacheinfo']['novalue'];
} }
if ($value===true) { if ($value === true) {
$value=$lng['opcacheinfo']['true']; $value = $lng['opcacheinfo']['true'];
} }
if ($value===false) { if ($value === false) {
$value=$lng['opcacheinfo']['false']; $value = $lng['opcacheinfo']['false'];
} }
if (is_integer($value)) { if (is_integer($value)) {
$value=number_format($value,0,'.',' '); $value = number_format($value, 0, '.', ' ');
} }
$name=str_replace('_', ' ', $name); $name = str_replace('_', ' ', $name);
eval("\$runtimelines.=\"" . getTemplate("settings/opcacheinfo/runtime_line") . "\";"); eval("\$runtimelines.=\"" . \Froxlor\UI\Template::getTemplate("settings/opcacheinfo/runtime_line") . "\";");
} }
} }
$cachehits=@$opcache_status['opcache_statistics']['hits'] ?: 0; $cachehits = @$opcache_status['opcache_statistics']['hits'] ?: 0;
$cachemiss=@$opcache_status['opcache_statistics']['misses'] ?: 0; $cachemiss = @$opcache_status['opcache_statistics']['misses'] ?: 0;
$blacklistmiss=@$opcache_status['opcache_statistics']['blacklist_misses'] ?: 0; $blacklistmiss = @$opcache_status['opcache_statistics']['blacklist_misses'] ?: 0;
$cachetotal=$cachehits+$cachemiss+$blacklistmiss; $cachetotal = $cachehits + $cachemiss + $blacklistmiss;
$general=array( $general = array(
'version' => (isset($opcache_info['version']['opcache_product_name']) ? $opcache_info['version']['opcache_product_name'].' ' : '').$opcache_info['version']['version'], 'version' => (isset($opcache_info['version']['opcache_product_name']) ? $opcache_info['version']['opcache_product_name'] . ' ' : '') . $opcache_info['version']['version'],
'phpversion' => phpversion(), 'phpversion' => phpversion(),
'start_time' => @$opcache_status['opcache_statistics']['start_time'] ? date('Y-m-d H:i:s',$opcache_status['opcache_statistics']['start_time']) : '', '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'], '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,'.',' '), 'oom_restarts' => number_format(@$opcache_status['opcache_statistics']['oom_restarts'] ?: 0, 0, '.', ' '),
'hash_restarts' => number_format(@$opcache_status['opcache_statistics']['hash_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,'.',' '), 'manual_restarts' => number_format(@$opcache_status['opcache_statistics']['manual_restarts'] ?: 0, 0, '.', ' '),
'status' => (@$opcache_status['restart_in_progress'] ? $lng['opcacheinfo']['restartinprogress'] : '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'])))),
(@$opcache_status['restart_pending'] ? $lng['opcacheinfo']['restartpending'] : 'cachedscripts' => number_format(@$opcache_status['opcache_statistics']['num_cached_scripts'] ?: 0, 0, '.', ' '),
(@$opcache_status['cache_full'] ? $lng['opcacheinfo']['cachefull'] : 'cachehits' => number_format($cachehits, 0, '.', ' ') . ($cachetotal > 0 ? sprintf(" (%.1f %%)", $cachehits / ($cachetotal) * 100) : ''),
(@$opcache_status['opcache_enabled'] ? $lng['opcacheinfo']['enabled'] : $lng['opcacheinfo']['novalue'])))), 'cachemiss' => number_format($cachemiss, 0, '.', ' ') . ($cachetotal > 0 ? sprintf(" (%.1f %%)", $cachemiss / ($cachetotal) * 100) : ''),
'cachedscripts' => number_format(@$opcache_status['opcache_statistics']['num_cached_scripts'] ?: 0,0,'.',' '), 'blacklistmiss' => number_format($blacklistmiss, 0, '.', ' ') . ($cachetotal > 0 ? sprintf(" (%.1f %%)", $blacklistmiss / ($cachetotal) * 100) : '')
'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; $usedmem = @$opcache_status['memory_usage']['used_memory'] ?: 0;
$usedmemstr=bsize($usedmem); $usedmemstr = bsize($usedmem);
$freemem=@$opcache_status['memory_usage']['free_memory'] ?: 0; $freemem = @$opcache_status['memory_usage']['free_memory'] ?: 0;
$freememstr=bsize($freemem); $freememstr = bsize($freemem);
$totalmem=$usedmem+$freemem; $totalmem = $usedmem + $freemem;
$wastedmem=@$opcache_status['memory_usage']['wasted_memory'] ?: 0; $wastedmem = @$opcache_status['memory_usage']['wasted_memory'] ?: 0;
$wastedmemstr=bsize($wastedmem); $wastedmemstr = bsize($wastedmem);
if ($totalmem) { if ($totalmem) {
$memory=array( $memory = array(
'total' => bsize($totalmem), 'total' => bsize($totalmem),
'used' => $usedmemstr . ($totalmem>0 ? sprintf(" (%.1f %%)", $usedmem/($totalmem)*100) : ''), 'used' => $usedmemstr . ($totalmem > 0 ? sprintf(" (%.1f %%)", $usedmem / ($totalmem) * 100) : ''),
'free' => $freememstr . ($totalmem>0 ? sprintf(" (%.1f %%)", $freemem/($totalmem)*100) : ''), 'free' => $freememstr . ($totalmem > 0 ? sprintf(" (%.1f %%)", $freemem / ($totalmem) * 100) : ''),
'wasted' => $wastedmemstr . ($totalmem>0 ? sprintf(" (%.1f %%)", $wastedmem/($totalmem)*100) : ''), 'wasted' => $wastedmemstr . ($totalmem > 0 ? sprintf(" (%.1f %%)", $wastedmem / ($totalmem) * 100) : '')
); );
} }
if (isset($opcache_status['interned_strings_usage'])) { if (isset($opcache_status['interned_strings_usage'])) {
$usedstring=@$opcache_status['interned_strings_usage']['used_memory'] ?: 0; $usedstring = @$opcache_status['interned_strings_usage']['used_memory'] ?: 0;
$usedstringstr=bsize($usedstring); $usedstringstr = bsize($usedstring);
$freestring=@$opcache_status['interned_strings_usage']['free_memory'] ?: 0; $freestring = @$opcache_status['interned_strings_usage']['free_memory'] ?: 0;
$freestringstr=bsize($freestring); $freestringstr = bsize($freestring);
$totalstring=$usedstring+$freestring; $totalstring = $usedstring + $freestring;
$stringbuffer=array( $stringbuffer = array(
'total' => bsize($totalstring), 'total' => bsize($totalstring),
'used' => $usedstringstr . ($totalstring>0 ? sprintf(" (%.1f %%)", $usedstring/$totalstring*100) : ''), 'used' => $usedstringstr . ($totalstring > 0 ? sprintf(" (%.1f %%)", $usedstring / $totalstring * 100) : ''),
'free' => $freestringstr . ($totalstring>0 ? sprintf(" (%.1f %%)", $freestring/$totalstring*100) : ''), 'free' => $freestringstr . ($totalstring > 0 ? sprintf(" (%.1f %%)", $freestring / $totalstring * 100) : ''),
'strcount' => number_format(@$opcache_status['interned_strings_usage']['number_of_strings'] ?: 0,0,'.',' '), 'strcount' => number_format(@$opcache_status['interned_strings_usage']['number_of_strings'] ?: 0, 0, '.', ' ')
); );
} }
$usedkey=@$opcache_status['opcache_statistics']['num_cached_keys'] ?: 0; $usedkey = @$opcache_status['opcache_statistics']['num_cached_keys'] ?: 0;
$usedkeystr=number_format($usedkey,0,'.',' '); $usedkeystr = number_format($usedkey, 0, '.', ' ');
$totalkey=@$opcache_status['opcache_statistics']['max_cached_keys'] ?: 0; $totalkey = @$opcache_status['opcache_statistics']['max_cached_keys'] ?: 0;
$wastedkey=$usedkey - (@$opcache_status['opcache_statistics']['num_cached_scripts'] ?: 0); $wastedkey = $usedkey - (@$opcache_status['opcache_statistics']['num_cached_scripts'] ?: 0);
if (isset($opcache_status['opcache_statistics'])) { if (isset($opcache_status['opcache_statistics'])) {
$keystat=array( $keystat = array(
'total' => number_format($totalkey,0,'.',' '), 'total' => number_format($totalkey, 0, '.', ' '),
'used' => $usedkeystr . ($totalkey>0 ? sprintf(" (%.1f %%)", $usedkey/($totalkey)*100) : ''), 'used' => $usedkeystr . ($totalkey > 0 ? sprintf(" (%.1f %%)", $usedkey / ($totalkey) * 100) : ''),
'wasted' => number_format($wastedkey,0,'.',' ') . ($totalkey>0 ? sprintf(" (%.1f %%)", $wastedkey/($totalkey)*100) : ''), 'wasted' => number_format($wastedkey, 0, '.', ' ') . ($totalkey > 0 ? sprintf(" (%.1f %%)", $wastedkey / ($totalkey) * 100) : '')
); );
} }
$blacklistlines = ''; $blacklistlines = '';
if (isset($opcache_info['blacklist']) && is_array($opcache_info['blacklist'])) { if (isset($opcache_info['blacklist']) && is_array($opcache_info['blacklist'])) {
foreach ($opcache_info['blacklist'] as $value) { foreach ($opcache_info['blacklist'] as $value) {
eval("\$blacklistlines.=\"" . getTemplate("settings/opcacheinfo/blacklist_line") . "\";"); eval("\$blacklistlines.=\"" . \Froxlor\UI\Template::getTemplate("settings/opcacheinfo/blacklist_line") . "\";");
} }
} }
eval("echo \"" . getTemplate("settings/opcacheinfo/showinfo") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/opcacheinfo/showinfo") . "\";");
} }
function bsize($s) { function bsize($s)
foreach (array('', 'K', 'M', 'G') as $i => $k) { {
if ($s < 1024) foreach (array(
break; '',
$s/=1024; 'K',
} 'M',
return sprintf("%5.1f %sBytes", $s, $k); '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 * @package Panel
* *
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; 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'])) { if (isset($_POST['id'])) {
$id = intval($_POST['id']); $id = intval($_POST['id']);
} elseif (isset($_GET['id'])) { } elseif (isset($_GET['id'])) {
@@ -30,315 +33,310 @@ if ($page == 'overview') {
if ($action == '') { 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 = ''; $tablecontent = '';
$count = 0; $count = 0;
$result = Database::query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "`"); if (isset($result['count']) && $result['count'] > 0) {
foreach ($result['list'] as $row) {
while ($row = $result->fetch(PDO::FETCH_ASSOC)) { if (isset($row['is_default']) && $row['is_default'] == true) {
$row['description'] = "<b>" . $row['description'] . "</b>";
$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 (count($ssdids) > 0) { $domains = "";
$query .= " AND `id` NOT IN (".implode(', ', $ssdids).")"; $subdomains_count = count($row['subdomains']);
foreach ($row['domains'] as $configdomain) {
$domains .= $idna_convert->decode($configdomain) . "<br>";
} }
} $count ++;
if ($subdomains_count == 0 && empty($domains)) {
$domainresult_stmt = Database::prepare($query); $domains = $lng['admin']['phpsettings']['notused'];
Database::pexecute($domainresult_stmt, $query_params);
$domains = '';
if (Database::num_rows() > 0) {
while ($row2 = $domainresult_stmt->fetch(PDO::FETCH_ASSOC)) {
$domains.= $row2['domain'] . '<br/>';
} }
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 \"" . \Froxlor\UI\Template::getTemplate("phpconfig/overview") . "\";");
eval("echo \"" . getTemplate("phpconfig/overview") . "\";");
} }
if ($action == 'add') { if ($action == 'add') {
if ((int)$userinfo['change_serversettings'] == 1) { if ((int) $userinfo['change_serversettings'] == 1) {
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send' try {
) { PhpSettings::getLocal($userinfo, $_POST)->add();
$description = validate($_POST['description'], 'description'); } catch (Exception $e) {
$phpsettings = validate(str_replace("\r\n", "\n", $_POST['phpsettings']), 'phpsettings', '/^[^\0]*$/'); \Froxlor\UI\Response::dynamic_error($e->getMessage());
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;
} }
elseif (Settings::Get('phpfpm.enabled') == 1) { \Froxlor\UI\Response::redirectTo($filename, array(
$fpm_enableslowlog = isset($_POST['phpfpm_enable_slowlog']) ? (int)$_POST['phpfpm_enable_slowlog'] : 0; 'page' => $page,
$fpm_reqtermtimeout = validate($_POST['phpfpm_reqtermtimeout'], 'phpfpm_reqtermtimeout', '/^([0-9]+)(|s|m|h|d)$/'); 's' => $s
$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));
} else { } else {
$result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = 1"); if (file_exists(\Froxlor\Froxlor::getInstallDir() . '/templates/misc/php/default.ini.php')) {
$result = $result_stmt->fetch(PDO::FETCH_ASSOC); require_once \Froxlor\Froxlor::getInstallDir() . '/templates/misc/php/default.ini.php';
$result = [
'phpsettings' => DEFAULT_PHPINI
];
} else {
// use first php-config as fallback
$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'; $fpmconfigs = '';
$phpconfig_add_form = htmlform::genHTMLForm($phpconfig_add_data); $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', 'dynamic', true, true);
$pm_select .= \Froxlor\UI\HTML::makeoption('dynamic', 'dynamic', 'dynamic', true, true);
$pm_select .= \Froxlor\UI\HTML::makeoption('ondemand', 'ondemand', 'dynamic', 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']; $title = $phpconfig_add_data['phpconfig_add']['title'];
$image = $phpconfig_add_data['phpconfig_add']['image']; $image = $phpconfig_add_data['phpconfig_add']['image'];
eval("echo \"" . getTemplate("phpconfig/overview_add") . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/overview_add") . "\";");
} }
} else { } else {
standard_error('nopermissionsorinvalidid'); \Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
} }
} }
if ($action == 'delete') { if ($action == 'delete') {
$result_stmt = Database::prepare(" try {
SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :id" $json_result = PhpSettings::getLocal($userinfo, array(
); 'id' => $id
$result = Database::pexecute_first($result_stmt, array('id' => $id)); ))->get();
} catch (Exception $e) {
if ((Settings::Get('system.mod_fcgid') == '1' \Froxlor\UI\Response::dynamic_error($e->getMessage());
&& Settings::Get('system.mod_fcgid_defaultini_ownvhost') == $id)
|| (Settings::Get('phpfpm.enabled') == '1'
&& Settings::Get('phpfpm.vhost_defaultini') == $id)
) {
standard_error('cannotdeletehostnamephpconfig');
} }
$result = json_decode($json_result, true)['data'];
if ((Settings::Get('system.mod_fcgid') == '1' if ($result['id'] != 0 && $result['id'] == $id && (int) $userinfo['change_serversettings'] == 1 && $id != 1) // cannot delete the default php.config
&& 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 (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 { } 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 { } else {
standard_error('nopermissionsorinvalidid'); \Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
} }
} }
if ($action == 'edit') { if ($action == 'edit') {
$result_stmt = Database::prepare(" try {
SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :id" $json_result = PhpSettings::getLocal($userinfo, array(
); 'id' => $id
$result = Database::pexecute_first($result_stmt, 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 if ($result['id'] != 0 && $result['id'] == $id && (int) $userinfo['change_serversettings'] == 1) {
&& $result['id'] == $id
&& (int)$userinfo['change_serversettings'] == 1
) {
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send' try {
) { PhpSettings::getLocal($userinfo, $_POST)->update();
$description = validate($_POST['description'], 'description'); } catch (Exception $e) {
$phpsettings = validate(str_replace("\r\n", "\n", $_POST['phpsettings']), 'phpsettings', '/^[^\0]*$/'); \Froxlor\UI\Response::dynamic_error($e->getMessage());
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;
} }
elseif (Settings::Get('phpfpm.enabled') == 1) { \Froxlor\UI\Response::redirectTo($filename, array(
$fpm_enableslowlog = isset($_POST['phpfpm_enable_slowlog']) ? (int)$_POST['phpfpm_enable_slowlog'] : 0; 'page' => $page,
$fpm_reqtermtimeout = validate($_POST['phpfpm_reqtermtimeout'], 'phpfpm_reqtermtimeout', '/^([0-9]+)(|s|m|h|d)$/'); 's' => $s
$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));
} else { } else {
$phpconfig_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php'; $fpmconfigs = '';
$phpconfig_edit_form = htmlform::genHTMLForm($phpconfig_edit_data); $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']; $title = $phpconfig_edit_data['phpconfig_edit']['title'];
$image = $phpconfig_edit_data['phpconfig_edit']['image']; $image = $phpconfig_edit_data['phpconfig_edit']['image'];
eval("echo \"" . getTemplate("phpconfig/overview_edit") . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/overview_edit") . "\";");
} }
} else { } 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', 'dynamic', true, true);
$pm_select .= \Froxlor\UI\HTML::makeoption('dynamic', 'dynamic', 'dynamic', true, true);
$pm_select .= \Froxlor\UI\HTML::makeoption('ondemand', 'ondemand', 'dynamic', 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');
} }
} }
} }

322
admin_plans.php Normal file
View File

@@ -0,0 +1,322 @@
<?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']
);
try {
// get total count
$json_result = HostingPlans::getLocal($userinfo)->listingCount();
$result = json_decode($json_result, true)['data'];
// initialize pagination and filtering
$paging = new \Froxlor\UI\Pagination($userinfo, $fields, $result);
// get list
$json_result = HostingPlans::getLocal($userinfo, $paging->getApiCommandParams())->listing();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
$plans = '';
$sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$count = 0;
foreach ($result['list'] as $row) {
$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 ++;
}
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, $_POST)->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;
$result['api_allowed'] = 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 * @package Panel
* *
*/ */
use Froxlor\Database\Database;
use Froxlor\Settings;
use Froxlor\Api\Commands\Froxlor;
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require './lib/init.php';
@@ -27,12 +30,10 @@ $sql_root = Database::getSqlData();
Database::needRoot(false); Database::needRoot(false);
if ($page == 'overview' && $userinfo['change_serversettings'] == '1') { if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$settings_data = loadConfigArrayDir('./actions/admin/settings/'); $settings_data = \Froxlor\PhpHelper::loadConfigArrayDir('./actions/admin/settings/');
$settings = loadSettings($settings_data); Settings::loadSettingsInto($settings_data);
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send'
) {
$_part = isset($_GET['part']) ? $_GET['part'] : ''; $_part = isset($_GET['part']) ? $_GET['part'] : '';
if ($_part == '') { if ($_part == '') {
@@ -48,7 +49,6 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$settings_part = true; $settings_part = true;
} }
$only_enabledisable = false; $only_enabledisable = false;
} else { } else {
$settings_all = false; $settings_all = false;
$settings_part = false; $settings_part = false;
@@ -56,30 +56,28 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
} }
// check if the session timeout is too low #815 // check if the session timeout is too low #815
if (isset($_POST['session_sessiontimeout']) if (isset($_POST['session_sessiontimeout']) && $_POST['session_sessiontimeout'] < 60) {
&& $_POST['session_sessiontimeout'] < 60 \Froxlor\UI\Response::standard_error($lng['error']['session_timeout'], $lng['error']['session_timeout_desc']);
) {
standard_error($lng['error']['session_timeout'], $lng['error']['session_timeout_desc']);
} }
if (processFormEx( if (\Froxlor\UI\Form::processFormEx($settings_data, $_POST, array(
$settings_data, 'filename' => $filename,
$_POST, 'action' => $action,
array('filename' => $filename, 'action' => $action, 'page' => $page), 'page' => $page
$_part, ), $_part, $settings_all, $settings_part, $only_enabledisable)) {
$settings_all, $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "rebuild configfiles due to changed setting");
$settings_part, \Froxlor\System\Cronjob::inserttask('1');
$only_enabledisable
)
) {
$log->logAction(ADM_ACTION, LOG_INFO, "rebuild configfiles due to changed setting");
inserttask('1');
// Using nameserver, insert a task which rebuilds the server config // 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 { } else {
$_part = isset($_GET['part']) ? $_GET['part'] : ''; $_part = isset($_GET['part']) ? $_GET['part'] : '';
@@ -87,39 +85,36 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$_part = isset($_POST['part']) ? $_POST['part'] : ''; $_part = isset($_POST['part']) ? $_POST['part'] : '';
} }
$fields = buildFormEx($settings_data, $_part); $fields = \Froxlor\UI\Form::buildFormEx($settings_data, $_part);
$settings_page = ''; $settings_page = '';
if ($_part == '') { if ($_part == '') {
eval("\$settings_page .= \"" . getTemplate("settings/settings_overview") . "\";"); eval("\$settings_page .= \"" . \Froxlor\UI\Template::getTemplate("settings/settings_overview") . "\";");
} else { } 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 \$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(); ob_start();
phpinfo(); phpinfo();
$phpinfo = array('phpinfo' => array()); $phpinfo = array(
if (preg_match_all( 'phpinfo' => array()
'#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>)?)?</tr>)#s', );
ob_get_clean(), $matches, PREG_SET_ORDER if (preg_match_all('#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>)?)?</tr>)#s', ob_get_clean(), $matches, PREG_SET_ORDER)) {
)
) {
foreach ($matches as $match) { foreach ($matches as $match) {
$end = array_keys($phpinfo); $end = array_keys($phpinfo);
$end = end($end); $end = end($end);
if (strlen($match[1])) { if (strlen($match[1])) {
$phpinfo[$match[1]] = array(); $phpinfo[$match[1]] = array();
} elseif (isset($match[3])) { } 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 { } else {
$phpinfo[$end][] = $match[2]; $phpinfo[$end][] = $match[2];
} }
@@ -129,112 +124,99 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$phpinfoentries = ""; $phpinfoentries = "";
foreach ($section as $key => $val) { foreach ($section as $key => $val) {
if (is_array($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)) { } elseif (is_string($key)) {
eval("\$phpinfoentries .= \"" . getTemplate("settings/phpinfo/phpinfo_2") . "\";"); eval("\$phpinfoentries .= \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo/phpinfo_2") . "\";");
} else { } else {
eval("\$phpinfoentries .= \"" . getTemplate("settings/phpinfo/phpinfo_1") . "\";"); eval("\$phpinfoentries .= \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo/phpinfo_1") . "\";");
} }
} }
// first header -> show actual php version // first header -> show actual php version
if (strtolower($name) == "phpinfo") { 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; $phpinfo = $phpinfohtml;
} else { } 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' $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "rebuild configfiles");
&& $userinfo['change_serversettings'] == '1' \Froxlor\System\Cronjob::inserttask('1');
) { \Froxlor\System\Cronjob::inserttask('10');
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$log->logAction(ADM_ACTION, LOG_INFO, "rebuild configfiles");
inserttask('1');
inserttask('10');
// Using nameserver, insert a task which rebuilds the server config // Using nameserver, insert a task which rebuilds the server config
inserttask('4'); \Froxlor\System\Cronjob::inserttask('4');
// cron.d file
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 { } 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' if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $userinfo['change_serversettings'] == '1'
) {
if (isset($_POST['send']) $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "updated resource-counters");
&& $_POST['send'] == 'send' $updatecounters = \Froxlor\User::updateCounters(true);
) {
$log->logAction(ADM_ACTION, LOG_INFO, "updated resource-counters");
$updatecounters = updateCounters(true);
$customers = ''; $customers = '';
foreach ($updatecounters['customers'] as $customerid => $customer) { foreach ($updatecounters['customers'] as $customerid => $customer) {
eval("\$customers.=\"" . getTemplate("settings/updatecounters_row_customer") . "\";"); eval("\$customers.=\"" . \Froxlor\UI\Template::getTemplate("settings/updatecounters_row_customer") . "\";");
} }
$admins = ''; $admins = '';
foreach ($updatecounters['admins'] as $adminid => $admin) { 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 { } 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' if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $userinfo['change_serversettings'] == '1'
) {
if (isset($_POST['send']) $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, "wiped all cleartext mail passwords");
&& $_POST['send'] == 'send'
) {
$log->logAction(ADM_ACTION, LOG_WARNING, "wiped all cleartext mail passwords");
Database::query("UPDATE `" . TABLE_MAIL_USERS . "` SET `password` = '';"); Database::query("UPDATE `" . TABLE_MAIL_USERS . "` SET `password` = '';");
Database::query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '0' WHERE `settinggroup` = 'system' AND `varname` = 'mailpwcleartext'"); Database::query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '0' WHERE `settinggroup` = 'system' AND `varname` = 'mailpwcleartext'");
redirectTo($filename, array('s' => $s)); \Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} else { } 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' if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $userinfo['change_serversettings'] == '1'
) {
if (isset($_POST['send']) $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, "wiped all mailquotas");
&& $_POST['send'] == 'send'
) {
$log->logAction(ADM_ACTION, LOG_WARNING, "wiped all mailquotas");
// Set the quota to 0 which means unlimited // Set the quota to 0 which means unlimited
Database::query("UPDATE `" . TABLE_MAIL_USERS . "` SET `quota` = '0';"); Database::query("UPDATE `" . TABLE_MAIL_USERS . "` SET `quota` = '0';");
Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_quota_used` = '0'"); Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_quota_used` = '0'");
redirectTo($filename, array('s' => $s)); \Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} else { } 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') {
} elseif ($page == 'enforcequotas' if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $userinfo['change_serversettings'] == '1'
) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
// Fetch all accounts // Fetch all accounts
$result_stmt = Database::query("SELECT `quota`, `customerid` FROM `" . TABLE_MAIL_USERS . "`"); $result_stmt = Database::query("SELECT `quota`, `customerid` FROM `" . TABLE_MAIL_USERS . "`");
@@ -248,7 +230,10 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
while ($array = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while ($array = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$difference = Settings::Get('system.mail_quota') - $array['quota']; $difference = Settings::Get('system.mail_quota') - $array['quota'];
Database::pexecute($upd_stmt, array('diff' => $difference, 'customerid' => $customerid)); Database::pexecute($upd_stmt, array(
'diff' => $difference,
'customerid' => $customerid
));
} }
} }
@@ -256,27 +241,29 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$upd_stmt = Database::prepare(" $upd_stmt = Database::prepare("
UPDATE `" . TABLE_MAIL_USERS . "` SET `quota` = :quota UPDATE `" . TABLE_MAIL_USERS . "` SET `quota` = :quota
"); ");
Database::pexecute($upd_stmt, array('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 // Update the Customer, if the used quota is bigger than the allowed quota
Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_quota` = `email_quota_used` WHERE `email_quota` < `email_quota_used`"); Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_quota` = `email_quota_used` WHERE `email_quota` < `email_quota_used`");
$log->logAction(ADM_ACTION, LOG_WARNING, 'enforcing mailquota to all customers: ' . Settings::Get('system.mail_quota') . ' MB'); $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, 'enforcing mailquota to all customers: ' . Settings::Get('system.mail_quota') . ' MB');
redirectTo($filename, array('s' => $s)); \Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} else { } else {
ask_yesno('admin_quotas_reallyenforce', $filename, array('page' => $page)); \Froxlor\UI\HTML::askYesNo('admin_quotas_reallyenforce', $filename, array(
'page' => $page
));
} }
} elseif ($page == 'integritycheck' } elseif ($page == 'integritycheck' && $userinfo['change_serversettings'] == '1') {
&& $userinfo['change_serversettings'] == '1' $integrity = new \Froxlor\Database\IntegrityCheck();
) { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$integrity = new IntegrityCheck();
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$integrity->fixAll(); $integrity->fixAll();
} elseif(isset($_GET['action']) } elseif (isset($_GET['action']) && $_GET['action'] == "fix") {
&& $_GET['action'] == "fix") { \Froxlor\UI\HTML::askYesNo('admin_integritycheck_reallyfix', $filename, array(
ask_yesno('admin_integritycheck_reallyfix', $filename, array('page' => $page)); 'page' => $page
));
} }
$integritycheck = ''; $integritycheck = '';
@@ -284,7 +271,114 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$displayid = $id + 1; $displayid = $id + 1;
$result = $integrity->$check(); $result = $integrity->$check();
$checkdesc = $lng['integrity_check'][$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 * @package Panel
* *
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Database\Database;
use Froxlor\Settings;
if (isset($_POST['subjectid'])) { if (isset($_POST['subjectid'])) {
$subjectid = intval($_POST['subjectid']); $subjectid = intval($_POST['subjectid']);
$mailbodyid = intval($_POST['mailbodyid']); $mailbodyid = intval($_POST['mailbodyid']);
} elseif (isset($_GET['subjectid'])) {
} elseif(isset($_GET['subjectid'])) {
$subjectid = intval($_GET['subjectid']); $subjectid = intval($_GET['subjectid']);
$mailbodyid = intval($_GET['mailbodyid']); $mailbodyid = intval($_GET['mailbodyid']);
} }
if (isset($_POST['id'])) { if (isset($_POST['id'])) {
$id = intval($_POST['id']); $id = intval($_POST['id']);
} elseif (isset($_GET['id'])) {
} elseif(isset($_GET['id'])) {
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
@@ -45,21 +45,8 @@ $available_templates = array(
); );
// only show templates of features that are enabled #1191 // only show templates of features that are enabled #1191
if ((int)Settings::Get('system.report_enable') == 1) { if ((int) Settings::Get('system.report_enable') == 1) {
array_push($available_templates, array_push($available_templates, 'trafficmaxpercent', 'diskmaxpercent');
'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'
);
} }
$file_templates = array( $file_templates = array(
@@ -67,8 +54,8 @@ $file_templates = array(
); );
if ($action == '') { if ($action == '') {
//email templates // email templates
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_templates"); $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_templates");
if (Settings::Get('panel.sendalternativemail') == 1) { if (Settings::Get('panel.sendalternativemail') == 1) {
$available_templates[] = 'pop_success_alternative'; $available_templates[] = 'pop_success_alternative';
@@ -78,9 +65,10 @@ if ($action == '') {
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT `id`, `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` SELECT `id`, `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `templategroup`='mails' WHERE `adminid` = :adminid AND `templategroup`='mails'
ORDER BY `language`, `varname`" ORDER BY `language`, `varname`");
); Database::pexecute($result_stmt, array(
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'])); 'adminid' => $userinfo['adminid']
));
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$parts = array(); $parts = array();
@@ -94,20 +82,22 @@ if ($action == '') {
$subjectid = $email['subject']; $subjectid = $email['subject'];
$mailbodyid = $email['mailbody']; $mailbodyid = $email['mailbody'];
$template = $lng['admin']['templates'][$action]; $template = $lng['admin']['templates'][$action];
eval("\$templates.=\"" . getTemplate("templates/templates_template") . "\";"); eval("\$templates.=\"" . \Froxlor\UI\Template::getTemplate("templates/templates_template") . "\";");
} }
} }
$add = false; $add = false;
while (list($language_file, $language_name) = each($languages)) { foreach ($languages as $language_file => $language_name) {
$templates_done = array(); $templates_done = array();
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `language`= :lang WHERE `adminid` = :adminid AND `language`= :lang
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'" AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'");
); Database::pexecute($result_stmt, array(
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'lang' => $language_name)); 'adminid' => $userinfo['adminid'],
'lang' => $language_name
));
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$templates_done[] = str_replace('_subject', '', $row['varname']); $templates_done[] = str_replace('_subject', '', $row['varname']);
@@ -118,111 +108,115 @@ if ($action == '') {
} }
} }
//filetemplates // filetemplates
$filetemplates = ''; $filetemplates = '';
$filetemplateadd = false; $filetemplateadd = false;
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `templategroup`='files'" WHERE `adminid` = :adminid AND `templategroup`='files'");
); Database::pexecute($result_stmt, array(
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'])); 'adminid' => $userinfo['adminid']
));
if (Database::num_rows() != count($file_templates)) { if (Database::num_rows() != count($file_templates)) {
$filetemplateadd = true; $filetemplateadd = true;
} }
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { 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") . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/templates") . "\";");
} elseif ($action == 'delete' && $subjectid != 0 && $mailbodyid != 0) {
} elseif($action == 'delete' // email templates
&& $subjectid != 0
&& $mailbodyid != 0
) {
//email templates
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` SELECT `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :id" WHERE `adminid` = :adminid AND `id` = :id");
); Database::pexecute($result_stmt, array(
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'id' => $subjectid)); 'adminid' => $userinfo['adminid'],
'id' => $subjectid
));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC); $result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if ($result['varname'] != '') { if ($result['varname'] != '') {
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send'
) {
$del_stmt = Database::prepare(" $del_stmt = Database::prepare("
DELETE FROM `" . TABLE_PANEL_TEMPLATES . "` DELETE FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid WHERE `adminid` = :adminid
AND (`id` = :ida OR `id` = :idb)" AND (`id` = :ida OR `id` = :idb)");
);
Database::pexecute($del_stmt, array( Database::pexecute($del_stmt, array(
'adminid' => $userinfo['adminid'], 'adminid' => $userinfo['adminid'],
'ida' => $subjectid, 'ida' => $subjectid,
'idb' => $mailbodyid 'idb' => $mailbodyid
)); ));
$log->logAction(ADM_ACTION, LOG_INFO, "deleted template '" . $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])] . "'"); $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "deleted template '" . $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])] . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); \Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else { } 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) {
} elseif($action == 'deletef' // file templates
&& $id != 0
) {
//file templates
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "` SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :id" WHERE `adminid` = :adminid AND `id` = :id");
); Database::pexecute($result_stmt, array(
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'id' => $id)); 'adminid' => $userinfo['adminid'],
'id' => $id
));
if (Database::num_rows() > 0) { if (Database::num_rows() > 0) {
$row = $result_stmt->fetch(PDO::FETCH_ASSOC); $row = $result_stmt->fetch(PDO::FETCH_ASSOC);
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send'
) {
$del_stmt = Database::prepare(" $del_stmt = Database::prepare("
DELETE FROM `" . TABLE_PANEL_TEMPLATES . "` DELETE FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :id" WHERE `adminid` = :adminid AND `id` = :id");
); Database::pexecute($del_stmt, array(
Database::pexecute($del_stmt, array('adminid' => $userinfo['adminid'], 'id' => $id)); 'adminid' => $userinfo['adminid'],
$log->logAction(ADM_ACTION, LOG_INFO, "deleted template '" . $lng['admin']['templates'][$row['varname']] . "'"); 'id' => $id
redirectTo($filename, array('page' => $page, 's' => $s)); ));
$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 { } 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 { } else {
standard_error('templatenotfound'); \Froxlor\UI\Response::standard_error('templatenotfound');
} }
} elseif ($action == 'add') {
} elseif($action == 'add') {
if (Settings::Get('panel.sendalternativemail') == 1) { if (Settings::Get('panel.sendalternativemail') == 1) {
$available_templates[] = 'pop_success_alternative'; $available_templates[] = 'pop_success_alternative';
} }
if (isset($_POST['prepare']) if (isset($_POST['prepare']) && $_POST['prepare'] == 'prepare') {
&& $_POST['prepare'] == 'prepare' // email templates
) { $language = htmlentities(\Froxlor\Validate\Validate::validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect'));
//email templates $template = \Froxlor\Validate\Validate::validate($_POST['template'], 'template');
$language = htmlentities(validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect'));
$template = validate($_POST['template'], 'template');
$lng_bak = $lng; $lng_bak = $lng;
foreach ($langs['English'] as $key => $value) { foreach ($langs['English'] as $key => $value) {
include_once makeSecurePath($value['file']); include_once \Froxlor\FileDir::makeSecurePath($value['file']);
} }
if ($language != 'English') { if ($language != 'English') {
foreach ($langs[$language] as $key => $value) { 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; $lng = $lng_bak;
$template_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/templates/formfield.template_add.php'; $template_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/templates/formfield.template_add.php';
$template_add_form = htmlform::genHTMLForm($template_add_data); $template_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($template_add_data);
$title = $template_add_data['template_add']['title']; $title = $template_add_data['template_add']['title'];
$image = $template_add_data['template_add']['image']; $image = $template_add_data['template_add']['image'];
eval("echo \"" . getTemplate("templates/templates_add_2") . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/templates_add_2") . "\";");
} elseif (isset($_POST['send']) && $_POST['send'] == 'send') {
} elseif(isset($_POST['send']) // email templates
&& $_POST['send'] == 'send' $language = htmlentities(\Froxlor\Validate\Validate::validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect'));
) { $template = \Froxlor\Validate\Validate::validate($_POST['template'], 'template');
//email templates $subject = \Froxlor\Validate\Validate::validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate');
$language = htmlentities(validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect')); $mailbody = \Froxlor\Validate\Validate::validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate');
$template = validate($_POST['template'], 'template');
$subject = validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate');
$mailbody = validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate');
$templates = array(); $templates = array();
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `language` = :lang WHERE `adminid` = :adminid AND `language` = :lang
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'" AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'");
); Database::pexecute($result_stmt, array(
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'lang' => $language)); '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[] = str_replace('_subject', '', $row['varname']);
} }
$templates = array_diff($available_templates, $templates); $templates = array_diff($available_templates, $templates);
if (array_search($template, $templates) === false) { if (array_search($template, $templates) === false) {
standard_error('templatenotfound'); \Froxlor\UI\Response::standard_error('templatenotfound');
} else { } else {
$ins_stmt = Database::prepare(" $ins_stmt = Database::prepare("
INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` SET INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` SET
@@ -270,14 +262,13 @@ if ($action == '') {
`language` = :lang, `language` = :lang,
`templategroup` = 'mails', `templategroup` = 'mails',
`varname` = :var, `varname` = :var,
`value` = :value" `value` = :value");
);
// mail-subject // mail-subject
$ins_data = array( $ins_data = array(
'adminid' => $userinfo['adminid'], 'adminid' => $userinfo['adminid'],
'lang' => $language, 'lang' => $language,
'var' => $template.'_subject', 'var' => $template . '_subject',
'value' => $subject 'value' => $subject
); );
Database::pexecute($ins_stmt, $ins_data); Database::pexecute($ins_stmt, $ins_data);
@@ -286,21 +277,21 @@ if ($action == '') {
$ins_data = array( $ins_data = array(
'adminid' => $userinfo['adminid'], 'adminid' => $userinfo['adminid'],
'lang' => $language, 'lang' => $language,
'var' => $template.'_mailbody', 'var' => $template . '_mailbody',
'value' => $mailbody 'value' => $mailbody
); );
Database::pexecute($ins_stmt, $ins_data); Database::pexecute($ins_stmt, $ins_data);
$log->logAction(ADM_ACTION, LOG_INFO, "added template '" . $language . ' - ' . $template . "'"); $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "added template '" . $language . ' - ' . $template . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); \Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} }
} elseif (isset($_POST['filesend']) && $_POST['filesend'] == 'filesend') {
} elseif(isset($_POST['filesend']) // file templates
&& $_POST['filesend'] == 'filesend' $template = \Froxlor\Validate\Validate::validate($_POST['template'], 'template');
) { $filecontent = \Froxlor\Validate\Validate::validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset');
//file templates
$template = validate($_POST['template'], 'template');
$filecontent = validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset');
$ins_stmt = Database::prepare(" $ins_stmt = Database::prepare("
INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` SET INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` SET
@@ -308,8 +299,7 @@ if ($action == '') {
`language` = '', `language` = '',
`templategroup` = 'files', `templategroup` = 'files',
`varname` = :var, `varname` = :var,
`value` = :value" `value` = :value");
);
$ins_data = array( $ins_data = array(
'adminid' => $userinfo['adminid'], 'adminid' => $userinfo['adminid'],
@@ -318,24 +308,28 @@ if ($action == '') {
); );
Database::pexecute($ins_stmt, $ins_data); Database::pexecute($ins_stmt, $ins_data);
$log->logAction(ADM_ACTION, LOG_INFO, "added template '" . $template . "'"); $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "added template '" . $template . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); \Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} elseif (! isset($_GET['files'])) {
} elseif(!isset($_GET['files'])) { // email templates
//email templates
$add = false; $add = false;
$language_options = ''; $language_options = '';
$template_options = ''; $template_options = '';
while (list($language_file, $language_name) = each($languages)) { foreach ($languages as $language_file => $language_name) {
$templates = array(); $templates = array();
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `language` = :lang WHERE `adminid` = :adminid AND `language` = :lang
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'" AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'");
); Database::pexecute($result_stmt, array(
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'lang' => $language_name)); 'adminid' => $userinfo['adminid'],
'lang' => $language_name
));
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$templates[] = str_replace('_subject', '', $row['varname']); $templates[] = str_replace('_subject', '', $row['varname']);
@@ -343,33 +337,32 @@ if ($action == '') {
if (count(array_diff($available_templates, $templates)) > 0) { if (count(array_diff($available_templates, $templates)) > 0) {
$add = true; $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); $templates = array_diff($available_templates, $templates);
foreach ($templates as $template) { 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) { if ($add) {
eval("echo \"" . getTemplate("templates/templates_add_1") . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/templates_add_1") . "\";");
} else { } else {
standard_error('alltemplatesdefined'); \Froxlor\UI\Response::standard_error('alltemplatesdefined');
} }
} else { } else {
//filetemplates // filetemplates
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `templategroup`='files'" WHERE `adminid` = :adminid AND `templategroup`='files'");
); Database::pexecute($result_stmt, array(
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'])); 'adminid' => $userinfo['adminid']
));
if (Database::num_rows() == count($file_templates)) { if (Database::num_rows() == count($file_templates)) {
standard_error('alltemplatesdefined'); \Froxlor\UI\Response::standard_error('alltemplatesdefined');
} else { } else {
$templatesdefined = array(); $templatesdefined = array();
@@ -380,44 +373,39 @@ if ($action == '') {
} }
foreach (array_diff($file_templates, $templatesdefined) as $template) { 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_data = include_once dirname(__FILE__) . '/lib/formfields/admin/templates/formfield.filetemplate_add.php';
$filetemplate_add_form = htmlform::genHTMLForm($filetemplate_add_data); $filetemplate_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($filetemplate_add_data);
$title = $filetemplate_add_data['filetemplate_add']['title']; $title = $filetemplate_add_data['filetemplate_add']['title'];
$image = $filetemplate_add_data['filetemplate_add']['image']; $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) {
} elseif($action == 'edit' // email templates
&& $subjectid != 0
&& $mailbodyid != 0
) {
//email templates
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT `language`, `varname`, `value` FROM `" . TABLE_PANEL_TEMPLATES . "` SELECT `language`, `varname`, `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :subjectid" WHERE `adminid` = :adminid AND `id` = :subjectid");
); Database::pexecute($result_stmt, array(
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'subjectid' => $subjectid)); 'adminid' => $userinfo['adminid'],
'subjectid' => $subjectid
));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC); $result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if ($result['varname'] != '') { if ($result['varname'] != '') {
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == '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');
$subject = validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate');
$mailbody = validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate');
$upd_stmt = Database::prepare(" $upd_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET
`value` = :value `value` = :value
WHERE `adminid` = :adminid AND `id` = :id" WHERE `adminid` = :adminid AND `id` = :id");
);
// subject // subject
Database::pexecute($upd_stmt, array( Database::pexecute($upd_stmt, array(
'value' => $subject, 'value' => $subject,
@@ -431,85 +419,85 @@ if ($action == '') {
'id' => $mailbodyid 'id' => $mailbodyid
)); ));
$log->logAction(ADM_ACTION, LOG_INFO, "edited template '" . $result['varname'] . "'"); $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "edited template '" . $result['varname'] . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); \Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else { } else {
$result = htmlentities_array($result); $result = \Froxlor\PhpHelper::htmlentitiesArray($result);
$template = $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])]; $template = $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])];
$subject = $result['value']; $subject = $result['value'];
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT `language`, `varname`, `value` SELECT `language`, `varname`, `value`
FROM `" . TABLE_PANEL_TEMPLATES . "` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `id` = :id" WHERE `id` = :id");
); Database::pexecute($result_stmt, array(
Database::pexecute($result_stmt, array('id' => $mailbodyid)); 'id' => $mailbodyid
));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC); $result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$template_name = str_replace('_mailbody', '', $result['varname']); $template_name = str_replace('_mailbody', '', $result['varname']);
// don't escape the already escaped language-string so save up before htmlentities() // don't escape the already escaped language-string so save up before htmlentities()
$language = $result['language']; $language = $result['language'];
$result = htmlentities_array($result); $result = \Froxlor\PhpHelper::htmlentitiesArray($result);
$mailbody = $result['value']; $mailbody = $result['value'];
$template_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/templates/formfield.template_edit.php'; $template_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/templates/formfield.template_edit.php';
$template_edit_form = htmlform::genHTMLForm($template_edit_data); $template_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($template_edit_data);
$title = $template_edit_data['template_edit']['title']; $title = $template_edit_data['template_edit']['title'];
$image = $template_edit_data['template_edit']['image']; $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) {
} elseif($action == 'editf' // file templates
&& $id != 0
) {
//file templates
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "` SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :id" WHERE `adminid` = :adminid AND `id` = :id");
); Database::pexecute($result_stmt, array(
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'id' => $id)); 'adminid' => $userinfo['adminid'],
'id' => $id
));
if(Database::num_rows() > 0) { if (Database::num_rows() > 0) {
$row = $result_stmt->fetch(PDO::FETCH_ASSOC); $row = $result_stmt->fetch(PDO::FETCH_ASSOC);
//filetemplates // filetemplates
if (isset($_POST['filesend']) if (isset($_POST['filesend']) && $_POST['filesend'] == 'filesend') {
&& $_POST['filesend'] == 'filesend' $filecontent = \Froxlor\Validate\Validate::validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset');
) {
$filecontent = validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset');
$upd_stmt = Database::prepare(" $upd_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET
`value` = :value `value` = :value
WHERE `adminid` = :adminid AND `id` = :id" WHERE `adminid` = :adminid AND `id` = :id");
);
Database::pexecute($upd_stmt, array( Database::pexecute($upd_stmt, array(
'value' => $filecontent, 'value' => $filecontent,
'adminid' => $userinfo['adminid'], 'adminid' => $userinfo['adminid'],
'id' => $id 'id' => $id
)); ));
$log->logAction(ADM_ACTION, LOG_INFO, "edited template '" . $row['varname'] . "'"); $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "edited template '" . $row['varname'] . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); \Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else { } 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_data = include_once dirname(__FILE__) . '/lib/formfields/admin/templates/formfield.filetemplate_edit.php';
$filetemplate_edit_form = htmlform::genHTMLForm($filetemplate_edit_data); $filetemplate_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($filetemplate_edit_data);
$title = $filetemplate_edit_data['filetemplate_edit']['title']; $title = $filetemplate_edit_data['filetemplate_edit']['title'];
$image = $filetemplate_edit_data['filetemplate_edit']['image']; $image = $filetemplate_edit_data['filetemplate_edit']['image'];
eval("echo \"" . getTemplate("templates/filetemplates_edit") . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/filetemplates_edit") . "\";");
} }
} else { } 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 * @package Panel
* *
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require './lib/init.php';
if ($action == 'logout') { use Froxlor\Database\Database;
$logout_stmt = Database::prepare(" use Froxlor\Settings;
DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :adminid
AND `adminsession` = '1'"
);
Database::pexecute($logout_stmt, array('adminid' => $userinfo['adminid']));
redirectTo('index.php');
}
if (isset($_POST['id'])) { if (isset($_POST['id'])) {
$id = intval($_POST['id']); $id = intval($_POST['id']);
} elseif(isset($_GET['id'])) { } elseif (isset($_GET['id'])) {
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
@@ -48,52 +40,52 @@ $months = array(
'9' => 'sep', '9' => 'sep',
'10' => 'oct', '10' => 'oct',
'11' => 'nov', '11' => 'nov',
'12' => 'dec', '12' => 'dec'
); );
if ($page == 'overview' || $page == 'customers') { if ($page == 'overview' || $page == 'customers') {
$customerview = 1; $customerview = 1;
$stats_tables = ''; $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); $minyear = $minyear_stmt->fetch(PDO::FETCH_ASSOC);
if (!isset($minyear['year']) || $minyear['year'] == 0) { if (! isset($minyear['year']) || $minyear['year'] == 0) {
$maxyears = 0; $maxyears = 0;
} else { } else {
$maxyears = date("Y") - $minyear['year']; $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']; $overview['type'] = $lng['traffic']['customer'];
$domain_list = ''; $domain_list = '';
$totals = array( $totals = array(
'jan' => 0, 'jan' => 0,
'feb' => 0, 'feb' => 0,
'mar' => 0, 'mar' => 0,
'apr' => 0, 'apr' => 0,
'may' => 0, 'may' => 0,
'jun' => 0, 'jun' => 0,
'jul' => 0, 'jul' => 0,
'aug' => 0, 'aug' => 0,
'sep' => 0, 'sep' => 0,
'oct' => 0, 'oct' => 0,
'nov' => 0, 'nov' => 0,
'dec' => 0, 'dec' => 0
); );
$customer_name_list_stmt = Database::prepare(" $customer_name_list_stmt = Database::prepare("
SELECT `customerid`,`company`,`name`,`firstname` SELECT `customerid`,`company`,`name`,`firstname`
FROM `" . TABLE_PANEL_CUSTOMERS . "` FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE `deactivated`='0'" . WHERE `deactivated`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :id") . "
($userinfo['customers_see_all'] ? '' : " AND `adminid` = :id") . " ORDER BY name");
ORDER BY name" Database::pexecute($customer_name_list_stmt, array(
); 'id' => $userinfo['adminid']
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( $virtual_host = array(
'name' => ($customer_name['company'] == '' ? $customer_name['name'] . ", " . $customer_name['firstname'] : $customer_name['company']), 'name' => ($customer_name['company'] == '' ? $customer_name['name'] . ", " . $customer_name['firstname'] : $customer_name['company']),
@@ -109,33 +101,35 @@ if ($page == 'overview' || $page == 'customers') {
'sep' => '-', 'sep' => '-',
'oct' => '-', 'oct' => '-',
'nov' => '-', 'nov' => '-',
'dec' => '-', 'dec' => '-'
); );
$traffic_list_stmt = Database::prepare(" $traffic_list_stmt = Database::prepare("
SELECT month, SUM(http+ftp_up+ftp_down+mail)*1024 AS traffic SELECT month, SUM(http+ftp_up+ftp_down+mail)*1024 AS traffic
FROM `" . TABLE_PANEL_TRAFFIC . "` FROM `" . TABLE_PANEL_TRAFFIC . "`
WHERE year = :year AND `customerid` = :id WHERE year = :year AND `customerid` = :id
GROUP BY month ORDER BY month" GROUP BY month ORDER BY month");
); Database::pexecute($traffic_list_stmt, array(
Database::pexecute($traffic_list_stmt, array('year' => (date("Y")-$years), 'id' => $customer_name['customerid'])); 'year' => (date("Y") - $years),
'id' => $customer_name['customerid']
));
while ($traffic_month = $traffic_list_stmt->fetch(PDO::FETCH_ASSOC)) { 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'); $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']; $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 // sum up totals
$virtual_host = array( $virtual_host = array(
'name' => $lng['traffic']['months']['total'], 'name' => $lng['traffic']['months']['total']
); );
foreach ($totals as $month => $bytes) { 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; $customerview = 0;
eval("\$total_list = sprintf(\"%s\", \"" . getTemplate("traffic/index_table_row") . "\");"); eval("\$total_list = sprintf(\"%s\", \"" . \Froxlor\UI\Template::getTemplate("traffic/index_table_row") . "\");");
eval("\$stats_tables .= sprintf(\"%s\", \"" . getTemplate("traffic/index_table") . "\");"); 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 * @package Panel
* *
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Database\Database;
use Froxlor\Settings;
if ($page == 'overview') { 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 * this is a dirty hack but syscp 1.4.2.1 does not
* have any version/dbversion in the database (don't know why) * have any version/dbversion in the database (don't know why)
* so we have to set them both to run a correct upgrade * so we have to set them both to run a correct upgrade
*/ */
if (!isFroxlor()) { if (! \Froxlor\Froxlor::isFroxlor()) {
if (Settings::Get('panel.version') == null if (Settings::Get('panel.version') == null || Settings::Get('panel.version') == '') {
|| Settings::Get('panel.version') == ''
) {
Settings::Set('panel.version', '1.4.2.1'); Settings::Set('panel.version', '1.4.2.1');
} }
if (Settings::Get('system.dbversion') == null if (Settings::Get('system.dbversion') == null || Settings::Get('system.dbversion') == '') {
|| Settings::Get('system.dbversion') == ''
) {
/** /**
* for syscp-stable (1.4.2.1) this value has to be 0 * for syscp-stable (1.4.2.1) this value has to be 0
* so the required table-fields are added correctly * so the required table-fields are added correctly
@@ -42,40 +40,33 @@ if ($page == 'overview') {
* -> bug #54 * -> bug #54
*/ */
$result_stmt = Database::query(" $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); $result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if (isset($result['value'])) { if (isset($result['value'])) {
Settings::Set('system.dbversion', (int)$result['value'], false); Settings::Set('system.dbversion', (int) $result['value'], false);
} else { } else {
Settings::Set('system.dbversion', 0, false); Settings::Set('system.dbversion', 0, false);
} }
} }
} }
if (hasDbUpdates($dbversion)) { if (\Froxlor\Froxlor::hasDbUpdates() || \Froxlor\Froxlor::hasUpdates()) {
$successful_update = false; $successful_update = false;
$message = ''; $message = '';
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == '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') . "\";");
if ((isset($_POST['update_preconfig'])
&& isset($_POST['update_changesagreed'])
&& intval($_POST['update_changesagreed']) != 0)
|| !isset($_POST['update_preconfig'])
) {
eval("echo \"" . getTemplate('update/update_start') . "\";");
include_once './install/updatesql.php'; include_once \Froxlor\Froxlor::getInstallDir() . 'install/updatesql.php';
$redirect_url = 'admin_index.php?s=' . $s; $redirect_url = 'admin_index.php?s=' . $s;
eval("echo \"" . getTemplate('update/update_end') . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/update_end') . "\";");
updateCounters(); \Froxlor\User::updateCounters();
inserttask('1'); \Froxlor\System\Cronjob::inserttask('1');
@chmod('./lib/userdata.inc.php', 0440); @chmod(\Froxlor\Froxlor::getInstallDir() . '/lib/userdata.inc.php', 0440);
$successful_update = true; $successful_update = true;
} else { } else {
@@ -83,27 +74,27 @@ if ($page == 'overview') {
} }
} }
if (!$successful_update) { if (! $successful_update) {
$current_version = Settings::Get('panel.version'); $current_version = Settings::Get('panel.version');
$current_db_version = Settings::Get('panel.db_version'); $current_db_version = Settings::Get('panel.db_version');
if (empty($current_db_version)) { if (empty($current_db_version)) {
$current_db_version = "0"; $current_db_version = "0";
} }
$new_version = $version; $new_version = $version;
$new_db_version = $dbversion; $new_db_version = $dbversion;
$ui_text = $lng['update']['update_information']['part_a']; $ui_text = $lng['update']['update_information']['part_a'];
if ($version != $current_version) { if ($version != $current_version) {
$ui_text = str_replace('%curversion', $current_version, $ui_text); $ui_text = str_replace('%curversion', $current_version, $ui_text);
$ui_text = str_replace('%newversion', $new_version, $ui_text); $ui_text = str_replace('%newversion', $new_version, $ui_text);
} else { } else {
// show db version // show db version
$ui_text = str_replace('%curversion', $current_db_version, $ui_text); $ui_text = str_replace('%curversion', $current_db_version, $ui_text);
$ui_text = str_replace('%newversion', $new_db_version, $ui_text); $ui_text = str_replace('%newversion', $new_db_version, $ui_text);
} }
$update_information = $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); $preconfig = getPreConfig($current_version, $current_db_version);
if ($preconfig != '') { if ($preconfig != '') {
$update_information .= '<br />' . $preconfig . $message; $update_information .= '<br />' . $preconfig . $message;
@@ -111,11 +102,11 @@ if ($page == 'overview') {
$update_information .= $lng['update']['update_information']['part_b']; $update_information .= $lng['update']['update_information']['part_b'];
eval("echo \"" . getTemplate('update/index') . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/index') . "\";");
} }
} else { } else {
$success_message = $lng['update']['noupdatesavail']; $success_message = $lng['update']['noupdatesavail'];
$redirect_url = 'admin_index.php?s=' . $s; $redirect_url = 'admin_index.php?s=' . $s;
eval("echo \"" . getTemplate('update/noupdatesavail') . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/noupdatesavail') . "\";");
} }
} }

88
api.php Normal file
View File

@@ -0,0 +1,88 @@
<?php
use voku\helper\AntiXSS;
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($request, true);
// is it valid?
if (is_null($decoded_request)) {
json_response(400, "Invalid JSON");
}
/**
* check for xss attempts and clean request
*/
$antiXss = new AntiXSS();
$request = $antiXss->xss_clean($request);
// validate content
try {
$decoded_request = stripcslashes_deep($decoded_request);
$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();
}
function stripcslashes_deep($value)
{
return is_array($value) ? array_map('stripcslashes_deep', $value) : stripcslashes($value);
}

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>

81
composer.json Normal file
View File

@@ -0,0 +1,81 @@
{
"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.1",
"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",
"froxlor/idna-convert-legacy": "^2.1",
"voku/anti-xss": "^4.1"
},
"require-dev": {
"phpunit/phpunit": "8.4.1",
"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"
}
}

4240
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

@@ -16,10 +16,19 @@
* @package Panel * @package Panel
* *
*/ */
define('AREA', 'customer'); define('AREA', 'customer');
require './lib/init.php'; require './lib/init.php';
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')) {
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
if (isset($_POST['id'])) { if (isset($_POST['id'])) {
$id = intval($_POST['id']); $id = intval($_POST['id']);
} elseif (isset($_GET['id'])) { } elseif (isset($_GET['id'])) {
@@ -27,221 +36,154 @@ if (isset($_POST['id'])) {
} }
if ($page == 'overview') { if ($page == 'overview') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras"); $log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_extras");
eval("echo \"" . getTemplate("extras/extras") . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/extras") . "\";");
} elseif ($page == 'htpasswds') { } elseif ($page == 'htpasswds') {
// redirect if this customer sub-page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options', 'extras.directoryprotection')) {
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
if ($action == '') { 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( $fields = array(
'username' => $lng['login']['username'], 'username' => $lng['login']['username'],
'path' => $lng['panel']['path'] 'path' => $lng['panel']['path']
); );
$paging = new paging($userinfo, TABLE_PANEL_HTPASSWDS, $fields); try {
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "` // get total count
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit() $json_result = DirProtections::getLocal($userinfo)->listingCount();
); $result = json_decode($json_result, true)['data'];
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'])); // initialize pagination and filtering
$paging->setEntries(Database::num_rows()); $paging = new \Froxlor\UI\Pagination($userinfo, $fields, $result);
// get list
$json_result = DirProtections::getLocal($userinfo, $paging->getApiCommandParams())->listing();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s); $pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$i = 0;
$count = 0; $count = 0;
$htpasswds = ''; $htpasswds = '';
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { foreach ($result['list'] as $row) {
if ($paging->checkDisplay($i)) { if (strpos($row['path'], $userinfo['documentroot']) === 0) {
if (strpos($row['path'], $userinfo['documentroot']) === 0) { $row['path'] = str_replace($userinfo['documentroot'], "/", $row['path']);
$row['path'] = str_replace($userinfo['documentroot'], "/", $row['path']);
}
$row = htmlentities_array($row);
eval("\$htpasswds.=\"" . getTemplate("extras/htpasswds_htpasswd") . "\";");
$count++;
} }
$row['path'] = \Froxlor\FileDir::makeCorrectDir($row['path']);
$i++; $row = \Froxlor\PhpHelper::htmlentitiesArray($row);
eval("\$htpasswds.=\"" . \Froxlor\UI\Template::getTemplate("extras/htpasswds_htpasswd") . "\";");
$count ++;
} }
eval("echo \"" . getTemplate("extras/htpasswds") . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htpasswds") . "\";");
} elseif ($action == 'delete' && $id != 0) { } elseif ($action == 'delete' && $id != 0) {
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "` try {
WHERE `customerid`= :customerid $json_result = DirProtections::getLocal($userinfo, array(
AND `id`= :id" 'id' => $id
); ))->get();
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id)); } catch (Exception $e) {
$result = $result_stmt->fetch(PDO::FETCH_ASSOC); \Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if (isset($result['username']) && $result['username'] != '') { if (isset($result['username']) && $result['username'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_HTPASSWDS . "` try {
WHERE `customerid`= :customerid DirProtections::getLocal($userinfo, $_POST)->delete();
AND `id`= :id" } catch (Exception $e) {
); \Froxlor\UI\Response::dynamic_error($e->getMessage());
Database::pexecute($stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
$log->logAction(USR_ACTION, LOG_INFO, "deleted htpasswd for '" . $result['username'] . " (" . $result['path'] . ")'");
inserttask('1');
redirectTo($filename, array('page' => $page, 's' => $s));
} else {
if (strpos($result['path'], $userinfo['documentroot']) === 0) {
$result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']);
}
ask_yesno('extras_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['username'] . ' (' . $result['path'] . ')');
}
}
} 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));
}
} else {
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
$htpasswd_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/extras/formfield.htpasswd_add.php';
$htpasswd_add_form = 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") . "\";");
}
} 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);
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));
} }
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else { } else {
if (strpos($result['path'], $userinfo['documentroot']) === 0) { if (strpos($result['path'], $userinfo['documentroot']) === 0) {
$result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']); $result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']);
} }
$result = htmlentities_array($result); \Froxlor\UI\HTML::askYesNo('extras_reallydelete', $filename, array(
'id' => $id,
'page' => $page,
'action' => $action
), $result['username'] . ' (' . $result['path'] . ')');
}
}
} elseif ($action == 'add') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
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 = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
$htpasswd_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/extras/formfield.htpasswd_edit.php'; $htpasswd_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htpasswd_add.php';
$htpasswd_edit_form = htmlform::genHTMLForm($htpasswd_edit_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 \"" . \Froxlor\UI\Template::getTemplate("extras/htpasswds_add") . "\";");
}
} elseif ($action == 'edit' && $id != 0) {
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') {
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 = \Froxlor\PhpHelper::htmlentitiesArray($result);
$htpasswd_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htpasswd_edit.php';
$htpasswd_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($htpasswd_edit_data);
$title = $htpasswd_edit_data['htpasswd_edit']['title']; $title = $htpasswd_edit_data['htpasswd_edit']['title'];
$image = $htpasswd_edit_data['htpasswd_edit']['image']; $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') { } elseif ($page == 'htaccess') {
// redirect if this customer sub-page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options', 'extras.pathoptions')) {
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
if ($action == '') { 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( $fields = array(
'path' => $lng['panel']['path'], 'path' => $lng['panel']['path'],
'options_indexes' => $lng['extras']['view_directory'], 'options_indexes' => $lng['extras']['view_directory'],
@@ -250,212 +192,116 @@ if ($page == 'overview') {
'error500path' => $lng['extras']['error500path'], 'error500path' => $lng['extras']['error500path'],
'options_cgi' => $lng['extras']['execute_perl'] 'options_cgi' => $lng['extras']['execute_perl']
); );
$paging = new paging($userinfo, TABLE_PANEL_HTACCESS, $fields); try {
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "` // get total count
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit() $json_result = DirOptions::getLocal($userinfo)->listingCount();
); $result = json_decode($json_result, true)['data'];
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'])); // initialize pagination and filtering
$paging->setEntries(Database::num_rows()); $paging = new \Froxlor\UI\Pagination($userinfo, $fields, $result);
// get list
$json_result = DirOptions::getLocal($userinfo, $paging->getApiCommandParams())->listing();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s); $pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$i = 0;
$count = 0; $count = 0;
$htaccess = ''; $htaccess = '';
$cperlenabled = customerHasPerlEnabled($userinfo['customerid']); $cperlenabled = \Froxlor\Customer\Customer::customerHasPerlEnabled($userinfo['customerid']);
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { foreach ($result['list'] as $row) {
if ($paging->checkDisplay($i)) { if (strpos($row['path'], $userinfo['documentroot']) === 0) {
if (strpos($row['path'], $userinfo['documentroot']) === 0) { $row['path'] = str_replace($userinfo['documentroot'], "/", $row['path']);
$row['path'] = str_replace($userinfo['documentroot'], "/", $row['path']);
}
$row['options_indexes'] = str_replace('1', $lng['panel']['yes'], $row['options_indexes']);
$row['options_indexes'] = str_replace('0', $lng['panel']['no'], $row['options_indexes']);
$row['options_cgi'] = str_replace('1', $lng['panel']['yes'], $row['options_cgi']);
$row['options_cgi'] = str_replace('0', $lng['panel']['no'], $row['options_cgi']);
$row = htmlentities_array($row);
eval("\$htaccess.=\"" . getTemplate("extras/htaccess_htaccess") . "\";");
$count++;
} }
$row['path'] = \Froxlor\FileDir::makeCorrectDir($row['path']);
$i++; $row['options_indexes'] = str_replace('1', $lng['panel']['yes'], $row['options_indexes']);
$row['options_indexes'] = str_replace('0', $lng['panel']['no'], $row['options_indexes']);
$row['options_cgi'] = str_replace('1', $lng['panel']['yes'], $row['options_cgi']);
$row['options_cgi'] = str_replace('0', $lng['panel']['no'], $row['options_cgi']);
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
eval("\$htaccess.=\"" . \Froxlor\UI\Template::getTemplate("extras/htaccess_htaccess") . "\";");
$count ++;
} }
eval("echo \"" . getTemplate("extras/htaccess") . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htaccess") . "\";");
} elseif ($action == 'delete' && $id != 0) { } elseif ($action == 'delete' && $id != 0) {
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "` try {
WHERE `customerid` = :customerid $json_result = DirOptions::getLocal($userinfo, array(
AND `id` = :id" 'id' => $id
); ))->get();
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id)); } catch (Exception $e) {
$result = $result_stmt->fetch(PDO::FETCH_ASSOC); \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($result['customerid']) && $result['customerid'] != '' && $result['customerid'] == $userinfo['customerid']) {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
// do we have to remove the symlink and folder in suexecpath? try {
if ((int)Settings::Get('perl.suexecworkaround') == 1) { DirOptions::getLocal($userinfo, $_POST)->delete();
$loginname = getCustomerDetail($result['customerid'], 'loginname'); } catch (Exception $e) {
$suexecpath = makeCorrectDir(Settings::Get('perl.suexecpath').'/'.$loginname.'/'.md5($result['path']).'/'); \Froxlor\UI\Response::dynamic_error($e->getMessage());
$perlsymlink = makeCorrectFile($result['path'].'/cgi-bin');
// remove symlink
if (file_exists($perlsymlink)) {
safe_exec('rm -f '.escapeshellarg($perlsymlink));
$log->logAction(USR_ACTION, LOG_DEBUG, "deleted suexecworkaround symlink '" . $perlsymlink . "'");
}
// remove folder in suexec-path
if (file_exists($suexecpath)) {
safe_exec('rm -rf '.escapeshellarg($suexecpath));
$log->logAction(USR_ACTION, LOG_DEBUG, "deleted suexecworkaround path '" . $suexecpath . "'");
}
} }
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_HTACCESS . "` \Froxlor\UI\Response::redirectTo($filename, array(
WHERE `customerid`= :customerid 'page' => $page,
AND `id`= :id" 's' => $s
); ));
Database::pexecute($stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
$log->logAction(USR_ACTION, LOG_INFO, "deleted htaccess for '" . str_replace($userinfo['documentroot'], '/', $result['path']) . "'");
inserttask('1');
redirectTo($filename, array('page' => $page, 's' => $s));
} else { } else {
ask_yesno('extras_reallydelete_pathoptions', $filename, array('id' => $id, 'page' => $page, 'action' => $action), str_replace($userinfo['documentroot'], '/', $result['path'])); \Froxlor\UI\HTML::askYesNo('extras_reallydelete_pathoptions', $filename, array(
'id' => $id,
'page' => $page,
'action' => $action
), str_replace($userinfo['documentroot'], '/', $result['path']));
} }
} }
} elseif ($action == 'add') { } elseif ($action == 'add') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$path = makeCorrectDir(validate($_POST['path'], 'path')); try {
$userpath = $path; DirOptions::getLocal($userinfo, $_POST)->add();
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path); } catch (Exception $e) {
$path_dupe_check_stmt = Database::prepare("SELECT `id`, `path` FROM `" . TABLE_PANEL_HTACCESS . "` \Froxlor\UI\Response::dynamic_error($e->getMessage());
WHERE `path`= :path
AND `customerid`= :customerid"
);
Database::pexecute($path_dupe_check_stmt, array("path" => $path, "customerid" => $userinfo['customerid']));
$path_dupe_check = $path_dupe_check_stmt->fetch(PDO::FETCH_ASSOC);
if (!$_POST['path']) {
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));
} }
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else { } else {
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']); $pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
$cperlenabled = customerHasPerlEnabled($userinfo['customerid']); $cperlenabled = \Froxlor\Customer\Customer::customerHasPerlEnabled($userinfo['customerid']);
$htaccess_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/extras/formfield.htaccess_add.php'; $htaccess_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htaccess_add.php';
$htaccess_add_form = htmlform::genHTMLForm($htaccess_add_data); $htaccess_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($htaccess_add_data);
$title = $htaccess_add_data['htaccess_add']['title']; $title = $htaccess_add_data['htaccess_add']['title'];
$image = $htaccess_add_data['htaccess_add']['image']; $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)) { } elseif (($action == 'edit') && ($id != 0)) {
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "` try {
WHERE `customerid` = :customerid $json_result = DirOptions::getLocal($userinfo, array(
AND `id` = :id" 'id' => $id
); ))->get();
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id)); } catch (Exception $e) {
$result = $result_stmt->fetch(PDO::FETCH_ASSOC); \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($result['customerid'])) && ($result['customerid'] != '') && ($result['customerid'] == $userinfo['customerid'])) {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$option_indexes = intval($_POST['options_indexes']); try {
$options_cgi = isset($_POST['options_cgi']) ? intval($_POST['options_cgi']) : 0; DirOptions::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
if ($option_indexes != '1') { \Froxlor\UI\Response::dynamic_error($e->getMessage());
$option_indexes = '0';
} }
\Froxlor\UI\Response::redirectTo($filename, array(
if ($options_cgi != '1') { 'page' => $page,
$options_cgi = '0'; 's' => $s
} ));
$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('page' => $page, 's' => $s));
} else { } else {
if (strpos($result['path'], $userinfo['documentroot']) === 0) { if (strpos($result['path'], $userinfo['documentroot']) === 0) {
$result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']); $result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']);
@@ -464,21 +310,92 @@ if ($page == 'overview') {
$result['error404path'] = $result['error404path']; $result['error404path'] = $result['error404path'];
$result['error403path'] = $result['error403path']; $result['error403path'] = $result['error403path'];
$result['error500path'] = $result['error500path']; $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_indexes = \Froxlor\UI\HTML::makeyesno('options_indexes', '1', '0', $result['options_indexes']);
$options_cgi = makeyesno('options_cgi', '1', '0', $result['options_cgi']); * $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_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']; $title = $htaccess_edit_data['htaccess_edit']['title'];
$image = $htaccess_edit_data['htaccess_edit']['image']; $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')) {
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
if (Settings::Get('system.backupenabled') == 1) {
if ($action == 'abort' && isset($_POST['send']) && $_POST['send'] == 'send') {
$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());
}
\Froxlor\UI\Response::standard_success('backupaborted');
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
'action' => '',
's' => $s
));
}
if ($action == '') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_extras::backup");
// check whether there is a backup-job for this customer
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;
if ($result['count'] > 0) {
$existing_backupJob = array_shift($result['list']);
}
if (isset($_POST['send']) && $_POST['send'] == 'send') {
try {
CustomerBackups::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
\Froxlor\UI\Response::standard_success('backupscheduled');
} else {
if (! empty($existing_backupJob)) {
$action = "abort";
$row = $existing_backupJob['data'];
$row['path'] = \Froxlor\FileDir::makeCorrectDir(str_replace($userinfo['documentroot'], "/", $row['destdir']));
$row['backup_web'] = ($row['backup_web'] == '1') ? $lng['panel']['yes'] : $lng['panel']['no'];
$row['backup_mail'] = ($row['backup_mail'] == '1') ? $lng['panel']['yes'] : $lng['panel']['no'];
$row['backup_dbs'] = ($row['backup_dbs'] == '1') ? $lng['panel']['yes'] : $lng['panel']['no'];
}
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
$backup_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.backup.php';
$backup_form = \Froxlor\UI\HtmlForm::genHTMLForm($backup_data);
$title = $backup_data['backup']['title'];
$image = $backup_data['backup']['image'];
if (! empty($existing_backupJob)) {
// overwrite backup_form after we took everything from it we needed
eval("\$backup_form = \"" . \Froxlor\UI\Template::getTemplate("extras/backup_listexisting") . "\";");
}
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/backup") . "\";");
}
}
} else {
\Froxlor\UI\Response::standard_error('backupfunctionnotenabled');
}
} }

View File

@@ -16,10 +16,18 @@
* @package Panel * @package Panel
* *
*/ */
define('AREA', 'customer'); define('AREA', 'customer');
require './lib/init.php'; 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')) {
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
$id = 0; $id = 0;
if (isset($_POST['id'])) { if (isset($_POST['id'])) {
$id = intval($_POST['id']); $id = intval($_POST['id']);
@@ -28,421 +36,205 @@ if (isset($_POST['id'])) {
} }
if ($page == 'overview') { if ($page == 'overview') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_ftp"); $log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_ftp");
eval("echo \"" . getTemplate('ftp/ftp') . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/ftp') . "\";");
} elseif ($page == 'accounts') { } elseif ($page == 'accounts') {
if ($action == '') { 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( $fields = array(
'username' => $lng['login']['username'], 'username' => $lng['login']['username'],
'homedir' => $lng['panel']['path'], 'homedir' => $lng['panel']['path'],
'description' => $lng['panel']['ftpdesc'] 'description' => $lng['panel']['ftpdesc']
); );
$paging = new paging($userinfo, TABLE_FTP_USERS, $fields); try {
// get total count
$result_stmt = Database::prepare("SELECT `id`, `username`, `description`, `homedir` FROM `" . TABLE_FTP_USERS . "` $json_result = Ftps::getLocal($userinfo)->listingCount();
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit() $result = json_decode($json_result, true)['data'];
); // initialize pagination and filtering
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'])); $paging = new \Froxlor\UI\Pagination($userinfo, $fields, $result);
$ftps_count = Database::num_rows(); // get list
$paging->setEntries($ftps_count); $json_result = Ftps::getLocal($userinfo, $paging->getApiCommandParams())->listing();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
$ftps_count = $paging->getEntries();
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s); $pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$i = 0;
$count = 0; $count = 0;
$accounts = ''; $accounts = '';
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { foreach ($result['list'] as $row) {
if ($paging->checkDisplay($i)) { if (strpos($row['homedir'], $userinfo['documentroot']) === 0) {
if (strpos($row['homedir'], $userinfo['documentroot']) === 0) { $row['documentroot'] = str_replace($userinfo['documentroot'], "/", $row['homedir']);
$row['documentroot'] = str_replace($userinfo['documentroot'], "/", $row['homedir']); } else {
} else { $row['documentroot'] = $row['homedir'];
$row['documentroot'] = $row['homedir'];
}
$row['documentroot'] = makeCorrectDir($row['documentroot']);
$row = htmlentities_array($row);
eval("\$accounts.=\"" . getTemplate('ftp/accounts_account') . "\";");
$count++;
} }
$row['documentroot'] = \Froxlor\FileDir::makeCorrectDir($row['documentroot']);
$i++; $row = \Froxlor\PhpHelper::htmlentitiesArray($row);
eval("\$accounts.=\"" . \Froxlor\UI\Template::getTemplate('ftp/accounts_account') . "\";");
$count ++;
} }
eval("echo \"" . getTemplate('ftp/accounts') . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/accounts') . "\";");
} elseif ($action == 'delete' && $id != 0) { } 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 . "` try {
WHERE `customerid` = :customerid $json_result = Ftps::getLocal($userinfo, array(
AND `id` = :id" 'id' => $id
); ))->get();
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id)); } catch (Exception $e) {
$result = $result_stmt->fetch(PDO::FETCH_ASSOC); \Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if (isset($result['username']) && $result['username'] != $userinfo['loginname']) { if (isset($result['username']) && $result['username'] != $userinfo['loginname']) {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "` try {
SET `up_count` = `up_count` + :up_count, Ftps::getLocal($userinfo, $_POST)->delete();
`up_bytes` = `up_bytes` + :up_bytes, } catch (Exception $e) {
`down_count` = `down_count` + :down_count, \Froxlor\UI\Response::dynamic_error($e->getMessage());
`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']);
} }
\Froxlor\UI\Response::redirectTo($filename, array(
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` 'page' => $page,
SET `ftps_used` = `ftps_used` - 1 $resetaccnumber 's' => $s
WHERE `customerid` = :customerid" ));
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid']));
redirectTo($filename, array('page' => $page, 's' => $s));
} else { } 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 { } else {
standard_error('ftp_cantdeletemainaccount'); \Froxlor\UI\Response::standard_error('ftp_cantdeletemainaccount');
} }
} elseif ($action == 'add') { } elseif ($action == 'add') {
if ($userinfo['ftps_used'] < $userinfo['ftps'] || $userinfo['ftps'] == '-1') { if ($userinfo['ftps_used'] < $userinfo['ftps'] || $userinfo['ftps'] == '-1') {
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send') { try {
$description = validate($_POST['ftp_description'], 'description'); Ftps::getLocal($userinfo, $_POST)->add();
// @FIXME use a good path-validating regex here (refs #1231) } catch (Exception $e) {
$path = validate($_POST['path'], 'path'); \Froxlor\UI\Response::dynamic_error($e->getMessage());
$password = validate($_POST['ftp_password'], 'password');
$password = validatePassword($password);
$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`)
VALUES (:customerid, :username, :description, :password, :homedir, 'y', :guid, :guid)"
);
$params = array(
"customerid" => $userinfo['customerid'],
"username" => $username,
"description" => $description,
"password" => $cryptPassword,
"homedir" => $path,
"guid" => $userinfo['guid']
);
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));
} }
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else { } 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') { if (Settings::Get('customer.ftpatdomain') == '1') {
$domainlist = array(); $domainlist = array();
$domains = ''; $domains = '';
$result_domains_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` $result_domains_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `customerid`= :customerid" WHERE `customerid`= :customerid");
); Database::pexecute($result_domains_stmt, array(
Database::pexecute($result_domains_stmt, array("customerid" => $userinfo['customerid'])); "customerid" => $userinfo['customerid']
));
while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
$domainlist[] = $row_domain['domain']; $domainlist[] = $row_domain['domain'];
} }
sort($domainlist); sort($domainlist);
if (isset($domainlist[0]) && $domainlist[0] != '') { if (isset($domainlist[0]) && $domainlist[0] != '') {
foreach ($domainlist as $dom) { foreach ($domainlist as $dom) {
$domains .= makeoption($idna_convert->decode($dom), $dom); $domains .= \Froxlor\UI\HTML::makeoption($idna_convert->decode($dom), $dom);
} }
} }
} }
//$sendinfomail = makeyesno('sendinfomail', '1', '0', '0'); if (Settings::Get('system.allow_customer_shell') == '1') {
$shells = \Froxlor\UI\HTML::makeoption("/bin/false", "/bin/false", "/bin/false");
$shells_avail = Settings::Get('system.available_shells');
if (! empty($shells_avail)) {
$shells_avail = explode(",", $shells_avail);
$shells_avail = array_map("trim", $shells_avail);
foreach ($shells_avail as $_shell) {
$shells .= \Froxlor\UI\HTML::makeoption($_shell, $_shell, "/bin/false");
}
}
}
$ftp_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/ftp/formfield.ftp_add.php'; // $sendinfomail = \Froxlor\UI\HTML::makeyesno('sendinfomail', '1', '0', '0');
$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']; $title = $ftp_add_data['ftp_add']['title'];
$image = $ftp_add_data['ftp_add']['image']; $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) { } elseif ($action == 'edit' && $id != 0) {
$result_stmt = Database::prepare("SELECT `id`, `username`, `description`, `homedir`, `uid`, `gid` FROM `" . TABLE_FTP_USERS . "` try {
WHERE `customerid` = :customerid $json_result = Ftps::getLocal($userinfo, array(
AND `id` = :id" 'id' => $id
); ))->get();
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id)); } catch (Exception $e) {
$result = $result_stmt->fetch(PDO::FETCH_ASSOC); \Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if (isset($result['username']) && $result['username'] != '') { if (isset($result['username']) && $result['username'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
// @FIXME use a good path-validating regex here (refs #1231) try {
$path = validate($_POST['path'], 'path'); Ftps::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
$_setnewpass = false; \Froxlor\UI\Response::dynamic_error($e->getMessage());
if (isset($_POST['ftp_password']) && $_POST['ftp_password'] != '') {
$password = validate($_POST['ftp_password'], 'password');
$password = validatePassword($password);
$_setnewpass = true;
} }
\Froxlor\UI\Response::redirectTo($filename, array(
if ($_setnewpass) { 'page' => $page,
if ($password == '') { 's' => $s
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
WHERE `customerid` = :customerid
AND `id` = :id"
);
Database::pexecute($stmt, array("desc" => $description, "customerid" => $userinfo['customerid'], "id" => $id));
redirectTo($filename, array('page' => $page, 's' => $s));
} else { } else {
if (strpos($result['homedir'], $userinfo['documentroot']) === 0) { if (strpos($result['homedir'], $userinfo['documentroot']) === 0) {
$homedir = str_replace($userinfo['documentroot'], "/", $result['homedir']); $homedir = str_replace($userinfo['documentroot'], "/", $result['homedir']);
} else { } else {
$homedir = $result['homedir']; $homedir = $result['homedir'];
} }
$homedir = 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') { if (Settings::Get('customer.ftpatdomain') == '1') {
$domains = ''; $domains = '';
$result_domains_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` $result_domains_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `customerid` = :customerid" WHERE `customerid` = :customerid");
); Database::pexecute($result_domains_stmt, array(
Database::pexecute($result_domains_stmt, array("customerid" => $userinfo['customerid'])); "customerid" => $userinfo['customerid']
));
while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
$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']);
} }
} }
$ftp_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/ftp/formfield.ftp_edit.php'; if (Settings::Get('system.allow_customer_shell') == '1') {
$ftp_edit_form = htmlform::genHTMLForm($ftp_edit_data); $shells = \Froxlor\UI\HTML::makeoption("/bin/false", "/bin/false", $result['shell']);
$shells_avail = Settings::Get('system.available_shells');
if (! empty($shells_avail)) {
$shells_avail = explode(",", $shells_avail);
$shells_avail = array_map("trim", $shells_avail);
foreach ($shells_avail as $_shell) {
$shells .= \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 = \Froxlor\UI\HtmlForm::genHTMLForm($ftp_edit_data);
$title = $ftp_edit_data['ftp_edit']['title']; $title = $ftp_edit_data['ftp_edit']['title'];
$image = $ftp_edit_data['ftp_edit']['image']; $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 * @package Panel
* *
*/ */
define('AREA', 'customer'); define('AREA', 'customer');
require './lib/init.php'; require './lib/init.php';
if ($action == 'logout') { use Froxlor\Database\Database;
$log->logAction(USR_ACTION, LOG_NOTICE, 'logged out'); 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') { if (Settings::Get('session.allow_multiple_login') == '1') {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` $stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :customerid WHERE `userid` = :customerid
AND `adminsession` = '0' AND `adminsession` = '0'
AND `hash` = :hash" AND `hash` = :hash");
);
$params["hash"] = $s; $params["hash"] = $s;
} else { } else {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` $stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :customerid WHERE `userid` = :customerid
AND `adminsession` = '0'" AND `adminsession` = '0'");
);
} }
Database::pexecute($stmt, $params); Database::pexecute($stmt, $params);
redirectTo('index.php'); \Froxlor\UI\Response::redirectTo('index.php');
} }
if ($page == 'overview') { 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 . "` $domain_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `customerid` = :customerid WHERE `customerid` = :customerid
AND `parentdomainid` = '0' AND `parentdomainid` = '0'
AND `id` <> :standardsubdomain AND `id` <> :standardsubdomain
"); ");
Database::pexecute($domain_stmt, array("customerid" => $userinfo['customerid'], "standardsubdomain" => $userinfo['standardsubdomain'])); Database::pexecute($domain_stmt, array(
"customerid" => $userinfo['customerid'],
"standardsubdomain" => $userinfo['standardsubdomain']
));
$domains = ''; $domains = '';
$domainArray = array(); $domainArray = array();
@@ -70,7 +76,10 @@ if ($page == 'overview') {
WHERE `customerid` = :customerid WHERE `customerid` = :customerid
AND `id` = :standardsubdomain AND `id` = :standardsubdomain
"); ");
$std_domain = Database::pexecute_first($std_domain_stmt, array("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']; $stdsubdomain = $std_domain['domain'];
} }
@@ -78,118 +87,150 @@ if ($page == 'overview') {
$yesterday = time() - (60 * 60 * 24); $yesterday = time() - (60 * 60 * 24);
$month = date('M Y', $yesterday); $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']
));
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'] = round($userinfo['diskspace'] / 1024, Settings::Get('panel.decimal_places'));
$userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, Settings::Get('panel.decimal_places'));
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 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['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']) : ''; $userinfo['custom_notes'] = ($userinfo['custom_notes'] != '') ? nl2br($userinfo['custom_notes']) : '';
$services_enabled = ""; $services_enabled = "";
$se = array(); $se = array();
if ($userinfo['imap'] == '1') $se[] = "IMAP"; if ($userinfo['imap'] == '1')
if ($userinfo['pop3'] == '1') $se[] = "POP3"; $se[] = "IMAP";
if ($userinfo['phpenabled'] == '1') $se[] = "PHP"; if ($userinfo['pop3'] == '1')
if ($userinfo['perlenabled'] == '1') $se[] = "Perl/CGI"; $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); $services_enabled = implode(", ", $se);
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') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$old_password = validate($_POST['old_password'], 'old password'); $old_password = \Froxlor\Validate\Validate::validate($_POST['old_password'], 'old password');
if (!validatePasswordLogin($userinfo,$old_password,TABLE_PANEL_CUSTOMERS,'customerid')) { if (! \Froxlor\System\Crypt::validatePasswordLogin($userinfo, $old_password, TABLE_PANEL_CUSTOMERS, 'customerid')) {
standard_error('oldpasswordnotcorrect'); \Froxlor\UI\Response::standard_error('oldpasswordnotcorrect');
} }
$new_password = validatePassword($_POST['new_password'], 'new password'); $new_password = \Froxlor\System\Crypt::validatePassword($_POST['new_password'], 'new password');
$new_password_confirm = validatePassword($_POST['new_password_confirm'], 'new password confirm'); $new_password_confirm = \Froxlor\System\Crypt::validatePassword($_POST['new_password_confirm'], 'new password confirm');
if ($old_password == '') { if ($old_password == '') {
standard_error(array('stringisempty', 'oldpassword')); \Froxlor\UI\Response::standard_error(array(
'stringisempty',
'oldpassword'
));
} elseif ($new_password == '') { } elseif ($new_password == '') {
standard_error(array('stringisempty', 'newpassword')); \Froxlor\UI\Response::standard_error(array(
'stringisempty',
'newpassword'
));
} elseif ($new_password_confirm == '') { } elseif ($new_password_confirm == '') {
standard_error(array('stringisempty', 'newpasswordconfirm')); \Froxlor\UI\Response::standard_error(array(
'stringisempty',
'newpasswordconfirm'
));
} elseif ($new_password != $new_password_confirm) { } elseif ($new_password != $new_password_confirm) {
standard_error('newpasswordconfirmerror'); \Froxlor\UI\Response::standard_error('newpasswordconfirmerror');
} else { } else {
// Update user password // Update user password
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` try {
SET `password` = :newpassword Customers::getLocal($userinfo, array(
WHERE `customerid` = :customerid" 'id' => $userinfo['customerid'],
); 'new_customer_password' => $new_password
$params = array( ))->update();
"newpassword" => makeCryptPassword($new_password), } catch (Exception $e) {
"customerid" => $userinfo['customerid'] \Froxlor\UI\Response::dynamic_error($e->getMessage());
); }
Database::pexecute($stmt, $params); $log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, 'changed password');
$log->logAction(USR_ACTION, LOG_NOTICE, 'changed password');
// Update ftp password // Update ftp password
if (isset($_POST['change_main_ftp']) && $_POST['change_main_ftp'] == 'true') { if (isset($_POST['change_main_ftp']) && $_POST['change_main_ftp'] == 'true') {
$cryptPassword = makeCryptPassword($new_password); $cryptPassword = \Froxlor\System\Crypt::makeCryptPassword($new_password);
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "` $stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "`
SET `password` = :password SET `password` = :password
WHERE `customerid` = :customerid WHERE `customerid` = :customerid
AND `username` = :username" AND `username` = :username");
);
$params = array( $params = array(
"password" => $cryptPassword, "password" => $cryptPassword,
"customerid" => $userinfo['customerid'], "customerid" => $userinfo['customerid'],
"username" => $userinfo['loginname'] "username" => $userinfo['loginname']
); );
Database::pexecute($stmt, $params); Database::pexecute($stmt, $params);
$log->logAction(USR_ACTION, LOG_NOTICE, 'changed main ftp password'); $log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, 'changed main ftp password');
} }
// Update webalizer password // Update statistics password
if (isset($_POST['change_webalizer']) && $_POST['change_webalizer'] == 'true') { if (isset($_POST['change_stats']) && $_POST['change_stats'] == 'true') {
if (CRYPT_STD_DES == 1) { $new_stats_password = \Froxlor\System\Crypt::makeCryptPassword($new_password, true);
$saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2);
$new_webalizer_password = crypt($new_password, $saltfordescrypt);
} else {
$new_webalizer_password = crypt($new_password);
}
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_HTPASSWDS . "` $stmt = Database::prepare("UPDATE `" . TABLE_PANEL_HTPASSWDS . "`
SET `password` = :password SET `password` = :password
WHERE `customerid` = :customerid WHERE `customerid` = :customerid
AND `username` = :username" AND `username` = :username");
);
$params = array( $params = array(
"password" => $new_webalizer_password, "password" => $new_stats_password,
"customerid" => $userinfo['customerid'], "customerid" => $userinfo['customerid'],
"username" => $userinfo['loginname'] "username" => $userinfo['loginname']
); );
Database::pexecute($stmt, $params); Database::pexecute($stmt, $params);
} }
redirectTo($filename, array('s' => $s)); \Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} }
} else { } 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') { 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])) { if (isset($languages[$def_language])) {
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` try {
SET `def_language` = :lang Customers::getLocal($userinfo, array(
WHERE `customerid` = :customerid" 'id' => $userinfo['customerid'],
); 'def_language' => $def_language
Database::pexecute($stmt, array("lang" => $def_language, "customerid" => $userinfo['customerid'])); ))->update();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
// also update current session
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_SESSIONS . "` $stmt = Database::prepare("UPDATE `" . TABLE_PANEL_SESSIONS . "`
SET `language` = :lang SET `language` = :lang
WHERE `hash` = :hash" WHERE `hash` = :hash");
); Database::pexecute($stmt, array(
Database::pexecute($stmt, array("lang" => $def_language, "hash" => $s)); "lang" => $def_language,
"hash" => $s
$log->logAction(USR_ACTION, LOG_NOTICE, "changed default language to '" . $def_language . "'"); ));
} }
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "changed default language to '" . $def_language . "'");
redirectTo($filename, array('s' => $s)); \Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} else { } else {
$default_lang = Settings::Get('panel.standardlanguage'); $default_lang = Settings::Get('panel.standardlanguage');
if ($userinfo['def_language'] != '') { if ($userinfo['def_language'] != '') {
@@ -197,30 +238,37 @@ if ($page == 'overview') {
} }
$language_options = ''; $language_options = '';
while (list($language_file, $language_name) = each($languages)) { foreach ($languages as $language_file => $language_name) {
$language_options .= makeoption($language_name, $language_file, $default_lang, true); $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') { } elseif ($page == 'change_theme') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$theme = validate($_POST['theme'], 'theme'); $theme = \Froxlor\Validate\Validate::validate($_POST['theme'], 'theme');
try {
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` Customers::getLocal($userinfo, array(
SET `theme` = :theme 'id' => $userinfo['customerid'],
WHERE `customerid` = :customerid" 'theme' => $theme
); ))->update();
Database::pexecute($stmt, array("theme" => $theme, "customerid" => $userinfo['customerid'])); } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
// also update current session
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_SESSIONS . "` $stmt = Database::prepare("UPDATE `" . TABLE_PANEL_SESSIONS . "`
SET `theme` = :theme SET `theme` = :theme
WHERE `hash` = :hash" WHERE `hash` = :hash");
); Database::pexecute($stmt, array(
Database::pexecute($stmt, array("theme" => $theme, "hash" => $s)); "theme" => $theme,
"hash" => $s
));
$log->logAction(USR_ACTION, LOG_NOTICE, "changed default theme to '" . $theme . "'"); $log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "changed default theme to '" . $theme . "'");
redirectTo($filename, array('s' => $s)); \Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} else { } else {
$default_theme = Settings::Get('panel.default_theme'); $default_theme = Settings::Get('panel.default_theme');
if ($userinfo['theme'] != '') { if ($userinfo['theme'] != '') {
@@ -228,14 +276,13 @@ if ($page == 'overview') {
} }
$theme_options = ''; $theme_options = '';
$themes_avail = getThemes(); $themes_avail = \Froxlor\UI\Template::getThemes();
foreach ($themes_avail as $t => $d) { 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') { } elseif ($page == 'send_error_report' && Settings::Get('system.allow_error_report_customer') == '1') {
// only show this if we really have an exception to report // only show this if we really have an exception to report
@@ -243,8 +290,8 @@ if ($page == 'overview') {
$errid = $_GET['errorid']; $errid = $_GET['errorid'];
// read error file // read error file
$err_dir = makeCorrectDir(FROXLOR_INSTALL_DIR."/logs/"); $err_dir = \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir() . "/logs/");
$err_file = makeCorrectFile($err_dir."/".$errid."_sql-error.log"); $err_file = \Froxlor\FileDir::makeCorrectFile($err_dir . "/" . $errid . "_sql-error.log");
if (file_exists($err_file)) { if (file_exists($err_file)) {
@@ -254,27 +301,26 @@ if ($page == 'overview') {
$_error = array( $_error = array(
'code' => str_replace("\n", "", substr($error[1], 5)), 'code' => str_replace("\n", "", substr($error[1], 5)),
'message' => str_replace("\n", "", substr($error[2], 4)), '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)), '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 // build mail-content
$mail_body = "Dear froxlor-team,\n\n"; $mail_body = "Dear froxlor-team,\n\n";
$mail_body .= "the following error has been reported by a user:\n\n"; $mail_body .= "the following error has been reported by a user:\n\n";
$mail_body .= "-------------------------------------------------------------\n"; $mail_body .= "-------------------------------------------------------------\n";
$mail_body .= $_error['code'].' '.$_error['message']."\n\n"; $mail_body .= $_error['code'] . ' ' . $_error['message'] . "\n\n";
$mail_body .= "File: ".$_error['file'].':'.$_error['line']."\n\n"; $mail_body .= "File: " . $_error['file'] . ':' . $_error['line'] . "\n\n";
$mail_body .= "Trace:\n".trim($_error['trace'])."\n\n"; $mail_body .= "Trace:\n" . trim($_error['trace']) . "\n\n";
$mail_body .= "-------------------------------------------------------------\n\n"; $mail_body .= "-------------------------------------------------------------\n\n";
$mail_body .= "Froxlor-version: ".$version."\n\n"; $mail_body .= "Froxlor-version: " . $version . "\n";
$mail_body .= "DB-version: " . $dbversion . "\n\n";
$mail_body .= "End of report"; $mail_body .= "End of report";
$mail_html = str_replace("\n", "<br />", $mail_body); $mail_html = str_replace("\n", "<br />", $mail_body);
// send actual report to dev-team // send actual report to dev-team
if (isset($_POST['send']) if (isset($_POST['send']) && $_POST['send'] == 'send') {
&& $_POST['send'] == 'send'
) {
// send mail and say thanks // send mail and say thanks
$_mailerror = false; $_mailerror = false;
try { try {
@@ -283,7 +329,7 @@ if ($page == 'overview') {
$mail->MsgHTML($mail_html); $mail->MsgHTML($mail_html);
$mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team'); $mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team');
$mail->Send(); $mail->Send();
} catch(phpmailerException $e) { } catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage(); $mailerr_msg = $e->errorMessage();
$_mailerror = true; $_mailerror = true;
} catch (Exception $e) { } catch (Exception $e) {
@@ -293,21 +339,30 @@ if ($page == 'overview') {
if ($_mailerror) { if ($_mailerror) {
// error when reporting an error...LOLFUQ // 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 // finally remove error from fs
@unlink($err_file); @unlink($err_file);
redirectTo($filename, array('s' => $s)); \Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} }
// show a nice summary of the error-report // show a nice summary of the error-report
// before actually sending anything // before actually sending anything
eval("echo \"" . getTemplate("index/send_error_report") . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/send_error_report") . "\";");
} else { } else {
redirectTo($filename, array('s' => $s)); \Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} }
} else { } 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,12 +16,19 @@
* @package Panel * @package Panel
* *
*/ */
define('AREA', 'customer'); define('AREA', 'customer');
require './lib/init.php'; require './lib/init.php';
if ($page == 'log' use Froxlor\Api\Commands\SysLog;
) { 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')) {
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
if ($page == 'log') {
if ($action == '') { if ($action == '') {
$fields = array( $fields = array(
'date' => $lng['logger']['date'], 'date' => $lng['logger']['date'],
@@ -29,89 +36,85 @@ if ($page == 'log'
'user' => $lng['logger']['user'], 'user' => $lng['logger']['user'],
'text' => $lng['logger']['action'] 'text' => $lng['logger']['action']
); );
$paging = new paging($userinfo, TABLE_PANEL_LOG, $fields, null, null, 0, 'desc'); try {
$result_stmt = Database::prepare(' // get total count
SELECT * FROM `' . TABLE_PANEL_LOG . '` WHERE `user` = :loginname ' . $paging->getSqlWhere(true) . ' ' . $paging->getSqlOrderBy() . ' ' . $paging->getSqlLimit() $json_result = SysLog::getLocal($userinfo)->listingCount();
); $result = json_decode($json_result, true)['data'];
Database::pexecute($result_stmt, array("loginname" => $userinfo['loginname'])); // initialize pagination and filtering
$logs_count = Database::num_rows(); $paging = new \Froxlor\UI\Pagination($userinfo, $fields, $result);
$paging->setEntries($logs_count); // get list
$json_result = SysLog::getLocal($userinfo, $paging->getApiCommandParams())->listing();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s); $pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$clog = array(); $clog = array();
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { foreach ($result['list'] as $row) {
if (!isset($clog[$row['action']]) if (! isset($clog[$row['action']]) || ! is_array($clog[$row['action']])) {
|| !is_array($clog[$row['action']])
) {
$clog[$row['action']] = array(); $clog[$row['action']] = array();
} }
$clog[$row['action']][$row['logid']] = $row; $clog[$row['action']][$row['logid']] = $row;
} }
if ($paging->sortfield == 'date' if ($paging->sortfield == 'date' && $paging->sortorder == 'desc') {
&& $paging->sortorder == 'desc'
) {
krsort($clog); krsort($clog);
} else { } else {
ksort($clog); ksort($clog);
} }
$i = 0;
$count = 0; $count = 0;
$log_count = 0; $log_count = 0;
$log = ''; $log = '';
foreach ($clog as $action => $logrows) { foreach ($clog as $action => $logrows) {
$_action = 0; $_action = 0;
foreach ($logrows as $row) { foreach ($logrows as $row) {
if ($paging->checkDisplay($i)) { // if ($paging->checkDisplay($i)) {
$row = htmlentities_array($row); $row = \Froxlor\PhpHelper::htmlentitiesArray($row);
$row['date'] = date("d.m.y H:i:s", $row['date']); $row['date'] = date("d.m.y H:i:s", $row['date']);
if ($_action != $action) { if ($_action != $action) {
switch ($action) { switch ($action) {
case USR_ACTION: case \Froxlor\FroxlorLogger::USR_ACTION:
$_action = $lng['admin']['customer']; $_action = $lng['admin']['customer'];
break; break;
case RES_ACTION: case \Froxlor\FroxlorLogger::RES_ACTION:
$_action = $lng['logger']['reseller']; $_action = $lng['logger']['reseller'];
break; break;
case ADM_ACTION: case \Froxlor\FroxlorLogger::ADM_ACTION:
$_action = $lng['logger']['admin']; $_action = $lng['logger']['admin'];
break; break;
case CRON_ACTION: case \Froxlor\FroxlorLogger::CRON_ACTION:
$_action = $lng['logger']['cron']; $_action = $lng['logger']['cron'];
break; break;
case LOGIN_ACTION: case \Froxlor\FroxlorLogger::LOGIN_ACTION:
$_action = $lng['logger']['login']; $_action = $lng['logger']['login'];
break; break;
case LOG_ERROR: case \Froxlor\FroxlorLogger::LOG_ERROR:
$_action = $lng['logger']['intern']; $_action = $lng['logger']['intern'];
break; break;
default: default:
$_action = $lng['logger']['unknown']; $_action = $lng['logger']['unknown'];
break; break;
}
$row['action'] = $_action;
eval("\$log.=\"" . getTemplate('logger/logger_action') . "\";");
} }
$log_count++; $row['action'] = $_action;
$row['type'] = getLogLevelDesc($row['type']); eval("\$log.=\"" . \Froxlor\UI\Template::getTemplate('logger/logger_action') . "\";");
eval("\$log.=\"" . getTemplate('logger/logger_log') . "\";");
$count++;
$_action = $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++;
} }
eval("echo \"" . getTemplate('logger/logger') . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate('logger/logger') . "\";");
} }
} }

View File

@@ -16,10 +16,18 @@
* @package Panel * @package Panel
* *
*/ */
define('AREA', 'customer'); define('AREA', 'customer');
require './lib/init.php'; 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')) {
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
// get sql-root access data // get sql-root access data
Database::needRoot(true); Database::needRoot(true);
Database::needSqlData(); Database::needSqlData();
@@ -33,67 +41,74 @@ if (isset($_POST['id'])) {
} }
if ($page == 'overview') { 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(); Database::needSqlData();
$sql = Database::getSqlData(); $sql = Database::getSqlData();
$lng['mysql']['description'] = str_replace('<SQL_HOST>', $sql['host'], $lng['mysql']['description']); $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') { } elseif ($page == 'mysqls') {
if ($action == '') { 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( $fields = array(
'databasename' => $lng['mysql']['databasename'], 'databasename' => $lng['mysql']['databasename'],
'description' => $lng['mysql']['databasedescription'] 'description' => $lng['mysql']['databasedescription']
); );
$paging = new paging($userinfo, TABLE_PANEL_DATABASES, $fields); try {
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_DATABASES . "` // get total count
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit() $json_result = Mysqls::getLocal($userinfo)->listingCount();
); $result = json_decode($json_result, true)['data'];
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'])); // initialize pagination and filtering
$mysqls_count = Database::num_rows(); $paging = new \Froxlor\UI\Pagination($userinfo, $fields, $result);
$paging->setEntries($mysqls_count); // get list
$json_result = Mysqls::getLocal($userinfo, $paging->getApiCommandParams())->listing();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
$mysqls_count = $paging->getEntries();
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s); $pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$i = 0;
$count = 0; $count = 0;
$mysqls = ''; $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); $dbserver = $dbservers_stmt->fetch(PDO::FETCH_ASSOC);
$count_mysqlservers = $dbserver['numservers']; $count_mysqlservers = $dbserver['numservers'];
// Begin root-session // Begin root-session
Database::needRoot(true); Database::needRoot(true);
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { foreach ($result['list'] as $row) {
if ($paging->checkDisplay($i)) { $row = \Froxlor\PhpHelper::htmlentitiesArray($row);
$row = htmlentities_array($row); $mbdata_stmt = Database::prepare("SELECT SUM(data_length + index_length) as MB FROM information_schema.TABLES
$mbdata_stmt = Database::prepare("SELECT SUM(data_length + index_length) as MB FROM information_schema.TABLES
WHERE table_schema = :table_schema WHERE table_schema = :table_schema
GROUP BY table_schema" GROUP BY table_schema");
); $mbdata = Database::pexecute_first($mbdata_stmt, array(
Database::pexecute($mbdata_stmt, array("table_schema" => $row['databasename'])); "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'); if (!$mbdata) {
eval("\$mysqls.=\"" . getTemplate('mysql/mysqls_database') . "\";"); $mbdata = array('MB' => 0);
$count++;
} }
$i++; $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 ++;
} }
Database::needRoot(false); Database::needRoot(false);
// End root-session // End root-session
eval("echo \"" . getTemplate('mysql/mysqls') . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate('mysql/mysqls') . "\";");
} elseif ($action == 'delete' && $id != 0) { } elseif ($action == 'delete' && $id != 0) {
$result_stmt = Database::prepare('SELECT `id`, `databasename`, `description`, `dbserver` FROM `' . TABLE_PANEL_DATABASES . '`
WHERE `customerid`="' . (int)$userinfo['customerid'] . '" try {
AND `id`="' . (int)$id . '"' $json_result = Mysqls::getLocal($userinfo, array(
); 'id' => $id
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'])); ))->get();
$result = $result_stmt->fetch(PDO::FETCH_ASSOC); } 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($result['databasename']) && $result['databasename'] != '') {
@@ -102,251 +117,91 @@ if ($page == 'overview') {
$sql_root = Database::getSqlData(); $sql_root = Database::getSqlData();
Database::needRoot(false); Database::needRoot(false);
if (!isset($sql_root[$result['dbserver']]) || !is_array($sql_root[$result['dbserver']])) { if (! isset($sql_root[$result['dbserver']]) || ! is_array($sql_root[$result['dbserver']])) {
$result['dbserver'] = 0; $result['dbserver'] = 0;
} }
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
// Begin root-session try {
Database::needRoot(true, $result['dbserver']); Mysqls::getLocal($userinfo, $_POST)->delete();
$dbm = new DbManager($log); } catch (Exception $e) {
$dbm->getManager()->deleteDatabase($result['databasename']); \Froxlor\UI\Response::dynamic_error($e->getMessage());
$log->logAction(USR_ACTION, LOG_INFO, "deleted database '" . $result['databasename'] . "'"); }
Database::needRoot(false); \Froxlor\UI\Response::redirectTo($filename, array(
// End root-session 'page' => $page,
's' => $s
$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));
} else { } else {
$dbnamedesc = $result['databasename']; $dbnamedesc = $result['databasename'];
if (isset($result['description']) && $result['description'] != '') { if (isset($result['description']) && $result['description'] != '') {
$dbnamedesc .= ' ('.$result['description'].')'; $dbnamedesc .= ' (' . $result['description'] . ')';
} }
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') { } elseif ($action == 'add') {
if ($userinfo['mysqls_used'] < $userinfo['mysqls'] || $userinfo['mysqls'] == '-1') { if ($userinfo['mysqls_used'] < $userinfo['mysqls'] || $userinfo['mysqls'] == '-1') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$password = validate($_POST['mysql_password'], 'password'); try {
$password = validatePassword($password); Mysqls::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
$sendinfomail = isset($_POST['sendinfomail']) ? 1 : 0; \Froxlor\UI\Response::dynamic_error($e->getMessage());
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));
} }
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else { } 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 = ''; $mysql_servers = '';
$count_mysqlservers = 0; $count_mysqlservers = 0;
while ($dbserver = $dbservers_stmt->fetch(PDO::FETCH_ASSOC)) { while ($dbserver = $dbservers_stmt->fetch(PDO::FETCH_ASSOC)) {
Database::needRoot(true, $dbserver['dbserver']); Database::needRoot(true, $dbserver['dbserver']);
Database::needSqlData(); Database::needSqlData();
$sql_root = Database::getSqlData(); $sql_root = Database::getSqlData();
$mysql_servers .= makeoption($sql_root['caption'], $dbserver['dbserver']); $mysql_servers .= \Froxlor\UI\HTML::makeoption($sql_root['caption'], $dbserver['dbserver']);
$count_mysqlservers++; $count_mysqlservers ++;
} }
Database::needRoot(false); Database::needRoot(false);
$mysql_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/mysql/formfield.mysql_add.php'; $mysql_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/mysql/formfield.mysql_add.php';
$mysql_add_form = htmlform::genHTMLForm($mysql_add_data); $mysql_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($mysql_add_data);
$title = $mysql_add_data['mysql_add']['title']; $title = $mysql_add_data['mysql_add']['title'];
$image = $mysql_add_data['mysql_add']['image']; $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) { } elseif ($action == 'edit' && $id != 0) {
$result_stmt = Database::prepare("SELECT `id`, `databasename`, `description`, `dbserver` FROM `" . TABLE_PANEL_DATABASES . "` try {
WHERE `customerid` = :customerid $json_result = Mysqls::getLocal($userinfo, array(
AND `id` = :id" 'id' => $id
); ))->get();
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id)); } catch (Exception $e) {
$result = $result_stmt->fetch(PDO::FETCH_ASSOC); \Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if (isset($result['databasename']) && $result['databasename'] != '') { 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') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
// Only change Password if it is set, do nothing if it is empty! -- PH 2004-11-29 try {
$password = validate($_POST['mysql_password'], 'password'); $json_result = Mysqls::getLocal($userinfo, $_POST)->update();
if ($password != '') { } catch (Exception $e) {
// validate password \Froxlor\UI\Response::dynamic_error($e->getMessage());
$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
} }
\Froxlor\UI\Response::redirectTo($filename, array(
// Update the Database description -- PH 2004-11-29 'page' => $page,
$log->logAction(USR_ACTION, LOG_INFO, "edited database '" . $result['databasename'] . "'"); 's' => $s
$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));
} else { } 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); $dbserver = $dbservers_stmt->fetch(PDO::FETCH_ASSOC);
$count_mysqlservers = $dbserver['numservers']; $count_mysqlservers = $dbserver['numservers'];
@@ -355,13 +210,13 @@ if ($page == 'overview') {
$sql_root = Database::getSqlData(); $sql_root = Database::getSqlData();
Database::needRoot(false); Database::needRoot(false);
$mysql_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/mysql/formfield.mysql_edit.php'; $mysql_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/mysql/formfield.mysql_edit.php';
$mysql_edit_form = htmlform::genHTMLForm($mysql_edit_data); $mysql_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($mysql_edit_data);
$title = $mysql_edit_data['mysql_edit']['title']; $title = $mysql_edit_data['mysql_edit']['title'];
$image = $mysql_edit_data['mysql_edit']['image']; $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,387 +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';
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,10 +16,18 @@
* @package Panel * @package Panel
* *
*/ */
define('AREA', 'customer'); define('AREA', 'customer');
$intrafficpage = 1; $intrafficpage = 1;
require './lib/init.php'; 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')) {
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
$traffic = ''; $traffic = '';
$month = null; $month = null;
$year = null; $year = null;
@@ -30,8 +38,7 @@ if (isset($_POST['month']) && isset($_POST['year'])) {
} elseif (isset($_GET['month']) && isset($_GET['year'])) { } elseif (isset($_GET['month']) && isset($_GET['year'])) {
$month = intval($_GET['month']); $month = intval($_GET['month']);
$year = intval($_GET['year']); $year = intval($_GET['year']);
} } // BAM! $_GET???
//BAM! $_GET???
elseif (isset($_GET['page']) && $_GET['page'] == 'current') { elseif (isset($_GET['page']) && $_GET['page'] == 'current') {
if (date('d') != '01') { if (date('d') != '01') {
$month = date('m'); $month = date('m');
@@ -47,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; $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` $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 . "` FROM `" . TABLE_PANEL_TRAFFIC . "`
@@ -55,8 +62,7 @@ if (!is_null($month) && !is_null($year)) {
AND `month` = :month AND `month` = :month
AND `year` = :year AND `year` = :year
GROUP BY `day` GROUP BY `day`
ORDER BY `day` DESC" ORDER BY `day` DESC");
);
$params = array( $params = array(
"customerid" => $userinfo['customerid'], "customerid" => $userinfo['customerid'],
"month" => $month, "month" => $month,
@@ -80,40 +86,39 @@ if (!is_null($month) && !is_null($year)) {
if (extension_loaded('bcmath')) { if (extension_loaded('bcmath')) {
$traf['ftptext'] = bcdiv($row['ftp_up'], 1024, Settings::Get('panel.decimal_places')) . " MiB up/ " . bcdiv($row['ftp_down'], 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)"; $traf['ftptext'] = bcdiv($row['ftp_up'], 1024, Settings::Get('panel.decimal_places')) . " MiB up/ " . bcdiv($row['ftp_down'], 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)";
$traf['httptext'] = bcdiv($http, 1024, Settings::Get('panel.decimal_places')) . " MiB (HTTP)";
$traf['mailtext'] = bcdiv($mail, 1024, Settings::Get('panel.decimal_places')) . " MiB (Mail)";
$traf['ftp'] = bcdiv($ftp, 1024, Settings::Get('panel.decimal_places')); $traf['ftp'] = bcdiv($ftp, 1024, Settings::Get('panel.decimal_places'));
$traf['http'] = bcdiv($http, 1024, Settings::Get('panel.decimal_places'));
$traf['mail'] = bcdiv($mail, 1024, Settings::Get('panel.decimal_places'));
$traf['byte'] = bcdiv($traf['byte'], 1024, Settings::Get('panel.decimal_places'));
} else { } else {
$traf['ftptext'] = round($row['ftp_up'] / 1024, Settings::Get('panel.decimal_places')) . " MiB up/ " . round($row['ftp_down'] / 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)"; $traf['ftptext'] = round($row['ftp_up'] / 1024, Settings::Get('panel.decimal_places')) . " MiB up/ " . round($row['ftp_down'] / 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)";
$traf['httptext'] = round($http / 1024, Settings::Get('panel.decimal_places')) . " MiB (HTTP)"; $traf['ftp'] = round($ftp / 1024, Settings::Get('panel.decimal_places'));
$traf['mailtext'] = round($mail / 1024, Settings::Get('panel.decimal_places')) . " MiB (Mail)";
$traf['http'] = round($http, Settings::Get('panel.decimal_places'));
$traf['ftp'] = round($ftp, Settings::Get('panel.decimal_places'));
$traf['mail'] = round($mail, Settings::Get('panel.decimal_places'));
$traf['byte'] = round($traf['byte'] / 1024, Settings::Get('panel.decimal_places'));
} }
eval("\$traffic.=\"" . getTemplate('traffic/traffic_month') . "\";"); getReadableTraffic($traf,'httptext', $http, 1024, "MiB (HTTP)");
getReadableTraffic($traf,'http', $http, 1024);
getReadableTraffic($traf,'mailtext', $mail, 1024, "MiB (Mail)");
getReadableTraffic($traf,'mail', $mail, 1024);
getReadableTraffic($traf,'byte', $traf['byte'], (1024 * 1024));
eval("\$traffic.=\"" . \Froxlor\UI\Template::getTemplate('traffic/traffic_month') . "\";");
$show = $lng['traffic']['months'][intval($row['month'])] . ' ' . $row['year']; $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['http'] = \Froxlor\PhpHelper::sizeReadable($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['ftp'] = \Froxlor\PhpHelper::sizeReadable($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['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 { } 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 $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 . "` FROM `" . TABLE_PANEL_TRAFFIC . "`
WHERE `customerid` = :customerid WHERE `customerid` = :customerid
GROUP BY CONCAT(`year`,`month`) GROUP BY `year`, `month`
ORDER BY CONCAT(`year`,`month`) DESC ORDER BY `year` DESC, `month` DESC
LIMIT 12" LIMIT 12
); ");
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'])); Database::pexecute($result_stmt, array(
"customerid" => $userinfo['customerid']
));
$traffic_complete['http'] = 0; $traffic_complete['http'] = 0;
$traffic_complete['ftp'] = 0; $traffic_complete['ftp'] = 0;
$traffic_complete['mail'] = 0; $traffic_complete['mail'] = 0;
@@ -133,28 +138,33 @@ if (!is_null($month) && !is_null($year)) {
if (extension_loaded('bcmath')) { if (extension_loaded('bcmath')) {
$traf['ftptext'] = bcdiv($ftp_up, 1024, Settings::Get('panel.decimal_places')) . " MiB up/ " . bcdiv($ftp_down, 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)"; $traf['ftptext'] = bcdiv($ftp_up, 1024, Settings::Get('panel.decimal_places')) . " MiB up/ " . bcdiv($ftp_down, 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)";
$traf['httptext'] = bcdiv($http, 1024, Settings::Get('panel.decimal_places')) . " MiB (HTTP)";
$traf['mailtext'] = bcdiv($mail, 1024, Settings::Get('panel.decimal_places')) . " MiB (Mail)";
$traf['ftp'] = bcdiv(($ftp_up + $ftp_down), 1024, Settings::Get('panel.decimal_places')); $traf['ftp'] = bcdiv(($ftp_up + $ftp_down), 1024, Settings::Get('panel.decimal_places'));
$traf['http'] = bcdiv($http, 1024, Settings::Get('panel.decimal_places'));
$traf['mail'] = bcdiv($mail, 1024, Settings::Get('panel.decimal_places'));
$traf['byte'] = bcdiv($traf['byte'], 1024 * 1024, Settings::Get('panel.decimal_places'));
} else { } else {
$traf['ftptext'] = round($ftp_up / 1024, Settings::Get('panel.decimal_places')) . " MiB up/ " . round($ftp_down / 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)"; $traf['ftptext'] = round($ftp_up / 1024, Settings::Get('panel.decimal_places')) . " MiB up/ " . round($ftp_down / 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)";
$traf['httptext'] = round($http / 1024, Settings::Get('panel.decimal_places')) . " MiB (HTTP)";
$traf['mailtext'] = round($mail / 1024, Settings::Get('panel.decimal_places')) . " MiB (Mail)";
$traf['ftp'] = round(($ftp_up + $ftp_down) / 1024, Settings::Get('panel.decimal_places')); $traf['ftp'] = round(($ftp_up + $ftp_down) / 1024, Settings::Get('panel.decimal_places'));
$traf['http'] = round($http / 1024, Settings::Get('panel.decimal_places'));
$traf['mail'] = round($mail / 1024, Settings::Get('panel.decimal_places'));
$traf['byte'] = round($traf['byte'] / (1024 * 1024), Settings::Get('panel.decimal_places'));
} }
eval("\$traffic.=\"" . getTemplate('traffic/traffic_traffic') . "\";"); getReadableTraffic($traf,'httptext', $http, 1024, "MiB (HTTP)");
getReadableTraffic($traf,'http', $http, 1024);
getReadableTraffic($traf,'mailtext', $mail, 1024, "MiB (Mail)");
getReadableTraffic($traf,'mail', $mail, 1024);
getReadableTraffic($traf,'byte', $traf['byte'], (1024 * 1024));
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['http'] = \Froxlor\PhpHelper::sizeReadable($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['ftp'] = \Froxlor\PhpHelper::sizeReadable($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['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') . "\";");
}
function getReadableTraffic(&$traf, $index, $value, $divisor, $desc = "")
{
if (extension_loaded('bcmath')) {
$traf[$index] = bcdiv($value, $divisor,Settings::Get('panel.decimal_places')).(!empty($desc) ? " ".$desc : "");
} else {
$traf[$index] = round($value / $divisor, Settings::Get('panel.decimal_places')).(!empty($desc) ? " ".$desc : "");
}
} }

132
dns_editor.php Normal file
View File

@@ -0,0 +1,132 @@
<?php
if (! defined('AREA')) {
header("Location: index.php");
exit();
}
/**
* This file is part of the Froxlor project.
* Copyright (c) 2016 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2016-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
*
*/
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
$domain_id = isset($_GET['domain_id']) ? (int) $_GET['domain_id'] : null;
$record = isset($_POST['record']['record']) ? trim($_POST['record']['record']) : null;
$type = isset($_POST['record']['type']) ? $_POST['record']['type'] : 'A';
$prio = isset($_POST['record']['prio']) ? (int) $_POST['record']['prio'] : null;
$content = isset($_POST['record']['content']) ? trim($_POST['record']['content']) : null;
$ttl = isset($_POST['record']['ttl']) ? (int) $_POST['record']['ttl'] : 18000;
// get domain-name
$domain = \Froxlor\Dns\Dns::getAllowedDomainEntry($domain_id, AREA, $userinfo);
$errors = "";
$success_message = "";
// action for adding a new entry
if ($action == 'add_record' && ! empty($_POST)) {
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 = $prio = $content = "";
} catch (Exception $e) {
$errors = str_replace("\n", "<br>", $e->getMessage());
}
} elseif ($action == 'delete') {
// remove entry
$entry_id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
if ($entry_id > 0) {
try {
DomainZones::getLocal($userinfo, array(
'entry_id' => $entry_id,
'id' => $domain_id
))->delete();
// success message (inline)
$success_message = $lng['success']['dns_record_deleted'];
} catch (Exception $e) {
$errors = str_replace("\n", "<br>", $e->getMessage());
}
}
}
// select all entries
try {
// get list
$json_result = DomainZones::getLocal($userinfo, [
'id' => $domain_id
])->listing();
} catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
$dom_entries = $result['list'];
// show editor
$record_list = "";
$existing_entries = "";
$type_select = "";
$entriescount = 0;
if (! empty($dom_entries)) {
$entriescount = count($dom_entries);
foreach ($dom_entries as $entry) {
$entry['content'] = wordwrap($entry['content'], 100, '<br>', true);
eval("\$existing_entries.=\"" . \Froxlor\UI\Template::getTemplate("dns_editor/entry_bit", true) . "\";");
}
}
// available types
$type_select_values = array(
'A',
'AAAA',
'CAA',
'CNAME',
'DNAME',
'LOC',
'MX',
'NS',
'RP',
'SRV',
'SSHFP',
'TXT'
);
asort($type_select_values);
foreach ($type_select_values as $_type) {
$type_select .= \Froxlor\UI\HTML::makeoption($_type, $_type, $type);
}
eval("\$record_list=\"" . \Froxlor\UI\Template::getTemplate("dns_editor/list", true) . "\";");
try {
$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);

727
index.php
View File

@@ -16,23 +16,102 @@
* @package Panel * @package Panel
* *
*/ */
define('AREA', 'login'); define('AREA', 'login');
require './lib/init.php'; require './lib/init.php';
use Froxlor\Database\Database;
use Froxlor\Settings;
use Froxlor\FroxlorLogger;
if ($action == '') { if ($action == '') {
$action = 'login'; $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') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$loginname = validate($_POST['loginname'], 'loginname'); $loginname = \Froxlor\Validate\Validate::validate($_POST['loginname'], 'loginname');
$password = validate($_POST['password'], 'password'); $password = \Froxlor\Validate\Validate::validate($_POST['password'], 'password');
$stmt = Database::prepare("SELECT `loginname` AS `customer` FROM `" . TABLE_PANEL_CUSTOMERS . "` $stmt = Database::prepare("SELECT `loginname` AS `customer` FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE `loginname`= :loginname" WHERE `loginname`= :loginname");
); Database::pexecute($stmt, array(
Database::pexecute($stmt, array("loginname" => $loginname)); "loginname" => $loginname
));
$row = $stmt->fetch(PDO::FETCH_ASSOC); $row = $stmt->fetch(PDO::FETCH_ASSOC);
if ($row['customer'] == $loginname) { if ($row['customer'] == $loginname) {
@@ -42,21 +121,26 @@ if ($action == 'login') {
$is_admin = false; $is_admin = false;
} else { } else {
$is_admin = true; $is_admin = true;
if ((int)Settings::Get('login.domain_login') == 1) { if ((int) Settings::Get('login.domain_login') == 1) {
$domainname = $idna_convert->encode(preg_replace(array('/\:(\d)+$/', '/^https?\:\/\//'), '', $loginname)); $domainname = $idna_convert->encode(preg_replace(array(
'/\:(\d)+$/',
'/^https?\:\/\//'
), '', $loginname));
$stmt = Database::prepare("SELECT `customerid` FROM `" . TABLE_PANEL_DOMAINS . "` $stmt = Database::prepare("SELECT `customerid` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `domain` = :domain" WHERE `domain` = :domain");
); Database::pexecute($stmt, array(
Database::pexecute($stmt, array("domain" => $domainname)); "domain" => $domainname
));
$row2 = $stmt->fetch(PDO::FETCH_ASSOC); $row2 = $stmt->fetch(PDO::FETCH_ASSOC);
if (isset($row2['customerid']) && $row2['customerid'] > 0) { if (isset($row2['customerid']) && $row2['customerid'] > 0) {
$loginname = getCustomerDetail($row2['customerid'], 'loginname'); $loginname = \Froxlor\Customer\Customer::getCustomerDetail($row2['customerid'], 'loginname');
if ($loginname !== false) { if ($loginname !== false) {
$stmt = Database::prepare("SELECT `loginname` AS `customer` FROM `" . TABLE_PANEL_CUSTOMERS . "` $stmt = Database::prepare("SELECT `loginname` AS `customer` FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE `loginname`= :loginname" WHERE `loginname`= :loginname");
); Database::pexecute($stmt, array(
Database::pexecute($stmt, array("loginname" => $loginname)); "loginname" => $loginname
));
$row3 = $stmt->fetch(PDO::FETCH_ASSOC); $row3 = $stmt->fetch(PDO::FETCH_ASSOC);
if ($row3['customer'] == $loginname) { if ($row3['customer'] == $loginname) {
$table = "`" . TABLE_PANEL_CUSTOMERS . "`"; $table = "`" . TABLE_PANEL_CUSTOMERS . "`";
@@ -69,29 +153,31 @@ if ($action == 'login') {
} }
} }
if ((hasUpdates($version) || hasDbUpdates($dbversion)) && $is_admin == false) { if ((\Froxlor\Froxlor::hasUpdates() || \Froxlor\Froxlor::hasDbUpdates()) && $is_admin == false) {
redirectTo('index.php'); \Froxlor\UI\Response::redirectTo('index.php');
exit; exit();
} }
if ($is_admin) { 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 . "` $stmt = Database::prepare("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "`
WHERE `loginname`= :loginname WHERE `loginname`= :loginname
AND `change_serversettings` = '1'" AND `change_serversettings` = '1'");
); Database::pexecute($stmt, array(
Database::pexecute($stmt, array("loginname" => $loginname)); "loginname" => $loginname
));
$row = $stmt->fetch(PDO::FETCH_ASSOC); $row = $stmt->fetch(PDO::FETCH_ASSOC);
if (!isset($row['admin'])) { if (! isset($row['admin'])) {
// not an admin who can see updates // not an admin who can see updates
redirectTo('index.php'); \Froxlor\UI\Response::redirectTo('index.php');
exit; exit();
} }
} else { } else {
$stmt = Database::prepare("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "` $stmt = Database::prepare("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "`
WHERE `loginname`= :loginname" WHERE `loginname`= :loginname");
); Database::pexecute($stmt, array(
Database::pexecute($stmt, array("loginname" => $loginname)); "loginname" => $loginname
));
$row = $stmt->fetch(PDO::FETCH_ASSOC); $row = $stmt->fetch(PDO::FETCH_ASSOC);
} }
@@ -101,193 +187,184 @@ if ($action == 'login') {
$adminsession = '1'; $adminsession = '1';
} else { } else {
// Log failed login // Log failed login
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => $_SERVER['REMOTE_ADDR'])); $rstlog = FroxlorLogger::getInstanceOf(array(
$rstlog->logAction(LOGIN_ACTION, LOG_WARNING, "Unknown user '" . $loginname . "' tried to login."); 'loginname' => $_SERVER['REMOTE_ADDR']
));
$rstlog->logAction(\Froxlor\FroxlorLogger::LOGIN_ACTION, LOG_WARNING, "Unknown user '" . $loginname . "' tried to login.");
redirectTo('index.php', array('showmessage' => '2')); \Froxlor\UI\Response::redirectTo('index.php', array(
exit; 'showmessage' => '2'
));
exit();
} }
} }
$userinfo_stmt = Database::prepare("SELECT * FROM $table $userinfo_stmt = Database::prepare("SELECT * FROM $table
WHERE `loginname`= :loginname" WHERE `loginname`= :loginname");
); Database::pexecute($userinfo_stmt, array(
Database::pexecute($userinfo_stmt, array("loginname" => $loginname)); "loginname" => $loginname
));
$userinfo = $userinfo_stmt->fetch(PDO::FETCH_ASSOC); $userinfo = $userinfo_stmt->fetch(PDO::FETCH_ASSOC);
if ($userinfo['loginfail_count'] >= Settings::Get('login.maxloginattempts') && $userinfo['lastlogin_fail'] > (time() - Settings::Get('login.deactivatetime'))) { if ($userinfo['loginfail_count'] >= Settings::Get('login.maxloginattempts') && $userinfo['lastlogin_fail'] > (time() - Settings::Get('login.deactivatetime'))) {
redirectTo('index.php', array('showmessage' => '3')); \Froxlor\UI\Response::redirectTo('index.php', array(
exit; 'showmessage' => '3'
} elseif (validatePasswordLogin($userinfo, $password, $table, $uid)) { ));
// only show "you're banned" if the login was successful exit();
// because we don't want to publish that the user does exist } elseif (\Froxlor\System\Crypt::validatePasswordLogin($userinfo, $password, $table, $uid)) {
if ($userinfo['deactivated']) { // only show "you're banned" if the login was successful
unset($userinfo); // because we don't want to publish that the user does exist
redirectTo('index.php', array('showmessage' => '5')); if ($userinfo['deactivated']) {
exit; unset($userinfo);
} else { \Froxlor\UI\Response::redirectTo('index.php', array(
// login correct 'showmessage' => '5'
// reset loginfail_counter, set lastlogin_succ ));
$stmt = Database::prepare("UPDATE $table exit();
} else {
// login correct
// reset loginfail_counter, set lastlogin_succ
$stmt = Database::prepare("UPDATE $table
SET `lastlogin_succ`= :lastlogin_succ, `loginfail_count`='0' SET `lastlogin_succ`= :lastlogin_succ, `loginfail_count`='0'
WHERE `$uid`= :uid" WHERE `$uid`= :uid");
); Database::pexecute($stmt, array(
Database::pexecute($stmt, array("lastlogin_succ" => time(), "uid" => $userinfo[$uid])); "lastlogin_succ" => time(),
$userinfo['userid'] = $userinfo[$uid]; "uid" => $userinfo[$uid]
$userinfo['adminsession'] = $adminsession; ));
} $userinfo['userid'] = $userinfo[$uid];
$userinfo['adminsession'] = $adminsession;
}
} else { } else {
// login incorrect // login incorrect
$stmt = Database::prepare("UPDATE $table $stmt = Database::prepare("UPDATE $table
SET `lastlogin_fail`= :lastlogin_fail, `loginfail_count`=`loginfail_count`+1 SET `lastlogin_fail`= :lastlogin_fail, `loginfail_count`=`loginfail_count`+1
WHERE `$uid`= :uid" WHERE `$uid`= :uid");
); Database::pexecute($stmt, array(
Database::pexecute($stmt, array("lastlogin_fail" => time(), "uid" => $userinfo[$uid])); "lastlogin_fail" => time(),
"uid" => $userinfo[$uid]
));
// Log failed login // Log failed login
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => $_SERVER['REMOTE_ADDR'])); $rstlog = FroxlorLogger::getInstanceOf(array(
$rstlog->logAction(LOGIN_ACTION, LOG_WARNING, "User '" . $loginname . "' tried to login with wrong password."); 'loginname' => $_SERVER['REMOTE_ADDR']
));
$rstlog->logAction(\Froxlor\FroxlorLogger::LOGIN_ACTION, LOG_WARNING, "User '" . $loginname . "' tried to login with wrong password.");
unset($userinfo); unset($userinfo);
redirectTo('index.php', array('showmessage' => '2')); \Froxlor\UI\Response::redirectTo('index.php', array(
exit; 'showmessage' => '2'
));
exit();
} }
if (isset($userinfo['userid']) && $userinfo['userid'] != '') { // 2FA activated
$s = md5(uniqid(microtime(), 1)); if (Settings::Get('2fa.enabled') == '1' && $userinfo['type_2fa'] > 0) {
// redirect to code-enter-page
if (isset($_POST['language'])) { $_SESSION['secret_2fa'] = ($userinfo['type_2fa'] == 2 ? $userinfo['data_2fa'] : 'email');
$language = validate($_POST['language'], 'language'); $_SESSION['uid_2fa'] = $userinfo[$uid];
if ($language == 'profile') { $_SESSION['uidfield_2fa'] = $uid;
$language = $userinfo['def_language']; $_SESSION['uidtable_2fa'] = $table;
} elseif (!isset($languages[$language])) { $_SESSION['unfo_2fa'] = $is_admin;
$language = Settings::Get('panel.standardlanguage'); // send mail if type_2fa = 1 (email)
} if ($userinfo['type_2fa'] == 1) {
} else { // generate code
$language = Settings::Get('panel.standardlanguage'); $tfa = new \Froxlor\FroxlorTwoFactorAuth('Froxlor');
} $code = $tfa->getCode($tfa->createSecret());
// set code for user
if (isset($userinfo['theme']) && $userinfo['theme'] != '') { $stmt = Database::prepare("UPDATE $table SET `data_2fa` = :d2fa WHERE `$uid` = :uid");
$theme = $userinfo['theme']; Database::pexecute($stmt, array(
} else { "d2fa" => $code,
$theme = Settings::Get('panel.default_theme'); "uid" => $userinfo[$uid]
} ));
// build up & send email
if (Settings::Get('session.allow_multiple_login') != '1') { $_mailerror = false;
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` $mailerr_msg = "";
WHERE `userid` = :uid $replace_arr = array(
AND `adminsession` = :adminsession" '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 try {
// Changed with #1287 to new method $mail->Subject = $lng['mails']['2fa']['subject'];
$theme_field = false; $mail->AltBody = $mail_body;
$stmt = Database::query("SHOW COLUMNS FROM panel_sessions LIKE 'theme'"); $mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $mail->AddAddress($userinfo['email'], \Froxlor\User::getCorrectUserSalutation($userinfo));
if ($row['Field'] == "theme") { $mail->Send();
$has_theme = true; } catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
$mailerr_msg = $e->getMessage();
$_mailerror = true;
} }
}
$params = array( if ($_mailerror) {
"hash" => $s, $rstlog = FroxlorLogger::getInstanceOf(array(
"userid" => $userinfo['userid'], 'loginname' => '2fa code-sending'
"ipaddress" => $remote_addr, ));
"useragent" => $http_user_agent, $rstlog->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
"lastactivity" => time(), \Froxlor\UI\Response::redirectTo('index.php', array(
"language" => $language, 'showmessage' => '4',
"adminsession" => $userinfo['adminsession'] 'customermail' => $userinfo['email']
); ));
exit();
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);
} }
$mail->ClearAddresses();
} }
} else { \Froxlor\UI\Response::redirectTo('index.php', array(
redirectTo('index.php', array('showmessage' => '2')); 'action' => '2fa_entercode'
));
exit();
} }
exit;
if (! finishLogin($userinfo)) {
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '2'
));
}
exit();
} else { } else {
$language_options = ''; $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)) { foreach ($languages as $language_file => $language_name) {
$language_options .= makeoption($language_name, $language_file, 'profile', true); $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 = ''; $message = '';
$successmessage = ''; $successmessage = '';
switch ($smessage) { switch ($smessage) {
case 1: case 1:
$successmessage = $lng['pwdreminder']['success']; $successmessage = $lng['pwdreminder']['success'];
break; break;
case 2: case 2:
$message = $lng['error']['login']; $message = $lng['error']['login'];
break; break;
case 3: case 3:
$message = sprintf($lng['error']['login_blocked'], Settings::Get('login.deactivatetime')); $message = sprintf($lng['error']['login_blocked'], Settings::Get('login.deactivatetime'));
break; break;
case 4: case 4:
$cmail = isset($_GET['customermail']) ? $_GET['customermail'] : 'unknown'; $cmail = isset($_GET['customermail']) ? $_GET['customermail'] : 'unknown';
$message = str_replace('%s', $cmail, $lng['error']['errorsendingmail']); $message = str_replace('%s', $cmail, $lng['error']['errorsendingmail']);
break; break;
case 5: case 5:
$message = $lng['error']['user_banned']; $message = $lng['error']['user_banned'];
break; break;
case 6: case 6:
$successmessage = $lng['pwdreminder']['changed']; $successmessage = $lng['pwdreminder']['changed'];
break; break;
case 7: case 7:
$message = $lng['pwdreminder']['wrongcode']; $message = $lng['pwdreminder']['wrongcode'];
break; break;
case 8: case 8:
$message = $lng['pwdreminder']['notallowed']; $message = $lng['pwdreminder']['notallowed'];
break; break;
} }
$update_in_progress = ''; $update_in_progress = '';
if (hasUpdates($version) || hasDbUpdates($dbversion)) { if (\Froxlor\Froxlor::hasUpdates() || \Froxlor\Froxlor::hasDbUpdates()) {
$update_in_progress = $lng['update']['updateinprogress_onlyadmincanlogin']; $update_in_progress = $lng['update']['updateinprogress_onlyadmincanlogin'];
} }
@@ -296,16 +373,16 @@ if ($action == 'login') {
if (isset($_REQUEST['script']) && $_REQUEST['script'] != "") { if (isset($_REQUEST['script']) && $_REQUEST['script'] != "") {
$lastscript = $_REQUEST['script']; $lastscript = $_REQUEST['script'];
if (!file_exists(__DIR__."/".$lastscript)) { if (! file_exists(__DIR__ . "/" . $lastscript)) {
$lastscript = ""; $lastscript = "";
} }
} }
$lastqrystr = ""; $lastqrystr = "";
if (isset($_REQUEST['qrystr']) && $_REQUEST['qrystr'] != "") { if (isset($_REQUEST['qrystr']) && $_REQUEST['qrystr'] != "") {
$lastqrystr = strip_tags($_REQUEST['qrystr']); $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 = ''; $message = '';
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$loginname = validate($_POST['loginname'], 'loginname'); $loginname = \Froxlor\Validate\Validate::validate($_POST['loginname'], 'loginname');
$email = validateEmail($_POST['loginemail'], 'email'); $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 . "` $result_stmt = Database::prepare("SELECT `adminid`, `customerid`, `customernumber`, `firstname`, `name`, `company`, `email`, `loginname`, `def_language`, `deactivated` FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE `loginname`= :loginname WHERE `loginname`= :loginname
AND `email`= :email" AND `email`= :email");
); Database::pexecute($result_stmt, array(
Database::pexecute($result_stmt, array("loginname" => $loginname, "email" => $email)); "loginname" => $loginname,
"email" => $email
));
if (Database::num_rows() == 0) { if (Database::num_rows() == 0) {
$result_stmt = Database::prepare("SELECT `adminid`, `name`, `email`, `loginname`, `def_language`, `deactivated` FROM `" . TABLE_PANEL_ADMINS . "` $result_stmt = Database::prepare("SELECT `adminid`, `name`, `email`, `loginname`, `def_language`, `deactivated` FROM `" . TABLE_PANEL_ADMINS . "`
WHERE `loginname`= :loginname WHERE `loginname`= :loginname
AND `email`= :email" AND `email`= :email");
); Database::pexecute($result_stmt, array(
Database::pexecute($result_stmt, array("loginname" => $loginname, "email" => $email)); "loginname" => $loginname,
"email" => $email
));
if (Database::num_rows() > 0) { if (Database::num_rows() > 0) {
$adminchecked = true; $adminchecked = true;
@@ -341,23 +422,24 @@ if ($action == 'forgotpwd') {
/* Check whether user is banned */ /* Check whether user is banned */
if ($user['deactivated']) { if ($user['deactivated']) {
redirectTo('index.php', array('showmessage' => '8')); \Froxlor\UI\Response::redirectTo('index.php', array(
exit; 'showmessage' => '8'
));
exit();
} }
if (($adminchecked && Settings::Get('panel.allow_preset_admin') == '1') || $adminchecked == false) { if (($adminchecked && Settings::Get('panel.allow_preset_admin') == '1') || $adminchecked == false) {
if ($user !== false) { if ($user !== false) {
// build a activation code // build a activation code
$timestamp = time(); $timestamp = time();
$first = substr(md5($user['loginname'] . $timestamp . randomStr(16)), 0, 15); $first = substr(md5($user['loginname'] . $timestamp . \Froxlor\PhpHelper::randomStr(16)), 0, 15);
$third = substr(md5($user['email'] . $timestamp . randomStr(16)), -15); $third = substr(md5($user['email'] . $timestamp . \Froxlor\PhpHelper::randomStr(16)), - 15);
$activationcode = $first . $timestamp . $third . substr(md5($third . $timestamp), 0, 10); $activationcode = $first . $timestamp . $third . substr(md5($third . $timestamp), 0, 10);
// Drop all existing activation codes for this user // Drop all existing activation codes for this user
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_ACTIVATION . "` $stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_ACTIVATION . "`
WHERE `userid` = :userid WHERE `userid` = :userid
AND `admin` = :admin" AND `admin` = :admin");
);
$params = array( $params = array(
"userid" => $adminchecked ? $user['adminid'] : $user['customerid'], "userid" => $adminchecked ? $user['adminid'] : $user['customerid'],
"admin" => $adminchecked ? 1 : 0 "admin" => $adminchecked ? 1 : 0
@@ -367,8 +449,7 @@ if ($action == 'forgotpwd') {
// Add new activation code to database // Add new activation code to database
$stmt = Database::prepare("INSERT INTO `" . TABLE_PANEL_ACTIVATION . "` $stmt = Database::prepare("INSERT INTO `" . TABLE_PANEL_ACTIVATION . "`
(userid, admin, creation, activationcode) (userid, admin, creation, activationcode)
VALUES (:userid, :admin, :creation, :activationcode)" VALUES (:userid, :admin, :creation, :activationcode)");
);
$params = array( $params = array(
"userid" => $adminchecked ? $user['adminid'] : $user['customerid'], "userid" => $adminchecked ? $user['adminid'] : $user['customerid'],
"admin" => $adminchecked ? 1 : 0, "admin" => $adminchecked ? 1 : 0,
@@ -377,11 +458,13 @@ if ($action == 'forgotpwd') {
); );
Database::pexecute($stmt, $params); Database::pexecute($stmt, $params);
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset')); $rstlog = FroxlorLogger::getInstanceOf(array(
$rstlog->logAction(USR_ACTION, LOG_WARNING, "User '" . $user['loginname'] . "' requested a link for setting a new password."); '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 // 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 // this can be a fixed value to avoid potential exploiting by modifying headers
$host = Settings::Get('system.hostname'); // $_SERVER['HTTP_HOST']; $host = Settings::Get('system.hostname'); // $_SERVER['HTTP_HOST'];
$port = $_SERVER['SERVER_PORT'] != 80 ? ':' . $_SERVER['SERVER_PORT'] : ''; $port = $_SERVER['SERVER_PORT'] != 80 ? ':' . $_SERVER['SERVER_PORT'] : '';
@@ -392,12 +475,16 @@ if ($action == 'forgotpwd') {
// there can be only one script to handle this so we can use a fixed value here // there can be only one script to handle this so we can use a fixed value here
$script = "/index.php"; // $_SERVER['SCRIPT_NAME']; $script = "/index.php"; // $_SERVER['SCRIPT_NAME'];
if (Settings::Get('system.froxlordirectlyviahostname') == 0) { if (Settings::Get('system.froxlordirectlyviahostname') == 0) {
$script = makeCorrectFile("/".basename(__DIR__)."/".$script); $script = \Froxlor\FileDir::makeCorrectFile("/" . basename(__DIR__) . "/" . $script);
} }
$activationlink = $protocol . '://' . $host . $port . $script . '?action=resetpwd&resetcode=' . $activationcode; $activationlink = $protocol . '://' . $host . $port . $script . '?action=resetpwd&resetcode=' . $activationcode;
$replace_arr = array( $replace_arr = array(
'SALUTATION' => getCorrectUserSalutation($user), 'SALUTATION' => \Froxlor\User::getCorrectUserSalutation($user),
'NAME' => $user['name'],
'FIRSTNAME' => $user['firstname'] ?? "",
'COMPANY' => $user['company'] ?? "",
'CUSTOMER_NO' => $user['customernumber'] ?? 0,
'USERNAME' => $loginname, 'USERNAME' => $loginname,
'LINK' => $activationlink 'LINK' => $activationlink
); );
@@ -407,30 +494,35 @@ if ($action == 'forgotpwd') {
WHERE `adminid`= :adminid WHERE `adminid`= :adminid
AND `language`= :lang AND `language`= :lang
AND `templategroup`=\'mails\' AND `templategroup`=\'mails\'
AND `varname`=\'password_reset_subject\'' AND `varname`=\'password_reset_subject\'');
); Database::pexecute($result_stmt, array(
Database::pexecute($result_stmt, array("adminid" => $user['adminid'], "lang" => $def_language)); "adminid" => $user['adminid'],
"lang" => $def_language
));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC); $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 . '` $result_stmt = Database::prepare('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '`
WHERE `adminid`= :adminid WHERE `adminid`= :adminid
AND `language`= :lang AND `language`= :lang
AND `templategroup`=\'mails\' AND `templategroup`=\'mails\'
AND `varname`=\'password_reset_mailbody\'' AND `varname`=\'password_reset_mailbody\'');
); Database::pexecute($result_stmt, array(
Database::pexecute($result_stmt, array("adminid" => $user['adminid'], "lang" => $def_language)); "adminid" => $user['adminid'],
"lang" => $def_language
));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC); $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; $_mailerror = false;
$mailerr_msg = "";
try { try {
$mail->Subject = $mail_subject; $mail->Subject = $mail_subject;
$mail->AltBody = $mail_body; $mail->AltBody = $mail_body;
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body)); $mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
$mail->AddAddress($user['email'], getCorrectUserSalutation($user)); $mail->AddAddress($user['email'], \Froxlor\User::getCorrectUserSalutation($user));
$mail->Send(); $mail->Send();
} catch(phpmailerException $e) { } catch (\PHPMailer\PHPMailer\Exception $e) {
$mailerr_msg = $e->errorMessage(); $mailerr_msg = $e->errorMessage();
$_mailerror = true; $_mailerror = true;
} catch (Exception $e) { } catch (Exception $e) {
@@ -439,18 +531,27 @@ if ($action == 'forgotpwd') {
} }
if ($_mailerror) { if ($_mailerror) {
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset')); $rstlog = FroxlorLogger::getInstanceOf(array(
$rstlog->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg); 'loginname' => 'password_reset'
redirectTo('index.php', array('showmessage' => '4', 'customermail' => $user['email'])); ));
exit; $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(); $mail->ClearAddresses();
redirectTo('index.php', array('showmessage' => '1')); \Froxlor\UI\Response::redirectTo('index.php', array(
exit; 'showmessage' => '1'
));
exit();
} else { } else {
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset')); $rstlog = FroxlorLogger::getInstanceOf(array(
$rstlog->logAction(USR_ACTION, LOG_WARNING, "User '" . $loginname . "' requested to set a new password, but was not found in database!"); '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']; $message = $lng['login']['combination_not_found'];
} }
@@ -464,7 +565,7 @@ if ($action == 'forgotpwd') {
if ($adminchecked) { if ($adminchecked) {
if (Settings::Get('panel.allow_preset_admin') != '1') { if (Settings::Get('panel.allow_preset_admin') != '1') {
$message = $lng['pwdreminder']['notallowed']; $message = $lng['pwdreminder']['notallowed'];
unset ($adminchecked); unset($adminchecked);
} }
} else { } else {
if (Settings::Get('panel.allow_preset') != '1') { if (Settings::Get('panel.allow_preset') != '1') {
@@ -472,7 +573,7 @@ if ($action == 'forgotpwd') {
} }
} }
eval("echo \"" . getTemplate('fpwd') . "\";"); eval("echo \"" . \Froxlor\UI\Template::getTemplate('fpwd') . "\";");
} }
if ($action == 'resetpwd') { if ($action == 'resetpwd') {
@@ -480,9 +581,10 @@ if ($action == 'resetpwd') {
// Remove old activation codes // Remove old activation codes
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_ACTIVATION . "` $stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_ACTIVATION . "`
WHERE creation < :oldest" WHERE creation < :oldest");
); Database::pexecute($stmt, array(
Database::pexecute($stmt, array("oldest" => time() - 86400)); "oldest" => time() - 86400
));
if (isset($_GET['resetcode']) && strlen($_GET['resetcode']) == 50) { if (isset($_GET['resetcode']) && strlen($_GET['resetcode']) == 50) {
// Check if activation code is valid // Check if activation code is valid
@@ -494,63 +596,170 @@ if ($action == 'resetpwd') {
if (substr(md5($third . $timestamp), 0, 10) == $check && $timestamp >= time() - 86400) { if (substr(md5($third . $timestamp), 0, 10) == $check && $timestamp >= time() - 86400) {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if (isset($_POST['send']) && $_POST['send'] == 'send') {
$stmt = Database::prepare("SELECT `userid`, `admin` FROM `" . TABLE_PANEL_ACTIVATION . "` $stmt = Database::prepare("SELECT `userid`, `admin` FROM `" . TABLE_PANEL_ACTIVATION . "`
WHERE `activationcode` = :activationcode" WHERE `activationcode` = :activationcode");
); $result = Database::pexecute_first($stmt, array(
$result = Database::pexecute_first($stmt, array("activationcode" => $activationcode)); "activationcode" => $activationcode
));
if ($result !== false) { if ($result !== false) {
if ($result['admin'] == 1) { try {
$new_password = validate($_POST['new_password'], 'new password'); $new_password = \Froxlor\System\Crypt::validatePassword($_POST['new_password'], true);
$new_password_confirm = validate($_POST['new_password_confirm'], 'new password confirm'); $new_password_confirm = \Froxlor\System\Crypt::validatePassword($_POST['new_password_confirm'], true);
} else { } catch (Exception $e) {
$new_password = validatePassword($_POST['new_password'], 'new password'); $message = $e->getMessage();
$new_password_confirm = validatePassword($_POST['new_password_confirm'], 'new password confirm');
} }
if ($new_password == '') { if (empty($message) && (empty($new_password) || $new_password != $new_password_confirm)) {
$message = $new_password; $message = $lng['error']['newpasswordconfirmerror'];
} elseif ($new_password_confirm == '') { }
$message = $new_password_confirm;
} elseif ($new_password != $new_password_confirm) { if (empty($message)) {
$message = $new_password . " != " . $new_password_confirm;
} else {
// Update user password // Update user password
if ($result['admin'] == 1) { if ($result['admin'] == 1) {
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_ADMINS . "` $stmt = Database::prepare("UPDATE `" . TABLE_PANEL_ADMINS . "`
SET `password` = :newpassword SET `password` = :newpassword
WHERE `adminid` = :userid" WHERE `adminid` = :userid");
);
} else { } else {
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` $stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "`
SET `password` = :newpassword 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 = FroxlorLogger::getInstanceOf(array(
$rstlog->logAction(USR_ACTION, LOG_NOTICE, "changed password using password reset."); 'loginname' => 'password_reset'
));
$rstlog->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "changed password using password reset.");
// Remove activation code from DB // Remove activation code from DB
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_ACTIVATION . "` $stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_ACTIVATION . "`
WHERE `activationcode` = :activationcode WHERE `activationcode` = :activationcode
AND `userid` = :userid" AND `userid` = :userid");
); Database::pexecute($stmt, array(
Database::pexecute($stmt, array("activationcode" => $activationcode, "userid" => $result['userid'])); "activationcode" => $activationcode,
redirectTo('index.php', array("showmessage" => '6')); "userid" => $result['userid']
));
\Froxlor\UI\Response::redirectTo('index.php', array(
"showmessage" => '6'
));
} }
} else { } 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 { } else {
redirectTo('index.php', array("showmessage" => '7')); \Froxlor\UI\Response::redirectTo('index.php', array(
"showmessage" => '7'
));
} }
} else { } 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,22 +8,22 @@ CREATE TABLE `ftp_groups` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `groupname` (`groupname`), UNIQUE KEY `groupname` (`groupname`),
KEY `customerid` (`customerid`) KEY `customerid` (`customerid`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `ftp_users`; DROP TABLE IF EXISTS `ftp_users`;
CREATE TABLE `ftp_users` ( CREATE TABLE `ftp_users` (
`id` int(20) NOT NULL auto_increment, `id` int(20) NOT NULL auto_increment,
`username` varchar(255) NOT NULL default '', `username` varchar(255) NOT NULL,
`uid` int(5) NOT NULL default '0', `uid` int(5) NOT NULL default '0',
`gid` int(5) NOT NULL default '0', `gid` int(5) NOT NULL default '0',
`password` varchar(128) NOT NULL default '', `password` varchar(128) NOT NULL,
`homedir` varchar(255) NOT NULL default '', `homedir` varchar(255) NOT NULL default '',
`shell` varchar(255) NOT NULL default '/bin/false', `shell` varchar(255) NOT NULL default '/bin/false',
`login_enabled` enum('N','Y') NOT NULL default 'N', `login_enabled` enum('N','Y') NOT NULL default 'N',
`login_count` int(15) NOT NULL default '0', `login_count` int(15) NOT NULL default '0',
`last_login` datetime NOT NULL default '0000-00-00 00:00:00', `last_login` datetime default NULL,
`up_count` int(15) NOT NULL default '0', `up_count` int(15) NOT NULL default '0',
`up_bytes` bigint(30) NOT NULL default '0', `up_bytes` bigint(30) NOT NULL default '0',
`down_count` int(15) NOT NULL default '0', `down_count` int(15) NOT NULL default '0',
@@ -33,7 +33,7 @@ CREATE TABLE `ftp_users` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`), UNIQUE KEY `username` (`username`),
KEY `customerid` (`customerid`) 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', `mboxsize` bigint(30) NOT NULL default '0',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`) 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, `id` int(11) NOT NULL auto_increment,
`email` varchar(255) NOT NULL default '', `email` varchar(255) NOT NULL default '',
`email_full` varchar(255) NOT NULL default '', `email_full` varchar(255) NOT NULL default '',
`destination` text NOT NULL, `destination` text,
`domainid` int(11) NOT NULL default '0', `domainid` int(11) NOT NULL default '0',
`customerid` int(11) NOT NULL default '0', `customerid` int(11) NOT NULL default '0',
`popaccountid` int(11) NOT NULL default '0', `popaccountid` int(11) NOT NULL default '0',
`iscatchall` tinyint(1) unsigned NOT NULL default '0', `iscatchall` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `email` (`email`) 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`; DROP TABLE IF EXISTS `panel_activation`;
@@ -84,18 +84,18 @@ CREATE TABLE `panel_activation` (
`creation` int(11) unsigned NOT NULL default '0', `creation` int(11) unsigned NOT NULL default '0',
`activationcode` varchar(50) default NULL, `activationcode` varchar(50) default NULL,
PRIMARY KEY (id) 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`; DROP TABLE IF EXISTS `panel_admins`;
CREATE TABLE `panel_admins` ( CREATE TABLE `panel_admins` (
`adminid` int(11) unsigned NOT NULL auto_increment, `adminid` int(11) unsigned NOT NULL auto_increment,
`loginname` varchar(50) NOT NULL default '', `loginname` varchar(50) NOT NULL,
`password` varchar(255) NOT NULL default '', `password` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL default '', `name` varchar(255) NOT NULL default '',
`email` varchar(255) NOT NULL default '', `email` varchar(255) NOT NULL default '',
`def_language` varchar(255) NOT NULL default '', `def_language` varchar(100) NOT NULL default '',
`ip` tinyint(4) NOT NULL default '-1', `ip` varchar(500) NOT NULL default '-1',
`customers` int(15) NOT NULL default '0', `customers` int(15) NOT NULL default '0',
`customers_used` int(15) NOT NULL default '0', `customers_used` int(15) NOT NULL default '0',
`customers_see_all` tinyint(1) NOT NULL default '0', `customers_see_all` tinyint(1) NOT NULL default '0',
@@ -118,9 +118,6 @@ CREATE TABLE `panel_admins` (
`email_quota_used` bigint(13) NOT NULL default '0', `email_quota_used` bigint(13) NOT NULL default '0',
`ftps` int(15) NOT NULL default '0', `ftps` int(15) NOT NULL default '0',
`ftps_used` 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` int(15) NOT NULL default '0',
`subdomains_used` int(15) NOT NULL default '0', `subdomains_used` int(15) NOT NULL default '0',
`traffic` bigint(30) NOT NULL default '0', `traffic` bigint(30) NOT NULL default '0',
@@ -130,19 +127,22 @@ CREATE TABLE `panel_admins` (
`lastlogin_fail` int(11) unsigned NOT NULL default '0', `lastlogin_fail` int(11) unsigned NOT NULL default '0',
`loginfail_count` int(11) unsigned NOT NULL default '0', `loginfail_count` int(11) unsigned NOT NULL default '0',
`reportsent` tinyint(4) unsigned NOT NULL default '0', `reportsent` tinyint(4) unsigned NOT NULL default '0',
`theme` varchar(255) NOT NULL default 'Sparkle', `theme` varchar(50) NOT NULL default 'Sparkle',
`custom_notes` text, `custom_notes` text,
`custom_notes_show` tinyint(1) NOT NULL default '0', `custom_notes_show` tinyint(1) NOT NULL default '0',
`type_2fa` tinyint(1) NOT NULL default '0',
`data_2fa` varchar(25) NOT NULL default '',
`api_allowed` tinyint(1) NOT NULL default '1',
PRIMARY KEY (`adminid`), PRIMARY KEY (`adminid`),
UNIQUE KEY `loginname` (`loginname`) UNIQUE KEY `loginname` (`loginname`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_customers`; DROP TABLE IF EXISTS `panel_customers`;
CREATE TABLE `panel_customers` ( CREATE TABLE `panel_customers` (
`customerid` int(11) unsigned NOT NULL auto_increment, `customerid` int(11) unsigned NOT NULL auto_increment,
`loginname` varchar(50) NOT NULL default '', `loginname` varchar(50) NOT NULL,
`password` varchar(255) NOT NULL default '', `password` varchar(255) NOT NULL default '',
`adminid` int(11) unsigned NOT NULL default '0', `adminid` int(11) unsigned NOT NULL default '0',
`name` varchar(255) NOT NULL default '', `name` varchar(255) NOT NULL default '',
@@ -150,13 +150,13 @@ CREATE TABLE `panel_customers` (
`gender` int(1) NOT NULL DEFAULT '0', `gender` int(1) NOT NULL DEFAULT '0',
`company` varchar(255) NOT NULL default '', `company` varchar(255) NOT NULL default '',
`street` varchar(255) NOT NULL default '', `street` varchar(255) NOT NULL default '',
`zipcode` varchar(255) NOT NULL default '', `zipcode` varchar(25) NOT NULL default '',
`city` varchar(255) NOT NULL default '', `city` varchar(255) NOT NULL default '',
`phone` varchar(255) NOT NULL default '', `phone` varchar(50) NOT NULL default '',
`fax` varchar(255) NOT NULL default '', `fax` varchar(50) NOT NULL default '',
`email` varchar(255) NOT NULL default '', `email` varchar(255) NOT NULL default '',
`customernumber` varchar(255) NOT NULL default '', `customernumber` varchar(255) NOT NULL default '',
`def_language` varchar(255) NOT NULL default '', `def_language` varchar(100) NOT NULL default '',
`diskspace` bigint(30) NOT NULL default '0', `diskspace` bigint(30) NOT NULL default '0',
`diskspace_used` bigint(30) NOT NULL default '0', `diskspace_used` bigint(30) NOT NULL default '0',
`mysqls` int(15) NOT NULL default '0', `mysqls` int(15) NOT NULL default '0',
@@ -171,8 +171,6 @@ CREATE TABLE `panel_customers` (
`email_quota_used` bigint(13) NOT NULL default '0', `email_quota_used` bigint(13) NOT NULL default '0',
`ftps` int(15) NOT NULL default '0', `ftps` int(15) NOT NULL default '0',
`ftps_used` 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` int(15) NOT NULL default '0',
`subdomains_used` int(15) NOT NULL default '0', `subdomains_used` int(15) NOT NULL default '0',
`traffic` bigint(30) NOT NULL default '0', `traffic` bigint(30) NOT NULL default '0',
@@ -191,14 +189,21 @@ CREATE TABLE `panel_customers` (
`pop3` tinyint(1) NOT NULL default '1', `pop3` tinyint(1) NOT NULL default '1',
`imap` tinyint(1) NOT NULL default '1', `imap` tinyint(1) NOT NULL default '1',
`perlenabled` tinyint(1) NOT NULL default '0', `perlenabled` tinyint(1) NOT NULL default '0',
`theme` varchar(255) NOT NULL default 'Sparkle', `dnsenabled` tinyint(1) NOT NULL default '0',
`theme` varchar(50) NOT NULL default 'Sparkle',
`custom_notes` text, `custom_notes` text,
`custom_notes_show` tinyint(1) NOT NULL default '0', `custom_notes_show` tinyint(1) NOT NULL default '0',
`lepublickey` mediumtext DEFAULT NULL, `lepublickey` mediumtext default NULL,
`leprivatekey` mediumtext DEFAULT NULL, `leprivatekey` mediumtext default NULL,
`leregistered` tinyint(1) NOT NULL default '0',
`allowed_phpconfigs` varchar(500) NOT NULL default '',
`type_2fa` tinyint(1) NOT NULL default '0',
`data_2fa` varchar(25) NOT NULL default '',
`api_allowed` tinyint(1) NOT NULL default '1',
`logviewenabled` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`customerid`), PRIMARY KEY (`customerid`),
UNIQUE KEY `loginname` (`loginname`) UNIQUE KEY `loginname` (`loginname`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -211,14 +216,15 @@ CREATE TABLE `panel_databases` (
`dbserver` int(11) unsigned NOT NULL default '0', `dbserver` int(11) unsigned NOT NULL default '0',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `customerid` (`customerid`) KEY `customerid` (`customerid`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_domains`; DROP TABLE IF EXISTS `panel_domains`;
CREATE TABLE `panel_domains` ( CREATE TABLE `panel_domains` (
`id` int(11) unsigned NOT NULL auto_increment, `id` int(11) unsigned NOT NULL auto_increment,
`domain` varchar(255) NOT NULL default '', `domain` varchar(255) NOT NULL,
`domain_ace` varchar(255) NOT NULL default '',
`adminid` int(11) unsigned NOT NULL default '0', `adminid` int(11) unsigned NOT NULL default '0',
`customerid` int(11) unsigned NOT NULL default '0', `customerid` int(11) unsigned NOT NULL default '0',
`aliasdomain` int(11) unsigned NULL, `aliasdomain` int(11) unsigned NULL,
@@ -236,16 +242,19 @@ CREATE TABLE `panel_domains` (
`dkim_pubkey` text, `dkim_pubkey` text,
`wwwserveralias` tinyint(1) NOT NULL default '1', `wwwserveralias` tinyint(1) NOT NULL default '1',
`parentdomainid` int(11) NOT NULL default '0', `parentdomainid` int(11) NOT NULL default '0',
`phpenabled` tinyint(1) NOT NULL default '0',
`openbasedir` tinyint(1) NOT NULL default '0', `openbasedir` tinyint(1) NOT NULL default '0',
`openbasedir_path` tinyint(1) NOT NULL default '0', `openbasedir_path` tinyint(1) NOT NULL default '0',
`speciallogfile` tinyint(1) NOT NULL default '0', `speciallogfile` tinyint(1) NOT NULL default '0',
`ssl_redirect` tinyint(4) NOT NULL default '0', `ssl_redirect` tinyint(4) NOT NULL default '0',
`specialsettings` text, `specialsettings` text,
`ssl_specialsettings` text,
`include_specialsettings` tinyint(1) NOT NULL default '0',
`deactivated` tinyint(1) NOT NULL default '0', `deactivated` tinyint(1) NOT NULL default '0',
`bindserial` varchar(10) NOT NULL default '2000010100', `bindserial` varchar(10) NOT NULL default '2000010100',
`add_date` int( 11 ) NOT NULL default '0', `add_date` int( 11 ) NOT NULL default '0',
`registration_date` date NOT NULL, `registration_date` date DEFAULT NULL,
`termination_date` date NOT NULL, `termination_date` date DEFAULT NULL,
`phpsettingid` INT( 11 ) UNSIGNED NOT NULL DEFAULT '1', `phpsettingid` INT( 11 ) UNSIGNED NOT NULL DEFAULT '1',
`mod_fcgid_starter` int(4) default '-1', `mod_fcgid_starter` int(4) default '-1',
`mod_fcgid_maxrequests` int(4) default '-1', `mod_fcgid_maxrequests` int(4) default '-1',
@@ -253,19 +262,31 @@ CREATE TABLE `panel_domains` (
`letsencrypt` tinyint(1) NOT NULL default '0', `letsencrypt` tinyint(1) NOT NULL default '0',
`hsts` varchar(10) NOT NULL default '0', `hsts` varchar(10) NOT NULL default '0',
`hsts_sub` tinyint(1) NOT NULL default '0', `hsts_sub` tinyint(1) NOT NULL default '0',
`hsts_preload` tinyint(1) NOT NULL default '1', `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',
`override_tls` tinyint(1) DEFAULT '0',
`ssl_protocols` text,
`ssl_cipher_list` text,
`tlsv13_cipher_list` text,
`ssl_enabled` tinyint(1) DEFAULT '1',
`ssl_honorcipherorder` tinyint(1) DEFAULT '0',
`ssl_sessiontickets` tinyint(1) DEFAULT '1',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `customerid` (`customerid`), KEY `customerid` (`customerid`),
KEY `parentdomain` (`parentdomainid`), KEY `parentdomain` (`parentdomainid`),
KEY `domain` (`domain`) KEY `domain` (`domain`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_ipsandports`; DROP TABLE IF EXISTS `panel_ipsandports`;
CREATE TABLE `panel_ipsandports` ( CREATE TABLE `panel_ipsandports` (
`id` int(11) unsigned NOT NULL auto_increment, `id` int(11) unsigned NOT NULL auto_increment,
`ip` varchar(39) NOT NULL default '', `ip` varchar(39) NOT NULL,
`port` int(5) NOT NULL default '80', `port` int(5) NOT NULL default '80',
`listen_statement` tinyint(1) NOT NULL default '0', `listen_statement` tinyint(1) NOT NULL default '0',
`namevirtualhost_statement` tinyint(1) NOT NULL default '0', `namevirtualhost_statement` tinyint(1) NOT NULL default '0',
@@ -273,14 +294,19 @@ CREATE TABLE `panel_ipsandports` (
`vhostcontainer_servername_statement` tinyint(1) NOT NULL default '0', `vhostcontainer_servername_statement` tinyint(1) NOT NULL default '0',
`specialsettings` text, `specialsettings` text,
`ssl` tinyint(4) NOT NULL default '0', `ssl` tinyint(4) NOT NULL default '0',
`ssl_cert_file` varchar(255) NOT NULL, `ssl_cert_file` varchar(255) NOT NULL default '',
`ssl_key_file` varchar(255) NOT NULL, `ssl_key_file` varchar(255) NOT NULL default '',
`ssl_ca_file` varchar(255) NOT NULL, `ssl_ca_file` varchar(255) NOT NULL default '',
`default_vhostconf_domain` text, `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 '', `docroot` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`) `ssl_specialsettings` text,
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; `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;
@@ -296,7 +322,7 @@ CREATE TABLE `panel_htaccess` (
`error401path` varchar(255) NOT NULL default '', `error401path` varchar(255) NOT NULL default '',
`options_cgi` tinyint(1) NOT NULL default '0', `options_cgi` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -310,7 +336,7 @@ CREATE TABLE `panel_htpasswds` (
`authname` varchar(255) NOT NULL default 'Restricted Area', `authname` varchar(255) NOT NULL default 'Restricted Area',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `customerid` (`customerid`) KEY `customerid` (`customerid`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -339,7 +365,7 @@ CREATE TABLE `panel_settings` (
`varname` varchar(255) NOT NULL default '', `varname` varchar(255) NOT NULL default '',
`value` text NOT NULL, `value` text NOT NULL,
PRIMARY KEY (`settingid`) 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 INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('catchall', 'catchall_enabled', '1'), ('catchall', 'catchall_enabled', '1'),
@@ -351,17 +377,6 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('customer', 'ftpatdomain', '0'), ('customer', 'ftpatdomain', '0'),
('customer', 'show_news_feed', '0'), ('customer', 'show_news_feed', '0'),
('customer', 'news_feed_url', ''), ('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', 'enabled', '1'),
('logger', 'log_cron', '0'), ('logger', 'log_cron', '0'),
('logger', 'logfile', ''), ('logger', 'logfile', ''),
@@ -375,20 +390,18 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('admin', 'show_news_feed', '0'), ('admin', 'show_news_feed', '0'),
('admin', 'show_version_login', '0'), ('admin', 'show_version_login', '0'),
('admin', 'show_version_footer', '0'), ('admin', 'show_version_footer', '0'),
('caa', 'caa_entry', ''),
('spf', 'use_spf', '0'), ('spf', 'use_spf', '0'),
('spf', 'spf_entry', '@ IN TXT "v=spf1 a mx -all"'), ('spf', 'spf_entry', '"v=spf1 a mx -all"'),
('dkim', 'dkim_algorithm', 'all'), ('dkim', 'dkim_algorithm', 'all'),
('dkim', 'dkim_add_adsp', '1'),
('dkim', 'dkim_keylength', '1024'), ('dkim', 'dkim_keylength', '1024'),
('dkim', 'dkim_servicetype', '0'), ('dkim', 'dkim_servicetype', '0'),
('dkim', 'dkim_add_adsppolicy', '1'),
('dkim', 'dkim_notes', ''), ('dkim', 'dkim_notes', ''),
('defaultwebsrverrhandler', 'enabled', '0'), ('defaultwebsrverrhandler', 'enabled', '0'),
('defaultwebsrverrhandler', 'err401', ''), ('defaultwebsrverrhandler', 'err401', ''),
('defaultwebsrverrhandler', 'err403', ''), ('defaultwebsrverrhandler', 'err403', ''),
('defaultwebsrverrhandler', 'err404', ''), ('defaultwebsrverrhandler', 'err404', ''),
('defaultwebsrverrhandler', 'err500', ''), ('defaultwebsrverrhandler', 'err500', ''),
('ticket', 'default_priority', '2'),
('customredirect', 'enabled', '1'), ('customredirect', 'enabled', '1'),
('customredirect', 'default', '1'), ('customredirect', 'default', '1'),
('perl', 'suexecworkaround', '0'), ('perl', 'suexecworkaround', '0'),
@@ -397,25 +410,113 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('login', 'maxloginattempts', '3'), ('login', 'maxloginattempts', '3'),
('login', 'deactivatetime', '900'), ('login', 'deactivatetime', '900'),
('phpfpm', 'enabled', '0'), ('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', 'tmpdir', '/var/customers/tmp/'),
('phpfpm', 'peardir', '/usr/share/php/:/usr/share/php5/'), ('phpfpm', 'peardir', '/usr/share/php/:/usr/share/php5/'),
('phpfpm', 'envpath', '/usr/local/bin:/usr/bin:/bin'),
('phpfpm', 'enabled_ownvhost', '0'), ('phpfpm', 'enabled_ownvhost', '0'),
('phpfpm', 'vhost_httpuser', 'froxlorlocal'), ('phpfpm', 'vhost_httpuser', 'froxlorlocal'),
('phpfpm', 'vhost_httpgroup', 'froxlorlocal'), ('phpfpm', 'vhost_httpgroup', 'froxlorlocal'),
('phpfpm', 'idle_timeout', '30'),
('phpfpm', 'aliasconfigdir', '/var/www/php-fpm/'), ('phpfpm', 'aliasconfigdir', '/var/www/php-fpm/'),
('phpfpm', 'defaultini', '1'), ('phpfpm', 'defaultini', '1'),
('phpfpm', 'vhost_defaultini', '2'), ('phpfpm', 'vhost_defaultini', '2'),
('phpfpm', 'fastcgi_ipcdir', '/var/lib/apache2/fastcgi/'), ('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'), ('nginx', 'fastcgiparams', '/etc/nginx/fastcgi_params'),
('system', 'lastaccountnumber', '0'), ('system', 'lastaccountnumber', '0'),
('system', 'lastguid', '9999'), ('system', 'lastguid', '9999'),
@@ -435,9 +536,10 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('system', 'mysql_access_host', 'localhost'), ('system', 'mysql_access_host', 'localhost'),
('system', 'lastcronrun', ''), ('system', 'lastcronrun', ''),
('system', 'defaultip', '1'), ('system', 'defaultip', '1'),
('system', 'defaultsslip', ''),
('system', 'phpappendopenbasedir', '/tmp/'), ('system', 'phpappendopenbasedir', '/tmp/'),
('system', 'deactivateddocroot', ''), ('system', 'deactivateddocroot', ''),
('system', 'mailpwcleartext', '1'), ('system', 'mailpwcleartext', '0'),
('system', 'last_tasks_run', '000000'), ('system', 'last_tasks_run', '000000'),
('system', 'nameservers', ''), ('system', 'nameservers', ''),
('system', 'mxservers', ''), ('system', 'mxservers', ''),
@@ -452,6 +554,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('system', 'ssl_cert_file', '/etc/apache2/apache2.pem'), ('system', 'ssl_cert_file', '/etc/apache2/apache2.pem'),
('system', 'use_ssl', '0'), ('system', 'use_ssl', '0'),
('system', 'default_vhostconf', ''), ('system', 'default_vhostconf', ''),
('system', 'default_sslvhostconf', ''),
('system', 'mail_quota_enabled', '0'), ('system', 'mail_quota_enabled', '0'),
('system', 'mail_quota', '100'), ('system', 'mail_quota', '100'),
('system', 'webalizer_enabled', '1'), ('system', 'webalizer_enabled', '1'),
@@ -471,10 +574,12 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('system', 'stdsubdomain', ''), ('system', 'stdsubdomain', ''),
('system', 'awstats_path', '/usr/bin/'), ('system', 'awstats_path', '/usr/bin/'),
('system', 'awstats_conf', '/etc/awstats/'), ('system', 'awstats_conf', '/etc/awstats/'),
('system', 'awstats_logformat', '1'),
('system', 'defaultttl', '604800'), ('system', 'defaultttl', '604800'),
('system', 'mod_fcgid_defaultini', '1'), ('system', 'mod_fcgid_defaultini', '1'),
('system', 'ftpserver', 'proftpd'), ('system', 'ftpserver', 'proftpd'),
('system', 'dns_createmailentry', '0'), ('system', 'dns_createmailentry', '0'),
('system', 'dns_createcaaentry', '1'),
('system', 'froxlordirectlyviahostname', '0'), ('system', 'froxlordirectlyviahostname', '0'),
('system', 'report_enable', '1'), ('system', 'report_enable', '1'),
('system', 'report_webmax', '90'), ('system', 'report_webmax', '90'),
@@ -495,9 +600,11 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('system', 'ssl_cert_chainfile', ''), ('system', 'ssl_cert_chainfile', ''),
('system', 'ssl_cipher_list', 'ECDH+AESGCM:ECDH+AES256:!aNULL:!MD5:!DSS:!DH:!AES128'), ('system', 'ssl_cipher_list', 'ECDH+AESGCM:ECDH+AES256:!aNULL:!MD5:!DSS:!DH:!AES128'),
('system', 'nginx_php_backend', '127.0.0.1:8888'), ('system', 'nginx_php_backend', '127.0.0.1:8888'),
('system', 'http2_support', '0'),
('system', 'perl_server', 'unix:/var/run/nginx/cgiwrap-dispatch.sock'), ('system', 'perl_server', 'unix:/var/run/nginx/cgiwrap-dispatch.sock'),
('system', 'phpreload_command', ''), ('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', 'documentroot_use_default_value', '0'),
('system', 'passwordcryptfunc', '3'), ('system', 'passwordcryptfunc', '3'),
('system', 'axfrservers', ''), ('system', 'axfrservers', ''),
@@ -520,11 +627,53 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('system', 'lepublickey', 'unset'), ('system', 'lepublickey', 'unset'),
('system', 'letsencryptca', 'production'), ('system', 'letsencryptca', 'production'),
('system', 'letsencryptcountrycode', 'DE'), ('system', 'letsencryptcountrycode', 'DE'),
('system', 'letsencryptstate', 'Germany'), ('system', 'letsencryptstate', 'Hessen'),
('system', 'letsencryptchallengepath', '/var/www/froxlor'), ('system', 'letsencryptchallengepath', '/var/www/froxlor'),
('system', 'letsencryptkeysize', '4096'), ('system', 'letsencryptkeysize', '4096'),
('system', 'letsencryptreuseold', 0), ('system', 'letsencryptreuseold', 0),
('system', 'leenabled', '0'), ('system', 'leenabled', '0'),
('system', 'leapiversion', '2'),
('system', 'backupenabled', '0'),
('system', 'dnsenabled', '0'),
('system', 'dns_server', 'Bind'),
('system', 'apacheglobaldiropt', ''),
('system', 'allow_customer_shell', '0'),
('system', 'available_shells', ''),
('system', 'le_froxlor_enabled', '0'),
('system', 'le_froxlor_redirect', '0'),
('system', 'letsencryptacmeconf', '/etc/apache2/conf-enabled/acme.conf'),
('system', 'mail_use_smtp', '0'),
('system', 'mail_smtp_host', 'localhost'),
('system', 'mail_smtp_port', '25'),
('system', 'mail_smtp_usetls', '1'),
('system', 'mail_smtp_auth', '1'),
('system', 'mail_smtp_user', ''),
('system', 'mail_smtp_passwd', ''),
('system', 'hsts_maxage', '0'),
('system', 'hsts_incsub', '0'),
('system', 'hsts_preload', '0'),
('system', 'leregistered', '0'),
('system', 'leaccount', ''),
('system', 'nssextrausers', '0'),
('system', 'le_domain_dnscheck', '1'),
('system', 'ssl_protocols', 'TLSv1.2'),
('system', 'tlsv13_cipher_list', ''),
('system', 'honorcipherorder', '0'),
('system', 'sessiontickets', '1'),
('system', 'sessionticketsenabled', '1'),
('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', ''),
('system', 'apply_specialsettings_default', '1'),
('system', 'apply_phpconfigs_default', '1'),
('system', 'hide_incompatible_settings', '0'),
('api', 'enabled', '0'),
('2fa', 'enabled', '1'),
('panel', 'decimal_places', '4'), ('panel', 'decimal_places', '4'),
('panel', 'adminmail', 'admin@SERVERNAME'), ('panel', 'adminmail', 'admin@SERVERNAME'),
('panel', 'phpmyadmin_url', ''), ('panel', 'phpmyadmin_url', ''),
@@ -555,17 +704,19 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES
('panel', 'password_numeric', '0'), ('panel', 'password_numeric', '0'),
('panel', 'password_special_char_required', '0'), ('panel', 'password_special_char_required', '0'),
('panel', 'password_special_char', '!?<>§$%+#=@'), ('panel', 'password_special_char', '!?<>§$%+#=@'),
('panel', 'version', '0.9.35-rc1'), ('panel', 'customer_hide_options', ''),
('panel', 'db_version', '201603150'); ('panel', 'is_configured', '0'),
('panel', 'version', '0.10.23.1'),
('panel', 'db_version', '202012300');
DROP TABLE IF EXISTS `panel_tasks`; DROP TABLE IF EXISTS `panel_tasks`;
CREATE TABLE `panel_tasks` ( CREATE TABLE `panel_tasks` (
`id` int(11) unsigned NOT NULL auto_increment, `id` int(11) unsigned NOT NULL auto_increment,
`type` int(11) NOT NULL default '0', `type` int(11) NOT NULL default '0',
`data` text NOT NULL, `data` text,
PRIMARY KEY (`id`) 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'); INSERT INTO `panel_tasks` (`type`) VALUES ('99');
@@ -580,7 +731,7 @@ CREATE TABLE `panel_templates` (
`value` longtext NOT NULL, `value` longtext NOT NULL,
PRIMARY KEY (id), PRIMARY KEY (id),
KEY adminid (adminid) KEY adminid (adminid)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -598,7 +749,7 @@ CREATE TABLE `panel_traffic` (
`mail` bigint(30) unsigned NOT NULL default '0', `mail` bigint(30) unsigned NOT NULL default '0',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `customerid` (`customerid`) KEY `customerid` (`customerid`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -616,7 +767,7 @@ CREATE TABLE `panel_traffic_admins` (
`mail` bigint(30) unsigned NOT NULL default '0', `mail` bigint(30) unsigned NOT NULL default '0',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `adminid` (`adminid`) KEY `adminid` (`adminid`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -633,24 +784,7 @@ CREATE TABLE `panel_diskspace` (
`mysql` bigint(30) unsigned NOT NULL default '0', `mysql` bigint(30) unsigned NOT NULL default '0',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `customerid` (`customerid`) KEY `customerid` (`customerid`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_diskspace_admins`;
CREATE TABLE `panel_diskspace_admins` (
`id` int(11) unsigned NOT NULL auto_increment,
`adminid` int(11) unsigned NOT NULL default '0',
`year` int(4) unsigned zerofill NOT NULL default '0000',
`month` int(2) unsigned zerofill NOT NULL default '00',
`day` int(2) unsigned zerofill NOT NULL default '00',
`stamp` int(11) unsigned NOT NULL default '0',
`webspace` bigint(30) unsigned NOT NULL default '0',
`mail` bigint(30) unsigned NOT NULL default '0',
`mysql` bigint(30) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `adminid` (`adminid`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -661,7 +795,7 @@ CREATE TABLE `panel_languages` (
`iso` char(3) NOT NULL DEFAULT 'foo', `iso` char(3) NOT NULL DEFAULT 'foo',
`file` varchar(255) NOT NULL DEFAULT '', `file` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -675,41 +809,6 @@ INSERT INTO `panel_languages` (`id`, `language`, `iso`, `file`) VALUES
(7, 'Svenska', 'sv', 'lng/swedish.lng.php'); (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`; DROP TABLE IF EXISTS `panel_syslog`;
CREATE TABLE IF NOT EXISTS `panel_syslog` ( CREATE TABLE IF NOT EXISTS `panel_syslog` (
`logid` bigint(20) NOT NULL auto_increment, `logid` bigint(20) NOT NULL auto_increment,
@@ -719,7 +818,35 @@ CREATE TABLE IF NOT EXISTS `panel_syslog` (
`user` varchar(50) NOT NULL, `user` varchar(50) NOT NULL,
`text` text NOT NULL, `text` text NOT NULL,
PRIMARY KEY (`logid`) 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 'dynamic',
`max_children` int(4) NOT NULL DEFAULT '5',
`start_servers` int(4) NOT NULL DEFAULT '2',
`min_spare_servers` int(4) NOT NULL DEFAULT '1',
`max_spare_servers` int(4) NOT NULL DEFAULT '3',
`max_requests` int(4) NOT NULL DEFAULT '0',
`idle_timeout` int(4) NOT NULL DEFAULT '10',
`limit_extensions` varchar(255) NOT NULL default '.php',
`custom_config` text,
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.3-fpm restart', '/etc/php/7.3/fpm/pool.d/');
DROP TABLE IF EXISTS `panel_phpconfigs`; DROP TABLE IF EXISTS `panel_phpconfigs`;
@@ -735,14 +862,26 @@ CREATE TABLE `panel_phpconfigs` (
`fpm_reqterm` varchar(15) NOT NULL default '60s', `fpm_reqterm` varchar(15) NOT NULL default '60s',
`fpm_reqslow` varchar(15) NOT NULL default '5s', `fpm_reqslow` varchar(15) NOT NULL default '5s',
`phpsettings` text NOT NULL, `phpsettings` text NOT NULL,
PRIMARY KEY (`id`) `fpmsettingid` int(11) NOT NULL DEFAULT '1',
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; `pass_authorizationheader` tinyint(1) NOT NULL default '0',
`override_fpmconfig` tinyint(1) NOT NULL DEFAULT '0',
`pm` varchar(15) NOT NULL DEFAULT 'dynamic',
`max_children` int(4) NOT NULL DEFAULT '5',
`start_servers` int(4) NOT NULL DEFAULT '2',
`min_spare_servers` int(4) NOT NULL DEFAULT '1',
`max_spare_servers` int(4) NOT NULL DEFAULT '3',
`max_requests` int(4) NOT NULL DEFAULT '0',
`idle_timeout` int(4) NOT NULL DEFAULT '10',
`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 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'), (1, 'Default Config', '/usr/bin/php-cgi', 'php', '-1', '-1', 'allow_url_fopen = Off\r\nallow_url_include = Off\r\nauto_append_file =\r\nauto_globals_jit = On\r\nauto_prepend_file =\r\nbcmath.scale = 0\r\ncli_server.color = On\r\ndefault_charset = "UTF-8"\r\ndefault_mimetype = "text/html"\r\ndefault_socket_timeout = 60\r\nasp_tags = Off\r\ndisable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,curl_exec,curl_multi_exec,exec,parse_ini_file,passthru,popen,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,system\r\ndisplay_errors = Off\r\ndisplay_startup_errors = Off\r\ndoc_root =\r\nenable_dl = Off\r\nerror_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE\r\nexpose_php = Off\r\nfile_uploads = On\r\nhtml_errors = On\r\nignore_repeated_errors = Off\r\nignore_repeated_source = Off\r\ninclude_path = ".:{PEAR_DIR}"\r\nimplicit_flush = Off\r\nldap.max_links = -1\r\nlog_errors = On\r\nlog_errors_max_len = 1024\r\nmail.add_x_header = Off\r\nmax_execution_time = 30\r\nmax_file_uploads = 20\r\nmax_input_time = 60\r\nmemory_limit = 128M\r\n{OPEN_BASEDIR_C}open_basedir = "{OPEN_BASEDIR}"\r\noutput_buffering = 4096\r\npost_max_size = 16M\r\nprecision = 14\r\nregister_argc_argv = Off\r\nreport_memleaks = On\r\nrequest_order = "GP"\r\nsendmail_path = "/usr/sbin/sendmail -t -i -f {CUSTOMER_EMAIL}"\r\nserialize_precision = -1\r\nsession.auto_start = 0\r\nsession.cache_expire = 180\r\nsession.cache_limiter = nocache\r\nsession.cookie_domain =\r\nsession.cookie_httponly =\r\nsession.cookie_lifetime = 0\r\nsession.cookie_path = /\r\nsession.cookie_samesite =\r\nsession.gc_divisor = 1000\r\nsession.gc_maxlifetime = 1440\r\nsession.gc_probability = 0\r\nsession.name = PHPSESSID\r\nsession.referer_check =\r\nsession.save_handler = files\r\nsession.save_path = "{TMP_DIR}"\r\nsession.serialize_handler = php\r\nsession.sid_bits_per_character = 5\r\nsession.sid_length = 26\r\nsession.trans_sid_tags = "a=href,area=href,frame=src,form="\r\nsession.use_cookies = 1\r\nsession.use_only_cookies = 1\r\nsession.use_strict_mode = 0\r\nsession.use_trans_sid = 0\r\nshort_open_tag = On\r\nupload_max_filesize = 32M\r\nupload_tmp_dir = "{TMP_DIR}"\r\nvariables_order = "GPCS"\r\nopcache.restrict_api = "{DOCUMENT_ROOT}"\r\n'),
(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_url_fopen = On\r\nallow_url_include = Off\r\nauto_append_file =\r\nauto_globals_jit = On\r\nauto_prepend_file =\r\nbcmath.scale = 0\r\ncli_server.color = On\r\ndefault_charset = "UTF-8"\r\ndefault_mimetype = "text/html"\r\ndefault_socket_timeout = 60\r\nasp_tags = Off\r\ndisable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,curl_multi_exec,parse_ini_file,passthru,popen,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,system\r\ndisplay_errors = Off\r\ndisplay_startup_errors = Off\r\ndoc_root =\r\nenable_dl = Off\r\nerror_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE\r\nexpose_php = Off\r\nfile_uploads = On\r\nhtml_errors = On\r\nignore_repeated_errors = Off\r\nignore_repeated_source = Off\r\ninclude_path = ".:{PEAR_DIR}"\r\nimplicit_flush = Off\r\nldap.max_links = -1\r\nlog_errors = On\r\nlog_errors_max_len = 1024\r\nmail.add_x_header = Off\r\nmax_execution_time = 60\r\nmax_file_uploads = 20\r\nmax_input_time = 60\r\nmemory_limit = 128M\r\noutput_buffering = 4096\r\npost_max_size = 16M\r\nprecision = 14\r\nregister_argc_argv = Off\r\nreport_memleaks = On\r\nrequest_order = "GP"\r\nsendmail_path = "/usr/sbin/sendmail -t -i -f {CUSTOMER_EMAIL}"\r\nserialize_precision = -1\r\nsession.auto_start = 0\r\nsession.cache_expire = 180\r\nsession.cache_limiter = nocache\r\nsession.cookie_domain =\r\nsession.cookie_httponly =\r\nsession.cookie_lifetime = 0\r\nsession.cookie_path = /\r\nsession.cookie_samesite =\r\nsession.gc_divisor = 1000\r\nsession.gc_maxlifetime = 1440\r\nsession.gc_probability = 0\r\nsession.name = PHPSESSID\r\nsession.referer_check =\r\nsession.save_handler = files\r\nsession.save_path = "{TMP_DIR}"\r\nsession.serialize_handler = php\r\nsession.sid_bits_per_character = 5\r\nsession.sid_length = 26\r\nsession.trans_sid_tags = "a=href,area=href,frame=src,form="\r\nsession.use_cookies = 1\r\nsession.use_only_cookies = 1\r\nsession.use_strict_mode = 0\r\nsession.use_trans_sid = 0\r\nshort_open_tag = On\r\nupload_max_filesize = 32M\r\nupload_tmp_dir = "{TMP_DIR}"\r\nvariables_order = "GPCS"\r\nopcache.restrict_api = ""\r\n');
DROP TABLE IF EXISTS `cronjobs_run`; DROP TABLE IF EXISTS `cronjobs_run`;
@@ -750,22 +889,22 @@ CREATE TABLE IF NOT EXISTS `cronjobs_run` (
`id` bigint(20) NOT NULL auto_increment, `id` bigint(20) NOT NULL auto_increment,
`module` varchar(250) NOT NULL, `module` varchar(250) NOT NULL,
`cronfile` varchar(250) NOT NULL, `cronfile` varchar(250) NOT NULL,
`cronclass` varchar(500) NOT NULL,
`lastrun` int(15) NOT NULL DEFAULT '0', `lastrun` int(15) NOT NULL DEFAULT '0',
`interval` varchar(100) NOT NULL DEFAULT '5 MINUTE', `interval` varchar(100) NOT NULL DEFAULT '5 MINUTE',
`isactive` tinyint(1) DEFAULT '1', `isactive` tinyint(1) DEFAULT '1',
`desc_lng_key` varchar(100) NOT NULL DEFAULT 'cron_unknown_desc', `desc_lng_key` varchar(100) NOT NULL DEFAULT 'cron_unknown_desc',
PRIMARY KEY (`id`) 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 INSERT INTO `cronjobs_run` (`id`, `module`, `cronfile`, `cronclass`, `interval`, `isactive`, `desc_lng_key`) VALUES
(1, 'froxlor/core', 'tasks', '5 MINUTE', '1', 'cron_tasks'), (1, 'froxlor/core', 'tasks', '\\Froxlor\\Cron\\System\\TasksCron', '5 MINUTE', '1', 'cron_tasks'),
(2, 'froxlor/core', 'traffic', '1 DAY', '1', 'cron_traffic'), (2, 'froxlor/core', 'traffic', '\\Froxlor\\Cron\\Traffic\\TrafficCron', '1 DAY', '1', 'cron_traffic'),
(3, 'froxlor/ticket', 'used_tickets_reset', '1 DAY', '1', 'cron_ticketsreset'), (3, 'froxlor/reports', 'usage_report', '\\Froxlor\\Cron\\Traffic\\ReportsCron', '1 DAY', '1', 'cron_usage_report'),
(4, 'froxlor/ticket', 'ticketarchive', '1 MONTH', '1', 'cron_ticketarchive'), (4, 'froxlor/core', 'mailboxsize', '\\Froxlor\\Cron\\System\\MailboxsizeCron', '6 HOUR', '1', 'cron_mailboxsize'),
(5, 'froxlor/reports', 'usage_report', '1 DAY', '1', 'cron_usage_report'), (5, 'froxlor/letsencrypt', 'letsencrypt', '\\Froxlor\\Cron\\Http\\LetsEncrypt\\AcmeSh', '5 MINUTE', '0', 'cron_letsencrypt'),
(6, 'froxlor/core', 'mailboxsize', '6 HOUR', '1', 'cron_mailboxsize'), (6, 'froxlor/backup', 'backup', '\\Froxlor\\Cron\\System\\BackupCron', '1 DAY', '1', 'cron_backup');
(7, 'froxlor/letsencrypt', 'letsencrypt', '5 MINUTE', '0', 'cron_letsencrypt');
@@ -781,7 +920,7 @@ CREATE TABLE IF NOT EXISTS `ftp_quotalimits` (
`files_in_avail` int(10) unsigned NOT NULL, `files_in_avail` int(10) unsigned NOT NULL,
`files_out_avail` int(10) unsigned NOT NULL, `files_out_avail` int(10) unsigned NOT NULL,
`files_xfer_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;
@@ -800,7 +939,7 @@ CREATE TABLE IF NOT EXISTS `ftp_quotatallies` (
`files_in_used` int(10) unsigned NOT NULL, `files_in_used` int(10) unsigned NOT NULL,
`files_out_used` int(10) unsigned NOT NULL, `files_out_used` int(10) unsigned NOT NULL,
`files_xfer_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;
@@ -811,7 +950,7 @@ CREATE TABLE IF NOT EXISTS `redirect_codes` (
`desc` varchar(200) NOT NULL, `desc` varchar(200) NOT NULL,
`enabled` tinyint(1) DEFAULT '1', `enabled` tinyint(1) DEFAULT '1',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
@@ -829,21 +968,23 @@ CREATE TABLE IF NOT EXISTS `domain_redirect_codes` (
`rid` int(5) NOT NULL, `rid` int(5) NOT NULL,
`did` int(11) unsigned NOT NULL, `did` int(11) unsigned NOT NULL,
UNIQUE KEY `rc` (`rid`, `did`) 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`; DROP TABLE IF EXISTS `domain_ssl_settings`;
CREATE TABLE IF NOT EXISTS `domain_ssl_settings` ( CREATE TABLE IF NOT EXISTS `domain_ssl_settings` (
`id` int(5) NOT NULL auto_increment, `id` int(5) NOT NULL auto_increment,
`domainid` int(11) NOT NULL, `domainid` int(11) NOT NULL,
`ssl_cert_file` mediumtext NOT NULL, `ssl_cert_file` mediumtext,
`ssl_key_file` mediumtext NOT NULL, `ssl_key_file` mediumtext,
`ssl_ca_file` mediumtext, `ssl_ca_file` mediumtext,
`ssl_cert_chainfile` mediumtext, `ssl_cert_chainfile` mediumtext,
`ssl_csr_file` mediumtext, `ssl_csr_file` mediumtext,
`ssl_fullchain_file` mediumtext,
`expirationdate` datetime DEFAULT NULL, `expirationdate` datetime DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`),
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; UNIQUE KEY (`domainid`)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci;
DROP TABLE IF EXISTS `panel_domaintoip`; DROP TABLE IF EXISTS `panel_domaintoip`;
@@ -851,5 +992,46 @@ CREATE TABLE IF NOT EXISTS `panel_domaintoip` (
`id_domain` int(11) unsigned NOT NULL, `id_domain` int(11) unsigned NOT NULL,
`id_ipandports` int(11) unsigned NOT NULL, `id_ipandports` int(11) unsigned NOT NULL,
PRIMARY KEY (`id_domain`,`id_ipandports`) 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`;
CREATE TABLE `domain_dns_entries` (
`id` int(20) NOT NULL auto_increment,
`domain_id` int(15) NOT NULL,
`record` varchar(255) NOT NULL,
`type` varchar(10) NOT NULL DEFAULT 'A',
`content` text NOT NULL,
`ttl` int(11) NOT NULL DEFAULT '18000',
`prio` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=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 * @package Install
* *
*/ */
if (! file_exists(dirname(__DIR__) . '/vendor/autoload.php')) {
require 'lib/class.FroxlorInstall.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 = new FroxlorInstall();
$frxinstall->run(); $frxinstall->run();

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,88 @@
<?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)
{
set_time_limit(30);
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);
}
/**
* 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!!!');
} elseif ($status == 0 || $status == 1) {
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, 'Success');
}
}

View File

@@ -16,27 +16,32 @@
* @package Language * @package Language
* *
*/ */
$lng['requirements']['title'] = 'Checking system requirements...'; $lng['requirements']['title'] = 'Checking system requirements...';
$lng['requirements']['installed'] = 'installed'; $lng['requirements']['installed'] = 'installed';
$lng['requirements']['not_true'] = 'no'; $lng['requirements']['not_true'] = 'no';
$lng['requirements']['notfound'] = 'not found'; $lng['requirements']['notfound'] = 'not found';
$lng['requirements']['notinstalled'] = 'not installed'; $lng['requirements']['notinstalled'] = 'not installed';
$lng['requirements']['activated'] = 'enabled'; $lng['requirements']['activated'] = 'enabled';
$lng['requirements']['phpversion'] = 'PHP version >= 5.3'; $lng['requirements']['phpversion'] = 'PHP version >= 7.0';
$lng['requirements']['phpmagic_quotes_runtime'] = 'magic_quotes_runtime...'; $lng['requirements']['newerphpprefered'] = 'Good, but php-7.1 is prefered.';
$lng['requirements']['phpmagic_quotes_runtime_description'] = 'PHP setting "magic_quotes_runtime" must be set to "Off". We have disabled it temporary for now please fix the coresponding php.ini.';
$lng['requirements']['phppdo'] = 'PHP PDO extension and PDO-MySQL driver...'; $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']['phpxml'] = 'PHP XML-extension...';
$lng['requirements']['phpfilter'] = 'PHP filter-extension...'; $lng['requirements']['phpfilter'] = 'PHP filter-extension...';
$lng['requirements']['phpposix'] = 'PHP posix-extension...'; $lng['requirements']['phpposix'] = 'PHP posix-extension...';
$lng['requirements']['phpbcmath'] = 'PHP bcmath-extension...'; $lng['requirements']['phpbcmath'] = 'PHP bcmath-extension...';
$lng['requirements']['phpcurl'] = 'PHP curl-extension...'; $lng['requirements']['phpcurl'] = 'PHP curl-extension...';
$lng['requirements']['phpmbstring'] = 'PHP mbstring-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']['bcmathdescription'] = 'Traffic-calculation related functions will not work correctly!';
$lng['requirements']['curldescription'] = 'Version-check and news-feed may not work correctly!'; $lng['requirements']['zipdescription'] = 'The auto-update feature requires the zip extension.';
$lng['requirements']['openbasedir'] = 'open_basedir...'; $lng['requirements']['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']['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']['diedbecauseofrequirements'] = 'Cannot install Froxlor without these requirements! Try to fix them and retry.';
$lng['requirements']['froxlor_succ_checks'] = 'All requirements are satisfied'; $lng['requirements']['froxlor_succ_checks'] = 'All requirements are satisfied';
@@ -58,10 +63,11 @@ $lng['install']['admin_pass1'] = 'Administrator Password';
$lng['install']['admin_pass2'] = 'Administrator-Password (confirm)'; $lng['install']['admin_pass2'] = 'Administrator-Password (confirm)';
$lng['install']['activate_newsfeed'] = 'Enable the official newsfeed<br><small>(https://inside.froxlor.org/news/)</small>'; $lng['install']['activate_newsfeed'] = 'Enable the official newsfeed<br><small>(https://inside.froxlor.org/news/)</small>';
$lng['install']['serversettings'] = 'Server settings'; $lng['install']['serversettings'] = 'Server settings';
$lng['install']['distribution'] = 'Distribution';
$lng['install']['servername'] = 'Server name (FQDN, no ip-address)'; $lng['install']['servername'] = 'Server name (FQDN, no ip-address)';
$lng['install']['serverip'] = 'Server IP'; $lng['install']['serverip'] = 'Server IP';
$lng['install']['webserver'] = 'Webserver'; $lng['install']['webserver'] = 'Webserver';
$lng['install']['apache2'] = 'Apache 2'; $lng['install']['apache2'] = 'Apache 2.2';
$lng['install']['apache24'] = 'Apache 2.4'; $lng['install']['apache24'] = 'Apache 2.4';
$lng['install']['lighttpd'] = 'LigHTTPd'; $lng['install']['lighttpd'] = 'LigHTTPd';
$lng['install']['nginx'] = 'NGINX'; $lng['install']['nginx'] = 'NGINX';
@@ -81,8 +87,8 @@ $lng['install']['changing_data'] = 'Adjusting settings...';
$lng['install']['creating_entries'] = 'Inserting new values...'; $lng['install']['creating_entries'] = 'Inserting new values...';
$lng['install']['adding_admin_user'] = 'Creating admin-account...'; $lng['install']['adding_admin_user'] = 'Creating admin-account...';
$lng['install']['creating_configfile'] = 'Creating configfile...'; $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_temp'] = 'File was saved in %s, please move to ' . dirname(dirname(__DIR__)) . '/lib/userdata.inc.php';
$lng['install']['creating_configfile_failed'] = 'Could not create lib/userdata.inc.php, please create it manually with the following content:'; $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['install']['froxlor_succ_installed'] = 'Froxlor was installed successfully.';
$lng['click_here_to_refresh'] = 'Click here to check again'; $lng['click_here_to_refresh'] = 'Click here to check again';

View File

@@ -16,16 +16,13 @@
* @package Language * @package Language
* *
*/ */
$lng['requirements']['title'] = 'Vérification des prérequis système...'; $lng['requirements']['title'] = 'Vérification des prérequis système...';
$lng['requirements']['installed'] = 'installé'; $lng['requirements']['installed'] = 'installé';
$lng['requirements']['not_true'] = 'non'; $lng['requirements']['not_true'] = 'non';
$lng['requirements']['notfound'] = 'introuvable'; $lng['requirements']['notfound'] = 'introuvable';
$lng['requirements']['notinstalled'] = 'non installé'; $lng['requirements']['notinstalled'] = 'non installé';
$lng['requirements']['activated'] = 'activé'; $lng['requirements']['activated'] = 'activé';
$lng['requirements']['phpversion'] = 'PHP version >= 5.3'; $lng['requirements']['phpversion'] = 'PHP version >= 7.0';
$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']['phppdo'] = 'extension PHP PDO et pilote PDO-MySQL ...'; $lng['requirements']['phppdo'] = 'extension PHP PDO et pilote PDO-MySQL ...';
$lng['requirements']['phpxml'] = 'extension PHP XML...'; $lng['requirements']['phpxml'] = 'extension PHP XML...';
$lng['requirements']['phpfilter'] = 'extension PHP filter ...'; $lng['requirements']['phpfilter'] = 'extension PHP filter ...';
@@ -34,7 +31,6 @@ $lng['requirements']['phpbcmath'] = 'extension PHP bcmath ...';
$lng['requirements']['phpcurl'] = 'extension PHP curl...'; $lng['requirements']['phpcurl'] = 'extension PHP curl...';
$lng['requirements']['phpmbstring'] = 'extension PHP mbstring...'; $lng['requirements']['phpmbstring'] = 'extension PHP mbstring...';
$lng['requirements']['bcmathdescription'] = 'Les fonctions de calcul de traffic ne fonctionneront pas correctement!'; $lng['requirements']['bcmathdescription'] = 'Les fonctions de calcul de traffic ne fonctionneront pas correctement!';
$lng['requirements']['curldescription'] = 'Les vérifications de version et les flux d\'information peuvent ne pas fonctionner correctement!';
$lng['requirements']['openbasedir'] = 'open_basedir...'; $lng['requirements']['openbasedir'] = 'open_basedir...';
$lng['requirements']['openbasedirenabled'] = 'Froxlor ne fonctionnera pas correctement avec open_basedir activé. Merci de désactiver open_basedir pour Froxlor dans le php.ini correspondant'; $lng['requirements']['openbasedirenabled'] = 'Froxlor ne fonctionnera pas correctement avec open_basedir activé. Merci de désactiver open_basedir pour Froxlor dans le php.ini correspondant';
$lng['requirements']['diedbecauseofrequirements'] = 'Impossible d\'installer Froxlor sans ces prérequis! Essayez de les corriger et essayez à nouveau.'; $lng['requirements']['diedbecauseofrequirements'] = 'Impossible d\'installer Froxlor sans ces prérequis! Essayez de les corriger et essayez à nouveau.';
@@ -57,6 +53,7 @@ $lng['install']['admin_user'] = 'Nom d\'utilisateur administrateur';
$lng['install']['admin_pass1'] = 'Mot de passe administrateur'; $lng['install']['admin_pass1'] = 'Mot de passe administrateur';
$lng['install']['admin_pass2'] = 'Mot de passe administrateur (confirmez)'; $lng['install']['admin_pass2'] = 'Mot de passe administrateur (confirmez)';
$lng['install']['serversettings'] = 'Réglages serveur'; $lng['install']['serversettings'] = 'Réglages serveur';
$lng['install']['distribution'] = 'Distribution';
$lng['install']['servername'] = 'Nom du serveur (FQDN, pas d\'adresse IP)'; $lng['install']['servername'] = 'Nom du serveur (FQDN, pas d\'adresse IP)';
$lng['install']['serverip'] = 'Adresse IP du serveur'; $lng['install']['serverip'] = 'Adresse IP du serveur';
$lng['install']['webserver'] = 'Serveur Web'; $lng['install']['webserver'] = 'Serveur Web';
@@ -80,8 +77,8 @@ $lng['install']['changing_data'] = 'Ajustement des paramètres...';
$lng['install']['creating_entries'] = 'Insertion des nouvelles valeurs...'; $lng['install']['creating_entries'] = 'Insertion des nouvelles valeurs...';
$lng['install']['adding_admin_user'] = 'Création du compte administrateur...'; $lng['install']['adding_admin_user'] = 'Création du compte administrateur...';
$lng['install']['creating_configfile'] = 'Création du fichier de configuration...'; $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_temp'] = 'Le fichier a été enregistré dans %s, merci de le déplacer dans ' . dirname(dirname(__DIR__)) . '/lib/userdata.inc.php';
$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_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['install']['froxlor_succ_installed'] = 'Froxlor a été installé avec succès.';
$lng['click_here_to_refresh'] = 'Cliquez ici pour vérifier à nouveau'; $lng['click_here_to_refresh'] = 'Cliquez ici pour vérifier à nouveau';

View File

@@ -16,27 +16,32 @@
* @package Language * @package Language
* *
*/ */
$lng['requirements']['title'] = 'Prüfe Systemvoraussetzungen...'; $lng['requirements']['title'] = 'Prüfe Systemvoraussetzungen...';
$lng['requirements']['installed'] = 'installiert'; $lng['requirements']['installed'] = 'installiert';
$lng['requirements']['not_true'] = 'nein'; $lng['requirements']['not_true'] = 'nein';
$lng['requirements']['notfound'] = 'nicht gefunden'; $lng['requirements']['notfound'] = 'nicht gefunden';
$lng['requirements']['notinstalled'] = 'nicht installiert'; $lng['requirements']['notinstalled'] = 'nicht installiert';
$lng['requirements']['activated'] = 'ist aktiviert.'; $lng['requirements']['activated'] = 'ist aktiviert.';
$lng['requirements']['phpversion'] = 'PHP Version >= 5.3'; $lng['requirements']['phpversion'] = 'PHP Version >= 7.0';
$lng['requirements']['phpmagic_quotes_runtime'] = 'magic_quotes_runtime'; $lng['requirements']['newerphpprefered'] = 'Passt, aber php-7.1 wird bevorzugt.';
$lng['requirements']['phpmagic_quotes_runtime_description'] = 'Die PHP Einstellung "magic_quotes_runtime" muss deaktiviert sein ("Off"). Die Einstellung wurde temporär deaktiviert, bitte ändern Sie diese in der entsprechenden php.ini.';
$lng['requirements']['phppdo'] = 'PHP PDO Erweiterung und PDO-MySQL Treiber...'; $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']['phpxml'] = 'PHP XML-Erweiterung...';
$lng['requirements']['phpfilter'] = 'PHP filter-Erweiterung...'; $lng['requirements']['phpfilter'] = 'PHP filter-Erweiterung...';
$lng['requirements']['phpposix'] = 'PHP posix-Erweiterung...'; $lng['requirements']['phpposix'] = 'PHP posix-Erweiterung...';
$lng['requirements']['phpbcmath'] = 'PHP bcmath-Erweiterung...'; $lng['requirements']['phpbcmath'] = 'PHP bcmath-Erweiterung...';
$lng['requirements']['phpcurl'] = 'PHP curl-Erweiterung...'; $lng['requirements']['phpcurl'] = 'PHP curl-Erweiterung...';
$lng['requirements']['phpmbstring'] = 'PHP mbstring-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']['bcmathdescription'] = 'Traffic-Berechnungs bezogene Funktionen stehen nicht vollständig zur Verfügung!';
$lng['requirements']['curldescription'] = 'Versions-Prüfung und News-Feed stehen nicht vollständig zur Verfügung!'; $lng['requirements']['zipdescription'] = 'Die Auto-Update Funktion benötigt die zip Erweiterung.';
$lng['requirements']['openbasedir'] = 'open_basedir genutzt wird...'; $lng['requirements']['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']['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']['diedbecauseofrequirements'] = 'Kann Froxlor ohne diese Voraussetzungen nicht installieren! Beheben Sie die angezeigten Probleme und versuchen Sie es erneut.';
$lng['requirements']['froxlor_succ_checks'] = 'Alle Vorraussetzungen sind erfüllt'; $lng['requirements']['froxlor_succ_checks'] = 'Alle Vorraussetzungen sind erfüllt';
@@ -58,6 +63,7 @@ $lng['install']['admin_pass1'] = 'Administrator-Passwort';
$lng['install']['admin_pass2'] = 'Administrator-Passwort (Bestätigung)'; $lng['install']['admin_pass2'] = 'Administrator-Passwort (Bestätigung)';
$lng['install']['activate_newsfeed'] = 'Aktiviere das offizielle Newsfeed<br><small>(https://inside.froxlor.org/news/)</small>'; $lng['install']['activate_newsfeed'] = 'Aktiviere das offizielle Newsfeed<br><small>(https://inside.froxlor.org/news/)</small>';
$lng['install']['serversettings'] = 'Servereinstellungen'; $lng['install']['serversettings'] = 'Servereinstellungen';
$lng['install']['distribution'] = 'Distribution';
$lng['install']['servername'] = 'Servername (FQDN, keine IP-Adresse)'; $lng['install']['servername'] = 'Servername (FQDN, keine IP-Adresse)';
$lng['install']['serverip'] = 'Server-IP'; $lng['install']['serverip'] = 'Server-IP';
$lng['install']['webserver'] = 'Webserver'; $lng['install']['webserver'] = 'Webserver';
@@ -81,8 +87,8 @@ $lng['install']['changing_data'] = 'Einstellungen anpassen...';
$lng['install']['creating_entries'] = 'Trage neue Werte ein...'; $lng['install']['creating_entries'] = 'Trage neue Werte ein...';
$lng['install']['adding_admin_user'] = 'Erstelle Admin-Benutzer...'; $lng['install']['adding_admin_user'] = 'Erstelle Admin-Benutzer...';
$lng['install']['creating_configfile'] = 'Erstelle Konfigurationsdatei...'; $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_temp'] = 'Datei wurde in %s gespeichert, bitte nach ' . dirname(dirname(__DIR__)) . '/lib/userdata.inc.php verschieben.';
$lng['install']['creating_configfile_failed'] = 'Konnte lib/userdata.inc.php nicht erstellen, bitte manuell mit folgendem Inhalt anlegen:'; $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['install']['froxlor_succ_installed'] = 'Froxlor wurde erfolgreich installiert.';
$lng['click_here_to_refresh'] = 'Hier klicken, um erneut zu prüfen'; $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,160 +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'
&& @php_sapi_name() != 'cgi'
&& @php_sapi_name() != 'cgi-fcgi'
) {
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;
}

View File

@@ -0,0 +1,31 @@
#!/usr/bin/php
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2016 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2016-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Cron
*
*/
// Check if we're in the CLI
if (@php_sapi_name() !== 'cli') {
die('This script will only work in the shell.');
}
require dirname(dirname(__DIR__)) . '/vendor/autoload.php';
// give control to command line handler
try {
\Froxlor\Cli\SwitchServerIpCmd::processParameters($argc, $argv);
} catch (Exception $e) {
\Froxlor\Cli\SwitchServerIpCmd::printerr($e->getMessage());
}

32
install/scripts/update-cli.php Executable file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/php
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2020 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2016-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Cron
*
*/
// Check if we're in the CLI
if (@php_sapi_name() !== 'cli') {
die('This script will only work in the shell.');
}
require dirname(dirname(__DIR__)) . '/vendor/autoload.php';
// give control to command line handler
try {
$argv[] = '--run';
\Froxlor\Cli\UpdateCliCmd::processParameters($argc, $argv);
} catch (Exception $e) {
\Froxlor\Cli\UpdateCliCmd::printerr($e->getMessage());
}

View File

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

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