Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0cf721bd49 |
@@ -1,4 +0,0 @@
|
||||
codecov:
|
||||
notify:
|
||||
require_ci_to_pass: no
|
||||
|
||||
57
.github/CONTRIBUTING.md
vendored
@@ -1,57 +0,0 @@
|
||||
# Contributing
|
||||
|
||||
Before you start working on a PR, contact us via IRC in #froxlor on Freenode or
|
||||
the forum at https://forum.froxlor.org to get a clue whether someone else isn't
|
||||
already working on it or if we don not want/need this certain change.
|
||||
Of course, bugfixes are always welcome.
|
||||
However, at this stage of the 0.9.x branch, we are not looking for new
|
||||
features or refactoring, especially not the kind which requires changes to a
|
||||
lot of files.
|
||||
Please focus on our API based version 0.10.x (current master).
|
||||
|
||||
|
||||
|
||||
|
||||
## Checklist
|
||||
|
||||
General rules for PRs are:
|
||||
* Please save us all some trouble and unnecessary round-trips by _testing_ your
|
||||
changes.
|
||||
|
||||
* Re-write your commit history to provide a CLEAN history!
|
||||
|
||||
* i.e. do not provide PRs which contain a commit that changes something,
|
||||
the next changes it back, a third one changes it again, only a little
|
||||
differently...
|
||||
|
||||
|
||||
Thanks!
|
||||
|
||||
|
||||
|
||||
|
||||
### Webserver changes
|
||||
If you make changes to the functionality of webserver configuration, please
|
||||
make sure your implementation covers all supported webservers.
|
||||
|
||||
|
||||
|
||||
|
||||
### l10n
|
||||
|
||||
If you add new language strings, please make sure you add the english fallback
|
||||
strings in
|
||||
|
||||
* `lng/english.lng.php`
|
||||
* `install/lng/english.lng.php` (if applicable)
|
||||
|
||||
|
||||
|
||||
|
||||
### New settings and database-layout changnes
|
||||
If you add new settings or layout changes, please make sure you add these to
|
||||
|
||||
* `install/froxlor.sql`
|
||||
* and handle the update (see `install/updates/froxlor/0.10/update_0.10.inc.php`)
|
||||
* if you have any question on how update-process works, please contact us
|
||||
|
||||
3
.github/FUNDING.yml
vendored
@@ -1,3 +0,0 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
custom: ['https://paypal.me/Froxlor']
|
||||
64
.github/ISSUE_TEMPLATE.md
vendored
@@ -1,64 +0,0 @@
|
||||
# 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
@@ -1,38 +0,0 @@
|
||||
# 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
|
||||
|
||||
20
.gitignore
vendored
@@ -1,20 +0,0 @@
|
||||
install/update.log
|
||||
templates/*
|
||||
lib/userdata.inc.php
|
||||
lib/userdata.inc.php.bak
|
||||
logs/*
|
||||
!logs/index.html
|
||||
.buildpath
|
||||
.project
|
||||
.settings/
|
||||
*.diff
|
||||
*~
|
||||
.well-known
|
||||
.idea
|
||||
*.iml
|
||||
|
||||
!templates/Froxlor/
|
||||
!templates/Sparkle/
|
||||
!templates/misc/
|
||||
templates/Froxlor/assets/img/logo_custom.png
|
||||
vendor/
|
||||
67
.travis.yml
@@ -1,67 +0,0 @@
|
||||
language: php
|
||||
dist: bionic
|
||||
services:
|
||||
- docker
|
||||
php:
|
||||
- 7.3
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- namespaces
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- php: 7.3
|
||||
env: "DOCKER_MYSQL_TYPE=mysql DOCKER_MYSQL_VERSION=5.6"
|
||||
- php: 7.3
|
||||
env: "DOCKER_MYSQL_TYPE=mysql DOCKER_MYSQL_VERSION=5.7"
|
||||
- php: 7.3
|
||||
env: "DOCKER_MYSQL_TYPE=mysql DOCKER_MYSQL_VERSION=8.0 STARTCMD='mysqld --default-authentication-plugin=mysql_native_password'"
|
||||
- php: 7.3
|
||||
env: "DOCKER_MYSQL_TYPE=mariadb DOCKER_MYSQL_VERSION=10.3"
|
||||
- php: 7.3
|
||||
env: "DOCKER_MYSQL_TYPE=mariadb DOCKER_MYSQL_VERSION=10.4"
|
||||
|
||||
addons:
|
||||
apt:
|
||||
update: true
|
||||
|
||||
before_install:
|
||||
- export MYSQL_DATABASE=froxlor010
|
||||
- docker run -d --name mysql -e MYSQL_ROOT_PASSWORD=fr0xl0r.TravisCI -e MYSQL_DATABASE=$MYSQL_DATABASE -p 3306:3306 $DOCKER_MYSQL_TYPE:$DOCKER_MYSQL_VERSION $STARTCMD
|
||||
- sudo apt-get install -y ant
|
||||
- >
|
||||
export tries=0;
|
||||
export max_tries=20;
|
||||
while [[ true ]]; do
|
||||
tries=$((tries + 1));
|
||||
echo "waiting for database server to start up... [$tries]";
|
||||
sleep 5;
|
||||
# Now see that today's table is there, which would indicate that the cron job ran.
|
||||
mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -s -e 'SHOW VARIABLES LIKE "%version%";'
|
||||
look_exit=$?;
|
||||
if [[ "$look_exit" = "0" ]]; then echo "Database server successfully started"; break; fi;
|
||||
if [[ "$tries" -ge "$max_tries" ]]; then echo "Database server did not start in time"; exit 1; break; fi;
|
||||
done;
|
||||
|
||||
install:
|
||||
- mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "CREATE DATABASE IF NOT EXISTS froxlor010;"
|
||||
- mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "CREATE USER 'froxlor010'@'%' IDENTIFIED BY 'fr0xl0r.TravisCI';"
|
||||
- mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI -e "GRANT ALL ON froxlor010.* TO 'froxlor010'@'%';"
|
||||
- mysql -h 127.0.0.1 --protocol=TCP -u root -pfr0xl0r.TravisCI froxlor010 < install/froxlor.sql
|
||||
|
||||
script:
|
||||
- ant phpunit
|
||||
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash) -f "build/logs/clover.xml"
|
||||
|
||||
notifications:
|
||||
irc: "irc.freenode.org#froxlor"
|
||||
webhooks:
|
||||
urls:
|
||||
- https://webhooks.gitter.im/e/bdf91d1c3f745e51f796
|
||||
on_success: always
|
||||
on_failure: always
|
||||
on_start: never
|
||||
90
2fa.php
@@ -1,90 +0,0 @@
|
||||
<?php
|
||||
if (! defined('AREA')) {
|
||||
header("Location: index.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
if (Settings::Get('2fa.enabled') != '1') {
|
||||
\Froxlor\UI\Response::dynamic_error("2FA not activated");
|
||||
}
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2018 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2018-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
* @since 0.10.0
|
||||
*
|
||||
*/
|
||||
|
||||
// This file is being included in admin_index and customer_index
|
||||
// and therefore does not need to require lib/init.php
|
||||
if (AREA == 'admin') {
|
||||
$upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `type_2fa` = :t2fa, `data_2fa` = :d2fa WHERE adminid = :id");
|
||||
$uid = $userinfo['adminid'];
|
||||
} elseif (AREA == 'customer') {
|
||||
$upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `type_2fa` = :t2fa, `data_2fa` = :d2fa WHERE customerid = :id");
|
||||
$uid = $userinfo['customerid'];
|
||||
}
|
||||
$success_message = "";
|
||||
|
||||
$tfa = new \Froxlor\FroxlorTwoFactorAuth('Froxlor');
|
||||
|
||||
// do the delete and then just show a success-message
|
||||
if ($action == 'delete') {
|
||||
Database::pexecute($upd_stmt, array(
|
||||
't2fa' => 0,
|
||||
'd2fa' => "",
|
||||
'id' => $uid
|
||||
));
|
||||
\Froxlor\UI\Response::standard_success($lng['2fa']['2fa_removed']);
|
||||
} elseif ($action == 'add') {
|
||||
$type = isset($_POST['type_2fa']) ? $_POST['type_2fa'] : '0';
|
||||
|
||||
if ($type == 0 || $type == 1) {
|
||||
$data = "";
|
||||
}
|
||||
if ($type == 2) {
|
||||
// generate secret for TOTP
|
||||
$data = $tfa->createSecret();
|
||||
}
|
||||
Database::pexecute($upd_stmt, array(
|
||||
't2fa' => $type,
|
||||
'd2fa' => $data,
|
||||
'id' => $uid
|
||||
));
|
||||
\Froxlor\UI\Response::standard_success(sprintf($lng['2fa']['2fa_added'], $filename, $s));
|
||||
}
|
||||
|
||||
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed 2fa::overview");
|
||||
|
||||
if ($userinfo['type_2fa'] == '0') {
|
||||
|
||||
// available types
|
||||
$type_select_values = array(
|
||||
0 => '-',
|
||||
1 => 'E-Mail',
|
||||
2 => 'Authenticator'
|
||||
);
|
||||
asort($type_select_values);
|
||||
$type_select = "";
|
||||
foreach ($type_select_values as $_val => $_type) {
|
||||
$type_select .= \Froxlor\UI\HTML::makeoption($_type, $_val);
|
||||
}
|
||||
} elseif ($userinfo['type_2fa'] == '1') {
|
||||
// email 2fa enabled
|
||||
} elseif ($userinfo['type_2fa'] == '2') {
|
||||
// authenticator 2fa enabled
|
||||
$ga_qrcode = $tfa->getQRCodeImageAsDataUri($userinfo['loginname'], $userinfo['data_2fa']);
|
||||
}
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("2fa/overview", true) . "\";");
|
||||
11
COPYING
@@ -2,7 +2,7 @@
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
@@ -55,7 +55,7 @@ patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
@@ -225,7 +225,7 @@ impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
@@ -278,3 +278,4 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
|
||||
67
README.md
@@ -1,67 +0,0 @@
|
||||
[](https://travis-ci.com/Froxlor/Froxlor)
|
||||
[](https://gitter.im/Froxlor/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
|
||||
# Froxlor
|
||||
|
||||
The server administration software for your needs.
|
||||
Developed by experienced server administrators, this panel simplifies the effort of managing your hosting platform.
|
||||
|
||||
## Installation
|
||||
|
||||
### Fast install
|
||||
1. Ensure that your webserver serves /var/www
|
||||
2. Extract froxlor into /var/www
|
||||
3. Point your browser to http://[ip-of-webserver]/froxlor
|
||||
4. Follow the installer
|
||||
5. Login as administrator
|
||||
6. Adjust "System > Settings" according to your needs
|
||||
7. Choose your distribution under "System > Configuration"
|
||||
8. Follow the steps for your services
|
||||
9. Have fun!
|
||||
|
||||
### Detailed installation
|
||||
https://github.com/Froxlor/Froxlor/wiki/Install-froxlor-from-tarball
|
||||
|
||||
## Help
|
||||
|
||||
You may find help in the following places:
|
||||
|
||||
### IRC
|
||||
|
||||
froxlor may be found on freenode.net, channel #froxlor:
|
||||
irc://chat.freenode.net/froxlor
|
||||
|
||||
### Forum
|
||||
|
||||
The community is located on https://forum.froxlor.org/
|
||||
|
||||
### Wiki
|
||||
|
||||
More documentation may be found in the froxlor - wiki:
|
||||
https://github.com/Froxlor/Froxlor/wiki
|
||||
|
||||
## License
|
||||
|
||||
May be found in COPYING
|
||||
|
||||
## Downloads
|
||||
|
||||
### Tarball
|
||||
https://files.froxlor.org/releases/froxlor-latest.tar.gz [MD5](https://files.froxlor.org/releases/froxlor-latest.tar.gz.md5) [SHA1](https://files.froxlor.org/releases/froxlor-latest.tar.gz.sha1)
|
||||
|
||||
### Debian repository
|
||||
|
||||
[HowTo](https://github.com/Froxlor/Froxlor/wiki/Install-froxlor-on-debian)
|
||||
|
||||
/etc/apt/sources.list.d/froxlor.list
|
||||
> deb http://debian.froxlor.org {stretch|buster} main
|
||||
|
||||
### Gentoo repository
|
||||
|
||||
[HowTo](https://github.com/Froxlor/Froxlor/wiki/Install-froxlor-on-gentoo)
|
||||
|
||||
https://files.froxlor.org/gentoo/repositories.xml
|
||||
|
||||
## Contributing
|
||||
|
||||
[see here](.github/CONTRIBUTING.md)
|
||||
72
actions/admin/settings/000.version.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?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
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -14,77 +14,40 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Language
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'panel' => array(
|
||||
'title' => $lng['admin']['panelsettings'],
|
||||
'fields' => array(
|
||||
'panel_standardlanguage' => array(
|
||||
'label' => array(
|
||||
'title' => $lng['login']['language'],
|
||||
'description' => $lng['serversettings']['language']['description']
|
||||
),
|
||||
'label' => array('title' => $lng['login']['language'], 'description' => $lng['serversettings']['language']['description']),
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'standardlanguage',
|
||||
'type' => 'option',
|
||||
'default' => 'English',
|
||||
'option_mode' => 'one',
|
||||
'option_options_method' => array(
|
||||
'\\Froxlor\\User',
|
||||
'getLanguages'
|
||||
'option_options_method' => 'getLanguages',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'panel_default_theme' => array(
|
||||
'label' => array(
|
||||
'title' => $lng['panel']['theme'],
|
||||
'description' => $lng['serversettings']['default_theme']
|
||||
),
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'default_theme',
|
||||
'type' => 'option',
|
||||
'default' => 'Froxlor',
|
||||
'option_mode' => 'one',
|
||||
'option_options_method' => array(
|
||||
'\\Froxlor\\UI\\Template',
|
||||
'getThemes'
|
||||
),
|
||||
'save_method' => 'storeSettingDefaultTheme'
|
||||
),
|
||||
'panel_allow_theme_change_customer' => array(
|
||||
'label' => $lng['serversettings']['panel_allow_theme_change_customer'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'allow_theme_change_customer',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'panel_allow_theme_change_admin' => array(
|
||||
'label' => $lng['serversettings']['panel_allow_theme_change_admin'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'allow_theme_change_admin',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'panel_natsorting' => array(
|
||||
'label' => $lng['serversettings']['natsorting'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'natsorting',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_no_robots' => array(
|
||||
'label' => $lng['serversettings']['no_robots'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'no_robots',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_paging' => array(
|
||||
'label' => $lng['serversettings']['paging'],
|
||||
'settinggroup' => 'panel',
|
||||
@@ -92,8 +55,8 @@ return array(
|
||||
'type' => 'int',
|
||||
'int_min' => 0,
|
||||
'default' => 0,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_pathedit' => array(
|
||||
'label' => $lng['serversettings']['pathedit'],
|
||||
'settinggroup' => 'panel',
|
||||
@@ -101,12 +64,9 @@ return array(
|
||||
'type' => 'option',
|
||||
'default' => 'Manual',
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array(
|
||||
'Manual' => $lng['serversettings']['manual'],
|
||||
'Dropdown' => $lng['serversettings']['dropdown']
|
||||
'option_options' => array('Manual' => 'Manual', 'Dropdown' => 'Dropdown'),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'panel_adminmail' => array(
|
||||
'label' => $lng['serversettings']['adminmail'],
|
||||
'settinggroup' => 'panel',
|
||||
@@ -115,16 +75,16 @@ return array(
|
||||
'string_type' => 'mail',
|
||||
'string_emptyallowed' => false,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_adminmail_defname' => array(
|
||||
'label' => $lng['serversettings']['adminmail_defname'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'adminmail_defname',
|
||||
'type' => 'string',
|
||||
'default' => 'Froxlor Administrator',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_adminmail_return' => array(
|
||||
'label' => $lng['serversettings']['adminmail_return'],
|
||||
'settinggroup' => 'panel',
|
||||
@@ -133,8 +93,8 @@ return array(
|
||||
'string_type' => 'mail',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_decimal_places' => array(
|
||||
'label' => $lng['serversettings']['decimal_places'],
|
||||
'settinggroup' => 'panel',
|
||||
@@ -143,8 +103,8 @@ return array(
|
||||
'int_min' => 0,
|
||||
'int_max' => 15,
|
||||
'default' => 4,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_phpmyadmin_url' => array(
|
||||
'label' => $lng['serversettings']['phpmyadmin_url'],
|
||||
'settinggroup' => 'panel',
|
||||
@@ -153,8 +113,8 @@ return array(
|
||||
'string_type' => 'url',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_webmail_url' => array(
|
||||
'label' => $lng['serversettings']['webmail_url'],
|
||||
'settinggroup' => 'panel',
|
||||
@@ -163,8 +123,8 @@ return array(
|
||||
'string_type' => 'url',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_webftp_url' => array(
|
||||
'label' => $lng['serversettings']['webftp_url'],
|
||||
'settinggroup' => 'panel',
|
||||
@@ -173,102 +133,51 @@ return array(
|
||||
'string_type' => 'url',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'admin_show_version_login' => array(
|
||||
'label' => $lng['admin']['show_version_login'],
|
||||
'settinggroup' => 'admin',
|
||||
'varname' => 'show_version_login',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'admin_show_version_footer' => array(
|
||||
'label' => $lng['admin']['show_version_footer'],
|
||||
'settinggroup' => 'admin',
|
||||
'varname' => 'show_version_footer',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'admin_show_news_feed' => array(
|
||||
'label' => $lng['admin']['show_news_feed'],
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'admin_froxlor_graphic' => array(
|
||||
'label' => $lng['admin']['froxlor_graphic'],
|
||||
'settinggroup' => 'admin',
|
||||
'varname' => 'show_news_feed',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'customer_show_news_feed' => array(
|
||||
'label' => $lng['admin']['customer_show_news_feed'],
|
||||
'settinggroup' => 'customer',
|
||||
'varname' => 'show_news_feed',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'customer_news_feed_url' => array(
|
||||
'label' => $lng['admin']['customer_news_feed_url'],
|
||||
'settinggroup' => 'customer',
|
||||
'varname' => 'news_feed_url',
|
||||
'varname' => 'froxlor_graphic',
|
||||
'type' => 'string',
|
||||
'string_type' => 'url',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_allow_domain_change_admin' => array(
|
||||
'label' => $lng['serversettings']['panel_allow_domain_change_admin'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'allow_domain_change_admin',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_allow_domain_change_customer' => array(
|
||||
'label' => $lng['serversettings']['panel_allow_domain_change_customer'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'allow_domain_change_customer',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'panel_phpconfigs_hidestdsubdomain' => array(
|
||||
'label' => $lng['serversettings']['panel_phpconfigs_hidestdsubdomain'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'phpconfigs_hidestdsubdomain',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'panel_customer_hide_options' => array(
|
||||
'label' => $lng['serversettings']['panel_customer_hide_options'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'customer_hide_options',
|
||||
'type' => 'option',
|
||||
'default' => '',
|
||||
'option_mode' => 'multiple',
|
||||
'option_emptyallowed' => true,
|
||||
'option_options' => array(
|
||||
'email' => $lng['menue']['email']['email'],
|
||||
'mysql' => $lng['menue']['mysql']['mysql'],
|
||||
'domains' => $lng['menue']['domains']['domains'],
|
||||
'ftp' => $lng['menue']['ftp']['ftp'],
|
||||
'extras' => $lng['menue']['extras']['extras'],
|
||||
'extras.directoryprotection' => $lng['menue']['extras']['extras'] . " / " . $lng['menue']['extras']['directoryprotection'],
|
||||
'extras.pathoptions' => $lng['menue']['extras']['extras'] . " / " . $lng['menue']['extras']['pathoptions'],
|
||||
'extras.logger' => $lng['menue']['extras']['extras'] . " / " . $lng['menue']['logger']['logger'],
|
||||
'extras.backup' => $lng['menue']['extras']['extras'] . " / " . $lng['menue']['extras']['backup'],
|
||||
'traffic' => $lng['menue']['traffic']['traffic'],
|
||||
'traffic.http' => $lng['menue']['traffic']['traffic'] . " / HTTP",
|
||||
'traffic.ftp' => $lng['menue']['traffic']['traffic'] . " / FTP",
|
||||
'traffic.mail' => $lng['menue']['traffic']['traffic'] . " / Mail"
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
@@ -14,8 +14,9 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Settings
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'accounts' => array(
|
||||
@@ -27,144 +28,74 @@ return array(
|
||||
'varname' => 'sessiontimeout',
|
||||
'type' => 'int',
|
||||
'default' => 600,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'session_allow_multiple_login' => array(
|
||||
'label' => $lng['serversettings']['session_allow_multiple_login'],
|
||||
'settinggroup' => 'session',
|
||||
'varname' => 'allow_multiple_login',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'login_domain_login' => array(
|
||||
'label' => $lng['serversettings']['login_domain_login'],
|
||||
'settinggroup' => 'login',
|
||||
'varname' => 'domain_login',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'login_maxloginattempts' => array(
|
||||
'label' => $lng['serversettings']['maxloginattempts'],
|
||||
'settinggroup' => 'login',
|
||||
'varname' => 'maxloginattempts',
|
||||
'type' => 'int',
|
||||
'default' => 3,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'login_deactivatetime' => array(
|
||||
'label' => $lng['serversettings']['deactivatetime'],
|
||||
'settinggroup' => 'login',
|
||||
'varname' => 'deactivatetime',
|
||||
'type' => 'int',
|
||||
'default' => 900,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'2fa_enabled' => array(
|
||||
'label' => $lng['2fa']['2fa_enabled'],
|
||||
'settinggroup' => '2fa',
|
||||
'varname' => 'enabled',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_password_min_length' => array(
|
||||
'label' => $lng['serversettings']['panel_password_min_length'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'password_min_length',
|
||||
'type' => 'int',
|
||||
'default' => 0,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'panel_password_alpha_lower' => array(
|
||||
'label' => $lng['serversettings']['panel_password_alpha_lower'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'password_alpha_lower',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'panel_password_alpha_upper' => array(
|
||||
'label' => $lng['serversettings']['panel_password_alpha_upper'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'password_alpha_upper',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'panel_password_numeric' => array(
|
||||
'label' => $lng['serversettings']['panel_password_numeric'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'password_numeric',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'panel_password_special_char_required' => array(
|
||||
'label' => $lng['serversettings']['panel_password_special_char_required'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'password_special_char_required',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'panel_password_special_char' => array(
|
||||
'label' => $lng['serversettings']['panel_password_special_char'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'password_special_char',
|
||||
'type' => 'string',
|
||||
'default' => '!?<>§$%+#=@',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'panel_password_regex' => array(
|
||||
'label' => $lng['serversettings']['panel_password_regex'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'password_regex',
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'customer_accountprefix' => array(
|
||||
'label' => $lng['serversettings']['accountprefix'],
|
||||
'settinggroup' => 'customer',
|
||||
'varname' => 'accountprefix',
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'plausibility_check_method' => array(
|
||||
'\\Froxlor\\Validate\\Check',
|
||||
'checkUsername'
|
||||
'plausibility_check_method' => 'checkUsername',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'customer_mysqlprefix' => array(
|
||||
'label' => $lng['serversettings']['mysqlprefix'],
|
||||
'settinggroup' => 'customer',
|
||||
'varname' => 'mysqlprefix',
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'plausibility_check_method' => array(
|
||||
'\\Froxlor\\Validate\\Check',
|
||||
'checkUsername'
|
||||
'plausibility_check_method' => 'checkUsername',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'customer_ftpprefix' => array(
|
||||
'label' => $lng['serversettings']['ftpprefix'],
|
||||
'settinggroup' => 'customer',
|
||||
'varname' => 'ftpprefix',
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'customer_ftpatdomain' => array(
|
||||
'label' => $lng['serversettings']['ftpdomain'],
|
||||
'settinggroup' => 'customer',
|
||||
'varname' => 'ftpatdomain',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_allow_preset' => array(
|
||||
'label' => $lng['serversettings']['allow_password_reset'],
|
||||
'settinggroup' => 'panel',
|
||||
@@ -173,14 +104,14 @@ return array(
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'dependency' => array(
|
||||
'fieldname' => 'panel_allow_preset_admin',
|
||||
'fielddata' => array(
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'allow_preset_admin'
|
||||
),
|
||||
'onlyif' => 0
|
||||
)
|
||||
),
|
||||
'fieldname' => 'panel_allow_preset_admin',
|
||||
'fielddata' => array(
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'allow_preset_admin',
|
||||
),
|
||||
'onlyif' => 0
|
||||
)
|
||||
),
|
||||
'panel_allow_preset_admin' => array(
|
||||
'label' => $lng['serversettings']['allow_password_reset_admin'],
|
||||
'settinggroup' => 'panel',
|
||||
@@ -189,25 +120,17 @@ return array(
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'dependency' => array(
|
||||
'fieldname' => 'panel_allow_preset',
|
||||
'fielddata' => array(
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'allow_preset'
|
||||
),
|
||||
'onlyif' => 1
|
||||
)
|
||||
'fieldname' => 'panel_allow_preset',
|
||||
'fielddata' => array(
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'allow_preset',
|
||||
),
|
||||
'onlyif' => 1
|
||||
)
|
||||
),
|
||||
),
|
||||
'system_backupenabled' => array(
|
||||
'label' => $lng['serversettings']['backupenabled'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'backupenabled',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'cronmodule' => 'froxlor/backup',
|
||||
'save_method' => 'storeSettingField'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -14,8 +14,9 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Settings
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'system' => array(
|
||||
@@ -26,61 +27,29 @@ return array(
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'documentroot_prefix',
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/var/customers/webs/',
|
||||
'save_method' => 'storeSettingField',
|
||||
'plausibility_check_method' => array(
|
||||
'\\Froxlor\\Validate\\Check',
|
||||
'checkPathConflicts'
|
||||
)
|
||||
),
|
||||
'system_documentroot_use_default_value' => array(
|
||||
'label' => $lng['serversettings']['documentroot_use_default_value'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'documentroot_use_default_value',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
),
|
||||
'system_ipaddress' => array(
|
||||
'label' => $lng['serversettings']['ipaddress'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'ipaddress',
|
||||
'type' => 'option',
|
||||
'option_mode' => 'one',
|
||||
'option_options_method' => array(
|
||||
'\\Froxlor\\Domain\\IpAddr',
|
||||
'getIpAddresses'
|
||||
),
|
||||
'option_options_method' => 'getIpAddresses',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingIpAddress'
|
||||
),
|
||||
'save_method' => 'storeSettingIpAddress',
|
||||
),
|
||||
'system_defaultip' => array(
|
||||
'label' => $lng['serversettings']['defaultip'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'defaultip',
|
||||
'type' => 'option',
|
||||
'option_mode' => 'multiple',
|
||||
'option_options_method' => array(
|
||||
'\\Froxlor\\Domain\\IpAddr',
|
||||
'getIpPortCombinations'
|
||||
),
|
||||
'option_mode' => 'one',
|
||||
'option_options_method' => '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'
|
||||
'save_method' => 'storeSettingDefaultIp',
|
||||
),
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingDefaultSslIp'
|
||||
),
|
||||
'system_hostname' => array(
|
||||
'label' => $lng['serversettings']['hostname'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -88,55 +57,33 @@ return array(
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingHostname',
|
||||
'plausibility_check_method' => array(
|
||||
'\\Froxlor\\Validate\\Check',
|
||||
'checkHostname'
|
||||
)
|
||||
),
|
||||
'api_enabled' => array(
|
||||
'label' => $lng['serversettings']['enable_api'],
|
||||
'settinggroup' => 'api',
|
||||
'varname' => 'enabled',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_validatedomain' => array(
|
||||
'label' => $lng['serversettings']['validate_domain'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'validate_domain',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
),
|
||||
'system_stdsubdomain' => array(
|
||||
'label' => $lng['serversettings']['stdsubdomainhost'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'stdsubdomain',
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingHostname'
|
||||
),
|
||||
'save_method' => 'storeSettingHostname',
|
||||
),
|
||||
'system_mysql_access_host' => array(
|
||||
'label' => $lng['serversettings']['mysql_access_host'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mysql_access_host',
|
||||
'type' => 'string',
|
||||
'default' => '127.0.0.1,localhost',
|
||||
'plausibility_check_method' => array(
|
||||
'\\Froxlor\\Validate\\Check',
|
||||
'checkMysqlAccessHost'
|
||||
'plausibility_check_method' => 'checkMysqlAccessHost',
|
||||
'save_method' => 'storeSettingMysqlAccessHost',
|
||||
),
|
||||
'save_method' => 'storeSettingMysqlAccessHost'
|
||||
),
|
||||
'system_nssextrausers' => array(
|
||||
'label' => $lng['serversettings']['nssextrausers'],
|
||||
'system_realtime_port' => array(
|
||||
'label' => $lng['serversettings']['system_realtime_port'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'nssextrausers',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'varname' => 'realtime_port',
|
||||
'type' => (function_exists('socket_create') ? 'int' : 'hidden'),
|
||||
'int_max' => 65535,
|
||||
'default' => 0,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_index_file_extension' => array(
|
||||
'label' => $lng['serversettings']['index_file_extension'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -144,117 +91,39 @@ return array(
|
||||
'type' => 'string',
|
||||
'string_regexp' => '/^[a-zA-Z0-9]{1,6}$/',
|
||||
'default' => 'html',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_store_index_file_subs' => array(
|
||||
'label' => $lng['serversettings']['system_store_index_file_subs'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'store_index_file_subs',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_httpuser' => array(
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'httpuser',
|
||||
'type' => 'hidden',
|
||||
'default' => 'www-data'
|
||||
),
|
||||
'default' => 'www-data',
|
||||
),
|
||||
'system_httpgroup' => array(
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'httpgroup',
|
||||
'type' => 'hidden',
|
||||
'default' => 'www-data'
|
||||
),
|
||||
'system_report_enable' => array(
|
||||
'label' => $lng['serversettings']['report']['report'],
|
||||
'default' => 'www-data',
|
||||
),
|
||||
'system_debug_cron' => array(
|
||||
'label' => $lng['serversettings']['cron']['debug'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'report_enable',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'cronmodule' => 'froxlor/reports',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_report_webmax' => array(
|
||||
'label' => $lng['serversettings']['report']['webmax'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'report_webmax',
|
||||
'type' => 'int',
|
||||
'int_min' => 0,
|
||||
'int_max' => 150,
|
||||
'default' => 90,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_report_trafficmax' => array(
|
||||
'label' => $lng['serversettings']['report']['trafficmax'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'report_trafficmax',
|
||||
'type' => 'int',
|
||||
'int_min' => 0,
|
||||
'int_max' => 150,
|
||||
'default' => 90,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
|
||||
'system_mail_use_smtp' => array(
|
||||
'label' => $lng['serversettings']['mail_use_smtp'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mail_use_smtp',
|
||||
'varname' => 'debug_cron',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
),
|
||||
'system_mail_smtp_host' => array(
|
||||
'label' => $lng['serversettings']['mail_smtp_host'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mail_smtp_host',
|
||||
'type' => 'string',
|
||||
'default' => 'localhost',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'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'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -1,247 +0,0 @@
|
||||
<?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)
|
||||
),
|
||||
/**
|
||||
* 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')
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2014 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Settings
|
||||
*
|
||||
*/
|
||||
return array(
|
||||
'groups' => array(
|
||||
'crond' => array(
|
||||
'title' => $lng['admin']['cronsettings'],
|
||||
'fields' => array(
|
||||
'system_cronconfig' => array(
|
||||
'label' => $lng['serversettings']['system_cronconfig'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'cronconfig',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'default' => '/etc/cron.d/froxlor',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_croncmdline' => array(
|
||||
'label' => $lng['serversettings']['system_croncmdline'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'croncmdline',
|
||||
'type' => 'string',
|
||||
'default' => '/usr/bin/nice -n 5 /usr/bin/php -q',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_crondreload' => array(
|
||||
'label' => $lng['serversettings']['system_crondreload'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'crondreload',
|
||||
'type' => 'string',
|
||||
'default' => '/etc/init.d/cron reload',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_cron_allowautoupdate' => array(
|
||||
'label' => $lng['serversettings']['system_cron_allowautoupdate'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'cron_allowautoupdate',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_debug_cron' => array(
|
||||
'label' => $lng['serversettings']['cron']['debug'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'debug_cron',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -13,9 +13,10 @@
|
||||
* @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 \Froxlor\Settings
|
||||
*
|
||||
* @package Settings
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'webserver' => array(
|
||||
@@ -26,83 +27,12 @@ return array(
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'webserver',
|
||||
'type' => 'option',
|
||||
'default' => 'apache2',
|
||||
'default' => 'Apache2',
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array(
|
||||
'apache2' => 'Apache 2',
|
||||
'lighttpd' => 'ligHTTPd',
|
||||
'nginx' => 'Nginx'
|
||||
),
|
||||
'option_options' => array('apache2' => 'Apache 2', 'lighttpd' => 'ligHTTPd'),
|
||||
'save_method' => 'storeSettingField',
|
||||
'plausibility_check_method' => array(
|
||||
'\\Froxlor\\Validate\\Check',
|
||||
'checkPhpInterfaceSetting'
|
||||
),
|
||||
'overview_option' => true
|
||||
),
|
||||
'system_apache_24' => array(
|
||||
'label' => $lng['serversettings']['apache_24'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'apache24',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'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'
|
||||
),
|
||||
'visible' => \Froxlor\Settings::Get('system.use_ssl')
|
||||
),
|
||||
'system_dhparams_file' => array(
|
||||
'label' => $lng['serversettings']['dhparams_file'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'dhparams_file',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
'visible' => \Froxlor\Settings::Get('system.use_ssl')
|
||||
),
|
||||
'system_httpuser' => array(
|
||||
'label' => $lng['admin']['webserver_user'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'httpuser',
|
||||
'type' => 'string',
|
||||
'default' => 'www-data',
|
||||
'save_method' => 'storeSettingWebserverFcgidFpmUser'
|
||||
),
|
||||
'system_httpgroup' => array(
|
||||
'label' => $lng['admin']['webserver_group'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'httpgroup',
|
||||
'type' => 'string',
|
||||
'default' => 'www-data',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_apacheconf_vhost' => array(
|
||||
'label' => $lng['serversettings']['apacheconf_vhost'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -110,8 +40,8 @@ return array(
|
||||
'type' => 'string',
|
||||
'string_type' => 'filedir',
|
||||
'default' => '/etc/apache2/sites-enabled/',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_apacheconf_diroptions' => array(
|
||||
'label' => $lng['serversettings']['apacheconf_diroptions'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -119,17 +49,33 @@ return array(
|
||||
'type' => 'string',
|
||||
'string_type' => 'filedir',
|
||||
'default' => '/etc/apache2/sites-enabled/',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_apacheconf_htpasswddir' => array(
|
||||
'label' => $lng['serversettings']['apacheconf_htpasswddir'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'apacheconf_htpasswddir',
|
||||
'type' => 'string',
|
||||
'string_type' => 'confdir',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/etc/apache2/htpasswd/',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_apachereload_command' => array(
|
||||
'label' => $lng['serversettings']['apachereload_command'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'apachereload_command',
|
||||
'type' => 'string',
|
||||
'default' => '/etc/init.d/apache2 reload',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mod_log_sql' => array(
|
||||
'label' => $lng['serversettings']['mod_log_sql'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_log_sql',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_logfiles_directory' => array(
|
||||
'label' => $lng['serversettings']['logfiles_directory'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -137,92 +83,8 @@ return array(
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/var/customers/logs/',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_logfiles_script' => array(
|
||||
'label' => $lng['serversettings']['logfiles_script'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'logfiles_script',
|
||||
'type' => 'string',
|
||||
'string_type' => '',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array(
|
||||
'apache2'
|
||||
)
|
||||
),
|
||||
'system_logfiles_piped' => array(
|
||||
'label' => $lng['serversettings']['logfiles_piped'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'logfiles_piped',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array(
|
||||
'apache2'
|
||||
)
|
||||
),
|
||||
'system_logfiles_format' => array(
|
||||
'label' => $lng['serversettings']['logfiles_format'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'logfiles_format',
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'string_emptyallowed' => true,
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array(
|
||||
'apache2',
|
||||
'nginx'
|
||||
)
|
||||
),
|
||||
'system_logfiles_type' => array(
|
||||
'label' => $lng['serversettings']['logfiles_type'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'logfiles_type',
|
||||
'type' => 'option',
|
||||
'default' => '1',
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array(
|
||||
'1' => 'combined',
|
||||
'2' => 'vhost_combined'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array(
|
||||
'apache2'
|
||||
)
|
||||
),
|
||||
'system_errorlog_level' => array(
|
||||
'label' => $lng['serversettings']['errorlog_level'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'errorlog_level',
|
||||
'type' => 'option',
|
||||
'default' => (\Froxlor\Settings::Get('system.webserver') == 'nginx' ? 'error' : 'warn'),
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array(
|
||||
'emerg' => 'emerg',
|
||||
'alert' => 'alert',
|
||||
'crit' => 'crit',
|
||||
'error' => 'error',
|
||||
'warn' => 'warn',
|
||||
'notice' => 'notice',
|
||||
'info' => 'info',
|
||||
'debug' => 'debug'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array(
|
||||
'apache2',
|
||||
'nginx'
|
||||
)
|
||||
),
|
||||
'system_customersslpath' => array(
|
||||
'label' => $lng['serversettings']['customerssl_directory'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'customer_ssl_path',
|
||||
'type' => 'string',
|
||||
'string_type' => 'confdir',
|
||||
'default' => '/etc/ssl/froxlor-custom/',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpappendopenbasedir' => array(
|
||||
'label' => $lng['serversettings']['phpappendopenbasedir'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -230,8 +92,8 @@ return array(
|
||||
'type' => 'string',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_deactivateddocroot' => array(
|
||||
'label' => $lng['serversettings']['deactivateddocroot'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -240,78 +102,24 @@ return array(
|
||||
'string_type' => 'dir',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_default_vhostconf' => array(
|
||||
'label' => $lng['serversettings']['default_vhostconf'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'default_vhostconf',
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_apache_globaldiropt' => array(
|
||||
'label' => $lng['serversettings']['apache_globaldiropt'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'apacheglobaldiropt',
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
'visible' => (\Froxlor\Settings::Get('system.mod_fcgid') == 0 && \Froxlor\Settings::Get('phpfpm.enabled') == 0),
|
||||
'websrv_avail' => array(
|
||||
'apache2'
|
||||
)
|
||||
),
|
||||
'system_apachereload_command' => array(
|
||||
'label' => $lng['serversettings']['apachereload_command'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'apachereload_command',
|
||||
'type' => 'string',
|
||||
'default' => '/etc/init.d/apache2 reload',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpreload_command' => array(
|
||||
'label' => $lng['serversettings']['phpreload_command'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'phpreload_command',
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array(
|
||||
'nginx'
|
||||
)
|
||||
),
|
||||
'system_nginx_php_backend' => array(
|
||||
'label' => $lng['serversettings']['nginx_php_backend'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'nginx_php_backend',
|
||||
'type' => 'string',
|
||||
'default' => '127.0.0.1:8888',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array(
|
||||
'nginx'
|
||||
)
|
||||
),
|
||||
'nginx_fastcgiparams' => array(
|
||||
'label' => $lng['serversettings']['nginx_fastcgiparams'],
|
||||
'settinggroup' => 'nginx',
|
||||
'varname' => 'fastcgiparams',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'default' => '/etc/nginx/fastcgi_params',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array(
|
||||
'nginx'
|
||||
)
|
||||
),
|
||||
),
|
||||
'defaultwebsrverrhandler_enabled' => array(
|
||||
'label' => $lng['serversettings']['defaultwebsrverrhandler_enabled'],
|
||||
'settinggroup' => 'defaultwebsrverrhandler',
|
||||
'varname' => 'enabled',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'defaultwebsrverrhandler_err401' => array(
|
||||
'label' => $lng['serversettings']['defaultwebsrverrhandler_err401'],
|
||||
'settinggroup' => 'defaultwebsrverrhandler',
|
||||
@@ -319,11 +127,7 @@ return array(
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array(
|
||||
'apache2',
|
||||
'nginx'
|
||||
)
|
||||
),
|
||||
),
|
||||
'defaultwebsrverrhandler_err403' => array(
|
||||
'label' => $lng['serversettings']['defaultwebsrverrhandler_err403'],
|
||||
'settinggroup' => 'defaultwebsrverrhandler',
|
||||
@@ -331,19 +135,15 @@ return array(
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array(
|
||||
'apache2',
|
||||
'nginx'
|
||||
)
|
||||
),
|
||||
),
|
||||
'defaultwebsrverrhandler_err404' => array(
|
||||
'label' => $lng['serversettings']['defaultwebsrverrhandler_err404'],
|
||||
'settinggroup' => 'defaultwebsrverrhandler',
|
||||
'varname' => 'err404',
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'defaultwebsrverrhandler_err500' => array(
|
||||
'label' => $lng['serversettings']['defaultwebsrverrhandler_err500'],
|
||||
'settinggroup' => 'defaultwebsrverrhandler',
|
||||
@@ -351,19 +151,15 @@ return array(
|
||||
'type' => 'string',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array(
|
||||
'apache2',
|
||||
'nginx'
|
||||
)
|
||||
),
|
||||
),
|
||||
'customredirect_enabled' => array(
|
||||
'label' => $lng['serversettings']['customredirect_enabled'],
|
||||
'settinggroup' => 'customredirect',
|
||||
'varname' => 'enabled',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'customredirect_default' => array(
|
||||
'label' => $lng['serversettings']['customredirect_default'],
|
||||
'settinggroup' => 'customredirect',
|
||||
@@ -371,10 +167,63 @@ return array(
|
||||
'type' => 'option',
|
||||
'default' => '1',
|
||||
'option_mode' => 'one',
|
||||
'option_options_method' => array('\\Froxlor\\Domain\\Domain', 'getRedirectCodes'),
|
||||
'save_method' => 'storeSettingField'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
'option_options_method' => 'getRedirectCodes',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
),
|
||||
),
|
||||
'ssl' => array(
|
||||
'title' => $lng['admin']['sslsettings'],
|
||||
'fields' => array(
|
||||
'system_ssl_enabled' => array(
|
||||
'label' => $lng['serversettings']['ssl']['use_ssl'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'use_ssl',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_ssl_cert_file' => array(
|
||||
'label' => $lng['serversettings']['ssl']['ssl_cert_file'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'ssl_cert_file',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '/etc/apache2/apache2.pem',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_ssl_key_file' => array(
|
||||
'label' => $lng['serversettings']['ssl']['ssl_key_file'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'ssl_key_file',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '/etc/apache2/apache2.key',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_ssl_ca_file' => array(
|
||||
'label' => $lng['serversettings']['ssl']['ssl_ca_file'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'ssl_ca_file',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_ssl_openssl_cnf' => array(
|
||||
'label' => $lng['serversettings']['ssl']['openssl_cnf'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'openssl_cnf',
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -1,219 +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 \Froxlor\Settings
|
||||
*
|
||||
*/
|
||||
return array(
|
||||
'groups' => array(
|
||||
'ssl' => array(
|
||||
'title' => $lng['admin']['sslsettings'],
|
||||
'fields' => array(
|
||||
'system_ssl_enabled' => array(
|
||||
'label' => $lng['serversettings']['ssl']['use_ssl'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'use_ssl',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'overview_option' => true
|
||||
),
|
||||
'system_ssl_protocols' => array(
|
||||
'label' => $lng['serversettings']['ssl']['ssl_protocols'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'ssl_protocols',
|
||||
'type' => 'option',
|
||||
'default' => 'TLSv1,TLSv1.2',
|
||||
'option_mode' => 'multiple',
|
||||
'option_options' => array(
|
||||
'TLSv1' => 'TLSv1',
|
||||
'TLSv1.1' => 'TLSv1.1',
|
||||
'TLSv1.2' => 'TLSv1.2',
|
||||
'TLSv1.3' => 'TLSv1.3'
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_ssl_cipher_list' => array(
|
||||
'label' => $lng['serversettings']['ssl']['ssl_cipher_list'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'ssl_cipher_list',
|
||||
'type' => 'string',
|
||||
'string_emptyallowed' => false,
|
||||
'default' => 'ECDH+AESGCM:ECDH+AES256:!aNULL:!MD5:!DSS:!DH:!AES128',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_tlsv13_cipher_list' => array(
|
||||
'label' => $lng['serversettings']['ssl']['tlsv13_cipher_list'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'tlsv13_cipher_list',
|
||||
'type' => 'string',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'visible' => \Froxlor\Settings::Get('system.webserver') == "apache2" && \Froxlor\Settings::Get('system.apache24') == 1,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_ssl_cert_file' => array(
|
||||
'label' => $lng['serversettings']['ssl']['ssl_cert_file'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'ssl_cert_file',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '/etc/apache2/apache2.pem',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_ssl_key_file' => array(
|
||||
'label' => $lng['serversettings']['ssl']['ssl_key_file'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'ssl_key_file',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '/etc/apache2/apache2.key',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_ssl_cert_chainfile' => array(
|
||||
'label' => $lng['admin']['ipsandports']['ssl_cert_chainfile'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'ssl_cert_chainfile',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_ssl_ca_file' => array(
|
||||
'label' => $lng['serversettings']['ssl']['ssl_ca_file'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'ssl_ca_file',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_apache24_ocsp_cache_path' => array(
|
||||
'label' => $lng['serversettings']['ssl']['apache24_ocsp_cache_path'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'apache24_ocsp_cache_path',
|
||||
'type' => 'string',
|
||||
'string_type' => 'string',
|
||||
'string_emptyallowed' => false,
|
||||
'default' => 'shmcb:/var/run/apache2/ocsp-stapling.cache(131072)',
|
||||
'visible' => \Froxlor\Settings::Get('system.webserver') == "apache2" && \Froxlor\Settings::Get('system.apache24') == 1,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_leenabled' => array(
|
||||
'label' => $lng['serversettings']['leenabled'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'leenabled',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'cronmodule' => 'froxlor/letsencrypt',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_letsencryptacmeconf' => array(
|
||||
'label' => $lng['serversettings']['letsencryptacmeconf'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'letsencryptacmeconf',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'default' => '/etc/apache2/conf-enabled/acme.conf',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_leapiversion' => array(
|
||||
'label' => $lng['serversettings']['leapiversion'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'leapiversion',
|
||||
'type' => 'option',
|
||||
'default' => '2',
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array(
|
||||
'1' => 'ACME v1',
|
||||
'2' => 'ACME v2'
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_letsencryptca' => array(
|
||||
'label' => $lng['serversettings']['letsencryptca'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'letsencryptca',
|
||||
'type' => 'option',
|
||||
'default' => 'testing',
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array(
|
||||
'testing' => 'https://acme-staging' . (\Froxlor\Settings::Get('system.leapiversion') == '2' ? '-v02' : '') . '.api.letsencrypt.org (Test)',
|
||||
'production' => 'https://acme-v0' . \Froxlor\Settings::Get('system.leapiversion') . '.api.letsencrypt.org (Live)'
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_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']['disable_le_selfcheck'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'disable_le_selfcheck',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -1,128 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Settings
|
||||
*
|
||||
*/
|
||||
return array(
|
||||
'groups' => array(
|
||||
'fcgid' => array(
|
||||
'title' => $lng['admin']['fcgid_settings'],
|
||||
'websrv_avail' => array(
|
||||
'apache2',
|
||||
'lighttpd'
|
||||
),
|
||||
'fields' => array(
|
||||
'system_mod_fcgid_enabled' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'plausibility_check_method' => array(
|
||||
'\\Froxlor\\Validate\\Check',
|
||||
'checkFcgidPhpFpm'
|
||||
),
|
||||
'overview_option' => true
|
||||
),
|
||||
'system_mod_fcgid_configdir' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['configdir'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_configdir',
|
||||
'type' => 'string',
|
||||
'string_type' => 'confdir',
|
||||
'default' => '/var/www/php-fcgi-scripts/',
|
||||
'plausibility_check_method' => array(
|
||||
'\\Froxlor\\Validate\\Check',
|
||||
'checkPathConflicts'
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_mod_fcgid_tmpdir' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['tmpdir'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_tmpdir',
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/var/customers/tmp/',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_mod_fcgid_peardir' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['peardir'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_peardir',
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'string_delimiter' => ':',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '/usr/share/php/:/usr/share/php5/',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_mod_fcgid_wrapper' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['wrapper'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_wrapper',
|
||||
'type' => 'option',
|
||||
'option_options' => array(
|
||||
0 => 'ScriptAlias',
|
||||
1 => 'FcgidWrapper'
|
||||
),
|
||||
'default' => 1,
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array(
|
||||
'apache2'
|
||||
)
|
||||
),
|
||||
'system_mod_fcgid_starter' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['starter'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_starter',
|
||||
'type' => 'int',
|
||||
'default' => 0,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_mod_fcgid_maxrequests' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['maxrequests'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_maxrequests',
|
||||
'type' => 'int',
|
||||
'default' => 250,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_mod_fcgid_defaultini' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['defaultini'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_defaultini',
|
||||
'type' => 'option',
|
||||
'default' => '1',
|
||||
'option_mode' => 'one',
|
||||
'option_options_method' => array(
|
||||
'\\Froxlor\\Http\\PhpConfig',
|
||||
'getPhpConfigs'),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_mod_fcgid_idle_timeout' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['idle_timeout'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_idle_timeout',
|
||||
'type' => 'int',
|
||||
'default' => 30,
|
||||
'save_method' => 'storeSettingField'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -1,141 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package \Froxlor\Settings
|
||||
*
|
||||
*/
|
||||
return array(
|
||||
'groups' => array(
|
||||
'phpfpm' => array(
|
||||
'title' => $lng['admin']['phpfpm_settings'],
|
||||
'fields' => array(
|
||||
'system_phpfpm_enabled' => array(
|
||||
'label' => $lng['serversettings']['phpfpm'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'enabled',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'plausibility_check_method' => array(
|
||||
'\\Froxlor\\Validate\\Check',
|
||||
'checkFcgidPhpFpm'
|
||||
),
|
||||
'overview_option' => true
|
||||
),
|
||||
'system_phpfpm_defaultini' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['defaultini'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'defaultini',
|
||||
'type' => 'option',
|
||||
'default' => '1',
|
||||
'option_mode' => 'one',
|
||||
'option_options_method' => array(
|
||||
'\\Froxlor\\Http\\PhpConfig',
|
||||
'getPhpConfigs'
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_aliasconfigdir' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['aliasconfigdir'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'aliasconfigdir',
|
||||
'type' => 'string',
|
||||
'string_type' => 'confdir',
|
||||
'default' => '/var/www/php-fpm/',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_tmpdir' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['tmpdir'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'tmpdir',
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/var/customers/tmp/',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_peardir' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['peardir'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'peardir',
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'string_delimiter' => ':',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '/usr/share/php/:/usr/share/php5/',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_envpath' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['envpath'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'envpath',
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'string_delimiter' => ':',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '/usr/local/bin:/usr/bin:/bin',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_fastcgi_ipcdir' => array(
|
||||
'label' => $lng['serversettings']['phpfpm_settings']['ipcdir'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'fastcgi_ipcdir',
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/var/lib/apache2/fastcgi/',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_use_mod_proxy' => array(
|
||||
'label' => $lng['phpfpm']['use_mod_proxy'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'use_mod_proxy',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'visible' => \Froxlor\Settings::Get('system.apache24'),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_ini_flags' => array(
|
||||
'label' => $lng['phpfpm']['ini_flags'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'ini_flags',
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_ini_values' => array(
|
||||
'label' => $lng['phpfpm']['ini_values'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'ini_values',
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_ini_admin_flags' => array(
|
||||
'label' => $lng['phpfpm']['ini_admin_flags'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'ini_admin_flags',
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_phpfpm_ini_admin_values' => array(
|
||||
'label' => $lng['phpfpm']['ini_admin_values'],
|
||||
'settinggroup' => 'phpfpm',
|
||||
'varname' => 'ini_admin_values',
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -1,72 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Settings
|
||||
*
|
||||
*/
|
||||
return array(
|
||||
'groups' => array(
|
||||
'perl' => array(
|
||||
'title' => $lng['admin']['perl_settings'],
|
||||
'fields' => array(
|
||||
'perl_path' => array(
|
||||
'label' => $lng['serversettings']['perl_path'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'perl_path',
|
||||
'type' => 'string',
|
||||
'default' => '/usr/bin/perl',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array(
|
||||
'lighttpd'
|
||||
)
|
||||
),
|
||||
'system_perl_suexecworkaround' => array(
|
||||
'label' => $lng['serversettings']['perl']['suexecworkaround'],
|
||||
'settinggroup' => 'perl',
|
||||
'varname' => 'suexecworkaround',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array(
|
||||
'apache2'
|
||||
)
|
||||
),
|
||||
'system_perl_suexeccgipath' => array(
|
||||
'label' => $lng['serversettings']['perl']['suexeccgipath'],
|
||||
'settinggroup' => 'perl',
|
||||
'varname' => 'suexecpath',
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/var/www/cgi-bin/',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array(
|
||||
'apache2'
|
||||
)
|
||||
),
|
||||
'perl_server' => array(
|
||||
'label' => $lng['serversettings']['perl_server'],
|
||||
'settinggroup' => 'serversettings',
|
||||
'varname' => 'perl_server',
|
||||
'type' => 'string',
|
||||
'default' => 'unix:/var/run/nginx/cgiwrap-dispatch.sock',
|
||||
'save_method' => 'storeSettingField',
|
||||
'websrv_avail' => array(
|
||||
'nginx'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -14,8 +14,9 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Settings
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'statistics' => array(
|
||||
@@ -28,21 +29,17 @@ return array(
|
||||
'type' => 'option',
|
||||
'default' => 2,
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array(
|
||||
0 => $lng['admin']['webalizer']['normal'],
|
||||
1 => $lng['admin']['webalizer']['quiet'],
|
||||
2 => $lng['admin']['webalizer']['veryquiet']
|
||||
'option_options' => array(0 => $lng['admin']['webalizer']['normal'], 1 => $lng['admin']['webalizer']['quiet'], 2 => $lng['admin']['webalizer']['veryquiet']),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_awstats_enabled' => array(
|
||||
'label' => $lng['serversettings']['awstats_enabled'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'awstats_enabled',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_awstats_path' => array(
|
||||
'label' => $lng['serversettings']['awstats_path'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -50,17 +47,8 @@ return array(
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/usr/bin/',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_awstats_awstatspath' => array(
|
||||
'label' => $lng['serversettings']['awstats_awstatspath'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'awstats_awstatspath',
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/usr/bin/',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_awstats_conf' => array(
|
||||
'label' => $lng['serversettings']['awstats_conf'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -68,20 +56,11 @@ return array(
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/etc/awstats/',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_awstats_icons' => array(
|
||||
'label' => $lng['serversettings']['awstats_icons'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'awstats_icons',
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/usr/share/awstats/icon/',
|
||||
'save_method' => 'storeSettingField'
|
||||
'save_method' => 'storeSettingField',
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -14,8 +14,9 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Settings
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'mail' => array(
|
||||
@@ -29,8 +30,8 @@ return array(
|
||||
'default' => 2000,
|
||||
'int_min' => 1,
|
||||
'int_max' => 65535,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_vmail_gid' => array(
|
||||
'label' => $lng['serversettings']['vmail_gid'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -39,8 +40,8 @@ return array(
|
||||
'default' => 2000,
|
||||
'int_min' => 1,
|
||||
'int_max' => 65535,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_vmail_homedir' => array(
|
||||
'label' => $lng['serversettings']['vmail_homedir'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -48,107 +49,50 @@ return array(
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/var/customers/mail/',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_vmail_maildirname' => array(
|
||||
'label' => $lng['serversettings']['vmail_maildirname'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'vmail_maildirname',
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => 'Maildir',
|
||||
'string_emptyallowed' => true,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'panel_sendalternativemail' => array(
|
||||
'label' => $lng['serversettings']['sendalternativemail'],
|
||||
'settinggroup' => 'panel',
|
||||
'varname' => 'sendalternativemail',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mail_quota_enabled' => array(
|
||||
'label' => $lng['serversettings']['mail_quota_enabled'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mail_quota_enabled',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mail_quota' => array(
|
||||
'label' => $lng['serversettings']['mail_quota'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mail_quota',
|
||||
'type' => 'int',
|
||||
'default' => 100,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_catchall_enabled' => array(
|
||||
'label' => $lng['serversettings']['catchall_enabled'],
|
||||
'settinggroup' => 'catchall',
|
||||
'varname' => 'catchall_enabled',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingResetCatchall'
|
||||
),
|
||||
'system_mailtraffic_enabled' => array(
|
||||
'label' => $lng['serversettings']['mailtraffic_enabled'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mailtraffic_enabled',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_mdaserver' => array(
|
||||
'label' => $lng['serversettings']['mdaserver'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mdaserver',
|
||||
'type' => 'option',
|
||||
'option_mode' => 'one',
|
||||
'default' => 'dovecot',
|
||||
'option_options' => array(
|
||||
'courier' => 'Courier',
|
||||
'dovecot' => 'Dovecot'
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_mdalog' => array(
|
||||
'label' => $lng['serversettings']['mdalog'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mdalog',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'default' => '/var/log/mail.log',
|
||||
'string_emptyallowed' => true,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_mtaserver' => array(
|
||||
'label' => $lng['serversettings']['mtaserver'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mtaserver',
|
||||
'type' => 'option',
|
||||
'option_mode' => 'one',
|
||||
'default' => 'postfix',
|
||||
'option_options' => array(
|
||||
'exim4' => 'Exim4',
|
||||
'postfix' => 'Postfix'
|
||||
'system_autoresponder_enabled' => array(
|
||||
'label' => $lng['serversettings']['autoresponder_active'],
|
||||
'settinggroup' => 'autoresponder',
|
||||
'varname' => 'autoresponder_active',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'cronmodule' => 'froxlor/autoresponder',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_last_autoresponder_run' => array(
|
||||
'settinggroup' => 'autoresponder',
|
||||
'varname' => 'last_autoresponder_run',
|
||||
'type' => 'hidden',
|
||||
'default' => 0,
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_mtalog' => array(
|
||||
'label' => $lng['serversettings']['mtalog'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mtalog',
|
||||
'type' => 'string',
|
||||
'string_type' => 'file',
|
||||
'default' => '/var/log/mail.log',
|
||||
'string_emptyallowed' => true,
|
||||
'save_method' => 'storeSettingField'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -14,11 +14,12 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Settings
|
||||
*
|
||||
* @version $Id: 220.ftpserver.php 1 2010-04-07 10:00:00Z monotek $
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'ftpserver' => array(
|
||||
'ftpserver' => array(
|
||||
'title' => $lng['admin']['ftpserversettings'],
|
||||
'fields' => array(
|
||||
'ftpserver' => array(
|
||||
@@ -28,14 +29,11 @@ return array(
|
||||
'type' => 'option',
|
||||
'default' => 'proftpd',
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array(
|
||||
'proftpd' => 'Proftpd',
|
||||
'pureftpd' => 'Pureftpd'
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
)
|
||||
)
|
||||
)
|
||||
'option_options' => array('proftpd' => 'Proftpd', 'pureftpd' => 'Pureftpd'),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -14,43 +14,14 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Settings
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'nameserver' => array(
|
||||
'title' => $lng['admin']['nameserversettings'],
|
||||
'fields' => array(
|
||||
'nameserver_enable' => array(
|
||||
'label' => $lng['serversettings']['bindenable'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'bind_enable',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingField',
|
||||
'overview_option' => true
|
||||
),
|
||||
'system_dnsenabled' => array(
|
||||
'label' => $lng['serversettings']['dnseditorenable'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'dnsenabled',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_dns_server' => array(
|
||||
'label' => $lng['serversettings']['dns_server'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'dns_server',
|
||||
'type' => 'option',
|
||||
'default' => 'Bind',
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array(
|
||||
'Bind' => 'Bind9',
|
||||
'PowerDNS' => 'PowerDNS'
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_bindconf_directory' => array(
|
||||
'label' => $lng['serversettings']['bindconf_directory'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -58,16 +29,16 @@ return array(
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/etc/bind/',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_bindreload_command' => array(
|
||||
'label' => $lng['serversettings']['bindreload_command'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'bindreload_command',
|
||||
'type' => 'string',
|
||||
'default' => '/etc/init.d/bind9 reload',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_nameservers' => array(
|
||||
'label' => $lng['serversettings']['nameservers'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -76,8 +47,8 @@ return array(
|
||||
'string_regexp' => '/^(([a-z0-9\-\._]+, ?)*[a-z0-9\-\._]+)?$/i',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingFieldInsertBindTask'
|
||||
),
|
||||
'save_method' => 'storeSettingFieldInsertBindTask',
|
||||
),
|
||||
'system_mxservers' => array(
|
||||
'label' => $lng['serversettings']['mxservers'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -86,43 +57,8 @@ return array(
|
||||
'string_regexp' => '/^(([0-9]+ [a-z0-9\-\._]+, ?)*[0-9]+ [a-z0-9\-\._]+)?$/i',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_axfrservers' => array(
|
||||
'label' => $lng['serversettings']['axfrservers'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'axfrservers',
|
||||
'type' => 'string',
|
||||
'string_type' => 'validate_ip_incl_private',
|
||||
'string_delimiter' => ',',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_dns_createmailentry' => array(
|
||||
'label' => $lng['serversettings']['mail_also_with_mxservers'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'dns_createmailentry',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_dns_createcaaentry' => array(
|
||||
'label' => $lng['serversettings']['caa_entry'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'dns_createcaaentry',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'caa_caa_entry' => array(
|
||||
'label' => $lng['serversettings']['caa_entry_custom'],
|
||||
'settinggroup' => 'caa',
|
||||
'varname' => 'caa_entry',
|
||||
'type' => 'text',
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_defaultttl' => array(
|
||||
'label' => $lng['serversettings']['defaultttl'],
|
||||
'settinggroup' => 'system',
|
||||
@@ -131,9 +67,11 @@ return array(
|
||||
'default' => 604800, /* 1 week */
|
||||
'int_min' => 3600, /* 1 hour */
|
||||
'int_max' => 2147483647, /* integer max */
|
||||
'save_method' => 'storeSettingField'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -14,8 +14,9 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Settings
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'logging' => array(
|
||||
@@ -29,7 +30,7 @@ return array(
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'overview_option' => true
|
||||
),
|
||||
),
|
||||
'logger_severity' => array(
|
||||
'label' => $lng['serversettings']['logger']['severity'],
|
||||
'settinggroup' => 'logger',
|
||||
@@ -37,12 +38,9 @@ return array(
|
||||
'type' => 'option',
|
||||
'default' => 1,
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array(
|
||||
1 => $lng['admin']['logger']['normal'],
|
||||
2 => $lng['admin']['logger']['paranoid']
|
||||
'option_options' => array(1 => $lng['admin']['logger']['normal'], 2 => $lng['admin']['logger']['paranoid']),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'logger_logtypes' => array(
|
||||
'label' => $lng['serversettings']['logger']['types'],
|
||||
'settinggroup' => 'logger',
|
||||
@@ -50,13 +48,9 @@ return array(
|
||||
'type' => 'option',
|
||||
'default' => 'syslog,mysql',
|
||||
'option_mode' => 'multiple',
|
||||
'option_options' => array(
|
||||
'syslog' => 'syslog',
|
||||
'file' => 'file',
|
||||
'mysql' => 'mysql'
|
||||
'option_options' => array('syslog' => 'syslog', 'file' => 'file', 'mysql' => 'mysql'),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'logger_logfile' => array(
|
||||
'label' => $lng['serversettings']['logger']['logfile'],
|
||||
'settinggroup' => 'logger',
|
||||
@@ -65,25 +59,19 @@ return array(
|
||||
'string_type' => 'file',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'logger_log_cron' => array(
|
||||
'label' => $lng['serversettings']['logger']['logcron'],
|
||||
'settinggroup' => 'logger',
|
||||
'varname' => 'log_cron',
|
||||
'type' => 'option',
|
||||
'default' => 0,
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array(
|
||||
0 => $lng['serversettings']['logger']['logcronoption']['never'],
|
||||
1 => $lng['serversettings']['logger']['logcronoption']['once'],
|
||||
2 => $lng['serversettings']['logger']['logcronoption']['always']
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
)
|
||||
)
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -13,9 +13,10 @@
|
||||
* @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 \Froxlor\Settings
|
||||
*
|
||||
* @package Settings
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'dkim' => array(
|
||||
@@ -29,16 +30,15 @@ return array(
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingFieldInsertBindTask',
|
||||
'overview_option' => true
|
||||
),
|
||||
),
|
||||
'dkim_prefix' => array(
|
||||
'label' => $lng['dkim']['dkim_prefix'],
|
||||
'settinggroup' => 'dkim',
|
||||
'varname' => 'dkim_prefix',
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/etc/postfix/dkim/',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'dkim_domains' => array(
|
||||
'label' => $lng['dkim']['dkim_domains'],
|
||||
'settinggroup' => 'dkim',
|
||||
@@ -46,8 +46,8 @@ return array(
|
||||
'type' => 'string',
|
||||
'string_regexp' => '/^[a-z0-9\._]+$/i',
|
||||
'default' => 'domains',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'dkim_dkimkeys' => array(
|
||||
'label' => $lng['dkim']['dkim_dkimkeys'],
|
||||
'settinggroup' => 'dkim',
|
||||
@@ -55,8 +55,8 @@ return array(
|
||||
'type' => 'string',
|
||||
'string_regexp' => '/^[a-z0-9\._]+$/i',
|
||||
'default' => 'dkim-keys.conf',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'dkim_algorithm' => array(
|
||||
'label' => $lng['dkim']['dkim_algorithm'],
|
||||
'settinggroup' => 'dkim',
|
||||
@@ -64,13 +64,9 @@ return array(
|
||||
'type' => 'option',
|
||||
'default' => 'all',
|
||||
'option_mode' => 'multiple',
|
||||
'option_options' => array(
|
||||
'all' => 'All',
|
||||
'sha1' => 'SHA1',
|
||||
'sha256' => 'SHA256'
|
||||
'option_options' => array('all' => 'All', 'sha1' => 'SHA1', 'sha256' => 'SHA256'),
|
||||
'save_method' => 'storeSettingFieldInsertBindTask',
|
||||
),
|
||||
'save_method' => 'storeSettingFieldInsertBindTask'
|
||||
),
|
||||
'dkim_servicetype' => array(
|
||||
'label' => $lng['dkim']['dkim_servicetype'],
|
||||
'settinggroup' => 'dkim',
|
||||
@@ -78,28 +74,19 @@ return array(
|
||||
'type' => 'option',
|
||||
'default' => '0',
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array(
|
||||
'0' => 'All',
|
||||
'1' => 'E-Mail'
|
||||
'option_options' => array('0' => 'All', '1' => 'E-Mail'),
|
||||
'save_method' => 'storeSettingFieldInsertBindTask',
|
||||
),
|
||||
'save_method' => 'storeSettingFieldInsertBindTask'
|
||||
),
|
||||
'dkim_keylength' => array(
|
||||
'label' => array(
|
||||
'title' => $lng['dkim']['dkim_keylength']['title'],
|
||||
'description' => sprintf($lng['dkim']['dkim_keylength']['description'], \Froxlor\Settings::Get('dkim.dkim_prefix'))
|
||||
),
|
||||
'label' => $lng['dkim']['dkim_keylength'],
|
||||
'settinggroup' => 'dkim',
|
||||
'varname' => 'dkim_keylength',
|
||||
'type' => 'option',
|
||||
'default' => '1024',
|
||||
'option_mode' => 'one',
|
||||
'option_options' => array(
|
||||
'1024' => '1024 Bit',
|
||||
'2048' => '2048 Bit'
|
||||
'option_options' => array('1024' => '1024 Bit', '2048' => '2048 Bit'),
|
||||
'save_method' => 'storeSettingFieldInsertBindTask',
|
||||
),
|
||||
'save_method' => 'storeSettingFieldInsertBindTask'
|
||||
),
|
||||
'dkim_notes' => array(
|
||||
'label' => $lng['dkim']['dkim_notes'],
|
||||
'settinggroup' => 'dkim',
|
||||
@@ -107,19 +94,37 @@ return array(
|
||||
'type' => 'string',
|
||||
'string_regexp' => '/^[a-z0-9\._]+$/i',
|
||||
'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(
|
||||
'label' => $lng['dkim']['dkimrestart_command'],
|
||||
'settinggroup' => 'dkim',
|
||||
'varname' => 'dkimrestart_command',
|
||||
'type' => 'string',
|
||||
'default' => '/etc/init.d/dkim-filter restart',
|
||||
'save_method' => 'storeSettingField'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -12,8 +12,9 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Settings
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'spf' => array(
|
||||
@@ -27,18 +28,18 @@ return array(
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'overview_option' => true
|
||||
),
|
||||
),
|
||||
'spf_entry' => array(
|
||||
'label' => $lng['spf']['spf_entry'],
|
||||
'settinggroup' => 'spf',
|
||||
'varname' => 'spf_entry',
|
||||
'type' => 'string',
|
||||
'default' => '"v=spf1 a mx -all"',
|
||||
'default' => '@ IN TXT "v=spf1 a mx -all"',
|
||||
'save_method' => 'storeSettingField'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
143
actions/admin/settings/190.ticket.php
Normal file
@@ -0,0 +1,143 @@
|
||||
<?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
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
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',
|
||||
),
|
||||
'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']['unf_high'], 2 => $lng['ticket']['unf_normal'], 3 => $lng['ticket']['unf_low']),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
102
actions/admin/settings/200.aps.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?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
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'aps' => array(
|
||||
'title' => $lng['admin']['aps'],
|
||||
'fields' => array(
|
||||
'aps_enable' => array(
|
||||
'label' => $lng['aps']['activate_aps'],
|
||||
'settinggroup' => 'aps',
|
||||
'varname' => 'aps_active',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'cronmodule' => 'froxlor/aps',
|
||||
'save_method' => 'storeSettingField',
|
||||
'overview_option' => true
|
||||
),
|
||||
'aps_items_per_page' => array(
|
||||
'label' => $lng['aps']['packages_per_page'],
|
||||
'settinggroup' => 'aps',
|
||||
'varname' => 'items_per_page',
|
||||
'type' => 'int',
|
||||
'default' => 20,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'aps_upload_fields' => array(
|
||||
'label' => $lng['aps']['upload_fields'],
|
||||
'settinggroup' => 'aps',
|
||||
'varname' => 'upload_fields',
|
||||
'type' => 'int',
|
||||
'default' => 5,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'aps_exceptions' => array(
|
||||
'label' => $lng['aps']['exceptions'],
|
||||
'type' => 'label',
|
||||
),
|
||||
'aps_php-extension' => array(
|
||||
'label' => $lng['aps']['settings_php_extensions'],
|
||||
'settinggroup' => 'aps',
|
||||
'varname' => 'php-extension',
|
||||
'type' => 'option',
|
||||
'default' => '',
|
||||
'option_mode' => 'multiple',
|
||||
'option_options' => array('gd' => 'GD Library', 'pcre' => 'PCRE', 'ioncube' => 'ionCube', 'ioncube loader' => 'ionCube Loader', 'curl' => 'curl', 'mcrypt' => 'mcrypt', 'imap' => 'imap'),
|
||||
'save_method' => 'storeSettingApsPhpExtensions',
|
||||
),
|
||||
'aps_php-function' => array(
|
||||
'settinggroup' => 'aps',
|
||||
'varname' => 'php-function',
|
||||
'type' => 'hidden',
|
||||
'default' => '',
|
||||
),
|
||||
'aps_php-configuration' => array(
|
||||
'label' => $lng['aps']['settings_php_configuration'],
|
||||
'settinggroup' => 'aps',
|
||||
'varname' => 'php-configuration',
|
||||
'type' => 'option',
|
||||
'default' => '',
|
||||
'option_mode' => 'multiple',
|
||||
'option_options' => array('short_open_tag' => 'short_open_tag', 'file_uploads' => 'file_uploads', 'magic_quotes_gpc' => 'magic_quotes_gpc', 'register_globals' => 'register_globals', 'allow_url_fopen' => 'allow_url_fopen', 'safe_mode' => 'safe_mode', 'post_max_size' => 'post_max_size', 'memory_limit' => 'memory_limit', 'max_execution_time' => 'max_execution_time'),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'aps_webserver-module' => array(
|
||||
'label' => $lng['aps']['settings_webserver_modules'],
|
||||
'settinggroup' => 'aps',
|
||||
'varname' => 'webserver-module',
|
||||
'type' => 'option',
|
||||
'default' => '',
|
||||
'option_mode' => 'multiple',
|
||||
'option_options' => array('mod_perl' => 'mod_perl', 'mod_rewrite' => 'mod_rewrite', 'mod_access' => 'mod_access', 'fcgid-any' => 'FastCGI/mod_fcgid', 'htaccess' => '.htaccess'),
|
||||
'save_method' => 'storeSettingApsWebserverModules',
|
||||
),
|
||||
'aps_webserver-htaccess' => array(
|
||||
'settinggroup' => 'aps',
|
||||
'varname' => 'webserver-htaccess',
|
||||
'type' => 'hidden',
|
||||
'default' => '',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -14,8 +14,9 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Settings
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
return array(
|
||||
'groups' => array(
|
||||
'security' => array(
|
||||
@@ -27,63 +28,91 @@ return array(
|
||||
'varname' => 'unix_names',
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mailpwcleartext' => array(
|
||||
'label' => $lng['serversettings']['mailpwcleartext'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mailpwcleartext',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_passwordcryptfunc' => array(
|
||||
'label' => $lng['serversettings']['passwordcryptfunc'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'passwordcryptfunc',
|
||||
'type' => 'option',
|
||||
'default' => 0,
|
||||
'option_mode' => 'one',
|
||||
'option_options_method' => array(
|
||||
'\\Froxlor\\System\\Crypt',
|
||||
'getAvailablePasswordHashes'
|
||||
'default' => true,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_allow_error_report_admin' => array(
|
||||
'label' => $lng['serversettings']['allow_error_report_admin'],
|
||||
'system_mod_fcgid_enabled' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'allow_error_report_admin',
|
||||
'varname' => 'mod_fcgid',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_allow_error_report_customer' => array(
|
||||
'label' => $lng['serversettings']['allow_error_report_customer'],
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mod_fcgid_configdir' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['configdir'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'allow_error_report_customer',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_allow_customer_shell' => array(
|
||||
'label' => $lng['serversettings']['allow_allow_customer_shell'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'allow_customer_shell',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'system_available_shells' => array(
|
||||
'label' => $lng['serversettings']['available_shells'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'available_shells',
|
||||
'varname' => 'mod_fcgid_configdir',
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/var/www/php-fcgi-scripts/',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mod_fcgid_tmpdir' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['tmpdir'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_tmpdir',
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'default' => '/var/customers/tmp/',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mod_fcgid_peardir' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['peardir'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_peardir',
|
||||
'type' => 'string',
|
||||
'string_type' => 'dir',
|
||||
'string_delimiter' => ':',
|
||||
'string_emptyallowed' => true,
|
||||
'default' => '',
|
||||
'save_method' => 'storeSettingField'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
'default' => '/usr/share/php/:/usr/share/php5/',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mod_fcgid_wrapper' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['wrapper'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_wrapper',
|
||||
'type' => 'option',
|
||||
'option_options' => array(0 => 'ScriptAlias', 1=> 'FCGIWrapper'),
|
||||
'default' => 0,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mod_fcgid_starter' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['starter'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_starter',
|
||||
'type' => 'int',
|
||||
'default' => 0,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mod_fcgid_maxrequests' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['maxrequests'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_maxrequests',
|
||||
'type' => 'int',
|
||||
'default' => 250,
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
'system_mod_fcgid_defaultini' => array(
|
||||
'label' => $lng['serversettings']['mod_fcgid']['defaultini'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'mod_fcgid_defaultini',
|
||||
'type' => 'option',
|
||||
'default' => '1',
|
||||
'option_mode' => 'one',
|
||||
'option_options_method' => 'getPhpConfigs',
|
||||
'save_method' => 'storeSettingField',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
@@ -1,59 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2011- 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> (2011-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Settings
|
||||
*
|
||||
*/
|
||||
return array(
|
||||
'groups' => array(
|
||||
'diskquota' => array(
|
||||
'title' => $lng['diskquota'],
|
||||
'fields' => array(
|
||||
'diskquota_enabled' => array(
|
||||
'label' => $lng['serversettings']['diskquota_enabled'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'diskquota_enabled',
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'save_method' => 'storeSettingField',
|
||||
'overview_option' => true
|
||||
),
|
||||
'diskquota_repquota_path' => array(
|
||||
'label' => $lng['serversettings']['diskquota_repquota_path']['description'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'diskquota_repquota_path',
|
||||
'type' => 'string',
|
||||
'default' => '/usr/sbin/repquota',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'diskquota_quotatool_path' => array(
|
||||
'label' => $lng['serversettings']['diskquota_quotatool_path']['description'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'diskquota_quotatool_path',
|
||||
'type' => 'string',
|
||||
'default' => '/usr/bin/quotatool',
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'diskquota_customer_partition' => array(
|
||||
'label' => $lng['serversettings']['diskquota_customer_partition']['description'],
|
||||
'settinggroup' => 'system',
|
||||
'varname' => 'diskquota_customer_partition',
|
||||
'type' => 'string',
|
||||
'default' => '/dev/root',
|
||||
'save_method' => 'storeSettingField'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
857
admin_admins.php
@@ -14,26 +14,32 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\Api\Commands\Admins as Admins;
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
if (isset($_POST['id'])) {
|
||||
require ("./lib/init.php");
|
||||
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
} elseif (isset($_GET['id'])) {
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
|
||||
|
||||
if ($action == '') {
|
||||
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_admins");
|
||||
if($page == 'admins'
|
||||
&& $userinfo['change_serversettings'] == '1')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_admins");
|
||||
$fields = array(
|
||||
'loginname' => $lng['login']['username'],
|
||||
'name' => $lng['customer']['name'],
|
||||
@@ -41,13 +47,28 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
|
||||
'diskspace_used' => $lng['customer']['diskspace'] . ' (' . $lng['panel']['used'] . ')',
|
||||
'traffic' => $lng['customer']['traffic'],
|
||||
'traffic_used' => $lng['customer']['traffic'] . ' (' . $lng['panel']['used'] . ')',
|
||||
'mysqls' => $lng['customer']['mysqls'],
|
||||
'mysqls_used' => $lng['customer']['mysqls'] . ' (' . $lng['panel']['used'] . ')',
|
||||
'ftps' => $lng['customer']['ftps'],
|
||||
'ftps_used' => $lng['customer']['ftps'] . ' (' . $lng['panel']['used'] . ')',
|
||||
'tickets' => $lng['customer']['tickets'],
|
||||
'tickets_used' => $lng['customer']['tickets'] . ' (' . $lng['panel']['used'] . ')',
|
||||
'subdomains' => $lng['customer']['subdomains'],
|
||||
'subdomains_used' => $lng['customer']['subdomains'] . ' (' . $lng['panel']['used'] . ')',
|
||||
'emails' => $lng['customer']['emails'],
|
||||
'emails_used' => $lng['customer']['emails'] . ' (' . $lng['panel']['used'] . ')',
|
||||
'email_accounts' => $lng['customer']['accounts'],
|
||||
'email_accounts_used' => $lng['customer']['accounts'] . ' (' . $lng['panel']['used'] . ')',
|
||||
'email_forwarders' => $lng['customer']['forwarders'],
|
||||
'email_forwarders_used' => $lng['customer']['forwarders'] . ' (' . $lng['panel']['used'] . ')',
|
||||
'email_quota' => $lng['customer']['email_quota'],
|
||||
'email_quota_used' => $lng['customer']['email_quota'] . ' (' . $lng['panel']['used'] . ')',
|
||||
'deactivated' => $lng['admin']['deactivated']
|
||||
);
|
||||
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_ADMINS, $fields);
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_ADMINS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$admins = '';
|
||||
$result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_ADMINS . "` " . $paging->getSqlWhere(false) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
$numrows_admins = Database::num_rows();
|
||||
$paging->setEntries($numrows_admins);
|
||||
$result = $db->query("SELECT * FROM `" . TABLE_PANEL_ADMINS . "` " . $paging->getSqlWhere(false) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$sortcode = $paging->getHtmlSortCode($lng, true);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
@@ -55,288 +76,668 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
|
||||
$i = 0;
|
||||
$count = 0;
|
||||
|
||||
$dec_places = Settings::Get('panel.decimal_places');
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
if ($paging->checkDisplay($i)) {
|
||||
|
||||
$row['traffic_used'] = round($row['traffic_used'] / (1024 * 1024), $dec_places);
|
||||
$row['traffic'] = round($row['traffic'] / (1024 * 1024), $dec_places);
|
||||
$row['diskspace_used'] = round($row['diskspace_used'] / 1024, $dec_places);
|
||||
$row['diskspace'] = round($row['diskspace'] / 1024, $dec_places);
|
||||
|
||||
// percent-values for progressbar
|
||||
// For Disk usage
|
||||
if ($row['diskspace'] > 0) {
|
||||
$disk_percent = round(($row['diskspace_used'] * 100) / $row['diskspace'], 0);
|
||||
$disk_doublepercent = round($disk_percent * 2, 2);
|
||||
} else {
|
||||
$disk_percent = 0;
|
||||
$disk_doublepercent = 0;
|
||||
}
|
||||
// For Traffic usage
|
||||
if ($row['traffic'] > 0) {
|
||||
$traffic_percent = round(($row['traffic_used'] * 100) / $row['traffic'], 0);
|
||||
$traffic_doublepercent = round($traffic_percent * 2, 2);
|
||||
} else {
|
||||
$traffic_percent = 0;
|
||||
$traffic_doublepercent = 0;
|
||||
}
|
||||
|
||||
// fix progress-bars if value is >100%
|
||||
if ($disk_percent > 100) {
|
||||
$disk_percent = 100;
|
||||
}
|
||||
if ($traffic_percent > 100) {
|
||||
$traffic_percent = 100;
|
||||
}
|
||||
|
||||
$row = \Froxlor\PhpHelper::strReplaceArray('-1', 'UL', $row, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps subdomains');
|
||||
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
|
||||
|
||||
$row['custom_notes'] = ($row['custom_notes'] != '') ? nl2br($row['custom_notes']) : '';
|
||||
|
||||
eval("\$admins.=\"" . \Froxlor\UI\Template::getTemplate("admins/admins_admin") . "\";");
|
||||
$count ++;
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
$row['traffic_used'] = round($row['traffic_used'] / (1024 * 1024), $settings['panel']['decimal_places']);
|
||||
$row['traffic'] = round($row['traffic'] / (1024 * 1024), $settings['panel']['decimal_places']);
|
||||
$row['diskspace_used'] = round($row['diskspace_used'] / 1024, $settings['panel']['decimal_places']);
|
||||
$row['diskspace'] = round($row['diskspace'] / 1024, $settings['panel']['decimal_places']);
|
||||
$row = str_replace_array('-1', 'UL', $row, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps subdomains tickets');
|
||||
$row = htmlentities_array($row);
|
||||
eval("\$admins.=\"" . getTemplate("admins/admins_admin") . "\";");
|
||||
$count++;
|
||||
}
|
||||
$i ++;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$admincount = $numrows_admins;
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("admins/admins") . "\";");
|
||||
} elseif ($action == 'su') {
|
||||
|
||||
try {
|
||||
$json_result = Admins::getLocal($userinfo, array(
|
||||
'id' => $id
|
||||
))->get();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
$admincount = $db->num_rows($result);
|
||||
eval("echo \"" . getTemplate("admins/admins") . "\";");
|
||||
}
|
||||
elseif($action == 'su')
|
||||
{
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid` = '" . (int)$id . "'");
|
||||
$destination_admin = $result['loginname'];
|
||||
|
||||
if ($destination_admin != '' && $result['adminid'] != $userinfo['userid']) {
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT * FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = :userid
|
||||
");
|
||||
$result = Database::pexecute_first($result_stmt, array(
|
||||
'userid' => $userinfo['userid']
|
||||
));
|
||||
|
||||
if($destination_admin != ''
|
||||
&& $result['adminid'] != $userinfo['userid'])
|
||||
{
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid`='" . (int)$userinfo['userid'] . "'");
|
||||
$s = md5(uniqid(microtime(), 1));
|
||||
$ins_stmt = Database::prepare("
|
||||
INSERT INTO `" . TABLE_PANEL_SESSIONS . "` SET
|
||||
`hash` = :hash, `userid` = :userid, `ipaddress` = :ip,
|
||||
`useragent` = :ua, `lastactivity` = :la,
|
||||
`language` = :lang, `adminsession` = '1'
|
||||
");
|
||||
$ins_data = array(
|
||||
'hash' => $s,
|
||||
'userid' => $id,
|
||||
'ip' => $result['ipaddress'],
|
||||
'ua' => $result['useragent'],
|
||||
'la' => time(),
|
||||
'lang' => $result['language']
|
||||
);
|
||||
Database::pexecute($ins_stmt, $ins_data);
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "switched adminuser and is now '" . $destination_admin . "'");
|
||||
\Froxlor\UI\Response::redirectTo('admin_index.php', array(
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
\Froxlor\UI\Response::redirectTo('index.php', array(
|
||||
'action' => 'login'
|
||||
));
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_SESSIONS . "` (`hash`, `userid`, `ipaddress`, `useragent`, `lastactivity`, `language`, `adminsession`) VALUES ('" . $db->escape($s) . "', '" . (int)$id . "', '" . $db->escape($result['ipaddress']) . "', '" . $db->escape($result['useragent']) . "', '" . time() . "', '" . $db->escape($result['language']) . "', '1')");
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "switched adminuser and is now '" . $destination_admin . "'");
|
||||
redirectTo('admin_index.php', Array('s' => $s));
|
||||
}
|
||||
} elseif ($action == 'delete' && $id != 0) {
|
||||
try {
|
||||
$json_result = Admins::getLocal($userinfo, array(
|
||||
'id' => $id
|
||||
))->get();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
else
|
||||
{
|
||||
redirectTo('index.php', Array('action' => 'login'));
|
||||
}
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid`='" . (int)$id . "'");
|
||||
|
||||
if ($result['loginname'] != '') {
|
||||
if ($result['adminid'] == $userinfo['userid']) {
|
||||
\Froxlor\UI\Response::standard_error('youcantdeleteyourself');
|
||||
if($result['loginname'] != '')
|
||||
{
|
||||
if($result['adminid'] == $userinfo['userid'])
|
||||
{
|
||||
standard_error('youcantdeleteyourself');
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
Admins::getLocal($userinfo, array(
|
||||
'id' => $id
|
||||
))->delete();
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
\Froxlor\UI\HTML::askYesNo('admin_admin_reallydelete', $filename, array(
|
||||
'id' => $id,
|
||||
'page' => $page,
|
||||
'action' => $action
|
||||
), $result['loginname']);
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid`='" . (int)$id . "'");
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_TRAFFIC_ADMINS . "` WHERE `adminid`='" . (int)$id . "'");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `adminid` = '" . (int)$userinfo['userid'] . "' WHERE `adminid` = '" . (int)$id . "'");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `adminid` = '" . (int)$userinfo['userid'] . "' WHERE `adminid` = '" . (int)$id . "'");
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "deleted admin '" . $result['loginname'] . "'");
|
||||
updateCounters();
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
ask_yesno('admin_admin_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['loginname']);
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'add') {
|
||||
}
|
||||
elseif($action == 'add')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$name = validate($_POST['name'], 'name');
|
||||
$email = $idna_convert->encode(validate($_POST['email'], 'email'));
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
try {
|
||||
Admins::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 {
|
||||
$loginname = validate($_POST['loginname'], 'loginname');
|
||||
$password = validate($_POST['admin_password'], 'password');
|
||||
$password = validatePassword($password);
|
||||
$def_language = validate($_POST['def_language'], 'default language');
|
||||
$customers = intval_ressource($_POST['customers']);
|
||||
|
||||
$language_options = '';
|
||||
foreach ($languages as $language_file => $language_name) {
|
||||
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $userinfo['language'], true);
|
||||
if(isset($_POST['customers_ul']))
|
||||
{
|
||||
$customers = - 1;
|
||||
}
|
||||
|
||||
$ipaddress = \Froxlor\UI\HTML::makeoption($lng['admin']['allips'], "-1");
|
||||
$ipsandports_stmt = Database::query("
|
||||
SELECT `id`, `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` GROUP BY `ip` ORDER BY `ip` ASC
|
||||
");
|
||||
$domains = intval_ressource($_POST['domains']);
|
||||
|
||||
while ($row = $ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$ipaddress .= \Froxlor\UI\HTML::makeoption($row['ip'], $row['id']);
|
||||
if(isset($_POST['domains_ul']))
|
||||
{
|
||||
$domains = - 1;
|
||||
}
|
||||
|
||||
$customers_ul = \Froxlor\UI\HTML::makecheckbox('customers_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$diskspace_ul = \Froxlor\UI\HTML::makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$traffic_ul = \Froxlor\UI\HTML::makecheckbox('traffic_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$domains_ul = \Froxlor\UI\HTML::makecheckbox('domains_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$subdomains_ul = \Froxlor\UI\HTML::makecheckbox('subdomains_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$emails_ul = \Froxlor\UI\HTML::makecheckbox('emails_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$email_accounts_ul = \Froxlor\UI\HTML::makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$email_forwarders_ul = \Froxlor\UI\HTML::makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$email_quota_ul = \Froxlor\UI\HTML::makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$ftps_ul = \Froxlor\UI\HTML::makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$mysqls_ul = \Froxlor\UI\HTML::makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$subdomains = intval_ressource($_POST['subdomains']);
|
||||
|
||||
$admin_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/admin/formfield.admin_add.php';
|
||||
$admin_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($admin_add_data);
|
||||
if(isset($_POST['subdomains_ul']))
|
||||
{
|
||||
$subdomains = - 1;
|
||||
}
|
||||
|
||||
$title = $admin_add_data['admin_add']['title'];
|
||||
$image = $admin_add_data['admin_add']['image'];
|
||||
$emails = intval_ressource($_POST['emails']);
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("admins/admins_add") . "\";");
|
||||
}
|
||||
} elseif ($action == 'edit' && $id != 0) {
|
||||
try {
|
||||
$json_result = Admins::getLocal($userinfo, array(
|
||||
'id' => $id
|
||||
))->get();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
if(isset($_POST['emails_ul']))
|
||||
{
|
||||
$emails = - 1;
|
||||
}
|
||||
|
||||
if ($result['loginname'] != '') {
|
||||
$email_accounts = intval_ressource($_POST['email_accounts']);
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
try {
|
||||
Admins::getLocal($userinfo, $_POST)->update();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
if(isset($_POST['email_accounts_ul']))
|
||||
{
|
||||
$email_accounts = - 1;
|
||||
}
|
||||
|
||||
$email_forwarders = intval_ressource($_POST['email_forwarders']);
|
||||
|
||||
if(isset($_POST['email_forwarders_ul']))
|
||||
{
|
||||
$email_forwarders = - 1;
|
||||
}
|
||||
|
||||
if($settings['system']['mail_quota_enabled'] == '1')
|
||||
{
|
||||
$email_quota = validate($_POST['email_quota'], 'email_quota', '/^\d+$/', 'vmailquotawrong', array('0', ''));
|
||||
|
||||
if(isset($_POST['email_quota_ul']))
|
||||
{
|
||||
$email_quota = - 1;
|
||||
}
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$email_quota = - 1;
|
||||
}
|
||||
|
||||
$dec_places = Settings::Get('panel.decimal_places');
|
||||
$result['traffic'] = round($result['traffic'] / (1024 * 1024), $dec_places);
|
||||
$result['diskspace'] = round($result['diskspace'] / 1024, $dec_places);
|
||||
$ftps = intval_ressource($_POST['ftps']);
|
||||
|
||||
if(isset($_POST['ftps_ul']))
|
||||
{
|
||||
$ftps = - 1;
|
||||
}
|
||||
|
||||
$tickets = intval_ressource($_POST['tickets']);
|
||||
|
||||
if(isset($_POST['tickets_ul'])
|
||||
&& $settings['ticket']['enabled'] == '1')
|
||||
{
|
||||
$tickets = - 1;
|
||||
}
|
||||
|
||||
$mysqls = intval_ressource($_POST['mysqls']);
|
||||
|
||||
if(isset($_POST['mysqls_ul']))
|
||||
{
|
||||
$mysqls = - 1;
|
||||
}
|
||||
|
||||
if($settings['aps']['aps_active'] == '1')
|
||||
{
|
||||
$number_of_aps_packages = intval_ressource($_POST['number_of_aps_packages']);
|
||||
|
||||
if(isset($_POST['number_of_aps_packages_ul']))
|
||||
{
|
||||
$number_of_aps_packages = - 1;
|
||||
}
|
||||
|
||||
$can_manage_aps_packages = intval($_POST['can_manage_aps_packages']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$number_of_aps_packages = 0;
|
||||
$can_manage_aps_packages = 0;
|
||||
}
|
||||
|
||||
$customers_see_all = intval($_POST['customers_see_all']);
|
||||
$domains_see_all = intval($_POST['domains_see_all']);
|
||||
$caneditphpsettings = intval($_POST['caneditphpsettings']);
|
||||
$change_serversettings = intval($_POST['change_serversettings']);
|
||||
|
||||
$diskspace = intval_ressource($_POST['diskspace']);
|
||||
|
||||
if(isset($_POST['diskspace_ul']))
|
||||
{
|
||||
$diskspace = - 1;
|
||||
}
|
||||
|
||||
$traffic = doubleval_ressource($_POST['traffic']);
|
||||
|
||||
if(isset($_POST['traffic_ul']))
|
||||
{
|
||||
$traffic = - 1;
|
||||
}
|
||||
|
||||
$diskspace = $diskspace * 1024;
|
||||
$traffic = $traffic * 1024 * 1024;
|
||||
$ipaddress = intval_ressource($_POST['ipaddress']);
|
||||
|
||||
// Check if the account already exists
|
||||
|
||||
$loginname_check = $db->query_first("SELECT `loginname` FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `loginname` = '" . $db->escape($loginname) . "'");
|
||||
$loginname_check_admin = $db->query_first("SELECT `loginname` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `loginname` = '" . $db->escape($loginname) . "'");
|
||||
|
||||
if($loginname == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'myloginname'));
|
||||
}
|
||||
elseif(strtolower($loginname_check['loginname']) == strtolower($loginname)
|
||||
|| strtolower($loginname_check_admin['loginname']) == strtolower($loginname))
|
||||
{
|
||||
standard_error('loginnameexists', $loginname);
|
||||
}
|
||||
|
||||
// Accounts which match systemaccounts are not allowed, filtering them
|
||||
|
||||
elseif (preg_match('/^' . preg_quote($settings['customer']['accountprefix'], '/') . '([0-9]+)/', $loginname))
|
||||
{
|
||||
standard_error('loginnameissystemaccount', $settings['customer']['accountprefix']);
|
||||
}
|
||||
elseif(!validateUsername($loginname))
|
||||
{
|
||||
standard_error('loginnameiswrong', $loginname);
|
||||
}
|
||||
elseif($name == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'myname'));
|
||||
}
|
||||
elseif($email == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'emailadd'));
|
||||
}
|
||||
elseif($password == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'mypassword'));
|
||||
}
|
||||
elseif(!validateEmail($email))
|
||||
{
|
||||
standard_error('emailiswrong', $email);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($customers_see_all != '1')
|
||||
{
|
||||
$customers_see_all = '0';
|
||||
}
|
||||
|
||||
if($domains_see_all != '1')
|
||||
{
|
||||
$domains_see_all = '0';
|
||||
}
|
||||
|
||||
if($caneditphpsettings != '1')
|
||||
{
|
||||
$caneditphpsettings = '0';
|
||||
}
|
||||
|
||||
if($change_serversettings != '1')
|
||||
{
|
||||
$change_serversettings = '0';
|
||||
}
|
||||
|
||||
$result = $db->query("INSERT INTO `" . TABLE_PANEL_ADMINS . "` (`loginname`, `password`, `name`, `email`, `def_language`, `change_serversettings`, `customers`, `customers_see_all`, `domains`, `domains_see_all`, `caneditphpsettings`, `diskspace`, `traffic`, `subdomains`, `emails`, `email_accounts`, `email_forwarders`, `email_quota`, `ftps`, `tickets`, `mysqls`, `ip`, `can_manage_aps_packages`, `aps_packages`)
|
||||
VALUES ('" . $db->escape($loginname) . "', '" . md5($password) . "', '" . $db->escape($name) . "', '" . $db->escape($email) . "','" . $db->escape($def_language) . "', '" . $db->escape($change_serversettings) . "', '" . $db->escape($customers) . "', '" . $db->escape($customers_see_all) . "', '" . $db->escape($domains) . "', '" . $db->escape($domains_see_all) . "', '" . (int)$caneditphpsettings . "', '" . $db->escape($diskspace) . "', '" . $db->escape($traffic) . "', '" . $db->escape($subdomains) . "', '" . $db->escape($emails) . "', '" . $db->escape($email_accounts) . "', '" . $db->escape($email_forwarders) . "', '" . $db->escape($email_quota) . "', '" . $db->escape($ftps) . "', '" . $db->escape($tickets) . "', '" . $db->escape($mysqls) . "', '" . (int)$ipaddress . "', " . (int)$can_manage_aps_packages . ", " . (int)$number_of_aps_packages . ")");
|
||||
$adminid = $db->insert_id();
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "added admin '" . $loginname . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$language_options = '';
|
||||
|
||||
while(list($language_file, $language_name) = each($languages))
|
||||
{
|
||||
$language_options.= makeoption($language_name, $language_file, $userinfo['language'], true);
|
||||
}
|
||||
|
||||
$ipaddress = makeoption($lng['admin']['allips'], "-1");
|
||||
$ips = array();
|
||||
$ipsandports = $db->query('SELECT `id`, `ip` FROM `' . TABLE_PANEL_IPSANDPORTS . '` ORDER BY `ip`, `port` ASC');
|
||||
|
||||
while($row = $db->fetch_array($ipsandports))
|
||||
{
|
||||
if(filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
|
||||
{
|
||||
$row['ip'] = '[' . $row['ip'] . ']';
|
||||
}
|
||||
|
||||
if(!in_array($row['ip'], $ips))
|
||||
{
|
||||
$ipaddress.= makeoption($row['ip'], $row['id']);
|
||||
$ips[] = $row['ip'];
|
||||
}
|
||||
}
|
||||
|
||||
$customers_ul = makecheckbox('customers_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$diskspace_ul = makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$traffic_ul = makecheckbox('traffic_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$domains_ul = makecheckbox('domains_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$subdomains_ul = makecheckbox('subdomains_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$emails_ul = makecheckbox('emails_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$email_accounts_ul = makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$email_forwarders_ul = makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$email_quota_ul = makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$ftps_ul = makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$tickets_ul = makecheckbox('tickets_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$mysqls_ul = makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$change_serversettings = makeyesno('change_serversettings', '1', '0', '0');
|
||||
$customers_see_all = makeyesno('customers_see_all', '1', '0', '0');
|
||||
$domains_see_all = makeyesno('domains_see_all', '1', '0', '0');
|
||||
$caneditphpsettings = makeyesno('caneditphpsettings', '1', '0', '0');
|
||||
$can_manage_aps_packages = makeyesno('can_manage_aps_packages', '1', '0', '0');
|
||||
$number_of_aps_packages_ul = makecheckbox('number_of_aps_packages_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
|
||||
eval("echo \"" . getTemplate("admins/admins_add") . "\";");
|
||||
}
|
||||
}
|
||||
elseif($action == 'edit'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid`='" . (int)$id . "'");
|
||||
|
||||
if($result['loginname'] != '')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$name = validate($_POST['name'], 'name');
|
||||
$email = $idna_convert->encode(validate($_POST['email'], 'email'));
|
||||
|
||||
if($result['adminid'] == $userinfo['userid'])
|
||||
{
|
||||
$password = '';
|
||||
$def_language = $result['def_language'];
|
||||
$deactivated = $result['deactivated'];
|
||||
$customers = $result['customers'];
|
||||
$domains = $result['domains'];
|
||||
$subdomains = $result['subdomains'];
|
||||
$emails = $result['emails'];
|
||||
$email_accounts = $result['email_accounts'];
|
||||
$email_forwarders = $result['email_forwarders'];
|
||||
$email_quota = $result['email_quota'];
|
||||
$ftps = $result['ftps'];
|
||||
$tickets = $result['tickets'];
|
||||
$mysqls = $result['mysqls'];
|
||||
$customers_see_all = $result['customers_see_all'];
|
||||
$domains_see_all = $result['domains_see_all'];
|
||||
$caneditphpsettings = $result['caneditphpsettings'];
|
||||
$change_serversettings = $result['change_serversettings'];
|
||||
$diskspace = $result['diskspace'];
|
||||
$traffic = $result['traffic'];
|
||||
$ipaddress = $result['ip'];
|
||||
$can_manage_aps_packages = $result['can_manage_aps_packages'];
|
||||
$number_of_aps_packages = $result['aps_packages'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$password = validate($_POST['admin_password'], 'new password');
|
||||
$def_language = validate($_POST['def_language'], 'default language');
|
||||
$deactivated = intval($_POST['deactivated']);
|
||||
$customers = intval_ressource($_POST['customers']);
|
||||
|
||||
if(isset($_POST['customers_ul']))
|
||||
{
|
||||
$customers = - 1;
|
||||
}
|
||||
|
||||
$domains = intval_ressource($_POST['domains']);
|
||||
|
||||
if(isset($_POST['domains_ul']))
|
||||
{
|
||||
$domains = - 1;
|
||||
}
|
||||
|
||||
$subdomains = intval_ressource($_POST['subdomains']);
|
||||
|
||||
if(isset($_POST['subdomains_ul']))
|
||||
{
|
||||
$subdomains = - 1;
|
||||
}
|
||||
|
||||
$emails = intval_ressource($_POST['emails']);
|
||||
|
||||
if(isset($_POST['emails_ul']))
|
||||
{
|
||||
$emails = - 1;
|
||||
}
|
||||
|
||||
$email_accounts = intval_ressource($_POST['email_accounts']);
|
||||
|
||||
if(isset($_POST['email_accounts_ul']))
|
||||
{
|
||||
$email_accounts = - 1;
|
||||
}
|
||||
|
||||
$email_forwarders = intval_ressource($_POST['email_forwarders']);
|
||||
|
||||
if(isset($_POST['email_forwarders_ul']))
|
||||
{
|
||||
$email_forwarders = - 1;
|
||||
}
|
||||
|
||||
if($settings['system']['mail_quota_enabled'] == '1')
|
||||
{
|
||||
$email_quota = validate($_POST['email_quota'], 'email_quota', '/^\d+$/', 'vmailquotawrong', array('0', ''));
|
||||
|
||||
if(isset($_POST['email_quota_ul']))
|
||||
{
|
||||
$email_quota = - 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$email_quota = - 1;
|
||||
}
|
||||
|
||||
$ftps = intval_ressource($_POST['ftps']);
|
||||
|
||||
if(isset($_POST['ftps_ul']))
|
||||
{
|
||||
$ftps = - 1;
|
||||
}
|
||||
|
||||
$tickets = intval_ressource($_POST['tickets']);
|
||||
|
||||
if(isset($_POST['tickets_ul']))
|
||||
{
|
||||
$tickets = - 1;
|
||||
}
|
||||
|
||||
$mysqls = intval_ressource($_POST['mysqls']);
|
||||
|
||||
if(isset($_POST['mysqls_ul']))
|
||||
{
|
||||
$mysqls = - 1;
|
||||
}
|
||||
|
||||
$number_of_aps_packages = intval_ressource($_POST['number_of_aps_packages']);
|
||||
|
||||
if(isset($_POST['number_of_aps_packages_ul']))
|
||||
{
|
||||
$number_of_aps_packages = - 1;
|
||||
}
|
||||
|
||||
$customers_see_all = intval($_POST['customers_see_all']);
|
||||
$domains_see_all = intval($_POST['domains_see_all']);
|
||||
$caneditphpsettings = intval($_POST['caneditphpsettings']);
|
||||
$change_serversettings = intval($_POST['change_serversettings']);
|
||||
$can_manage_aps_packages = intval($_POST['can_manage_aps_packages']);
|
||||
|
||||
$diskspace = intval($_POST['diskspace']);
|
||||
|
||||
if(isset($_POST['diskspace_ul']))
|
||||
{
|
||||
$diskspace = - 1;
|
||||
}
|
||||
|
||||
$traffic = doubleval_ressource($_POST['traffic']);
|
||||
|
||||
if(isset($_POST['traffic_ul']))
|
||||
{
|
||||
$traffic = - 1;
|
||||
}
|
||||
|
||||
$diskspace = $diskspace * 1024;
|
||||
$traffic = $traffic * 1024 * 1024;
|
||||
$ipaddress = intval_ressource($_POST['ipaddress']);
|
||||
}
|
||||
|
||||
if($name == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'myname'));
|
||||
}
|
||||
elseif($email == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'emailadd'));
|
||||
}
|
||||
elseif(!validateEmail($email))
|
||||
{
|
||||
standard_error('emailiswrong', $email);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($password != '')
|
||||
{
|
||||
$password = validatePassword($password);
|
||||
$password = md5($password);
|
||||
}
|
||||
else
|
||||
{
|
||||
$password = $result['password'];
|
||||
}
|
||||
|
||||
if($deactivated != '1')
|
||||
{
|
||||
$deactivated = '0';
|
||||
}
|
||||
|
||||
if($customers_see_all != '1')
|
||||
{
|
||||
$customers_see_all = '0';
|
||||
}
|
||||
|
||||
if($domains_see_all != '1')
|
||||
{
|
||||
$domains_see_all = '0';
|
||||
}
|
||||
|
||||
if($caneditphpsettings != '1')
|
||||
{
|
||||
$caneditphpsettings = '0';
|
||||
}
|
||||
|
||||
if($change_serversettings != '1')
|
||||
{
|
||||
$change_serversettings = '0';
|
||||
}
|
||||
|
||||
$db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `name`='" . $db->escape($name) . "', `email`='" . $db->escape($email) . "', `def_language`='" . $db->escape($def_language) . "', `change_serversettings` = '" . $db->escape($change_serversettings) . "', `customers` = '" . $db->escape($customers) . "', `customers_see_all` = '" . $db->escape($customers_see_all) . "', `domains` = '" . $db->escape($domains) . "', `domains_see_all` = '" . $db->escape($domains_see_all) . "', `caneditphpsettings` = '" . (int)$caneditphpsettings . "', `password` = '" . $password . "', `diskspace`='" . $db->escape($diskspace) . "', `traffic`='" . $db->escape($traffic) . "', `subdomains`='" . $db->escape($subdomains) . "', `emails`='" . $db->escape($emails) . "', `email_accounts` = '" . $db->escape($email_accounts) . "', `email_forwarders`='" . $db->escape($email_forwarders) . "', `email_quota`='" . $db->escape($email_quota) . "', `ftps`='" . $db->escape($ftps) . "', `tickets`='" . $db->escape($tickets) . "', `mysqls`='" . $db->escape($mysqls) . "', `ip`='" . (int)$ipaddress . "', `deactivated`='" . $db->escape($deactivated) . "', `can_manage_aps_packages`=" . (int)$can_manage_aps_packages . ", `aps_packages`=" . (int)$number_of_aps_packages . " WHERE `adminid`='" . $db->escape($id) . "'");
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "edited admin '#" . $id . "'");
|
||||
$redirect_props = Array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
);
|
||||
|
||||
redirectTo($filename, $redirect_props);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result['traffic'] = round($result['traffic'] / (1024 * 1024), $settings['panel']['decimal_places']);
|
||||
$result['diskspace'] = round($result['diskspace'] / 1024, $settings['panel']['decimal_places']);
|
||||
$result['email'] = $idna_convert->decode($result['email']);
|
||||
$customers_ul = makecheckbox('customers_ul', $lng['customer']['unlimited'], '-1', false, $result['customers'], true, true);
|
||||
|
||||
$customers_ul = \Froxlor\UI\HTML::makecheckbox('customers_ul', $lng['customer']['unlimited'], '-1', false, $result['customers'], true, true);
|
||||
if ($result['customers'] == '-1') {
|
||||
if($result['customers'] == '-1')
|
||||
{
|
||||
$result['customers'] = '';
|
||||
}
|
||||
|
||||
$diskspace_ul = \Froxlor\UI\HTML::makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, $result['diskspace'], true, true);
|
||||
if ($result['diskspace'] == '-1') {
|
||||
$diskspace_ul = 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') {
|
||||
$traffic_ul = makecheckbox('traffic_ul', $lng['customer']['unlimited'], '-1', false, $result['traffic'], true, true);
|
||||
|
||||
if($result['traffic'] == '-1')
|
||||
{
|
||||
$result['traffic'] = '';
|
||||
}
|
||||
|
||||
$domains_ul = \Froxlor\UI\HTML::makecheckbox('domains_ul', $lng['customer']['unlimited'], '-1', false, $result['domains'], true, true);
|
||||
if ($result['domains'] == '-1') {
|
||||
$domains_ul = makecheckbox('domains_ul', $lng['customer']['unlimited'], '-1', false, $result['domains'], true, true);
|
||||
|
||||
if($result['domains'] == '-1')
|
||||
{
|
||||
$result['domains'] = '';
|
||||
}
|
||||
|
||||
$subdomains_ul = \Froxlor\UI\HTML::makecheckbox('subdomains_ul', $lng['customer']['unlimited'], '-1', false, $result['subdomains'], true, true);
|
||||
if ($result['subdomains'] == '-1') {
|
||||
$subdomains_ul = 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') {
|
||||
$emails_ul = 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') {
|
||||
$email_accounts_ul = 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') {
|
||||
$email_forwarders_ul = 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') {
|
||||
$email_quota_ul = 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') {
|
||||
$ftps_ul = 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') {
|
||||
$tickets_ul = makecheckbox('tickets_ul', $lng['customer']['unlimited'], '-1', false, $result['tickets'], true, true);
|
||||
|
||||
if($result['tickets'] == '-1')
|
||||
{
|
||||
$result['tickets'] = '';
|
||||
}
|
||||
|
||||
$mysqls_ul = makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, $result['mysqls'], true, true);
|
||||
|
||||
if($result['mysqls'] == '-1')
|
||||
{
|
||||
$result['mysqls'] = '';
|
||||
}
|
||||
|
||||
$number_of_aps_packages_ul = makecheckbox('number_of_aps_packages_ul', $lng['customer']['unlimited'], '-1', false, $result['aps_packages'], true, true);
|
||||
|
||||
if($result['aps_packages'] == '-1')
|
||||
{
|
||||
$result['aps_packages'] = '';
|
||||
}
|
||||
|
||||
$language_options = '';
|
||||
foreach ($languages as $language_file => $language_name) {
|
||||
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $result['def_language'], true);
|
||||
|
||||
while(list($language_file, $language_name) = each($languages))
|
||||
{
|
||||
$language_options.= makeoption($language_name, $language_file, $result['def_language'], true);
|
||||
}
|
||||
|
||||
$ipaddress = \Froxlor\UI\HTML::makeoption($lng['admin']['allips'], "-1", $result['ip']);
|
||||
$ipsandports_stmt = Database::query("
|
||||
SELECT `id`, `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` GROUP BY `id`, `ip` ORDER BY `ip`, `port` ASC
|
||||
");
|
||||
$ipaddress = makeoption($lng['admin']['allips'], "-1", $result['ip']);
|
||||
$ips = array();
|
||||
$ipsandports = $db->query('SELECT `id`, `ip` FROM `' . TABLE_PANEL_IPSANDPORTS . '` ORDER BY `ip`, `port` ASC');
|
||||
|
||||
while ($row = $ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$ipaddress .= \Froxlor\UI\HTML::makeoption($row['ip'], $row['id'], $result['ip']);
|
||||
while($row = $db->fetch_array($ipsandports))
|
||||
{
|
||||
if(filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
|
||||
{
|
||||
$row['ip'] = '[' . $row['ip'] . ']';
|
||||
}
|
||||
|
||||
if(!in_array($row['ip'], $ips))
|
||||
{
|
||||
$ipaddress.= makeoption($row['ip'], $row['id'], $result['ip']);
|
||||
$ips[] = $row['ip'];
|
||||
}
|
||||
}
|
||||
|
||||
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
|
||||
$change_serversettings = makeyesno('change_serversettings', '1', '0', $result['change_serversettings']);
|
||||
$customers_see_all = makeyesno('customers_see_all', '1', '0', $result['customers_see_all']);
|
||||
$domains_see_all = makeyesno('domains_see_all', '1', '0', $result['domains_see_all']);
|
||||
$caneditphpsettings = makeyesno('caneditphpsettings', '1', '0', $result['caneditphpsettings']);
|
||||
$deactivated = makeyesno('deactivated', '1', '0', $result['deactivated']);
|
||||
$can_manage_aps_packages = makeyesno('can_manage_aps_packages', '1', '0', $result['can_manage_aps_packages']);
|
||||
|
||||
$admin_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/admin/formfield.admin_edit.php';
|
||||
$admin_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($admin_edit_data);
|
||||
|
||||
$title = $admin_edit_data['admin_edit']['title'];
|
||||
$image = $admin_edit_data['admin_edit']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("admins/admins_edit") . "\";");
|
||||
$result = htmlentities_array($result);
|
||||
eval("echo \"" . getTemplate("admins/admins_edit") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,440 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* +----------------------------------------------------------------------+
|
||||
* | APC |
|
||||
* +----------------------------------------------------------------------+
|
||||
* | Copyright (c) 2006-2011 The PHP Group |
|
||||
* +----------------------------------------------------------------------+
|
||||
* | This source file is subject to version 3.01 of the PHP license, |
|
||||
* | that is bundled with this package in the file LICENSE, and is |
|
||||
* | available through the world-wide-web at the following url: |
|
||||
* | http://www.php.net/license/3_01.txt |
|
||||
* | If you did not receive a copy of the PHP license and are unable to |
|
||||
* | obtain it through the world-wide-web, please send a note to |
|
||||
* | license@php.net so we can mail you a copy immediately. |
|
||||
* +----------------------------------------------------------------------+
|
||||
* | Authors: Ralf Becker <beckerr@php.net> |
|
||||
* | Rasmus Lerdorf <rasmus@php.net> |
|
||||
* | Ilia Alshanetsky <ilia@prohost.org> |
|
||||
* +----------------------------------------------------------------------+
|
||||
*
|
||||
* All other licensing and usage conditions are those of the PHP Group.
|
||||
*
|
||||
* Based on https://github.com/krakjoe/apcu/blob/master/apc.php
|
||||
* Implemented into Froxlor: Janos Muzsi <muzsij@hypernics.hu>
|
||||
*
|
||||
*/
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
|
||||
$horizontal_bar_size = 950; // 1280px window width
|
||||
|
||||
if ($action == 'delete' && function_exists('apcu_clear_cache') && $userinfo['change_serversettings'] == '1') {
|
||||
apcu_clear_cache();
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "cleared APCu cache");
|
||||
header('Location: ' . $linker->getLink(array(
|
||||
'section' => 'apcuinfo',
|
||||
'page' => 'showinfo'
|
||||
)));
|
||||
exit();
|
||||
}
|
||||
|
||||
if (! function_exists('apcu_cache_info') || ! function_exists('apcu_sma_info')) {
|
||||
\Froxlor\UI\Response::standard_error($lng['error']['no_apcuinfo']);
|
||||
}
|
||||
|
||||
if ($page == 'showinfo') {
|
||||
$cache = apcu_cache_info();
|
||||
$mem = apcu_sma_info();
|
||||
$time = time();
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_apcuinfo");
|
||||
|
||||
$passtime = $time - $cache['start_time'] > 0 ? $time - $cache['start_time'] : 1; // zero division
|
||||
$mem_size = $mem['num_seg'] * $mem['seg_size'];
|
||||
$mem_avail = $mem['avail_mem'];
|
||||
$mem_used = $mem_size - $mem_avail;
|
||||
$seg_size = bsize($mem['seg_size']);
|
||||
$sharedmem = sprintf($lng['apcuinfo']['sharedmemval'], $mem['num_seg'], $seg_size, $cache['memory_type']);
|
||||
$req_rate_user = sprintf("%.2f", $cache['num_hits'] ? (($cache['num_hits'] + $cache['num_misses']) / $passtime) : 0);
|
||||
$hit_rate_user = sprintf("%.2f", $cache['num_hits'] ? (($cache['num_hits']) / $passtime) : 0);
|
||||
$miss_rate_user = sprintf("%.2f", $cache['num_misses'] ? (($cache['num_misses']) / $passtime) : 0);
|
||||
$insert_rate_user = sprintf("%.2f", $cache['num_inserts'] ? (($cache['num_inserts']) / $passtime) : 0);
|
||||
$apcversion = phpversion('apcu');
|
||||
$phpversion = phpversion();
|
||||
$number_vars = $cache['num_entries'];
|
||||
$starttime = date('Y-m-d H:i:s', $cache['start_time']);
|
||||
$uptime_duration = duration($cache['start_time']);
|
||||
$size_vars = bsize($cache['mem_size']);
|
||||
|
||||
// check for possible empty values that are used in the templates
|
||||
if (! isset($cache['file_upload_progress'])) {
|
||||
$cache['file_upload_progress'] = $lng['logger']['unknown'];
|
||||
}
|
||||
|
||||
if (! isset($cache['num_expunges'])) {
|
||||
$cache['num_expunges'] = $lng['logger']['unknown'];
|
||||
}
|
||||
|
||||
$runtimelines = '';
|
||||
foreach (ini_get_all('apcu') as $name => $v) {
|
||||
$value = $v['local_value'];
|
||||
eval("\$runtimelines.=\"" . \Froxlor\UI\Template::getTemplate("settings/apcuinfo/runtime_line") . "\";");
|
||||
}
|
||||
|
||||
$freemem = bsize($mem_avail) . sprintf(" (%.1f%%)", $mem_avail * 100 / $mem_size);
|
||||
$usedmem = bsize($mem_used) . sprintf(" (%.1f%%)", $mem_used * 100 / $mem_size);
|
||||
$hits = $cache['num_hits'] . @sprintf(" (%.1f%%)", $cache['num_hits'] * 100 / ($cache['num_hits'] + $cache['num_misses']));
|
||||
$misses = $cache['num_misses'] . @sprintf(" (%.1f%%)", $cache['num_misses'] * 100 / ($cache['num_hits'] + $cache['num_misses']));
|
||||
|
||||
// Fragementation: (freeseg - 1) / total_seg
|
||||
$nseg = $freeseg = $fragsize = $freetotal = 0;
|
||||
for ($i = 0; $i < $mem['num_seg']; $i ++) {
|
||||
$ptr = 0;
|
||||
foreach ($mem['block_lists'][$i] as $block) {
|
||||
if ($block['offset'] != $ptr) {
|
||||
++ $nseg;
|
||||
}
|
||||
$ptr = $block['offset'] + $block['size'];
|
||||
/* Only consider blocks <5M for the fragmentation % */
|
||||
if ($block['size'] < (5 * 1024 * 1024))
|
||||
$fragsize += $block['size'];
|
||||
$freetotal += $block['size'];
|
||||
}
|
||||
$freeseg += count($mem['block_lists'][$i]);
|
||||
}
|
||||
|
||||
if ($freeseg > 1) {
|
||||
$frag = sprintf("%.2f%% (%s out of %s in %d fragments)", ($fragsize / $freetotal) * 100, bsize($fragsize), bsize($freetotal), $freeseg);
|
||||
} else {
|
||||
$frag = "0%";
|
||||
}
|
||||
|
||||
foreach (ini_get_all('apcu') as $name => $v) {
|
||||
$value = $v['local_value'];
|
||||
}
|
||||
|
||||
$img_src1 = '';
|
||||
$img_src2 = '';
|
||||
$img_src3 = '';
|
||||
if (graphics_avail()) {
|
||||
$img_src = $linker->getLink(array(
|
||||
'section' => 'apcuinfo',
|
||||
'page' => 'img1',
|
||||
'action' => mt_rand(0, 1000000)
|
||||
));
|
||||
eval("\$img_src1=\"" . \Froxlor\UI\Template::getTemplate("settings/apcuinfo/img_line") . "\";");
|
||||
$img_src = $linker->getLink(array(
|
||||
'section' => 'apcuinfo',
|
||||
'page' => 'img2',
|
||||
'action' => mt_rand(0, 1000000)
|
||||
));
|
||||
eval("\$img_src2=\"" . \Froxlor\UI\Template::getTemplate("settings/apcuinfo/img_line") . "\";");
|
||||
$img_src = $linker->getLink(array(
|
||||
'section' => 'apcuinfo',
|
||||
'page' => 'img3',
|
||||
'action' => mt_rand(0, 1000000)
|
||||
));
|
||||
eval("\$img_src3=\"" . \Froxlor\UI\Template::getTemplate("settings/apcuinfo/img_line") . "\";");
|
||||
}
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/apcuinfo/showinfo") . "\";");
|
||||
} elseif ($page == 'img1') {
|
||||
|
||||
$mem = apcu_sma_info();
|
||||
|
||||
$size = 460;
|
||||
$image = imagecreate($size + 5, $size + 5);
|
||||
|
||||
$col_white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
|
||||
$col_red = imagecolorallocate($image, 0xD0, 0x60, 0x30);
|
||||
$col_green = imagecolorallocate($image, 0x60, 0xF0, 0x60);
|
||||
$col_black = imagecolorallocate($image, 0, 0, 0);
|
||||
|
||||
imagecolortransparent($image, $col_white);
|
||||
|
||||
$s = $mem['num_seg'] * $mem['seg_size'];
|
||||
$a = $mem['avail_mem'];
|
||||
$x = $y = $size / 2;
|
||||
$fuzz = 0.000001;
|
||||
|
||||
// This block of code creates the pie chart. It is a lot more complex than you
|
||||
// would expect because we try to visualize any memory fragmentation as well.
|
||||
$angle_from = 0;
|
||||
$string_placement = array();
|
||||
for ($i = 0; $i < $mem['num_seg']; $i ++) {
|
||||
$ptr = 0;
|
||||
$free = $mem['block_lists'][$i];
|
||||
uasort($free, 'block_sort');
|
||||
foreach ($free as $block) {
|
||||
if ($block['offset'] != $ptr) { // Used block
|
||||
$angle_to = $angle_from + ($block['offset'] - $ptr) / $s;
|
||||
if (($angle_to + $fuzz) > 1)
|
||||
$angle_to = 1;
|
||||
if (($angle_to * 360) - ($angle_from * 360) >= 1) {
|
||||
fill_arc($image, $x, $y, $size, $angle_from * 360, $angle_to * 360, $col_black, $col_red);
|
||||
if (($angle_to - $angle_from) > 0.05) {
|
||||
array_push($string_placement, array(
|
||||
$angle_from,
|
||||
$angle_to
|
||||
));
|
||||
}
|
||||
}
|
||||
$angle_from = $angle_to;
|
||||
}
|
||||
$angle_to = $angle_from + ($block['size']) / $s;
|
||||
if (($angle_to + $fuzz) > 1)
|
||||
$angle_to = 1;
|
||||
if (($angle_to * 360) - ($angle_from * 360) >= 1) {
|
||||
fill_arc($image, $x, $y, $size, $angle_from * 360, $angle_to * 360, $col_black, $col_green);
|
||||
if (($angle_to - $angle_from) > 0.05) {
|
||||
array_push($string_placement, array(
|
||||
$angle_from,
|
||||
$angle_to
|
||||
));
|
||||
}
|
||||
}
|
||||
$angle_from = $angle_to;
|
||||
$ptr = $block['offset'] + $block['size'];
|
||||
}
|
||||
if ($ptr < $mem['seg_size']) { // memory at the end
|
||||
$angle_to = $angle_from + ($mem['seg_size'] - $ptr) / $s;
|
||||
if (($angle_to + $fuzz) > 1)
|
||||
$angle_to = 1;
|
||||
fill_arc($image, $x, $y, $size, $angle_from * 360, $angle_to * 360, $col_black, $col_red);
|
||||
if (($angle_to - $angle_from) > 0.05) {
|
||||
array_push($string_placement, array(
|
||||
$angle_from,
|
||||
$angle_to
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($string_placement as $angle) {
|
||||
text_arc($image, $x, $y, $size, $angle[0] * 360, $angle[1] * 360, $col_black, bsize($s * ($angle[1] - $angle[0])));
|
||||
}
|
||||
|
||||
header("Content-type: image/png");
|
||||
imagepng($image);
|
||||
exit();
|
||||
} elseif ($page == 'img2') {
|
||||
|
||||
$cache = apcu_cache_info();
|
||||
|
||||
$size = $horizontal_bar_size;
|
||||
$image = imagecreate($size + 5, 140);
|
||||
|
||||
$col_white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
|
||||
$col_red = imagecolorallocate($image, 0xD0, 0x60, 0x30);
|
||||
$col_green = imagecolorallocate($image, 0x60, 0xF0, 0x60);
|
||||
$col_black = imagecolorallocate($image, 0, 0, 0);
|
||||
|
||||
imagecolortransparent($image, $col_white);
|
||||
|
||||
$s = $cache['num_hits'] + $cache['num_misses'];
|
||||
$a = $cache['num_hits'];
|
||||
|
||||
fill_box($image, 1, 10, $s ? ($a * ($size - 21) / $s) : $size, 50, $col_black, $col_green /* , sprintf("%.1f%%", $s ? $cache['num_hits'] * 100 / $s : 0) */
|
||||
);
|
||||
fill_box($image, 1, 80, $s ? max(4, ($s - $a) * ($size - 21) / $s) : $size, 50, $col_black, $col_red /* , sprintf("%.1f%%", $s ? $cache['num_misses'] * 100 / $s : 0) */
|
||||
);
|
||||
|
||||
header("Content-type: image/png");
|
||||
imagepng($image);
|
||||
exit();
|
||||
} elseif ($page == 'img3') {
|
||||
|
||||
$mem = apcu_sma_info();
|
||||
|
||||
$size = $horizontal_bar_size;
|
||||
$image = imagecreate($size, 70);
|
||||
|
||||
$col_white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
|
||||
$col_red = imagecolorallocate($image, 0xD0, 0x60, 0x30);
|
||||
$col_green = imagecolorallocate($image, 0x60, 0xF0, 0x60);
|
||||
$col_black = imagecolorallocate($image, 0, 0, 0);
|
||||
|
||||
imagecolortransparent($image, $col_white);
|
||||
|
||||
$s = $mem['num_seg'] * $mem['seg_size'];
|
||||
$a = $mem['avail_mem'];
|
||||
$x = 10;
|
||||
$y = 0;
|
||||
|
||||
// This block of code creates the bar chart. It is a lot more complex than you
|
||||
// would expect because we try to visualize any memory fragmentation as well.
|
||||
for ($i = 0; $i < $mem['num_seg']; $i ++) {
|
||||
$ptr = 0;
|
||||
$free = $mem['block_lists'][$i];
|
||||
uasort($free, 'block_sort');
|
||||
foreach ($free as $block) {
|
||||
if ($block['offset'] != $ptr) { // Used block
|
||||
$h = ($size - 5) * ($block['offset'] - $ptr) / $s;
|
||||
if ($h > 0) {
|
||||
fill_box($image, $y, $x, $h, 50, $col_black, $col_red);
|
||||
}
|
||||
$y += $h;
|
||||
}
|
||||
$h = ($size - 5) * ($block['size']) / $s;
|
||||
if ($h > 0) {
|
||||
fill_box($image, $y, $x, $h, 50, $col_black, $col_green);
|
||||
}
|
||||
$y += $h;
|
||||
$ptr = $block['offset'] + $block['size'];
|
||||
}
|
||||
if ($ptr < $mem['seg_size']) { // memory at the end
|
||||
$h = ($size - 5) * ($mem['seg_size'] - $ptr) / $s;
|
||||
if ($h > 0) {
|
||||
fill_box($image, $y, $x, $h, 50, $col_black, $col_red, bsize($mem['seg_size'] - $ptr), $j ++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
header("Content-type: image/png");
|
||||
imagepng($image);
|
||||
exit();
|
||||
}
|
||||
|
||||
function graphics_avail()
|
||||
{
|
||||
return extension_loaded('gd');
|
||||
}
|
||||
|
||||
// pretty printer for byte values
|
||||
//
|
||||
function bsize($s)
|
||||
{
|
||||
foreach (array(
|
||||
'',
|
||||
'K',
|
||||
'M',
|
||||
'G'
|
||||
) as $i => $k) {
|
||||
if ($s < 1024)
|
||||
break;
|
||||
$s /= 1024;
|
||||
}
|
||||
return sprintf("%5.1f %sBytes", $s, $k);
|
||||
}
|
||||
|
||||
function duration($ts)
|
||||
{
|
||||
global $time;
|
||||
$years = (int) ((($time - $ts) / (7 * 86400)) / 52.177457);
|
||||
$rem = (int) (($time - $ts) - ($years * 52.177457 * 7 * 86400));
|
||||
$weeks = (int) (($rem) / (7 * 86400));
|
||||
$days = (int) (($rem) / 86400) - $weeks * 7;
|
||||
$hours = (int) (($rem) / 3600) - $days * 24 - $weeks * 7 * 24;
|
||||
$mins = (int) (($rem) / 60) - $hours * 60 - $days * 24 * 60 - $weeks * 7 * 24 * 60;
|
||||
$str = '';
|
||||
if ($years == 1)
|
||||
$str .= "$years year, ";
|
||||
if ($years > 1)
|
||||
$str .= "$years years, ";
|
||||
if ($weeks == 1)
|
||||
$str .= "$weeks week, ";
|
||||
if ($weeks > 1)
|
||||
$str .= "$weeks weeks, ";
|
||||
if ($days == 1)
|
||||
$str .= "$days day,";
|
||||
if ($days > 1)
|
||||
$str .= "$days days,";
|
||||
if ($hours == 1)
|
||||
$str .= " $hours hour and";
|
||||
if ($hours > 1)
|
||||
$str .= " $hours hours and";
|
||||
if ($mins == 1)
|
||||
$str .= " 1 minute";
|
||||
else
|
||||
$str .= " $mins minutes";
|
||||
return $str;
|
||||
}
|
||||
|
||||
function block_sort($array1, $array2)
|
||||
{
|
||||
if ($array1['offset'] > $array2['offset']) {
|
||||
return 1;
|
||||
} else {
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
function fill_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1, $color2, $text = '', $placeindex = 0)
|
||||
{
|
||||
$r = $diameter / 2;
|
||||
$w = deg2rad((360 + $start + ($end - $start) / 2) % 360);
|
||||
|
||||
if (function_exists("imagefilledarc")) {
|
||||
// exists only if GD 2.0.1 is available
|
||||
imagefilledarc($im, $centerX + 1, $centerY + 1, $diameter, $diameter, $start, $end, $color1, IMG_ARC_PIE);
|
||||
imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2, IMG_ARC_PIE);
|
||||
imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color1, IMG_ARC_NOFILL | IMG_ARC_EDGED);
|
||||
} else {
|
||||
imagearc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2);
|
||||
imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2);
|
||||
imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start + 1)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2);
|
||||
imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end - 1)) * $r, $centerY + sin(deg2rad($end)) * $r, $color2);
|
||||
imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end)) * $r, $centerY + sin(deg2rad($end)) * $r, $color2);
|
||||
imagefill($im, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $color2);
|
||||
}
|
||||
if ($text) {
|
||||
if ($placeindex > 0) {
|
||||
imageline($im, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $diameter, $placeindex * 12, $color1);
|
||||
imagestring($im, 4, $diameter, $placeindex * 12, $text, $color1);
|
||||
} else {
|
||||
imagestring($im, 4, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $text, $color1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function text_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1, $text, $placeindex = 0)
|
||||
{
|
||||
$r = $diameter / 2;
|
||||
$w = deg2rad((360 + $start + ($end - $start) / 2) % 360);
|
||||
|
||||
if ($placeindex > 0) {
|
||||
imageline($im, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $diameter, $placeindex * 12, $color1);
|
||||
imagestring($im, 4, $diameter, $placeindex * 12, $text, $color1);
|
||||
} else {
|
||||
imagestring($im, 4, $centerX + $r * cos($w) / 2, $centerY + $r * sin($w) / 2, $text, $color1);
|
||||
}
|
||||
}
|
||||
|
||||
function fill_box($im, $x, $y, $w, $h, $color1, $color2, $text = '', $placeindex = '')
|
||||
{
|
||||
global $col_black;
|
||||
$x1 = $x + $w - 1;
|
||||
$y1 = $y + $h - 1;
|
||||
|
||||
imagerectangle($im, $x, $y1, $x1 + 1, $y + 1, $col_black);
|
||||
if ($y1 > $y)
|
||||
imagefilledrectangle($im, $x, $y, $x1, $y1, $color2);
|
||||
else
|
||||
imagefilledrectangle($im, $x, $y1, $x1, $y, $color2);
|
||||
imagerectangle($im, $x, $y1, $x1, $y, $color1);
|
||||
if ($text) {
|
||||
if ($placeindex > 0) {
|
||||
|
||||
if ($placeindex < 16) {
|
||||
$px = 5;
|
||||
$py = $placeindex * 12 + 6;
|
||||
imagefilledrectangle($im, $px + 90, $py + 3, $px + 90 - 4, $py - 3, $color2);
|
||||
imageline($im, $x, $y + $h / 2, $px + 90, $py, $color2);
|
||||
imagestring($im, 2, $px, $py - 6, $text, $color1);
|
||||
} else {
|
||||
if ($placeindex < 31) {
|
||||
$px = $x + 40 * 2;
|
||||
$py = ($placeindex - 15) * 12 + 6;
|
||||
} else {
|
||||
$px = $x + 40 * 2 + 100 * intval(($placeindex - 15) / 15);
|
||||
$py = ($placeindex % 15) * 12 + 6;
|
||||
}
|
||||
imagefilledrectangle($im, $px, $py + 3, $px - 4, $py - 3, $color2);
|
||||
imageline($im, $x + $w, $y + $h / 2, $px, $py, $color2);
|
||||
imagestring($im, 2, $px + 2, $py - 6, $text, $color1);
|
||||
}
|
||||
} else {
|
||||
imagestring($im, 4, $x + 5, $y1 - 16, $text, $color1);
|
||||
}
|
||||
}
|
||||
}
|
||||
34
admin_aps.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?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
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
// Required code
|
||||
|
||||
define('AREA', 'admin');
|
||||
require ("./lib/init.php");
|
||||
$Id = 0;
|
||||
|
||||
if(isset($_GET['id']))$Id = (int)$_GET['id'];
|
||||
|
||||
if(isset($_POST['id']))$Id = (int)$_POST['id'];
|
||||
eval("echo \"" . getTemplate("aps/header") . "\";");
|
||||
$Aps = new ApsParser($userinfo, $settings, $db);
|
||||
$Aps->MainHandler($action);
|
||||
eval("echo \"" . getTemplate("aps/footer") . "\";");
|
||||
|
||||
?>
|
||||
@@ -1,225 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2016 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Michael Kaufmann <mkaufmann@nutime.de>
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Frontend
|
||||
*
|
||||
* @since 0.9.35
|
||||
*
|
||||
*/
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
|
||||
use Froxlor\Http\HttpClient;
|
||||
|
||||
// define update-uri
|
||||
define('UPDATE_URI', "https://version.froxlor.org/Froxlor/api/" . $version);
|
||||
define('RELEASE_URI', "https://autoupdate.froxlor.org/froxlor-{version}.zip");
|
||||
define('CHECKSUM_URI', "https://autoupdate.froxlor.org/froxlor-{version}.zip.sha256");
|
||||
|
||||
// check for archive-stuff
|
||||
if (! extension_loaded('zip')) {
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s,
|
||||
'page' => 'error',
|
||||
'errno' => 2
|
||||
));
|
||||
}
|
||||
|
||||
// display initial version check
|
||||
if ($page == 'overview') {
|
||||
|
||||
// log our actions
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "checking auto-update");
|
||||
|
||||
// check for new version
|
||||
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 (is_array($latestversion) && count($latestversion) >= 1) {
|
||||
$_version = $latestversion[0];
|
||||
$_message = isset($latestversion[1]) ? $latestversion[1] : '';
|
||||
$_link = isset($latestversion[2]) ? $latestversion[2] : htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes');
|
||||
|
||||
// add the branding so debian guys are not gettings confused
|
||||
// about their version-number
|
||||
$version_label = $_version . $branding;
|
||||
$version_link = $_link;
|
||||
$message_addinfo = $_message;
|
||||
|
||||
// not numeric -> error-message
|
||||
if (! preg_match('/^((\d+\\.)(\d+\\.)(\d+\\.)?(\d+)?(\-(svn|dev|rc)(\d+))?)$/', $_version)) {
|
||||
// check for customized version to not output
|
||||
// "There is a newer version of froxlor" besides the error-message
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s,
|
||||
'page' => 'error',
|
||||
'errno' => 3
|
||||
));
|
||||
} elseif (\Froxlor\Froxlor::versionCompare2($version, $_version) == - 1) {
|
||||
// there is a newer version - yay
|
||||
$isnewerversion = 1;
|
||||
} else {
|
||||
// nothing new
|
||||
$isnewerversion = 0;
|
||||
}
|
||||
|
||||
// anzeige über version-status mit ggfls. formular
|
||||
// zum update schritt #1 -> download
|
||||
if ($isnewerversion == 1) {
|
||||
$text = 'There is a newer version available. Update to version <b>' . $_version . '</b> now?<br/>(Your current version is: ' . $version . ')';
|
||||
$hiddenparams = '<input type="hidden" name="newversion" value="' . $_version . '" />';
|
||||
$yesfile = $filename . '?s=' . $s . '&page=getdownload';
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("misc/question_yesno", true) . "\";");
|
||||
exit();
|
||||
} elseif ($isnewerversion == 0) {
|
||||
// all good
|
||||
\Froxlor\UI\Response::standard_success('noupdatesavail');
|
||||
} else {
|
||||
\Froxlor\UI\Response::standard_error('customized_version');
|
||||
}
|
||||
}
|
||||
} // download the new archive
|
||||
elseif ($page == 'getdownload') {
|
||||
|
||||
// retrieve the new version from the form
|
||||
$newversion = isset($_POST['newversion']) ? $_POST['newversion'] : null;
|
||||
|
||||
// valid?
|
||||
if ($newversion !== null) {
|
||||
|
||||
// define files to get
|
||||
$toLoad = str_replace('{version}', $newversion, RELEASE_URI);
|
||||
$toCheck = str_replace('{version}', $newversion, CHECKSUM_URI);
|
||||
|
||||
// check for local destination folder
|
||||
if (! is_dir(\Froxlor\Froxlor::getInstallDir() . '/updates/')) {
|
||||
mkdir(\Froxlor\Froxlor::getInstallDir() . '/updates/');
|
||||
}
|
||||
|
||||
// name archive
|
||||
$localArchive = \Froxlor\Froxlor::getInstallDir() . '/updates/' . basename($toLoad);
|
||||
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "Downloading " . $toLoad . " to " . $localArchive);
|
||||
|
||||
// remove old archive
|
||||
if (file_exists($localArchive)) {
|
||||
@unlink($localArchive);
|
||||
}
|
||||
|
||||
// get archive data
|
||||
try {
|
||||
HttpClient::fileGet($toLoad, $localArchive);
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s,
|
||||
'page' => 'error',
|
||||
'errno' => 4
|
||||
));
|
||||
}
|
||||
|
||||
// validate the integrity of the downloaded file
|
||||
$_shouldsum = HttpClient::urlGet($toCheck);
|
||||
if (! empty($_shouldsum)) {
|
||||
$_t = explode(" ", $_shouldsum);
|
||||
$shouldsum = $_t[0];
|
||||
} else {
|
||||
$shouldsum = null;
|
||||
}
|
||||
$filesum = hash_file('sha256', $localArchive);
|
||||
|
||||
if ($filesum != $shouldsum) {
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s,
|
||||
'page' => 'error',
|
||||
'errno' => 9
|
||||
));
|
||||
}
|
||||
|
||||
// to the next step
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s,
|
||||
'page' => 'extract',
|
||||
'archive' => basename($localArchive)
|
||||
));
|
||||
}
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s,
|
||||
'page' => 'error',
|
||||
'errno' => 6
|
||||
));
|
||||
} // extract and install new version
|
||||
elseif ($page == 'extract') {
|
||||
|
||||
$toExtract = isset($_GET['archive']) ? $_GET['archive'] : null;
|
||||
$localArchive = \Froxlor\Froxlor::getInstallDir() . '/updates/' . $toExtract;
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
// decompress from zip
|
||||
$zip = new ZipArchive();
|
||||
$res = $zip->open($localArchive);
|
||||
if ($res === true) {
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "Extracting " . $localArchive . " to " . \Froxlor\Froxlor::getInstallDir());
|
||||
$zip->extractTo(\Froxlor\Froxlor::getInstallDir());
|
||||
$zip->close();
|
||||
// success - remove unused archive
|
||||
@unlink($localArchive);
|
||||
// wait a bit before we redirect to be sure
|
||||
sleep(2);
|
||||
} else {
|
||||
// error
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s,
|
||||
'page' => 'error',
|
||||
'errno' => 8
|
||||
));
|
||||
}
|
||||
|
||||
// redirect to update-page?
|
||||
\Froxlor\UI\Response::redirectTo('admin_updates.php', array(
|
||||
's' => $s
|
||||
));
|
||||
}
|
||||
|
||||
if (! file_exists($localArchive)) {
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s,
|
||||
'page' => 'error',
|
||||
'errno' => 7
|
||||
));
|
||||
}
|
||||
|
||||
$text = 'Extract downloaded archive "' . $toExtract . '"?';
|
||||
$hiddenparams = '';
|
||||
$yesfile = $filename . '?s=' . $s . '&page=extract&archive=' . $toExtract;
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("misc/question_yesno", true) . "\";");
|
||||
} // display error
|
||||
elseif ($page == 'error') {
|
||||
|
||||
// retrieve error-number via url-parameter
|
||||
$errno = isset($_GET['errno']) ? (int) $_GET['errno'] : 0;
|
||||
|
||||
// 2 = no Zlib
|
||||
// 3 = custom version detected
|
||||
// 4 = could not store archive to local hdd
|
||||
// 5 = some weird value came from version.froxlor.org
|
||||
// 6 = download without valid version
|
||||
// 7 = local archive does not exist
|
||||
// 8 = could not extract archive
|
||||
// 9 = checksum mismatch
|
||||
\Froxlor\UI\Response::standard_error('autoupdate_' . $errno);
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
/**
|
||||
* 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
|
||||
@@ -9,258 +10,173 @@
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
* @since 0.9.34
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
|
||||
use Froxlor\Settings;
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
if ($userinfo['change_serversettings'] == '1') {
|
||||
$need_db_sql_data = true;
|
||||
require ("./lib/init.php");
|
||||
require ("./lib/configfiles_index.inc.php");
|
||||
$distribution = '';
|
||||
$distributions_select = '';
|
||||
$service = '';
|
||||
$services_select = '';
|
||||
$daemon = '';
|
||||
$daemons_select = '';
|
||||
|
||||
if ($action == 'setconfigured') {
|
||||
Settings::Set('panel.is_configured', '1', true);
|
||||
\Froxlor\UI\Response::redirectTo('admin_configfiles.php', array(
|
||||
's' => $s
|
||||
));
|
||||
}
|
||||
if($userinfo['change_serversettings'] == '1')
|
||||
{
|
||||
if(isset($_GET['distribution'])
|
||||
&& $_GET['distribution'] != ''
|
||||
&& isset($configfiles[$_GET['distribution']])
|
||||
&& is_array($configfiles[$_GET['distribution']]))
|
||||
{
|
||||
$distribution = $_GET['distribution'];
|
||||
|
||||
$customer_tmpdir = '/tmp/';
|
||||
if (Settings::Get('system.mod_fcgid') == '1' && Settings::Get('system.mod_fcgid_tmpdir') != '') {
|
||||
$customer_tmpdir = Settings::Get('system.mod_fcgid_tmpdir');
|
||||
} elseif (Settings::Get('phpfpm.enabled') == '1' && Settings::Get('phpfpm.tmpdir') != '') {
|
||||
$customer_tmpdir = Settings::Get('phpfpm.tmpdir');
|
||||
}
|
||||
if(isset($_GET['service'])
|
||||
&& $_GET['service'] != ''
|
||||
&& isset($configfiles[$distribution]['services'][$_GET['service']])
|
||||
&& is_array($configfiles[$distribution]['services'][$_GET['service']]))
|
||||
{
|
||||
$service = $_GET['service'];
|
||||
|
||||
// try to convert namserver hosts to ip's
|
||||
$ns_ips = "";
|
||||
if (Settings::Get('system.nameservers') != '') {
|
||||
$nameservers = explode(',', Settings::Get('system.nameservers'));
|
||||
foreach ($nameservers as $nameserver) {
|
||||
$nameserver = trim($nameserver);
|
||||
$nameserver_ips = \Froxlor\PhpHelper::gethostbynamel6($nameserver);
|
||||
if (is_array($nameserver_ips) && count($nameserver_ips) > 0) {
|
||||
$ns_ips .= implode(",", $nameserver_ips);
|
||||
if(isset($_GET['daemon'])
|
||||
&& $_GET['daemon'] != ''
|
||||
&& isset($configfiles[$distribution]['services'][$service]['daemons'][$_GET['daemon']])
|
||||
&& is_array($configfiles[$distribution]['services'][$service]['daemons'][$_GET['daemon']]))
|
||||
{
|
||||
$daemon = $_GET['daemon'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$replace_arr = Array(
|
||||
'<SQL_UNPRIVILEGED_USER>' => $sql['user'],
|
||||
'<SQL_UNPRIVILEGED_PASSWORD>' => 'FROXLOR_MYSQL_PASSWORD',
|
||||
'<SQL_DB>' => $sql['db'],
|
||||
'<SQL_HOST>' => $sql['host'],
|
||||
'<SQL_SOCKET>' => isset($sql['socket']) ? $sql['socket'] : null,
|
||||
'<SERVERNAME>' => Settings::Get('system.hostname'),
|
||||
'<SERVERIP>' => Settings::Get('system.ipaddress'),
|
||||
'<NAMESERVERS>' => Settings::Get('system.nameservers'),
|
||||
'<NAMESERVERS_IP>' => $ns_ips,
|
||||
'<AXFRSERVERS>' => Settings::Get('system.axfrservers'),
|
||||
'<VIRTUAL_MAILBOX_BASE>' => Settings::Get('system.vmail_homedir'),
|
||||
'<VIRTUAL_UID_MAPS>' => Settings::Get('system.vmail_uid'),
|
||||
'<VIRTUAL_GID_MAPS>' => Settings::Get('system.vmail_gid'),
|
||||
'<SSLPROTOCOLS>' => (Settings::Get('system.use_ssl') == '1') ? 'imaps pop3s' : '',
|
||||
'<CUSTOMER_TMP>' => \Froxlor\FileDir::makeCorrectDir($customer_tmpdir),
|
||||
'<BASE_PATH>' => \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir()),
|
||||
'<BIND_CONFIG_PATH>' => \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.bindconf_directory')),
|
||||
'<WEBSERVER_RELOAD_CMD>' => Settings::Get('system.apachereload_command'),
|
||||
'<CUSTOMER_LOGS>' => \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.logfiles_directory')),
|
||||
'<FPM_IPCDIR>' => \Froxlor\FileDir::makeCorrectDir(Settings::Get('phpfpm.fastcgi_ipcdir')),
|
||||
'<WEBSERVER_GROUP>' => Settings::Get('system.httpgroup')
|
||||
);
|
||||
|
||||
// get distro from URL param
|
||||
$distribution = (isset($_GET['distribution']) && $_GET['distribution'] != 'choose') ? $_GET['distribution'] : "";
|
||||
$service = (isset($_GET['service']) && $_GET['service'] != 'choose') ? $_GET['service'] : "";
|
||||
$daemon = (isset($_GET['daemon']) && $_GET['daemon'] != 'choose') ? $_GET['daemon'] : "";
|
||||
$distributions_select = "";
|
||||
$services_select = "";
|
||||
$daemons_select = "";
|
||||
|
||||
$configfiles = "";
|
||||
$services = "";
|
||||
$daemons = "";
|
||||
|
||||
$config_dir = \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir() . '/lib/configfiles/');
|
||||
|
||||
if ($distribution != "") {
|
||||
|
||||
if (! file_exists($config_dir . '/' . $distribution . ".xml")) {
|
||||
trigger_error("Unknown distribution, are you playing around with the URL?");
|
||||
exit();
|
||||
}
|
||||
|
||||
// create configparser object
|
||||
$configfiles = new \Froxlor\Config\ConfigParser($config_dir . '/' . $distribution . ".xml");
|
||||
|
||||
// get distro-info
|
||||
$dist_display = getCompleteDistroName($configfiles);
|
||||
|
||||
// get all the services from the distro
|
||||
$services = $configfiles->getServices();
|
||||
|
||||
if ($service != "") {
|
||||
|
||||
if (! isset($services[$service])) {
|
||||
trigger_error("Unknown service, are you playing around with the URL?");
|
||||
exit();
|
||||
}
|
||||
|
||||
$daemons = $services[$service]->getDaemons();
|
||||
|
||||
if ($daemon == "") {
|
||||
foreach ($daemons as $di => $dd) {
|
||||
$title = $dd->title;
|
||||
if ($dd->default) {
|
||||
$title = $title . " (" . strtolower($lng['panel']['default']) . ")";
|
||||
}
|
||||
$daemons_select .= \Froxlor\UI\HTML::makeoption($title, $di);
|
||||
else
|
||||
{
|
||||
foreach($configfiles[$distribution]['services'][$service]['daemons'] as $daemon_name => $daemon_details)
|
||||
{
|
||||
$daemons_select.= makeoption($daemon_details['label'], $daemon_name);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($services as $si => $sd) {
|
||||
$services_select .= \Froxlor\UI\HTML::makeoption($sd->title, $si);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($configfiles[$distribution]['services'] as $service_name => $service_details)
|
||||
{
|
||||
$services_select.= makeoption($service_details['label'], $service_name);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// show list of available distro's
|
||||
$distros = glob($config_dir . '*.xml');
|
||||
// tmp array
|
||||
$distributions_select_data = array();
|
||||
// read in all the distros
|
||||
foreach ($distros as $_distribution) {
|
||||
// get configparser object
|
||||
$dist = new \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)));
|
||||
}
|
||||
|
||||
// sort by distribution name
|
||||
ksort($distributions_select_data);
|
||||
|
||||
foreach ($distributions_select_data as $dist_display => $dist_index) {
|
||||
// create select-box-option
|
||||
$distributions_select .= \Froxlor\UI\HTML::makeoption($dist_display, $dist_index);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($configfiles as $distribution_name => $distribution_details)
|
||||
{
|
||||
$distributions_select.= makeoption($distribution_details['label'], $distribution_name);
|
||||
}
|
||||
}
|
||||
|
||||
if ($distribution != "" && $service != "" && $daemon != "") {
|
||||
|
||||
if (! isset($daemons[$daemon])) {
|
||||
trigger_error("Unknown daemon, are you playing around with the URL?");
|
||||
exit();
|
||||
}
|
||||
|
||||
$confarr = $daemons[$daemon]->getConfig();
|
||||
|
||||
if($distribution != ''
|
||||
&& $service != ''
|
||||
&& $daemon != '')
|
||||
{
|
||||
$replace_arr = Array(
|
||||
'<SQL_UNPRIVILEGED_USER>' => $sql['user'],
|
||||
'<SQL_UNPRIVILEGED_PASSWORD>' => 'MYSQL_PASSWORD',
|
||||
'<SQL_DB>' => $sql['db'],
|
||||
'<SQL_HOST>' => $sql['host'],
|
||||
'<SERVERNAME>' => $settings['system']['hostname'],
|
||||
'<SERVERIP>' => $settings['system']['ipaddress'],
|
||||
'<NAMESERVERS>' => $settings['system']['nameservers'],
|
||||
'<VIRTUAL_MAILBOX_BASE>' => $settings['system']['vmail_homedir'],
|
||||
'<VIRTUAL_UID_MAPS>' => $settings['system']['vmail_uid'],
|
||||
'<VIRTUAL_GID_MAPS>' => $settings['system']['vmail_gid'],
|
||||
'<SSLPROTOCOLS>' => ($settings['system']['use_ssl'] == '1') ? 'imaps pop3s' : '',
|
||||
'<REALTIME_PORT>' => $settings['system']['realtime_port'],
|
||||
'<CUSTOMER_TMP>' => ($settings['system']['mod_fcgid_tmpdir'] != '') ? makeCorrectDir($settings['system']['mod_fcgid_tmpdir']) : '/tmp/'
|
||||
);
|
||||
$files = '';
|
||||
$configpage = '';
|
||||
|
||||
$distro_editor = $configfiles->distributionEditor;
|
||||
|
||||
$commands_pre = "";
|
||||
$commands_file = "";
|
||||
$commands_post = "";
|
||||
|
||||
$lasttype = '';
|
||||
$commands = '';
|
||||
foreach ($confarr as $_action) {
|
||||
if ($lasttype != '' && $lasttype != $_action['type']) {
|
||||
$commands = trim($commands);
|
||||
$numbrows = count(explode("\n", $commands));
|
||||
eval("\$configpage.=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_commands") . "\";");
|
||||
$lasttype = '';
|
||||
foreach($configfiles[$distribution]['services'][$service]['daemons'][$daemon] as $action => $value)
|
||||
{
|
||||
if(substr($action, 0, 8) == 'commands')
|
||||
{
|
||||
$commands = '';
|
||||
|
||||
if(is_array($value))
|
||||
{
|
||||
$commands = implode("\n", $value);
|
||||
$commands = str_replace("\n\n", "\n", $commands);
|
||||
|
||||
if($commands != '')
|
||||
{
|
||||
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_commands") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
switch ($_action['type']) {
|
||||
case "install":
|
||||
$commands .= strtr($_action['content'], $replace_arr) . "\n";
|
||||
$lasttype = "install";
|
||||
break;
|
||||
case "command":
|
||||
$commands .= strtr($_action['content'], $replace_arr) . "\n";
|
||||
$lasttype = "command";
|
||||
break;
|
||||
case "file":
|
||||
if (array_key_exists('content', $_action)) {
|
||||
$commands_file = getFileContentContainer($_action['content'], $replace_arr, $_action['name'], $distro_editor);
|
||||
} elseif (array_key_exists('subcommands', $_action)) {
|
||||
foreach ($_action['subcommands'] as $fileaction) {
|
||||
if (array_key_exists('execute', $fileaction) && $fileaction['execute'] == "pre") {
|
||||
$commands_pre .= $fileaction['content'] . "\n";
|
||||
} elseif (array_key_exists('execute', $fileaction) && $fileaction['execute'] == "post") {
|
||||
$commands_post .= $fileaction['content'] . "\n";
|
||||
} elseif ($fileaction['type'] == 'file') {
|
||||
$commands_file = getFileContentContainer($fileaction['content'], $replace_arr, $_action['name'], $distro_editor);
|
||||
}
|
||||
}
|
||||
elseif(substr($action, 0, 5) == 'files')
|
||||
{
|
||||
$files = '';
|
||||
|
||||
if(is_array($value))
|
||||
{
|
||||
while(list($filename, $realname) = each($value))
|
||||
{
|
||||
$file_content = file_get_contents('./templates/misc/configfiles/' . $distribution . '/' . $daemon . '/' . $filename);
|
||||
$file_content = strtr($file_content, $replace_arr);
|
||||
$file_content = htmlspecialchars($file_content);
|
||||
$numbrows = count(explode("\n", $file_content));
|
||||
eval("\$files.=\"" . getTemplate("configfiles/configfiles_file") . "\";");
|
||||
}
|
||||
$realname = $_action['name'];
|
||||
$commands = trim($commands_pre);
|
||||
if ($commands != "") {
|
||||
$numbrows = count(explode("\n", $commands));
|
||||
eval("\$commands_pre=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_commands") . "\";");
|
||||
}
|
||||
$commands = trim($commands_post);
|
||||
if ($commands != "") {
|
||||
$numbrows = count(explode("\n", $commands));
|
||||
eval("\$commands_post=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_commands") . "\";");
|
||||
}
|
||||
eval("\$configpage.=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_subfileblock") . "\";");
|
||||
$commands = '';
|
||||
$commands_pre = '';
|
||||
$commands_post = '';
|
||||
break;
|
||||
|
||||
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_files") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
$commands = trim($commands);
|
||||
if ($commands != '') {
|
||||
$numbrows = count(explode("\n", $commands));
|
||||
eval("\$configpage.=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_commands") . "\";");
|
||||
|
||||
if(isset($configfiles[$distribution]['services'][$service]['daemons'][$daemon]['restart'])
|
||||
&& is_array($configfiles[$distribution]['services'][$service]['daemons'][$daemon]['restart']))
|
||||
{
|
||||
$restart = implode("\n", $configfiles[$distribution]['services'][$service]['daemons'][$daemon]['restart']);
|
||||
}
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles") . "\";");
|
||||
} else {
|
||||
$basedir = \Froxlor\Froxlor::getInstallDir();
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("configfiles/wizard") . "\";");
|
||||
else
|
||||
{
|
||||
$restart = '';
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("configfiles/configfiles") . "\";");
|
||||
}
|
||||
elseif($page == 'overview')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_configfiles");
|
||||
$distributions = '';
|
||||
foreach($configfiles as $distribution_name => $distribution_details)
|
||||
{
|
||||
$services = '';
|
||||
foreach($distribution_details['services'] as $service_name => $service_details)
|
||||
{
|
||||
$daemons = '';
|
||||
foreach($service_details['daemons'] as $daemon_name => $daemon_details)
|
||||
{
|
||||
eval("\$daemons.=\"" . getTemplate("configfiles/choose_daemon") . "\";");
|
||||
}
|
||||
|
||||
eval("\$services.=\"" . getTemplate("configfiles/choose_service") . "\";");
|
||||
}
|
||||
|
||||
eval("\$distributions.=\"" . getTemplate("configfiles/choose_distribution") . "\";");
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("configfiles/choose") . "\";");
|
||||
}
|
||||
else
|
||||
{
|
||||
eval("echo \"" . getTemplate("configfiles/wizard") . "\";");
|
||||
}
|
||||
} else {
|
||||
\Froxlor\UI\Response::redirectTo('admin_index.php', array(
|
||||
's' => $s
|
||||
));
|
||||
}
|
||||
|
||||
// helper functions
|
||||
function getFileContentContainer($file_content, &$replace_arr, $realname, $distro_editor)
|
||||
{
|
||||
$files = "";
|
||||
$file_content = trim($file_content);
|
||||
if ($file_content != '') {
|
||||
$file_content = strtr($file_content, $replace_arr);
|
||||
$file_content = htmlspecialchars($file_content);
|
||||
$numbrows = count(explode("\n", $file_content));
|
||||
eval("\$files=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_file") . "\";");
|
||||
}
|
||||
return $files;
|
||||
}
|
||||
|
||||
function getCompleteDistroName($cparser)
|
||||
{
|
||||
// get distro-info
|
||||
$dist_display = $cparser->distributionName;
|
||||
if ($cparser->distributionCodename != '') {
|
||||
$dist_display .= " " . $cparser->distributionCodename;
|
||||
}
|
||||
if ($cparser->distributionVersion != '') {
|
||||
$dist_display .= " (" . $cparser->distributionVersion . ")";
|
||||
}
|
||||
if ($cparser->deprecated) {
|
||||
$dist_display .= " [deprecated]";
|
||||
}
|
||||
return $dist_display;
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -12,35 +12,42 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Api\Commands\Cronjobs as Cronjobs;
|
||||
require_once("./lib/init.php");
|
||||
|
||||
if (isset($_POST['id'])) {
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
} elseif (isset($_GET['id'])) {
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if ($page == 'cronjobs' || $page == 'overview') {
|
||||
if ($action == '') {
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'viewed admin_cronjobs');
|
||||
if($page == 'cronjobs'
|
||||
|| $page == 'overview')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_cronjobs");
|
||||
|
||||
$fields = array(
|
||||
'c.lastrun' => $lng['cron']['lastrun'],
|
||||
'c.interval' => $lng['cron']['interval'],
|
||||
'c.isactive' => $lng['cron']['isactive']
|
||||
);
|
||||
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_CRONRUNS, $fields);
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_CRONRUNS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
|
||||
/*
|
||||
* @TODO Fix sorting
|
||||
*/
|
||||
$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());
|
||||
$result = $db->query("SELECT `c`.* FROM `" . TABLE_PANEL_CRONRUNS . "` `c` ORDER BY `cronfile` ASC");
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
@@ -48,86 +55,103 @@ if ($page == 'cronjobs' || $page == 'overview') {
|
||||
|
||||
$i = 0;
|
||||
$count = 0;
|
||||
$cmod = '';
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if ($cmod != $row['module']) {
|
||||
$_mod = explode("/", $row['module']);
|
||||
$module = ucfirst($_mod[1]);
|
||||
eval("\$crons.=\"" . \Froxlor\UI\Template::getTemplate('cronjobs/cronjobs_cronjobmodule') . "\";");
|
||||
$cmod = $row['module'];
|
||||
}
|
||||
if ($paging->checkDisplay($i)) {
|
||||
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
$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'];
|
||||
|
||||
|
||||
if((int)$row['isactive'] == 1)
|
||||
{
|
||||
$row['isactive'] = $lng['panel']['yes'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$row['isactive'] = $lng['panel']['no'];
|
||||
}
|
||||
|
||||
$description = $lng['crondesc'][$row['desc_lng_key']];
|
||||
|
||||
eval("\$crons.=\"" . \Froxlor\UI\Template::getTemplate('cronjobs/cronjobs_cronjob') . "\";");
|
||||
$count ++;
|
||||
|
||||
eval("\$crons.=\"" . getTemplate("cronjobs/cronjobs_cronjob") . "\";");
|
||||
$count++;
|
||||
}
|
||||
|
||||
$i ++;
|
||||
$i++;
|
||||
}
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('cronjobs/cronjobs') . "\";");
|
||||
} elseif ($action == 'new') {
|
||||
eval("echo \"" . getTemplate("cronjobs/cronjobs") . "\";");
|
||||
|
||||
}
|
||||
elseif($action == 'new')
|
||||
{
|
||||
/*
|
||||
* @TODO later
|
||||
*/
|
||||
} elseif ($action == 'edit' && $id != 0) {
|
||||
try {
|
||||
$json_result = Cronjobs::getLocal($userinfo, array(
|
||||
'id' => $id
|
||||
))->get();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
if ($result['cronfile'] != '') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
try {
|
||||
Cronjobs::getLocal($userinfo, $_POST)->update();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
elseif($action == 'edit'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_CRONRUNS . "` WHERE `id`='" . (int)$id . "'");
|
||||
|
||||
if ($result['cronfile'] != '')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$isactive = intval($_POST['isactive']);
|
||||
$interval_value = validate($_POST['interval_value'], 'interval_value', '/^([0-9]+)$/Di', 'stringisempty');
|
||||
$interval_interval = validate($_POST['interval_interval'], 'interval_interval');
|
||||
|
||||
if($isactive != 1)
|
||||
{
|
||||
$isactive = 0;
|
||||
}
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
|
||||
$interval = $interval_value.' '.strtoupper($interval_interval);
|
||||
|
||||
$db->query("UPDATE `" . TABLE_PANEL_CRONRUNS . "`
|
||||
SET `isactive` = '".(int)$isactive."',
|
||||
`interval` = '".$interval."'
|
||||
WHERE `id` = '" . (int)$id . "'");
|
||||
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
$isactive = makeyesno('isactive', '1', '0', $result['isactive']);
|
||||
// interval
|
||||
$interval_nfo = explode(' ', $result['interval']);
|
||||
$interval_value = $interval_nfo[0];
|
||||
|
||||
$interval_interval = '';
|
||||
$interval_interval .= \Froxlor\UI\HTML::makeoption($lng['cronmgmt']['minutes'], 'MINUTE', $interval_nfo[1]);
|
||||
$interval_interval .= \Froxlor\UI\HTML::makeoption($lng['cronmgmt']['hours'], 'HOUR', $interval_nfo[1]);
|
||||
$interval_interval .= \Froxlor\UI\HTML::makeoption($lng['cronmgmt']['days'], 'DAY', $interval_nfo[1]);
|
||||
$interval_interval .= \Froxlor\UI\HTML::makeoption($lng['cronmgmt']['weeks'], 'WEEK', $interval_nfo[1]);
|
||||
$interval_interval .= \Froxlor\UI\HTML::makeoption($lng['cronmgmt']['months'], 'MONTH', $interval_nfo[1]);
|
||||
$interval_interval.= makeoption($lng['cronmgmt']['seconds'], 'SECOND', $interval_nfo[1]);
|
||||
$interval_interval.= makeoption($lng['cronmgmt']['minutes'], 'MINUTE', $interval_nfo[1]);
|
||||
$interval_interval.= makeoption($lng['cronmgmt']['hours'], 'HOUR', $interval_nfo[1]);
|
||||
$interval_interval.= makeoption($lng['cronmgmt']['days'], 'DAY', $interval_nfo[1]);
|
||||
$interval_interval.= makeoption($lng['cronmgmt']['weeks'], 'WEEK', $interval_nfo[1]);
|
||||
$interval_interval.= makeoption($lng['cronmgmt']['months'], 'MONTH', $interval_nfo[1]);
|
||||
// end of interval
|
||||
|
||||
|
||||
$change_cronfile = false;
|
||||
if (substr($result['module'], 0, strpos($result['module'], '/')) != 'froxlor') {
|
||||
if (substr($result['module'], 0, strpos($result['module'], '/')) != 'froxlor')
|
||||
{
|
||||
$change_cronfile = true;
|
||||
}
|
||||
|
||||
$cronjobs_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/cronjobs/formfield.cronjobs_edit.php';
|
||||
$cronjobs_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($cronjobs_edit_data);
|
||||
|
||||
$title = $cronjobs_edit_data['cronjobs_edit']['title'];
|
||||
$image = $cronjobs_edit_data['cronjobs_edit']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('cronjobs/cronjob_edit') . "\";");
|
||||
|
||||
eval("echo \"" . getTemplate("cronjobs/cronjob_edit") . "\";");
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'delete' && $id != 0) {
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $id != 0)
|
||||
{
|
||||
/*
|
||||
* @TODO later
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
1542
admin_customers.php
1609
admin_domains.php
481
admin_index.php
@@ -14,50 +14,47 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\Api\Commands\Froxlor as Froxlor;
|
||||
use Froxlor\Api\Commands\Admins as Admins;
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
if ($action == 'logout') {
|
||||
require ("./lib/init.php");
|
||||
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "logged out");
|
||||
if($action == 'logout')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "logged out");
|
||||
|
||||
$params = array(
|
||||
'adminid' => (int) $userinfo['adminid']
|
||||
);
|
||||
|
||||
if (Settings::Get('session.allow_multiple_login') == '1') {
|
||||
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
|
||||
WHERE `userid` = :adminid
|
||||
AND `adminsession` = '1'
|
||||
AND `hash` = :hash");
|
||||
$params['hash'] = $s;
|
||||
} else {
|
||||
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
|
||||
WHERE `userid` = :adminid
|
||||
AND `adminsession` = '1'");
|
||||
if($settings['session']['allow_multiple_login'] == '1')
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['adminid'] . "' AND `adminsession` = '1' AND `hash` = '" . $s . "'");
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['adminid'] . "' AND `adminsession` = '1'");
|
||||
}
|
||||
Database::pexecute($stmt, $params);
|
||||
|
||||
\Froxlor\UI\Response::redirectTo('index.php');
|
||||
redirectTo('index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_POST['id'])) {
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
} elseif (isset($_GET['id'])) {
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if ($page == 'overview') {
|
||||
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_index");
|
||||
$overview_stmt = Database::prepare("SELECT COUNT(*) AS `number_customers`,
|
||||
if($page == 'overview')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_index");
|
||||
$overview = $db->query_first("SELECT COUNT(*) AS `number_customers`,
|
||||
SUM(`diskspace_used`) AS `diskspace_used`,
|
||||
SUM(`mysqls_used`) AS `mysqls_used`,
|
||||
SUM(`emails_used`) AS `emails_used`,
|
||||
@@ -65,98 +62,139 @@ if ($page == 'overview') {
|
||||
SUM(`email_forwarders_used`) AS `email_forwarders_used`,
|
||||
SUM(`email_quota_used`) AS `email_quota_used`,
|
||||
SUM(`ftps_used`) AS `ftps_used`,
|
||||
SUM(`tickets_used`) AS `tickets_used`,
|
||||
SUM(`subdomains_used`) AS `subdomains_used`,
|
||||
SUM(`traffic_used`) AS `traffic_used`
|
||||
FROM `" . TABLE_PANEL_CUSTOMERS . "`" . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = :adminid "));
|
||||
$overview = Database::pexecute_first($overview_stmt, array(
|
||||
'adminid' => $userinfo['adminid']
|
||||
));
|
||||
|
||||
$dec_places = Settings::Get('panel.decimal_places');
|
||||
$overview['traffic_used'] = round($overview['traffic_used'] / (1024 * 1024), $dec_places);
|
||||
$overview['diskspace_used'] = round($overview['diskspace_used'] / 1024, $dec_places);
|
||||
|
||||
$number_domains_stmt = Database::prepare("
|
||||
SELECT COUNT(*) AS `number_domains` FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `parentdomainid`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :adminid"));
|
||||
$number_domains = Database::pexecute_first($number_domains_stmt, array(
|
||||
'adminid' => $userinfo['adminid']
|
||||
));
|
||||
|
||||
SUM(`traffic_used`) AS `traffic_used`,
|
||||
SUM(`aps_packages_used`) AS `aps_packages_used`
|
||||
FROM `" . TABLE_PANEL_CUSTOMERS . "`" . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = '" . (int)$userinfo['adminid'] . "' "));
|
||||
$overview['traffic_used'] = round($overview['traffic_used'] / (1024 * 1024), $settings['panel']['decimal_places']);
|
||||
$overview['diskspace_used'] = round($overview['diskspace_used'] / 1024, $settings['panel']['decimal_places']);
|
||||
$number_domains = $db->query_first("SELECT COUNT(*) AS `number_domains` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `parentdomainid`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = '" . (int)$userinfo['adminid'] . "' "));
|
||||
$overview['number_domains'] = $number_domains['number_domains'];
|
||||
|
||||
$phpversion = phpversion();
|
||||
$mysqlserverversion = Database::getAttribute(PDO::ATTR_SERVER_VERSION);
|
||||
$phpmemorylimit = @ini_get("memory_limit");
|
||||
|
||||
if($phpmemorylimit == "")
|
||||
{
|
||||
$phpmemorylimit = $lng['admin']['memorylimitdisabled'];
|
||||
}
|
||||
|
||||
$mysqlserverversion = mysql_get_server_info();
|
||||
$mysqlclientversion = mysql_get_client_info();
|
||||
$webserverinterface = strtoupper(@php_sapi_name());
|
||||
|
||||
if ((isset($_GET['lookfornewversion']) && $_GET['lookfornewversion'] == 'yes') || (isset($lookfornewversion) && $lookfornewversion == 'yes')) {
|
||||
try {
|
||||
$json_result = Froxlor::getLocal($userinfo)->checkUpdate();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
if((isset($_GET['lookfornewversion']) && $_GET['lookfornewversion'] == 'yes')
|
||||
|| (isset($lookfornewversion) && $lookfornewversion == 'yes'))
|
||||
{
|
||||
$update_check_uri = 'http://version.froxlor.org/Froxlor/legacy/' . $version;
|
||||
|
||||
$lookfornewversion_lable = $result['version'];
|
||||
$lookfornewversion_link = $result['link'];
|
||||
$lookfornewversion_message = $result['message'];
|
||||
$lookfornewversion_addinfo = $result['additional_info'];
|
||||
$isnewerversion = $result['isnewerversion'];
|
||||
} else {
|
||||
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');
|
||||
|
||||
$lookfornewversion_lable = $_version;
|
||||
$lookfornewversion_link = $_link;
|
||||
$lookfornewversion_addinfo = $_message;
|
||||
|
||||
if (version_compare($version, $_version) == -1) {
|
||||
$isnewerversion = 1;
|
||||
} else {
|
||||
$isnewerversion = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
redirectTo($update_check_uri.'/pretty', NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
redirectTo($update_check_uri.'/pretty', NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
redirectTo($update_check_uri.'/pretty', NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$lookfornewversion_lable = $lng['admin']['lookfornewversion']['clickhere'];
|
||||
$lookfornewversion_link = htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes');
|
||||
$lookfornewversion_message = '';
|
||||
$lookfornewversion_addinfo = '';
|
||||
$isnewerversion = 0;
|
||||
}
|
||||
|
||||
$dec_places = Settings::Get('panel.decimal_places');
|
||||
$userinfo['diskspace'] = round($userinfo['diskspace'] / 1024, $dec_places);
|
||||
$userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, $dec_places);
|
||||
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $dec_places);
|
||||
$userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), $dec_places);
|
||||
$userinfo = \Froxlor\PhpHelper::strReplaceArray('-1', $lng['customer']['unlimited'], $userinfo, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps subdomains');
|
||||
$userinfo['diskspace'] = round($userinfo['diskspace'] / 1024, $settings['panel']['decimal_places']);
|
||||
$userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, $settings['panel']['decimal_places']);
|
||||
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $settings['panel']['decimal_places']);
|
||||
$userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), $settings['panel']['decimal_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 aps_packages');
|
||||
|
||||
$userinfo['custom_notes'] = ($userinfo['custom_notes'] != '') ? nl2br($userinfo['custom_notes']) : '';
|
||||
$cron_last_runs = getCronjobsLastRun();
|
||||
$outstanding_tasks = getOutstandingTasks();
|
||||
|
||||
$cron_last_runs = \Froxlor\System\Cronjob::getCronjobsLastRun();
|
||||
$outstanding_tasks = \Froxlor\System\Cronjob::getOutstandingTasks();
|
||||
$opentickets = 0;
|
||||
$opentickets = $db->query_first('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
|
||||
WHERE `answerto` = "0" AND (`status` = "0" OR `status` = "1")
|
||||
AND `lastreplier`="0" AND `adminid` = "' . $userinfo['adminid'] . '"');
|
||||
$awaitingtickets = $opentickets['count'];
|
||||
$awaitingtickets_text = '';
|
||||
|
||||
$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($opentickets > 0)
|
||||
{
|
||||
$awaitingtickets_text = strtr($lng['ticket']['awaitingticketreply'], array('%s' => '<a href="admin_tickets.php?page=tickets&s=' . $s . '">' . $opentickets['count'] . '</a>'));
|
||||
}
|
||||
|
||||
if (function_exists('sys_getloadavg')) {
|
||||
if(function_exists('sys_getloadavg'))
|
||||
{
|
||||
$loadArray = sys_getloadavg();
|
||||
$load = number_format($loadArray[0], 2, '.', '') . " / " . number_format($loadArray[1], 2, '.', '') . " / " . number_format($loadArray[2], 2, '.', '');
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$load = @file_get_contents('/proc/loadavg');
|
||||
|
||||
if (! $load) {
|
||||
if(!$load)
|
||||
{
|
||||
$load = $lng['admin']['noloadavailable'];
|
||||
}
|
||||
}
|
||||
|
||||
if (function_exists('posix_uname')) {
|
||||
if(function_exists('posix_uname'))
|
||||
{
|
||||
$showkernel = 1;
|
||||
$kernel_nfo = posix_uname();
|
||||
$kernel = $kernel_nfo['release'] . ' (' . $kernel_nfo['machine'] . ')';
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$showkernel = 0;
|
||||
$kernel = '';
|
||||
}
|
||||
|
||||
// Try to get the uptime
|
||||
// First: With exec (let's hope it's enabled for the Froxlor - vHost)
|
||||
// First: With exec (let's hope it's enabled for the SysCP - vHost)
|
||||
|
||||
$uptime_array = explode(" ", @file_get_contents("/proc/uptime"));
|
||||
|
||||
if (is_array($uptime_array) && isset($uptime_array[0]) && is_numeric($uptime_array[0])) {
|
||||
if(is_array($uptime_array)
|
||||
&& isset($uptime_array[0])
|
||||
&& is_numeric($uptime_array[0]))
|
||||
{
|
||||
// Some calculatioon to get a nicly formatted display
|
||||
|
||||
$seconds = round($uptime_array[0], 0);
|
||||
$minutes = $seconds / 60;
|
||||
$hours = $minutes / 60;
|
||||
@@ -167,228 +205,89 @@ if ($page == 'overview') {
|
||||
$uptime = "{$days}d, {$hours}h, {$minutes}m, {$seconds}s";
|
||||
|
||||
// Just cleanup
|
||||
|
||||
unset($uptime_array, $seconds, $minutes, $hours, $days);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// Nothing of the above worked, show an error :/
|
||||
|
||||
$uptime = '';
|
||||
}
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/index") . "\";");
|
||||
} elseif ($page == 'change_password') {
|
||||
eval("echo \"" . getTemplate("index/index") . "\";");
|
||||
}
|
||||
elseif($page == 'change_password')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$old_password = validate($_POST['old_password'], 'old password');
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$old_password = \Froxlor\Validate\Validate::validate($_POST['old_password'], 'old password');
|
||||
|
||||
if (! \Froxlor\System\Crypt::validatePasswordLogin($userinfo, $old_password, TABLE_PANEL_ADMINS, 'adminid')) {
|
||||
\Froxlor\UI\Response::standard_error('oldpasswordnotcorrect');
|
||||
if(md5($old_password) != $userinfo['password'])
|
||||
{
|
||||
standard_error('oldpasswordnotcorrect');
|
||||
exit;
|
||||
}
|
||||
|
||||
$new_password = \Froxlor\Validate\Validate::validate($_POST['new_password'], 'new password');
|
||||
$new_password_confirm = \Froxlor\Validate\Validate::validate($_POST['new_password_confirm'], 'new password confirm');
|
||||
$new_password = validate($_POST['new_password'], 'new password');
|
||||
$new_password_confirm = validate($_POST['new_password_confirm'], 'new password confirm');
|
||||
|
||||
if ($old_password == '') {
|
||||
\Froxlor\UI\Response::standard_error(array(
|
||||
'stringisempty',
|
||||
'oldpassword'
|
||||
));
|
||||
} elseif ($new_password == '') {
|
||||
\Froxlor\UI\Response::standard_error(array(
|
||||
'stringisempty',
|
||||
'newpassword'
|
||||
));
|
||||
} elseif ($new_password_confirm == '') {
|
||||
\Froxlor\UI\Response::standard_error(array(
|
||||
'stringisempty',
|
||||
'newpasswordconfirm'
|
||||
));
|
||||
} elseif ($new_password != $new_password_confirm) {
|
||||
\Froxlor\UI\Response::standard_error('newpasswordconfirmerror');
|
||||
} else {
|
||||
try {
|
||||
Admins::getLocal($userinfo, array(
|
||||
'id' => $userinfo['adminid'],
|
||||
'admin_password' => $new_password
|
||||
))->update();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'changed password');
|
||||
\Froxlor\UI\Response::redirectTo($filename, Array(
|
||||
's' => $s
|
||||
));
|
||||
if($old_password == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'oldpassword'));
|
||||
}
|
||||
elseif($new_password == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'newpassword'));
|
||||
}
|
||||
elseif($new_password_confirm == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'newpasswordconfirm'));
|
||||
}
|
||||
elseif($new_password != $new_password_confirm)
|
||||
{
|
||||
standard_error('newpasswordconfirmerror');
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `password`='" . md5($new_password) . "' WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `password`='" . md5($old_password) . "'");
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, 'changed password');
|
||||
redirectTo($filename, Array('s' => $s));
|
||||
}
|
||||
} else {
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/change_password") . "\";");
|
||||
}
|
||||
} elseif ($page == 'change_language') {
|
||||
else
|
||||
{
|
||||
eval("echo \"" . getTemplate("index/change_password") . "\";");
|
||||
}
|
||||
}
|
||||
elseif($page == 'change_language')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$def_language = validate($_POST['def_language'], 'default language');
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$def_language = \Froxlor\Validate\Validate::validate($_POST['def_language'], 'default language');
|
||||
|
||||
if (isset($languages[$def_language])) {
|
||||
try {
|
||||
Admins::getLocal($userinfo, array(
|
||||
'id' => $userinfo['adminid'],
|
||||
'def_language' => $def_language
|
||||
))->update();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
|
||||
// also update current session
|
||||
$lng_stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_SESSIONS . "`
|
||||
SET `language`= :lng
|
||||
WHERE `hash`= :hash");
|
||||
Database::pexecute($lng_stmt, array(
|
||||
'lng' => $def_language,
|
||||
'hash' => $s
|
||||
));
|
||||
if(isset($languages[$def_language]))
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `def_language`='" . $db->escape($def_language) . "' WHERE `adminid`='" . (int)$userinfo['adminid'] . "'");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SESSIONS . "` SET `language`='" . $db->escape($def_language) . "' WHERE `hash`='" . $db->escape($s) . "'");
|
||||
}
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "changed his/her default language to '" . $def_language . "'");
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "changed his/her default language to '" . $def_language . "'");
|
||||
redirectTo($filename, Array('s' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
$language_options = '';
|
||||
|
||||
$default_lang = Settings::Get('panel.standardlanguage');
|
||||
if ($userinfo['def_language'] != '') {
|
||||
$default_lang = $userinfo['def_language'];
|
||||
while(list($language_file, $language_name) = each($languages))
|
||||
{
|
||||
$language_options.= makeoption($language_name, $language_file, $userinfo['def_language'], true);
|
||||
}
|
||||
|
||||
foreach ($languages as $language_file => $language_name) {
|
||||
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $default_lang, true);
|
||||
}
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/change_language") . "\";");
|
||||
eval("echo \"" . getTemplate("index/change_language") . "\";");
|
||||
}
|
||||
} elseif ($page == 'change_theme') {
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$theme = \Froxlor\Validate\Validate::validate($_POST['theme'], 'theme');
|
||||
try {
|
||||
Admins::getLocal($userinfo, array(
|
||||
'id' => $userinfo['adminid'],
|
||||
'theme' => $theme
|
||||
))->update();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
|
||||
// also update current session
|
||||
$theme_stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_SESSIONS . "`
|
||||
SET `theme`= :theme
|
||||
WHERE `hash`= :hash");
|
||||
Database::pexecute($theme_stmt, array(
|
||||
'theme' => $theme,
|
||||
'hash' => $s
|
||||
));
|
||||
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "changed his/her theme to '" . $theme . "'");
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
|
||||
$theme_options = '';
|
||||
|
||||
$default_theme = Settings::Get('panel.default_theme');
|
||||
if ($userinfo['theme'] != '') {
|
||||
$default_theme = $userinfo['theme'];
|
||||
}
|
||||
|
||||
$themes_avail = \Froxlor\UI\Template::getThemes();
|
||||
foreach ($themes_avail as $t => $d) {
|
||||
$theme_options .= \Froxlor\UI\HTML::makeoption($d, $t, $default_theme, true);
|
||||
}
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/change_theme") . "\";");
|
||||
}
|
||||
} elseif ($page == 'send_error_report' && Settings::Get('system.allow_error_report_admin') == '1') {
|
||||
|
||||
// only show this if we really have an exception to report
|
||||
if (isset($_GET['errorid']) && $_GET['errorid'] != '') {
|
||||
|
||||
$errid = $_GET['errorid'];
|
||||
// read error file
|
||||
$err_dir = \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir() . "/logs/");
|
||||
$err_file = \Froxlor\FileDir::makeCorrectFile($err_dir . "/" . $errid . "_sql-error.log");
|
||||
|
||||
if (file_exists($err_file)) {
|
||||
|
||||
$error_content = file_get_contents($err_file);
|
||||
$error = explode("|", $error_content);
|
||||
|
||||
$_error = array(
|
||||
'code' => str_replace("\n", "", substr($error[1], 5)),
|
||||
'message' => str_replace("\n", "", substr($error[2], 4)),
|
||||
'file' => str_replace("\n", "", substr($error[3], 5 + strlen(\Froxlor\Froxlor::getInstallDir()))),
|
||||
'line' => str_replace("\n", "", substr($error[4], 5)),
|
||||
'trace' => str_replace(\Froxlor\Froxlor::getInstallDir(), "", substr($error[5], 6))
|
||||
);
|
||||
|
||||
// build mail-content
|
||||
$mail_body = "Dear froxlor-team,\n\n";
|
||||
$mail_body .= "the following error has been reported by a user:\n\n";
|
||||
$mail_body .= "-------------------------------------------------------------\n";
|
||||
$mail_body .= $_error['code'] . ' ' . $_error['message'] . "\n\n";
|
||||
$mail_body .= "File: " . $_error['file'] . ':' . $_error['line'] . "\n\n";
|
||||
$mail_body .= "Trace:\n" . trim($_error['trace']) . "\n\n";
|
||||
$mail_body .= "-------------------------------------------------------------\n\n";
|
||||
$mail_body .= "Froxlor-version: " . $version . "\n";
|
||||
$mail_body .= "DB-version: " . $dbversion . "\n\n";
|
||||
$mail_body .= "End of report";
|
||||
$mail_html = nl2br($mail_body);
|
||||
|
||||
// send actual report to dev-team
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
// send mail and say thanks
|
||||
$_mailerror = false;
|
||||
try {
|
||||
$mail->Subject = '[Froxlor] Error report by user';
|
||||
$mail->AltBody = $mail_body;
|
||||
$mail->MsgHTML($mail_html);
|
||||
$mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team');
|
||||
$mail->Send();
|
||||
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
||||
$mailerr_msg = $e->errorMessage();
|
||||
$_mailerror = true;
|
||||
} catch (Exception $e) {
|
||||
$mailerr_msg = $e->getMessage();
|
||||
$_mailerror = true;
|
||||
}
|
||||
|
||||
if ($_mailerror) {
|
||||
// error when reporting an error...LOLFUQ
|
||||
\Froxlor\UI\Response::standard_error('send_report_error', $mailerr_msg);
|
||||
}
|
||||
|
||||
// finally remove error from fs
|
||||
@unlink($err_file);
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s
|
||||
));
|
||||
}
|
||||
// show a nice summary of the error-report
|
||||
// before actually sending anything
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/send_error_report") . "\";");
|
||||
} else {
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s
|
||||
));
|
||||
}
|
||||
} else {
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s
|
||||
));
|
||||
}
|
||||
} elseif ($page == 'apikeys' && Settings::Get('api.enabled') == 1) {
|
||||
require_once __DIR__ . '/api_keys.php';
|
||||
} elseif ($page == 'apihelp' && Settings::Get('api.enabled') == 1) {
|
||||
require_once __DIR__ . '/apihelp.php';
|
||||
} elseif ($page == '2fa' && Settings::Get('2fa.enabled') == 1) {
|
||||
require_once __DIR__ . '/2fa.php';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -14,40 +14,40 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\Api\Commands\IpsAndPorts as IpsAndPorts;
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
if (isset($_POST['id'])) {
|
||||
require ("./lib/init.php");
|
||||
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
} elseif (isset($_GET['id'])) {
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if ($page == 'ipsandports' || $page == 'overview') {
|
||||
// Do not display attributes that are not used by the current webserver
|
||||
$websrv = Settings::Get('system.webserver');
|
||||
$is_nginx = ($websrv == 'nginx');
|
||||
$is_apache = ($websrv == 'apache2');
|
||||
$is_apache24 = $is_apache && (Settings::Get('system.apache24') === '1');
|
||||
|
||||
if ($action == '') {
|
||||
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_ipsandports");
|
||||
if($page == 'ipsandports'
|
||||
|| $page == 'overview')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_ipsandports");
|
||||
$fields = array(
|
||||
'ip' => $lng['admin']['ipsandports']['ip'],
|
||||
'port' => $lng['admin']['ipsandports']['port']
|
||||
);
|
||||
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_IPSANDPORTS, $fields);
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_IPSANDPORTS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$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());
|
||||
$result = $db->query("SELECT `id`, `ip`, `port`, `listen_statement`, `namevirtualhost_statement`, `vhostcontainer`, `vhostcontainer_servername_statement`, `specialsettings`, `ssl` FROM `" . TABLE_PANEL_IPSANDPORTS . "` " . $paging->getSqlWhere(false) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
@@ -55,107 +55,266 @@ if ($page == 'ipsandports' || $page == 'overview') {
|
||||
$i = 0;
|
||||
$count = 0;
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
$row = htmlentities_array($row);
|
||||
|
||||
if ($paging->checkDisplay($i)) {
|
||||
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
|
||||
if (filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
|
||||
if(filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
|
||||
{
|
||||
$row['ip'] = '[' . $row['ip'] . ']';
|
||||
}
|
||||
eval("\$ipsandports.=\"" . \Froxlor\UI\Template::getTemplate("ipsandports/ipsandports_ipandport") . "\";");
|
||||
$count ++;
|
||||
|
||||
eval("\$ipsandports.=\"" . getTemplate("ipsandports/ipsandports_ipandport") . "\";");
|
||||
$count++;
|
||||
}
|
||||
$i ++;
|
||||
}
|
||||
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'];
|
||||
|
||||
if (isset($result['id']) && $result['id'] == $id) {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$i++;
|
||||
}
|
||||
|
||||
try {
|
||||
IpsAndPorts::getLocal($userinfo, array(
|
||||
'id' => $id
|
||||
))->delete();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
eval("echo \"" . getTemplate("ipsandports/ipsandports") . "\";");
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id`='" . (int)$id . "'");
|
||||
|
||||
if(isset($result['id'])
|
||||
&& $result['id'] == $id)
|
||||
{
|
||||
$result_checkdomain = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `ipandport`='" . (int)$id . "'");
|
||||
|
||||
if($result_checkdomain['id'] == '')
|
||||
{
|
||||
if($result['id'] != $settings['system']['defaultip'])
|
||||
{
|
||||
$result_sameipotherport = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($result['ip']) . "' AND `id`!='" . (int)$id . "'");
|
||||
|
||||
if(($result['ip'] != $settings['system']['ipaddress'])
|
||||
|| ($result['ip'] == $settings['system']['ipaddress'] && $result_sameipotherport['id'] != ''))
|
||||
{
|
||||
$result = $db->query_first("SELECT `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id`='" . (int)$id . "'");
|
||||
|
||||
if($result['ip'] != '')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id`='" . (int)$id . "'");
|
||||
$log->logAction(ADM_ACTION, LOG_WARNING, "deleted IP/port '" . $result['ip'] . ":" . $result['port'] . "'");
|
||||
inserttask('1');
|
||||
inserttask('4');
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
ask_yesno('admin_ip_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['ip'] . ':' . $result['port']);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('cantdeletesystemip');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('cantdeletedefaultip');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('ipstillhasdomains');
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($action == 'add')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$ip = validate_ip($_POST['ip']);
|
||||
$port = validate($_POST['port'], 'port', '/^(([1-9])|([1-9][0-9])|([1-9][0-9][0-9])|([1-9][0-9][0-9][0-9])|([1-5][0-9][0-9][0-9][0-9])|(6[0-4][0-9][0-9][0-9])|(65[0-4][0-9][0-9])|(655[0-2][0-9])|(6553[0-5]))$/Di', array('stringisempty', 'myport'));
|
||||
$listen_statement = intval($_POST['listen_statement']);
|
||||
$namevirtualhost_statement = intval($_POST['namevirtualhost_statement']);
|
||||
$vhostcontainer = intval($_POST['vhostcontainer']);
|
||||
$specialsettings = validate(str_replace("\r\n", "\n", $_POST['specialsettings']), 'specialsettings', '/^[^\0]*$/');
|
||||
$vhostcontainer_servername_statement = intval($_POST['vhostcontainer_servername_statement']);
|
||||
$ssl = intval($_POST['ssl']);
|
||||
$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');
|
||||
$default_vhostconf_domain = validate(str_replace("\r\n", "\n", $_POST['default_vhostconf_domain']), 'default_vhostconf_domain', '/^[^\0]*$/');
|
||||
|
||||
if($listen_statement != '1')
|
||||
{
|
||||
$listen_statement = '0';
|
||||
}
|
||||
|
||||
if($namevirtualhost_statement != '1')
|
||||
{
|
||||
$namevirtualhost_statement = '0';
|
||||
}
|
||||
|
||||
if($vhostcontainer != '1')
|
||||
{
|
||||
$vhostcontainer = '0';
|
||||
}
|
||||
|
||||
if($vhostcontainer_servername_statement != '1')
|
||||
{
|
||||
$vhostcontainer_servername_statement = '0';
|
||||
}
|
||||
|
||||
if($ssl != '1')
|
||||
{
|
||||
$ssl = '0';
|
||||
}
|
||||
|
||||
if($ssl_cert_file != '')
|
||||
{
|
||||
$ssl_cert_file = makeCorrectFile($ssl_cert_file);
|
||||
}
|
||||
|
||||
if($ssl_key_file != '')
|
||||
{
|
||||
$ssl_key_file = makeCorrectFile($ssl_key_file);
|
||||
}
|
||||
|
||||
if($ssl_ca_file != '')
|
||||
{
|
||||
$ssl_ca_file = makeCorrectFile($ssl_ca_file);
|
||||
}
|
||||
|
||||
$result_checkfordouble = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($ip) . "' AND `port`='" . (int)$port . "'");
|
||||
|
||||
if($result_checkfordouble['id'] != '')
|
||||
{
|
||||
standard_error('myipnotdouble');
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_IPSANDPORTS . "` (`ip`, `port`, `listen_statement`, `namevirtualhost_statement`, `vhostcontainer`, `vhostcontainer_servername_statement`, `specialsettings`, `ssl`, `ssl_cert_file`, `ssl_key_file`, `ssl_ca_file`, `default_vhostconf_domain`) VALUES ('" . $db->escape($ip) . "', '" . (int)$port . "', '" . (int)$listen_statement . "', '" . (int)$namevirtualhost_statement . "', '" . (int)$vhostcontainer . "', '" . (int)$vhostcontainer_servername_statement . "', '" . $db->escape($specialsettings) . "', '" . (int)$ssl . "', '" . $db->escape($ssl_cert_file) . "', '" . $db->escape($ssl_key_file) . "', '" . $db->escape($ssl_ca_file) . "', '" . $db->escape($default_vhostconf_domain) . "')");
|
||||
|
||||
if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
|
||||
{
|
||||
$ip = '[' . $ip . ']';
|
||||
}
|
||||
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
\Froxlor\UI\HTML::askYesNo('admin_ip_reallydelete', $filename, array(
|
||||
'id' => $id,
|
||||
'page' => $page,
|
||||
'action' => $action
|
||||
), $result['ip'] . ':' . $result['port']);
|
||||
$log->logAction(ADM_ACTION, LOG_WARNING, "added IP/port '" . $ip . ":" . $port . "'");
|
||||
inserttask('1');
|
||||
inserttask('4');
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'add') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
try {
|
||||
IpsAndPorts::getLocal($userinfo, $_POST)->add();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
|
||||
$ipsandports_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/ipsandports/formfield.ipsandports_add.php';
|
||||
$ipsandports_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($ipsandports_add_data);
|
||||
|
||||
$title = $ipsandports_add_data['ipsandports_add']['title'];
|
||||
$image = $ipsandports_add_data['ipsandports_add']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("ipsandports/ipsandports_add") . "\";");
|
||||
else
|
||||
{
|
||||
$enable_ssl = makeyesno('ssl', '1', '0', '0');
|
||||
$listen_statement = makeyesno('listen_statement', '1', '0', '1');
|
||||
$namevirtualhost_statement = makeyesno('namevirtualhost_statement', '1', '0', '1');
|
||||
$vhostcontainer = makeyesno('vhostcontainer', '1', '0', '1');
|
||||
$vhostcontainer_servername_statement = makeyesno('vhostcontainer_servername_statement', '1', '0', '1');
|
||||
eval("echo \"" . getTemplate("ipsandports/ipsandports_add") . "\";");
|
||||
}
|
||||
} elseif ($action == 'edit' && $id != 0) {
|
||||
try {
|
||||
$json_result = IpsAndPorts::getLocal($userinfo, array(
|
||||
'id' => $id
|
||||
))->get();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
}
|
||||
elseif($action == 'edit'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id`='" . (int)$id . "'");
|
||||
|
||||
if ($result['ip'] != '') {
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
try {
|
||||
IpsAndPorts::getLocal($userinfo, $_POST)->update();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
if($result['ip'] != '')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$ip = validate_ip($_POST['ip']);
|
||||
$port = validate($_POST['port'], 'port', '/^(([1-9])|([1-9][0-9])|([1-9][0-9][0-9])|([1-9][0-9][0-9][0-9])|([1-5][0-9][0-9][0-9][0-9])|(6[0-4][0-9][0-9][0-9])|(65[0-4][0-9][0-9])|(655[0-2][0-9])|(6553[0-5]))$/Di', array('stringisempty', 'myport'));
|
||||
$result_checkfordouble = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($ip) . "' AND `port`='" . (int)$port . "'");
|
||||
$result_sameipotherport = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($result['ip']) . "' AND `id`!='" . (int)$id . "'");
|
||||
$listen_statement = intval($_POST['listen_statement']);
|
||||
$namevirtualhost_statement = intval($_POST['namevirtualhost_statement']);
|
||||
$vhostcontainer = intval($_POST['vhostcontainer']);
|
||||
$specialsettings = validate(str_replace("\r\n", "\n", $_POST['specialsettings']), 'specialsettings', '/^[^\0]*$/');
|
||||
$vhostcontainer_servername_statement = intval($_POST['vhostcontainer_servername_statement']);
|
||||
$ssl = intval($_POST['ssl']);
|
||||
$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');
|
||||
$default_vhostconf_domain = validate(str_replace("\r\n", "\n", $_POST['default_vhostconf_domain']), 'default_vhostconf_domain', '/^[^\0]*$/');
|
||||
|
||||
if($listen_statement != '1')
|
||||
{
|
||||
$listen_statement = '0';
|
||||
}
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
|
||||
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
|
||||
if($namevirtualhost_statement != '1')
|
||||
{
|
||||
$namevirtualhost_statement = '0';
|
||||
}
|
||||
|
||||
$ipsandports_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/ipsandports/formfield.ipsandports_edit.php';
|
||||
$ipsandports_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($ipsandports_edit_data);
|
||||
if($vhostcontainer != '1')
|
||||
{
|
||||
$vhostcontainer = '0';
|
||||
}
|
||||
|
||||
$title = $ipsandports_edit_data['ipsandports_edit']['title'];
|
||||
$image = $ipsandports_edit_data['ipsandports_edit']['image'];
|
||||
if($vhostcontainer_servername_statement != '1')
|
||||
{
|
||||
$vhostcontainer_servername_statement = '0';
|
||||
}
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("ipsandports/ipsandports_edit") . "\";");
|
||||
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($result['ip'] != $ip
|
||||
&& $result['ip'] == $settings['system']['ipaddress']
|
||||
&& $result_sameipotherport['id'] == '')
|
||||
{
|
||||
standard_error('cantchangesystemip');
|
||||
}
|
||||
elseif($result_checkfordouble['id'] != ''
|
||||
&& $result_checkfordouble['id'] != $id)
|
||||
{
|
||||
standard_error('myipnotdouble');
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_PANEL_IPSANDPORTS . "` SET `ip`='" . $db->escape($ip) . "', `port`='" . (int)$port . "', `listen_statement`='" . (int)$listen_statement . "', `namevirtualhost_statement`='" . (int)$namevirtualhost_statement . "', `vhostcontainer`='" . (int)$vhostcontainer . "', `vhostcontainer_servername_statement`='" . (int)$vhostcontainer_servername_statement . "', `specialsettings`='" . $db->escape($specialsettings) . "', `ssl`='" . (int)$ssl . "', `ssl_cert_file`='" . $db->escape($ssl_cert_file) . "', `ssl_key_file`='" . $db->escape($ssl_key_file) . "', `ssl_ca_file`='" . $db->escape($ssl_ca_file) . "', `default_vhostconf_domain`='" . $db->escape($default_vhostconf_domain) . "' WHERE `id`='" . (int)$id . "'");
|
||||
$log->logAction(ADM_ACTION, LOG_WARNING, "changed IP/port from '" . $result['ip'] . ":" . $result['port'] . "' to '" . $ip . ":" . $port . "'");
|
||||
inserttask('1');
|
||||
inserttask('4');
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$enable_ssl = makeyesno('ssl', '1', '0', $result['ssl']);
|
||||
$result = htmlentities_array($result);
|
||||
$listen_statement = makeyesno('listen_statement', '1', '0', $result['listen_statement']);
|
||||
$namevirtualhost_statement = makeyesno('namevirtualhost_statement', '1', '0', $result['namevirtualhost_statement']);
|
||||
$vhostcontainer = makeyesno('vhostcontainer', '1', '0', $result['vhostcontainer']);
|
||||
$vhostcontainer_servername_statement = makeyesno('vhostcontainer_servername_statement', '1', '0', $result['vhostcontainer_servername_statement']);
|
||||
eval("echo \"" . getTemplate("ipsandports/ipsandports_edit") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
178
admin_logger.php
@@ -14,44 +14,57 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
|
||||
use Froxlor\Database\Database;
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
if ($page == 'log' && $userinfo['change_serversettings'] == '1') {
|
||||
if ($action == '') {
|
||||
require ("./lib/init.php");
|
||||
|
||||
if($page == 'log'
|
||||
&& $userinfo['change_serversettings'] == '1')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$fields = array(
|
||||
'action' => $lng['logger']['action'],
|
||||
'date' => $lng['logger']['date'],
|
||||
'type' => $lng['logger']['type'],
|
||||
'user' => $lng['logger']['user'],
|
||||
'text' => $lng['logger']['action']
|
||||
'user' => $lng['logger']['user']
|
||||
);
|
||||
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_LOG, $fields, null, null, 0, 'desc', 30);
|
||||
$query = 'SELECT * FROM `' . TABLE_PANEL_LOG . '` ' . $paging->getSqlWhere(false) . ' ' . $paging->getSqlOrderBy();
|
||||
$result_stmt = Database::query($query . ' ' . $paging->getSqlLimit());
|
||||
$result_cnt_stmt = Database::query($query);
|
||||
$logs_count = $result_cnt_stmt->rowCount();
|
||||
$paging->setEntries($logs_count);
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_LOG, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$paging->sortfield = 'date';
|
||||
$paging->sortorder = 'desc';
|
||||
$result = $db->query('SELECT * FROM `' . TABLE_PANEL_LOG . '` ' . $paging->getSqlWhere(false) . ' ' . $paging->getSqlOrderBy() . ' ' . $paging->getSqlLimit());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$clog = array();
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
if (! isset($clog[$row['action']]) || ! is_array($clog[$row['action']])) {
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if(!isset($clog[$row['action']])
|
||||
|| !is_array($clog[$row['action']]))
|
||||
{
|
||||
$clog[$row['action']] = array();
|
||||
}
|
||||
|
||||
$clog[$row['action']][$row['logid']] = $row;
|
||||
}
|
||||
|
||||
if ($paging->sortfield == 'date' && $paging->sortorder == 'desc') {
|
||||
if($paging->sortfield == 'date'
|
||||
&& $paging->sortorder == 'desc')
|
||||
{
|
||||
krsort($clog);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
ksort($clog);
|
||||
}
|
||||
|
||||
@@ -59,73 +72,100 @@ if ($page == 'log' && $userinfo['change_serversettings'] == '1') {
|
||||
$count = 0;
|
||||
$log_count = 0;
|
||||
$log = '';
|
||||
foreach ($clog as $action => $logrows) {
|
||||
foreach($clog as $action => $logrows)
|
||||
{
|
||||
$_action = 0;
|
||||
foreach ($logrows as $row) {
|
||||
// if ($paging->checkDisplay($i)) {
|
||||
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
|
||||
$row['date'] = date("d.m.y H:i:s", $row['date']);
|
||||
foreach($logrows as $row)
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
$row = htmlentities_array($row);
|
||||
$row['date'] = date("d.m.y H:i:s", $row['date']);
|
||||
|
||||
if ($_action != $action) {
|
||||
switch ($action) {
|
||||
case \Froxlor\FroxlorLogger::USR_ACTION:
|
||||
$_action = $lng['admin']['customer'];
|
||||
if($_action != $action)
|
||||
{
|
||||
switch($action)
|
||||
{
|
||||
case USR_ACTION:
|
||||
$_action = $lng['admin']['customer'];
|
||||
break;
|
||||
case RES_ACTION:
|
||||
$_action = 'Reseller';
|
||||
break;
|
||||
case ADM_ACTION:
|
||||
$_action = 'Administrator';
|
||||
break;
|
||||
case CRON_ACTION:
|
||||
$_action = 'Cronjob';
|
||||
break;
|
||||
case LOG_ERROR:
|
||||
$_action = 'Internal';
|
||||
break;
|
||||
default:
|
||||
$_action = 'Unknown';
|
||||
break;
|
||||
}
|
||||
|
||||
$row['action'] = $_action;
|
||||
eval("\$log.=\"" . getTemplate("logger/logger_action") . "\";");
|
||||
}
|
||||
|
||||
$log_count++;
|
||||
$type = $row['type'];
|
||||
$_type = 'unknown';
|
||||
|
||||
switch($type)
|
||||
{
|
||||
case LOG_INFO:
|
||||
$_type = 'Information';
|
||||
break;
|
||||
case \Froxlor\FroxlorLogger::RES_ACTION:
|
||||
$_action = $lng['logger']['reseller'];
|
||||
case LOG_NOTICE:
|
||||
$_type = 'Notice';
|
||||
break;
|
||||
case \Froxlor\FroxlorLogger::ADM_ACTION:
|
||||
$_action = $lng['logger']['admin'];
|
||||
case LOG_WARNING:
|
||||
$_type = 'Warning';
|
||||
break;
|
||||
case \Froxlor\FroxlorLogger::CRON_ACTION:
|
||||
$_action = $lng['logger']['cron'];
|
||||
case LOG_ERR:
|
||||
$_type = 'Error';
|
||||
break;
|
||||
case \Froxlor\FroxlorLogger::LOGIN_ACTION:
|
||||
$_action = $lng['logger']['login'];
|
||||
break;
|
||||
case \Froxlor\FroxlorLogger::LOG_ERROR:
|
||||
$_action = $lng['logger']['intern'];
|
||||
case LOG_CRIT:
|
||||
$_type = 'Critical';
|
||||
break;
|
||||
default:
|
||||
$_action = $lng['logger']['unknown'];
|
||||
$_type = 'Unknown';
|
||||
break;
|
||||
}
|
||||
|
||||
$row['action'] = $_action;
|
||||
eval("\$log.=\"" . \Froxlor\UI\Template::getTemplate('logger/logger_action') . "\";");
|
||||
$row['type'] = $_type;
|
||||
eval("\$log.=\"" . getTemplate("logger/logger_log") . "\";");
|
||||
$count++;
|
||||
$_action = $action;
|
||||
}
|
||||
|
||||
$log_count ++;
|
||||
$row['type'] = \Froxlor\FroxlorLogger::getInstanceOf()->getLogLevelDesc($row['type']);
|
||||
eval("\$log.=\"" . \Froxlor\UI\Template::getTemplate('logger/logger_log') . "\";");
|
||||
$count ++;
|
||||
$_action = $action;
|
||||
// }
|
||||
$i ++;
|
||||
}
|
||||
$i ++;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('logger/logger') . "\";");
|
||||
} elseif ($action == 'truncate') {
|
||||
eval("echo \"" . getTemplate("logger/logger") . "\";");
|
||||
}
|
||||
elseif($action == 'truncate')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$yesterday = time() - (60 * 10);
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$truncatedate = time() - (60 * 10);
|
||||
$trunc_stmt = Database::prepare("
|
||||
DELETE FROM `" . TABLE_PANEL_LOG . "` WHERE `date` < :trunc");
|
||||
Database::pexecute($trunc_stmt, array(
|
||||
'trunc' => $truncatedate
|
||||
));
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, 'truncated the system-log (mysql)');
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
\Froxlor\UI\HTML::askYesNo('logger_reallytruncate', $filename, array(
|
||||
'page' => $page,
|
||||
'action' => $action
|
||||
), TABLE_PANEL_LOG);
|
||||
/* (60*60*24); */
|
||||
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_LOG . "` WHERE `date` < '" . $yesterday . "'");
|
||||
$log->logAction(ADM_ACTION, LOG_WARNING, "truncated the system-log (mysql)");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
ask_yesno('logger_reallytruncate', $filename, array('page' => $page, 'action' => $action), TABLE_PANEL_LOG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -14,114 +14,135 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
|
||||
use Froxlor\Database\Database;
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
if (isset($_POST['id'])) {
|
||||
require ("./lib/init.php");
|
||||
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
} elseif (isset($_GET['id'])) {
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if ($page == 'message') {
|
||||
if ($action == '') {
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'viewed panel_message');
|
||||
if($page == 'message')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed panel_message");
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
if ($_POST['receipient'] == 0 && $userinfo['customers_see_all'] == '1') {
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'sending messages to admins');
|
||||
$result = Database::query('SELECT `name`, `email` FROM `' . TABLE_PANEL_ADMINS . "`");
|
||||
} elseif ($_POST['receipient'] == 1) {
|
||||
if ($userinfo['customers_see_all'] == '1') {
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'sending messages to ALL customers');
|
||||
$result = Database::query('SELECT `firstname`, `name`, `company`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "`");
|
||||
} else {
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, 'sending messages to customers');
|
||||
$result = Database::prepare('
|
||||
SELECT `firstname`, `name`, `company`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "`
|
||||
WHERE `adminid` = :adminid");
|
||||
Database::pexecute($result, array(
|
||||
'adminid' => $userinfo['adminid']
|
||||
));
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
if($_POST['receipient'] == 0
|
||||
&& $userinfo['customers_see_all'] == '1')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "sending messages to admins");
|
||||
$result = $db->query('SELECT `name`, `email` FROM `' . TABLE_PANEL_ADMINS . "`");
|
||||
}
|
||||
elseif($_POST['receipient'] == 1)
|
||||
{
|
||||
if($userinfo['customers_see_all'] == "1")
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "sending messages to ALL customers");
|
||||
$result = $db->query('SELECT `firstname`, `name`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "`");
|
||||
}
|
||||
} else {
|
||||
\Froxlor\UI\Response::standard_error('noreceipientsgiven');
|
||||
else
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "sending messages to customers");
|
||||
$result = $db->query('SELECT `firstname`, `name`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "` WHERE `adminid`='" . $userinfo['adminid'] . "'");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('noreceipientsgiven');
|
||||
}
|
||||
|
||||
$subject = $_POST['subject'];
|
||||
$message = wordwrap($_POST['message'], 70);
|
||||
|
||||
if (! empty($message)) {
|
||||
if(!empty($message))
|
||||
{
|
||||
$mailcounter = 0;
|
||||
$mail->Body = $message;
|
||||
$mail->Subject = $subject;
|
||||
|
||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
$row['firstname'] = isset($row['firstname']) ? $row['firstname'] : '';
|
||||
$row['company'] = isset($row['company']) ? $row['company'] : '';
|
||||
$mail->AddAddress($row['email'], \Froxlor\User::getCorrectUserSalutation(array(
|
||||
'firstname' => $row['firstname'],
|
||||
'name' => $row['name'],
|
||||
'company' => $row['company']
|
||||
)));
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$mail->AddAddress($row['email'], (isset($row['firstname']) ? $row['firstname'] . ' ' : '') . $row['name']);
|
||||
$mail->From = $userinfo['email'];
|
||||
$mail->FromName = (isset($userinfo['firstname']) ? $userinfo['firstname'] . ' ' : '') . $userinfo['name'];
|
||||
|
||||
if (! $mail->Send()) {
|
||||
if ($mail->ErrorInfo != '') {
|
||||
if(!$mail->Send())
|
||||
{
|
||||
if($mail->ErrorInfo != '')
|
||||
{
|
||||
$mailerr_msg = $mail->ErrorInfo;
|
||||
} else {
|
||||
$mailerr_msg = $row['email'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$mailerr_msg = $row["email"];
|
||||
}
|
||||
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_ERR, 'Error sending mail: ' . $mailerr_msg);
|
||||
\Froxlor\UI\Response::standard_error('errorsendingmail', $row['email']);
|
||||
$log->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
|
||||
standard_error('errorsendingmail', $row["email"]);
|
||||
}
|
||||
|
||||
$mailcounter ++;
|
||||
$mailcounter++;
|
||||
$mail->ClearAddresses();
|
||||
}
|
||||
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s,
|
||||
'action' => 'showsuccess',
|
||||
'sentitems' => $mailcounter
|
||||
));
|
||||
} else {
|
||||
\Froxlor\UI\Response::standard_error('nomessagetosend');
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s, 'action' => 'showsuccess', 'sentitems' => $mailcounter));
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('nomessagetosend');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'showsuccess') {
|
||||
|
||||
if($action == 'showsuccess')
|
||||
{
|
||||
$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'];
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$successmessage = str_replace('%s', $sentitems, $lng['message']['success']);
|
||||
}
|
||||
} else {
|
||||
|
||||
$action = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$success = 0;
|
||||
$sentitems = 0;
|
||||
$successmessage = '';
|
||||
$action = '';
|
||||
}
|
||||
|
||||
$action = '';
|
||||
$receipients = '';
|
||||
|
||||
if ($userinfo['customers_see_all'] == '1') {
|
||||
$receipients .= \Froxlor\UI\HTML::makeoption($lng['panel']['reseller'], 0);
|
||||
if($userinfo['customers_see_all'] == "1")
|
||||
{
|
||||
$receipients.= makeoption($lng['panel']['reseller'], 0);
|
||||
}
|
||||
|
||||
$receipients .= \Froxlor\UI\HTML::makeoption($lng['panel']['customer'], 1);
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('message/message') . "\";");
|
||||
$receipients.= makeoption($lng['panel']['customer'], 1);
|
||||
eval("echo \"" . getTemplate("message/message") . "\";");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Janos Muzsi <muzsij@hypernics.hu> (2016)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
* Based on https://github.com/amnuts/opcache-gui
|
||||
*
|
||||
*/
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
|
||||
if ($action == 'reset' && function_exists('opcache_reset') && $userinfo['change_serversettings'] == '1') {
|
||||
opcache_reset();
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "reseted OPcache");
|
||||
header('Location: ' . $linker->getLink(array(
|
||||
'section' => 'opcacheinfo',
|
||||
'page' => 'showinfo'
|
||||
)));
|
||||
exit();
|
||||
}
|
||||
|
||||
if (! function_exists('opcache_get_configuration')) {
|
||||
\Froxlor\UI\Response::standard_error($lng['error']['no_opcacheinfo']);
|
||||
}
|
||||
|
||||
if ($page == 'showinfo') {
|
||||
|
||||
$opcache_info = opcache_get_configuration();
|
||||
$opcache_status = opcache_get_status(false);
|
||||
$time = time();
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed OPcache info");
|
||||
|
||||
$runtimelines = '';
|
||||
if (isset($opcache_info['directives']) && is_array($opcache_info['directives'])) {
|
||||
foreach ($opcache_info['directives'] as $name => $value) {
|
||||
$linkname = str_replace('_', '-', $name);
|
||||
if ($name == 'opcache.optimization_level' && is_integer($value)) {
|
||||
$value = '0x' . dechex($value);
|
||||
}
|
||||
if ($name == 'opcache.memory_consumption' && is_integer($value) && $value % (1024 * 1024) == 0) {
|
||||
$value = $value / (1024 * 1024);
|
||||
}
|
||||
if ($value === null || $value === '') {
|
||||
$value = $lng['opcacheinfo']['novalue'];
|
||||
}
|
||||
if ($value === true) {
|
||||
$value = $lng['opcacheinfo']['true'];
|
||||
}
|
||||
if ($value === false) {
|
||||
$value = $lng['opcacheinfo']['false'];
|
||||
}
|
||||
if (is_integer($value)) {
|
||||
$value = number_format($value, 0, '.', ' ');
|
||||
}
|
||||
$name = str_replace('_', ' ', $name);
|
||||
eval("\$runtimelines.=\"" . \Froxlor\UI\Template::getTemplate("settings/opcacheinfo/runtime_line") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
$cachehits = @$opcache_status['opcache_statistics']['hits'] ?: 0;
|
||||
$cachemiss = @$opcache_status['opcache_statistics']['misses'] ?: 0;
|
||||
$blacklistmiss = @$opcache_status['opcache_statistics']['blacklist_misses'] ?: 0;
|
||||
$cachetotal = $cachehits + $cachemiss + $blacklistmiss;
|
||||
|
||||
$general = array(
|
||||
'version' => (isset($opcache_info['version']['opcache_product_name']) ? $opcache_info['version']['opcache_product_name'] . ' ' : '') . $opcache_info['version']['version'],
|
||||
'phpversion' => phpversion(),
|
||||
'start_time' => @$opcache_status['opcache_statistics']['start_time'] ? date('Y-m-d H:i:s', $opcache_status['opcache_statistics']['start_time']) : '',
|
||||
'last_restart_time' => @$opcache_status['opcache_statistics']['last_restart_time'] ? date('Y-m-d H:i:s', $opcache_status['opcache_statistics']['last_restart_time']) : $lng['opcacheinfo']['never'],
|
||||
'oom_restarts' => number_format(@$opcache_status['opcache_statistics']['oom_restarts'] ?: 0, 0, '.', ' '),
|
||||
'hash_restarts' => number_format(@$opcache_status['opcache_statistics']['hash_restarts'] ?: 0, 0, '.', ' '),
|
||||
'manual_restarts' => number_format(@$opcache_status['opcache_statistics']['manual_restarts'] ?: 0, 0, '.', ' '),
|
||||
'status' => (@$opcache_status['restart_in_progress'] ? $lng['opcacheinfo']['restartinprogress'] : (@$opcache_status['restart_pending'] ? $lng['opcacheinfo']['restartpending'] : (@$opcache_status['cache_full'] ? $lng['opcacheinfo']['cachefull'] : (@$opcache_status['opcache_enabled'] ? $lng['opcacheinfo']['enabled'] : $lng['opcacheinfo']['novalue'])))),
|
||||
'cachedscripts' => number_format(@$opcache_status['opcache_statistics']['num_cached_scripts'] ?: 0, 0, '.', ' '),
|
||||
'cachehits' => number_format($cachehits, 0, '.', ' ') . ($cachetotal > 0 ? sprintf(" (%.1f %%)", $cachehits / ($cachetotal) * 100) : ''),
|
||||
'cachemiss' => number_format($cachemiss, 0, '.', ' ') . ($cachetotal > 0 ? sprintf(" (%.1f %%)", $cachemiss / ($cachetotal) * 100) : ''),
|
||||
'blacklistmiss' => number_format($blacklistmiss, 0, '.', ' ') . ($cachetotal > 0 ? sprintf(" (%.1f %%)", $blacklistmiss / ($cachetotal) * 100) : '')
|
||||
);
|
||||
|
||||
$usedmem = @$opcache_status['memory_usage']['used_memory'] ?: 0;
|
||||
$usedmemstr = bsize($usedmem);
|
||||
$freemem = @$opcache_status['memory_usage']['free_memory'] ?: 0;
|
||||
$freememstr = bsize($freemem);
|
||||
$totalmem = $usedmem + $freemem;
|
||||
$wastedmem = @$opcache_status['memory_usage']['wasted_memory'] ?: 0;
|
||||
$wastedmemstr = bsize($wastedmem);
|
||||
if ($totalmem) {
|
||||
$memory = array(
|
||||
'total' => bsize($totalmem),
|
||||
'used' => $usedmemstr . ($totalmem > 0 ? sprintf(" (%.1f %%)", $usedmem / ($totalmem) * 100) : ''),
|
||||
'free' => $freememstr . ($totalmem > 0 ? sprintf(" (%.1f %%)", $freemem / ($totalmem) * 100) : ''),
|
||||
'wasted' => $wastedmemstr . ($totalmem > 0 ? sprintf(" (%.1f %%)", $wastedmem / ($totalmem) * 100) : '')
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($opcache_status['interned_strings_usage'])) {
|
||||
$usedstring = @$opcache_status['interned_strings_usage']['used_memory'] ?: 0;
|
||||
$usedstringstr = bsize($usedstring);
|
||||
$freestring = @$opcache_status['interned_strings_usage']['free_memory'] ?: 0;
|
||||
$freestringstr = bsize($freestring);
|
||||
$totalstring = $usedstring + $freestring;
|
||||
$stringbuffer = array(
|
||||
'total' => bsize($totalstring),
|
||||
'used' => $usedstringstr . ($totalstring > 0 ? sprintf(" (%.1f %%)", $usedstring / $totalstring * 100) : ''),
|
||||
'free' => $freestringstr . ($totalstring > 0 ? sprintf(" (%.1f %%)", $freestring / $totalstring * 100) : ''),
|
||||
'strcount' => number_format(@$opcache_status['interned_strings_usage']['number_of_strings'] ?: 0, 0, '.', ' ')
|
||||
);
|
||||
}
|
||||
|
||||
$usedkey = @$opcache_status['opcache_statistics']['num_cached_keys'] ?: 0;
|
||||
$usedkeystr = number_format($usedkey, 0, '.', ' ');
|
||||
$totalkey = @$opcache_status['opcache_statistics']['max_cached_keys'] ?: 0;
|
||||
$wastedkey = $usedkey - (@$opcache_status['opcache_statistics']['num_cached_scripts'] ?: 0);
|
||||
if (isset($opcache_status['opcache_statistics'])) {
|
||||
$keystat = array(
|
||||
'total' => number_format($totalkey, 0, '.', ' '),
|
||||
'used' => $usedkeystr . ($totalkey > 0 ? sprintf(" (%.1f %%)", $usedkey / ($totalkey) * 100) : ''),
|
||||
'wasted' => number_format($wastedkey, 0, '.', ' ') . ($totalkey > 0 ? sprintf(" (%.1f %%)", $wastedkey / ($totalkey) * 100) : '')
|
||||
);
|
||||
}
|
||||
|
||||
$blacklistlines = '';
|
||||
if (isset($opcache_info['blacklist']) && is_array($opcache_info['blacklist'])) {
|
||||
foreach ($opcache_info['blacklist'] as $value) {
|
||||
eval("\$blacklistlines.=\"" . \Froxlor\UI\Template::getTemplate("settings/opcacheinfo/blacklist_line") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/opcacheinfo/showinfo") . "\";");
|
||||
}
|
||||
|
||||
function bsize($s)
|
||||
{
|
||||
foreach (array(
|
||||
'',
|
||||
'K',
|
||||
'M',
|
||||
'G'
|
||||
) as $i => $k) {
|
||||
if ($s < 1024)
|
||||
break;
|
||||
$s /= 1024;
|
||||
}
|
||||
return sprintf("%5.1f %sBytes", $s, $k);
|
||||
}
|
||||
@@ -14,321 +14,172 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Api\Commands\PhpSettings as PhpSettings;
|
||||
use Froxlor\Api\Commands\FpmDaemons as FpmDaemons;
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
if (isset($_POST['id'])) {
|
||||
require ("./lib/init.php");
|
||||
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
} elseif (isset($_GET['id'])) {
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if ($page == 'overview') {
|
||||
|
||||
if ($action == '') {
|
||||
|
||||
try {
|
||||
$json_result = PhpSettings::getLocal($userinfo, array(
|
||||
'with_subdomains' => true
|
||||
))->listing();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
|
||||
if($page == 'overview')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$tablecontent = '';
|
||||
$count = 0;
|
||||
if (isset($result['count']) && $result['count'] > 0) {
|
||||
foreach ($result['list'] as $row) {
|
||||
if (isset($row['is_default']) && $row['is_default'] == true) {
|
||||
$row['description'] = "<b>" . $row['description'] . "</b>";
|
||||
}
|
||||
$domains = "";
|
||||
$subdomains_count = count($row['subdomains']);
|
||||
foreach ($row['domains'] as $configdomain) {
|
||||
$domains .= $configdomain . "<br>";
|
||||
}
|
||||
$count ++;
|
||||
if ($subdomains_count == 0 && empty($domains)) {
|
||||
$domains = $lng['admin']['phpsettings']['notused'];
|
||||
}
|
||||
eval("\$tablecontent.=\"" . \Froxlor\UI\Template::getTemplate("phpconfig/overview_overview") . "\";");
|
||||
}
|
||||
}
|
||||
$result = $db->query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "`");
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/overview") . "\";");
|
||||
}
|
||||
|
||||
if ($action == 'add') {
|
||||
|
||||
if ((int) $userinfo['change_serversettings'] == 1) {
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
try {
|
||||
PhpSettings::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 {
|
||||
|
||||
$result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = 1");
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
$fpmconfigs = '';
|
||||
$configs = Database::query("SELECT * FROM `" . TABLE_PANEL_FPMDAEMONS . "` ORDER BY `description` ASC");
|
||||
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
|
||||
$fpmconfigs .= \Froxlor\UI\HTML::makeoption($row['description'], $row['id'], 1, true, true);
|
||||
}
|
||||
|
||||
$pm_select = \Froxlor\UI\HTML::makeoption('static', 'static', 'static', true, true);
|
||||
$pm_select .= \Froxlor\UI\HTML::makeoption('dynamic', 'dynamic', 'static', true, true);
|
||||
$pm_select .= \Froxlor\UI\HTML::makeoption('ondemand', 'ondemand', 'static', true, true);
|
||||
|
||||
$phpconfig_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php';
|
||||
$phpconfig_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($phpconfig_add_data);
|
||||
|
||||
$title = $phpconfig_add_data['phpconfig_add']['title'];
|
||||
$image = $phpconfig_add_data['phpconfig_add']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/overview_add") . "\";");
|
||||
}
|
||||
} else {
|
||||
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'delete') {
|
||||
|
||||
try {
|
||||
$json_result = PhpSettings::getLocal($userinfo, array(
|
||||
'id' => $id
|
||||
))->get();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
|
||||
if ($result['id'] != 0 && $result['id'] == $id && (int) $userinfo['change_serversettings'] == 1 && $id != 1) // cannot delete the default php.config
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$domainresult = false;
|
||||
|
||||
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 {
|
||||
\Froxlor\UI\HTML::askYesNo('phpsetting_reallydelete', $filename, array(
|
||||
'id' => $id,
|
||||
'page' => $page,
|
||||
'action' => $action
|
||||
), $result['description']);
|
||||
if((int)$userinfo['domains_see_all'] == 0)
|
||||
{
|
||||
$domainresult = $db->query("SELECT * FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `adminid` = " . (int)$userinfo['userid'] . " AND `phpsettingid` = " . (int)$row['id']);
|
||||
}
|
||||
} else {
|
||||
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
|
||||
else
|
||||
{
|
||||
$domainresult = $db->query("SELECT * FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `phpsettingid` = " . (int)$row['id']);
|
||||
}
|
||||
|
||||
$domains = '';
|
||||
|
||||
if($db->num_rows($domainresult) > 0)
|
||||
{
|
||||
while($row2 = $db->fetch_array($domainresult))
|
||||
{
|
||||
$domains.= $row2['domain'] . '<br/>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$domains = $lng['admin']['phpsettings']['notused'];
|
||||
}
|
||||
|
||||
eval("\$tablecontent.=\"" . getTemplate("phpconfig/overview_overview") . "\";");
|
||||
}
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting overview has been viewed by '" . $userinfo['loginname'] . "'");
|
||||
eval("echo \"" . getTemplate("phpconfig/overview") . "\";");
|
||||
}
|
||||
|
||||
if ($action == 'edit') {
|
||||
|
||||
try {
|
||||
$json_result = PhpSettings::getLocal($userinfo, array(
|
||||
'id' => $id
|
||||
))->get();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
|
||||
if ($result['id'] != 0 && $result['id'] == $id && (int) $userinfo['change_serversettings'] == 1) {
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
try {
|
||||
PhpSettings::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 {
|
||||
|
||||
$fpmconfigs = '';
|
||||
$configs = Database::query("SELECT * FROM `" . TABLE_PANEL_FPMDAEMONS . "` ORDER BY `description` ASC");
|
||||
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
|
||||
$fpmconfigs .= \Froxlor\UI\HTML::makeoption($row['description'], $row['id'], $result['fpmsettingid'], true, true);
|
||||
}
|
||||
|
||||
$pm_select = \Froxlor\UI\HTML::makeoption('static', 'static', $result['pm'], true, true);
|
||||
$pm_select .= \Froxlor\UI\HTML::makeoption('dynamic', 'dynamic', $result['pm'], true, true);
|
||||
$pm_select .= \Froxlor\UI\HTML::makeoption('ondemand', 'ondemand', $result['pm'], true, true);
|
||||
|
||||
$phpconfig_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php';
|
||||
$phpconfig_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($phpconfig_edit_data);
|
||||
|
||||
$title = $phpconfig_edit_data['phpconfig_edit']['title'];
|
||||
$image = $phpconfig_edit_data['phpconfig_edit']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/overview_edit") . "\";");
|
||||
}
|
||||
} else {
|
||||
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
|
||||
}
|
||||
}
|
||||
} elseif ($page == 'fpmdaemons') {
|
||||
|
||||
if ($action == '') {
|
||||
|
||||
try {
|
||||
$json_result = FpmDaemons::getLocal($userinfo)->listing();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
|
||||
$tablecontent = '';
|
||||
$count = 0;
|
||||
if (isset($result['count']) && $result['count'] > 0) {
|
||||
foreach ($result['list'] as $row) {
|
||||
$configs = "";
|
||||
foreach ($row['configs'] as $configused) {
|
||||
$configs .= $configused . "<br>";
|
||||
}
|
||||
$count ++;
|
||||
eval("\$tablecontent.=\"" . \Froxlor\UI\Template::getTemplate("phpconfig/fpmdaemons_overview") . "\";");
|
||||
}
|
||||
}
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/fpmdaemons") . "\";");
|
||||
}
|
||||
|
||||
if ($action == 'add') {
|
||||
|
||||
if ((int) $userinfo['change_serversettings'] == 1) {
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
try {
|
||||
FpmDaemons::getLocal($userinfo, $_POST)->add();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
|
||||
$pm_select = \Froxlor\UI\HTML::makeoption('static', 'static', 'static', true, true);
|
||||
$pm_select .= \Froxlor\UI\HTML::makeoption('dynamic', 'dynamic', 'static', true, true);
|
||||
$pm_select .= \Froxlor\UI\HTML::makeoption('ondemand', 'ondemand', 'static', true, true);
|
||||
|
||||
$fpmconfig_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.fpmconfig_add.php';
|
||||
$fpmconfig_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($fpmconfig_add_data);
|
||||
|
||||
$title = $fpmconfig_add_data['fpmconfig_add']['title'];
|
||||
$image = $fpmconfig_add_data['fpmconfig_add']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/fpmconfig_add") . "\";");
|
||||
}
|
||||
} else {
|
||||
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'delete') {
|
||||
|
||||
try {
|
||||
$json_result = FpmDaemons::getLocal($userinfo, array(
|
||||
'id' => $id
|
||||
))->get();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
|
||||
if ($id == 1) {
|
||||
\Froxlor\UI\Response::standard_error('cannotdeletedefaultphpconfig');
|
||||
}
|
||||
|
||||
if ($result['id'] != 0 && $result['id'] == $id && (int) $userinfo['change_serversettings'] == 1 && $id != 1) // cannot delete the default php.config
|
||||
if($action == 'add')
|
||||
{
|
||||
if((int)$userinfo['change_serversettings'] == 1)
|
||||
{
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
try {
|
||||
FpmDaemons::getLocal($userinfo, $_POST)->delete();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$description = validate($_POST['description'], 'description');
|
||||
$binary = makeCorrectFile(validate($_POST['binary'], 'binary'));
|
||||
$file_extensions = validate($_POST['file_extensions'], 'file_extensions', '/^[a-zA-Z0-9\s]*$/');
|
||||
$phpsettings = validate(str_replace("\r\n", "\n", $_POST['phpsettings']), 'phpsettings', '/^[^\0]*$/');
|
||||
$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', ''));
|
||||
|
||||
if(strlen($description) == 0
|
||||
|| strlen($description) > 50)
|
||||
{
|
||||
standard_error('descriptioninvalid');
|
||||
}
|
||||
\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']);
|
||||
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_PHPCONFIGS . "` SET `description` = '" . $db->escape($description) . "', `binary` = '" . $db->escape($binary) . "', `file_extensions` = '" . $db->escape($file_extensions) . "', `mod_fcgid_starter` = '" . $db->escape($mod_fcgid_starter) . "', `mod_fcgid_maxrequests` = '" . $db->escape($mod_fcgid_maxrequests) . "', `phpsettings` = '" . $db->escape($phpsettings) . "'");
|
||||
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 {
|
||||
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
|
||||
else
|
||||
{
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = 1");
|
||||
eval("echo \"" . getTemplate("phpconfig/overview_add") . "\";");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('nopermissionsorinvalidid');
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'edit') {
|
||||
if($action == 'delete')
|
||||
{
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = " . (int)$id);
|
||||
|
||||
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") . "\";");
|
||||
if($result['id'] != 0
|
||||
&& $result['id'] == $id
|
||||
&& (int)$userinfo['change_serversettings'] == 1
|
||||
&& $id != 1)
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `phpsettingid` = 1 WHERE `phpsettingid` = " . (int)$id);
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = " . (int)$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));
|
||||
}
|
||||
} else {
|
||||
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
|
||||
else
|
||||
{
|
||||
ask_yesno('phpsetting_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['description']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('nopermissionsorinvalidid');
|
||||
}
|
||||
}
|
||||
|
||||
if($action == 'edit')
|
||||
{
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = " . (int)$id);
|
||||
|
||||
if($result['id'] != 0
|
||||
&& $result['id'] == $id
|
||||
&& (int)$userinfo['change_serversettings'] == 1)
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$description = validate($_POST['description'], 'description');
|
||||
$binary = makeCorrectFile(validate($_POST['binary'], 'binary'));
|
||||
$file_extensions = validate($_POST['file_extensions'], 'file_extensions', '/^[a-zA-Z0-9\s]*$/');
|
||||
$phpsettings = validate(str_replace("\r\n", "\n", $_POST['phpsettings']), 'phpsettings', '/^[^\0]*$/');
|
||||
$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', ''));
|
||||
|
||||
if(strlen($description) == 0
|
||||
|| strlen($description) > 50)
|
||||
{
|
||||
standard_error('descriptioninvalid');
|
||||
}
|
||||
|
||||
$db->query("UPDATE `" . TABLE_PANEL_PHPCONFIGS . "` SET `description` = '" . $db->escape($description) . "', `binary` = '" . $db->escape($binary) . "', `file_extensions` = '" . $db->escape($file_extensions) . "', `mod_fcgid_starter` = '" . $db->escape($mod_fcgid_starter) . "', `mod_fcgid_maxrequests` = '" . $db->escape($mod_fcgid_maxrequests) . "', `phpsettings` = '" . $db->escape($phpsettings) . "' WHERE `id` = " . (int)$id);
|
||||
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
|
||||
{
|
||||
eval("echo \"" . getTemplate("phpconfig/overview_edit") . "\";");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('nopermissionsorinvalidid');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
325
admin_plans.php
@@ -1,325 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
*/
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
|
||||
use Froxlor\Api\Commands\HostingPlans;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
if (isset($_POST['id'])) {
|
||||
$id = intval($_POST['id']);
|
||||
} elseif (isset($_GET['id'])) {
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if ($page == '' || $page == 'overview') {
|
||||
|
||||
if ($action == '') {
|
||||
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_plans");
|
||||
$fields = array(
|
||||
'p.name' => $lng['admin']['plans']['name'],
|
||||
'p.description' => $lng['admin']['plans']['description'],
|
||||
'adminname' => $lng['admin']['admin'],
|
||||
'p.ts' => $lng['admin']['plans']['last_update']
|
||||
);
|
||||
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_PLANS, $fields);
|
||||
$plans = '';
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT p.*, a.loginname as adminname
|
||||
FROM `" . TABLE_PANEL_PLANS . "` p, `" . TABLE_PANEL_ADMINS . "` a
|
||||
WHERE " . ($userinfo['customers_see_all'] ? '' : " `p`.`adminid` = :adminid AND ") . "
|
||||
`p`.`adminid` = `a`.`adminid` " . $paging->getSqlWhere(false) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
Database::pexecute($result_stmt, array(
|
||||
'adminid' => $userinfo['adminid']
|
||||
));
|
||||
$paging->setEntries(Database::num_rows());
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$i = 0;
|
||||
$count = 0;
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
if ($paging->checkDisplay($i)) {
|
||||
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
|
||||
$row['ts_format'] = date("d.m.Y H:i", $row['ts']);
|
||||
eval("\$plans.=\"" . \Froxlor\UI\Template::getTemplate("plans/plans_plan") . "\";");
|
||||
$count ++;
|
||||
}
|
||||
$i ++;
|
||||
}
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("plans/plans") . "\";");
|
||||
} elseif ($action == 'delete' && $id != 0) {
|
||||
|
||||
try {
|
||||
$json_result = HostingPlans::getLocal($userinfo, array(
|
||||
'id' => $id
|
||||
))->get();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
|
||||
if ($result['id'] != 0 && $result['id'] == $id && (int) $userinfo['adminid'] == $result['adminid']) {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
|
||||
try {
|
||||
HostingPlans::getLocal($userinfo, array(
|
||||
'id' => $id
|
||||
))->delete();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
\Froxlor\UI\HTML::askYesNo('plan_reallydelete', $filename, array(
|
||||
'id' => $id,
|
||||
'page' => $page,
|
||||
'action' => $action
|
||||
), $result['name']);
|
||||
}
|
||||
} else {
|
||||
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
|
||||
}
|
||||
} elseif ($action == 'add') {
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
try {
|
||||
HostingPlans::getLocal($userinfo, $_POST)->add();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
|
||||
$diskspace_ul = \Froxlor\UI\HTML::makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$traffic_ul = \Froxlor\UI\HTML::makecheckbox('traffic_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$subdomains_ul = \Froxlor\UI\HTML::makecheckbox('subdomains_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$emails_ul = \Froxlor\UI\HTML::makecheckbox('emails_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$email_accounts_ul = \Froxlor\UI\HTML::makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$email_forwarders_ul = \Froxlor\UI\HTML::makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$email_quota_ul = \Froxlor\UI\HTML::makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$ftps_ul = \Froxlor\UI\HTML::makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
$mysqls_ul = \Froxlor\UI\HTML::makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
|
||||
|
||||
$phpconfigs = array();
|
||||
$configs = Database::query("
|
||||
SELECT c.*, fc.description as interpreter
|
||||
FROM `" . TABLE_PANEL_PHPCONFIGS . "` c
|
||||
LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fc ON fc.id = c.fpmsettingid
|
||||
");
|
||||
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
|
||||
if ((int) Settings::Get('phpfpm.enabled') == 1) {
|
||||
$phpconfigs[] = array(
|
||||
'label' => $row['description'] . " [" . $row['interpreter'] . "]<br />",
|
||||
'value' => $row['id']
|
||||
);
|
||||
} else {
|
||||
$phpconfigs[] = array(
|
||||
'label' => $row['description'] . "<br />",
|
||||
'value' => $row['id']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// dummy to avoid unknown variables
|
||||
$language_options = null;
|
||||
$gender_options = null;
|
||||
$hosting_plans = null;
|
||||
|
||||
$plans_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/plans/formfield.plans_add.php';
|
||||
$cust_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_add.php';
|
||||
// unset unneeded stuff
|
||||
unset($cust_add_data['customer_add']['sections']['section_a']);
|
||||
unset($cust_add_data['customer_add']['sections']['section_b']);
|
||||
unset($cust_add_data['customer_add']['sections']['section_cpre']);
|
||||
// merge
|
||||
$plans_add_data['plans_add']['sections'] = array_merge($plans_add_data['plans_add']['sections'], $cust_add_data['customer_add']['sections']);
|
||||
$plans_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($plans_add_data);
|
||||
|
||||
$title = $plans_add_data['plans_add']['title'];
|
||||
$image = $plans_add_data['plans_add']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("plans/plans_add") . "\";");
|
||||
}
|
||||
} elseif ($action == 'edit' && $id != 0) {
|
||||
try {
|
||||
$json_result = HostingPlans::getLocal($userinfo, array(
|
||||
'id' => $id
|
||||
))->get();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
|
||||
if ($result['name'] != '') {
|
||||
|
||||
$result['value'] = json_decode($result['value'], true);
|
||||
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
|
||||
|
||||
foreach ($result['value'] as $index => $value) {
|
||||
$result[$index] = $value;
|
||||
}
|
||||
$result['allowed_phpconfigs'] = json_encode($result['allowed_phpconfigs']);
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
|
||||
try {
|
||||
HostingPlans::getLocal($userinfo, array(
|
||||
'id' => $id
|
||||
))->update();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
|
||||
$diskspace_ul = \Froxlor\UI\HTML::makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, $result['diskspace'], true, true);
|
||||
if ($result['diskspace'] == '-1') {
|
||||
$result['diskspace'] = '';
|
||||
}
|
||||
|
||||
$traffic_ul = \Froxlor\UI\HTML::makecheckbox('traffic_ul', $lng['customer']['unlimited'], '-1', false, $result['traffic'], true, true);
|
||||
if ($result['traffic'] == '-1') {
|
||||
$result['traffic'] = '';
|
||||
}
|
||||
|
||||
$subdomains_ul = \Froxlor\UI\HTML::makecheckbox('subdomains_ul', $lng['customer']['unlimited'], '-1', false, $result['subdomains'], true, true);
|
||||
if ($result['subdomains'] == '-1') {
|
||||
$result['subdomains'] = '';
|
||||
}
|
||||
|
||||
$emails_ul = \Froxlor\UI\HTML::makecheckbox('emails_ul', $lng['customer']['unlimited'], '-1', false, $result['emails'], true, true);
|
||||
if ($result['emails'] == '-1') {
|
||||
$result['emails'] = '';
|
||||
}
|
||||
|
||||
$email_accounts_ul = \Froxlor\UI\HTML::makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, $result['email_accounts'], true, true);
|
||||
if ($result['email_accounts'] == '-1') {
|
||||
$result['email_accounts'] = '';
|
||||
}
|
||||
|
||||
$email_forwarders_ul = \Froxlor\UI\HTML::makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, $result['email_forwarders'], true, true);
|
||||
if ($result['email_forwarders'] == '-1') {
|
||||
$result['email_forwarders'] = '';
|
||||
}
|
||||
|
||||
$email_quota_ul = \Froxlor\UI\HTML::makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, $result['email_quota'], true, true);
|
||||
if ($result['email_quota'] == '-1') {
|
||||
$result['email_quota'] = '';
|
||||
}
|
||||
|
||||
$ftps_ul = \Froxlor\UI\HTML::makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, $result['ftps'], true, true);
|
||||
if ($result['ftps'] == '-1') {
|
||||
$result['ftps'] = '';
|
||||
}
|
||||
|
||||
$mysqls_ul = \Froxlor\UI\HTML::makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, $result['mysqls'], true, true);
|
||||
if ($result['mysqls'] == '-1') {
|
||||
$result['mysqls'] = '';
|
||||
}
|
||||
|
||||
$phpconfigs = array();
|
||||
$configs = Database::query("
|
||||
SELECT c.*, fc.description as interpreter
|
||||
FROM `" . TABLE_PANEL_PHPCONFIGS . "` c
|
||||
LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fc ON fc.id = c.fpmsettingid
|
||||
");
|
||||
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
|
||||
if ((int) Settings::Get('phpfpm.enabled') == 1) {
|
||||
$phpconfigs[] = array(
|
||||
'label' => $row['description'] . " [" . $row['interpreter'] . "]<br />",
|
||||
'value' => $row['id']
|
||||
);
|
||||
} else {
|
||||
$phpconfigs[] = array(
|
||||
'label' => $row['description'] . "<br />",
|
||||
'value' => $row['id']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$result['imap'] = $result['email_imap'];
|
||||
$result['pop3'] = $result['email_pop3'];
|
||||
|
||||
// dummy to avoid unknown variables
|
||||
$result['loginname'] = null;
|
||||
$result['documentroot'] = null;
|
||||
$result['standardsubdomain'] = null;
|
||||
$result['deactivated'] = null;
|
||||
$language_options = null;
|
||||
$result['firstname'] = null;
|
||||
$gender_options = null;
|
||||
$result['company'] = null;
|
||||
$result['street'] = null;
|
||||
$result['zipcode'] = null;
|
||||
$result['city'] = null;
|
||||
$result['phone'] = null;
|
||||
$result['fax'] = null;
|
||||
$result['email'] = null;
|
||||
$result['customernumber'] = null;
|
||||
$result['custom_notes'] = null;
|
||||
$result['custom_notes_show'] = null;
|
||||
$hosting_plans = null;
|
||||
$admin_select_cnt = null;
|
||||
$admin_select = null;
|
||||
|
||||
$plans_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/plans/formfield.plans_edit.php';
|
||||
$cust_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_edit.php';
|
||||
// unset unneeded stuff
|
||||
unset($cust_edit_data['customer_edit']['sections']['section_a']);
|
||||
unset($cust_edit_data['customer_edit']['sections']['section_b']);
|
||||
unset($cust_edit_data['customer_edit']['sections']['section_cpre']);
|
||||
// merge
|
||||
$plans_edit_data['plans_edit']['sections'] = array_merge($plans_edit_data['plans_edit']['sections'], $cust_edit_data['customer_edit']['sections']);
|
||||
$plans_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($plans_edit_data);
|
||||
|
||||
$title = $plans_edit_data['plans_edit']['title'];
|
||||
$image = $plans_edit_data['plans_edit']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("plans/plans_edit") . "\";");
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'jqGetPlanValues') {
|
||||
$planid = isset($_POST['planid']) ? (int) $_POST['planid'] : 0;
|
||||
try {
|
||||
$json_result = HostingPlans::getLocal($userinfo, array(
|
||||
'id' => $planid
|
||||
))->get();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
echo $result['value'];
|
||||
exit();
|
||||
}
|
||||
}
|
||||
@@ -14,371 +14,206 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\Api\Commands\Froxlor;
|
||||
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
|
||||
// get sql-root access data
|
||||
Database::needRoot(true);
|
||||
Database::needSqlData();
|
||||
$sql_root = Database::getSqlData();
|
||||
Database::needRoot(false);
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
|
||||
$settings_data = \Froxlor\PhpHelper::loadConfigArrayDir('./actions/admin/settings/');
|
||||
Settings::loadSettingsInto($settings_data);
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$need_db_sql_data = true;
|
||||
$need_root_db_sql_data = true;
|
||||
require ("./lib/init.php");
|
||||
|
||||
if(($page == 'settings' || $page == 'overview')
|
||||
&& $userinfo['change_serversettings'] == '1')
|
||||
{
|
||||
$settings_data = loadConfigArrayDir('./actions/admin/settings/');
|
||||
$settings = loadSettings($settings_data, $db);
|
||||
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$_part = isset($_GET['part']) ? $_GET['part'] : '';
|
||||
if ($_part == '') {
|
||||
|
||||
if($_part == '')
|
||||
{
|
||||
$_part = isset($_POST['part']) ? $_POST['part'] : '';
|
||||
}
|
||||
|
||||
if ($_part != '') {
|
||||
if ($_part == 'all') {
|
||||
if($_part != '')
|
||||
{
|
||||
if($_part == 'all')
|
||||
{
|
||||
$settings_all = true;
|
||||
$settings_part = false;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$settings_all = false;
|
||||
$settings_part = true;
|
||||
}
|
||||
|
||||
$only_enabledisable = false;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$settings_all = false;
|
||||
$settings_part = false;
|
||||
$only_enabledisable = true;
|
||||
}
|
||||
|
||||
// check if the session timeout is too low #815
|
||||
if (isset($_POST['session_sessiontimeout']) && $_POST['session_sessiontimeout'] < 60) {
|
||||
\Froxlor\UI\Response::standard_error($lng['error']['session_timeout'], $lng['error']['session_timeout_desc']);
|
||||
|
||||
if(processFormEx(
|
||||
$settings_data,
|
||||
$_POST,
|
||||
array('filename' => $filename, 'action' => $action, 'page' => $page),
|
||||
$_part,
|
||||
$settings_all,
|
||||
$settings_part,
|
||||
$only_enabledisable
|
||||
)
|
||||
) {
|
||||
standard_success('settingssaved', '', array('filename' => $filename, 'action' => $action, 'page' => $page));
|
||||
}
|
||||
|
||||
if (\Froxlor\UI\Form::processFormEx($settings_data, $_POST, array(
|
||||
'filename' => $filename,
|
||||
'action' => $action,
|
||||
'page' => $page
|
||||
), $_part, $settings_all, $settings_part, $only_enabledisable)) {
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "rebuild configfiles due to changed setting");
|
||||
\Froxlor\System\Cronjob::inserttask('1');
|
||||
// Using nameserver, insert a task which rebuilds the server config
|
||||
\Froxlor\System\Cronjob::inserttask('4');
|
||||
// cron.d file
|
||||
\Froxlor\System\Cronjob::inserttask('99');
|
||||
|
||||
\Froxlor\UI\Response::standard_success('settingssaved', '', array(
|
||||
'filename' => $filename,
|
||||
'action' => $action,
|
||||
'page' => $page
|
||||
));
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$_part = isset($_GET['part']) ? $_GET['part'] : '';
|
||||
if ($_part == '') {
|
||||
|
||||
if($_part == '')
|
||||
{
|
||||
$_part = isset($_POST['part']) ? $_POST['part'] : '';
|
||||
}
|
||||
|
||||
$fields = \Froxlor\UI\Form::buildFormEx($settings_data, $_part);
|
||||
|
||||
$fields = buildFormEx($settings_data, $_part);
|
||||
|
||||
$settings_page = '';
|
||||
if ($_part == '') {
|
||||
eval("\$settings_page .= \"" . \Froxlor\UI\Template::getTemplate("settings/settings_overview") . "\";");
|
||||
} else {
|
||||
eval("\$settings_page .= \"" . \Froxlor\UI\Template::getTemplate("settings/settings") . "\";");
|
||||
if($_part == '')
|
||||
{
|
||||
eval("\$settings_page .= \"" . getTemplate("settings/settings_overview") . "\";");
|
||||
}
|
||||
else
|
||||
{
|
||||
eval("\$settings_page .= \"" . getTemplate("settings/settings") . "\";");
|
||||
}
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/settings_form_begin") . "\";");
|
||||
|
||||
eval("echo \"" . getTemplate("settings/settings_form_begin") . "\";");
|
||||
eval("echo \$settings_page;");
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/settings_form_end") . "\";");
|
||||
eval("echo \"" . getTemplate("settings/settings_form_end") . "\";");
|
||||
|
||||
}
|
||||
} elseif ($page == 'phpinfo' && $userinfo['change_serversettings'] == '1') {
|
||||
ob_start();
|
||||
phpinfo();
|
||||
$phpinfo = array(
|
||||
'phpinfo' => array()
|
||||
);
|
||||
if (preg_match_all('#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>)?)?</tr>)#s', ob_get_clean(), $matches, PREG_SET_ORDER)) {
|
||||
foreach ($matches as $match) {
|
||||
$end = array_keys($phpinfo);
|
||||
$end = end($end);
|
||||
if (strlen($match[1])) {
|
||||
$phpinfo[$match[1]] = array();
|
||||
} elseif (isset($match[3])) {
|
||||
$phpinfo[$end][$match[2]] = isset($match[4]) ? array(
|
||||
$match[3],
|
||||
$match[4]
|
||||
) : $match[3];
|
||||
} else {
|
||||
$phpinfo[$end][] = $match[2];
|
||||
}
|
||||
}
|
||||
$phpinfohtml = '';
|
||||
foreach ($phpinfo as $name => $section) {
|
||||
$phpinfoentries = "";
|
||||
foreach ($section as $key => $val) {
|
||||
if (is_array($val)) {
|
||||
eval("\$phpinfoentries .= \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo/phpinfo_3") . "\";");
|
||||
} elseif (is_string($key)) {
|
||||
eval("\$phpinfoentries .= \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo/phpinfo_2") . "\";");
|
||||
} else {
|
||||
eval("\$phpinfoentries .= \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo/phpinfo_1") . "\";");
|
||||
}
|
||||
}
|
||||
// first header -> show actual php version
|
||||
if (strtolower($name) == "phpinfo") {
|
||||
$name = "PHP " . PHP_VERSION;
|
||||
}
|
||||
eval("\$phpinfohtml .= \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo/phpinfo_table") . "\";");
|
||||
}
|
||||
$phpinfo = $phpinfohtml;
|
||||
} else {
|
||||
\Froxlor\UI\Response::standard_error($lng['error']['no_phpinfo']);
|
||||
}
|
||||
elseif($page == 'rebuildconfigs'
|
||||
&& $userinfo['change_serversettings'] == '1')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "rebuild configfiles");
|
||||
inserttask('1');
|
||||
inserttask('4');
|
||||
inserttask('5');
|
||||
redirectTo('admin_index.php', array('s' => $s));
|
||||
}
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo") . "\";");
|
||||
} elseif ($page == 'rebuildconfigs' && $userinfo['change_serversettings'] == '1') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "rebuild configfiles");
|
||||
\Froxlor\System\Cronjob::inserttask('1');
|
||||
\Froxlor\System\Cronjob::inserttask('10');
|
||||
// Using nameserver, insert a task which rebuilds the server config
|
||||
\Froxlor\System\Cronjob::inserttask('4');
|
||||
// cron.d file
|
||||
\Froxlor\System\Cronjob::inserttask('99');
|
||||
|
||||
\Froxlor\UI\Response::standard_success('rebuildingconfigs', '', array(
|
||||
'filename' => 'admin_index.php'
|
||||
));
|
||||
} else {
|
||||
\Froxlor\UI\HTML::askYesNo('admin_configs_reallyrebuild', $filename, array(
|
||||
'page' => $page
|
||||
));
|
||||
else
|
||||
{
|
||||
ask_yesno('admin_configs_reallyrebuild', $filename, array('page' => $page));
|
||||
}
|
||||
} elseif ($page == 'updatecounters' && $userinfo['change_serversettings'] == '1') {
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "updated resource-counters");
|
||||
$updatecounters = \Froxlor\User::updateCounters(true);
|
||||
}
|
||||
elseif($page == 'updatecounters'
|
||||
&& $userinfo['change_serversettings'] == '1')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "updated resource-counters");
|
||||
$updatecounters = updateCounters(true);
|
||||
$customers = '';
|
||||
foreach ($updatecounters['customers'] as $customerid => $customer) {
|
||||
eval("\$customers.=\"" . \Froxlor\UI\Template::getTemplate("settings/updatecounters_row_customer") . "\";");
|
||||
foreach($updatecounters['customers'] as $customerid => $customer)
|
||||
{
|
||||
eval("\$customers.=\"" . getTemplate("settings/updatecounters_row_customer") . "\";");
|
||||
}
|
||||
|
||||
$admins = '';
|
||||
foreach ($updatecounters['admins'] as $adminid => $admin) {
|
||||
eval("\$admins.=\"" . \Froxlor\UI\Template::getTemplate("settings/updatecounters_row_admin") . "\";");
|
||||
foreach($updatecounters['admins'] as $adminid => $admin)
|
||||
{
|
||||
eval("\$admins.=\"" . getTemplate("settings/updatecounters_row_admin") . "\";");
|
||||
}
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/updatecounters") . "\";");
|
||||
} else {
|
||||
\Froxlor\UI\HTML::askYesNo('admin_counters_reallyupdate', $filename, array(
|
||||
'page' => $page
|
||||
));
|
||||
eval("echo \"" . getTemplate("settings/updatecounters") . "\";");
|
||||
}
|
||||
} elseif ($page == 'wipecleartextmailpws' && $userinfo['change_serversettings'] == '1') {
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, "wiped all cleartext mail passwords");
|
||||
Database::query("UPDATE `" . TABLE_MAIL_USERS . "` SET `password` = '';");
|
||||
Database::query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '0' WHERE `settinggroup` = 'system' AND `varname` = 'mailpwcleartext'");
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
\Froxlor\UI\HTML::askYesNo('admin_cleartextmailpws_reallywipe', $filename, array(
|
||||
'page' => $page
|
||||
));
|
||||
else
|
||||
{
|
||||
ask_yesno('admin_counters_reallyupdate', $filename, array('page' => $page));
|
||||
}
|
||||
} elseif ($page == 'wipequotas' && $userinfo['change_serversettings'] == '1') {
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, "wiped all mailquotas");
|
||||
}
|
||||
elseif($page == 'wipecleartextmailpws'
|
||||
&& $userinfo['change_serversettings'] == '1')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_WARNING, "wiped all cleartext mail passwords");
|
||||
$db->query("UPDATE `" . TABLE_MAIL_USERS . "` SET `password`='' ");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='0' WHERE `settinggroup`='system' AND `varname`='mailpwcleartext'");
|
||||
redirectTo('admin_settings.php', array('s' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
ask_yesno('admin_cleartextmailpws_reallywipe', $filename, array('page' => $page));
|
||||
}
|
||||
}
|
||||
elseif($page == 'wipequotas'
|
||||
&& $userinfo['change_serversettings'] == '1')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_WARNING, "wiped all mailquotas");
|
||||
|
||||
// Set the quota to 0 which means unlimited
|
||||
Database::query("UPDATE `" . TABLE_MAIL_USERS . "` SET `quota` = '0';");
|
||||
Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_quota_used` = '0'");
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
\Froxlor\UI\HTML::askYesNo('admin_quotas_reallywipe', $filename, array(
|
||||
'page' => $page
|
||||
));
|
||||
|
||||
$db->query("UPDATE `" . TABLE_MAIL_USERS . "` SET `quota`='0' ");
|
||||
$db->query("UPDATE " . TABLE_PANEL_CUSTOMERS . " SET `email_quota_used` = 0");
|
||||
redirectTo('admin_settings.php', array('s' => $s));
|
||||
}
|
||||
} elseif ($page == 'enforcequotas' && $userinfo['change_serversettings'] == '1') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
else
|
||||
{
|
||||
ask_yesno('admin_quotas_reallywipe', $filename, array('page' => $page));
|
||||
}
|
||||
}
|
||||
elseif($page == 'enforcequotas'
|
||||
&& $userinfo['change_serversettings'] == '1')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
// Fetch all accounts
|
||||
$result_stmt = Database::query("SELECT `quota`, `customerid` FROM `" . TABLE_MAIL_USERS . "`");
|
||||
|
||||
if (Database::num_rows() > 0) {
|
||||
$result = $db->query("SELECT `quota`, `customerid` FROM " . TABLE_MAIL_USERS);
|
||||
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET
|
||||
`email_quota_used` = `email_quota_used` + :diff
|
||||
WHERE `customerid` = :customerid
|
||||
");
|
||||
|
||||
while ($array = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$difference = Settings::Get('system.mail_quota') - $array['quota'];
|
||||
Database::pexecute($upd_stmt, array(
|
||||
'diff' => $difference,
|
||||
'customerid' => $customerid
|
||||
));
|
||||
}
|
||||
while($array = $db->fetch_array($result))
|
||||
{
|
||||
$difference = $settings['system']['mail_quota'] - $array['quota'];
|
||||
$db->query("UPDATE " . TABLE_PANEL_CUSTOMERS . " SET `email_quota_used` = `email_quota_used` + " . (int)$difference . " WHERE `customerid` = '" . $array['customerid'] . "'");
|
||||
}
|
||||
|
||||
// Set the new quota
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_MAIL_USERS . "` SET `quota` = :quota
|
||||
");
|
||||
Database::pexecute($upd_stmt, array(
|
||||
'quota' => Settings::Get('system.mail_quota')
|
||||
));
|
||||
|
||||
$db->query("UPDATE `" . TABLE_MAIL_USERS . "` SET `quota`='" . $settings['system']['mail_quota'] . "'");
|
||||
|
||||
// Update the Customer, if the used quota is bigger than the allowed quota
|
||||
Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_quota` = `email_quota_used` WHERE `email_quota` < `email_quota_used`");
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_WARNING, 'enforcing mailquota to all customers: ' . Settings::Get('system.mail_quota') . ' MB');
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
\Froxlor\UI\HTML::askYesNo('admin_quotas_reallyenforce', $filename, array(
|
||||
'page' => $page
|
||||
));
|
||||
|
||||
$db->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['system']['mail_quota'] . ' MB');
|
||||
redirectTo('admin_settings.php', array('s' => $s));
|
||||
}
|
||||
} elseif ($page == 'integritycheck' && $userinfo['change_serversettings'] == '1') {
|
||||
$integrity = new \Froxlor\Database\IntegrityCheck();
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$integrity->fixAll();
|
||||
} elseif (isset($_GET['action']) && $_GET['action'] == "fix") {
|
||||
\Froxlor\UI\HTML::askYesNo('admin_integritycheck_reallyfix', $filename, array(
|
||||
'page' => $page
|
||||
));
|
||||
else
|
||||
{
|
||||
ask_yesno('admin_quotas_reallyenforce', $filename, array('page' => $page));
|
||||
}
|
||||
|
||||
$integritycheck = '';
|
||||
foreach ($integrity->available as $id => $check) {
|
||||
$displayid = $id + 1;
|
||||
$result = $integrity->$check();
|
||||
$checkdesc = $lng['integrity_check'][$check];
|
||||
eval("\$integritycheck.=\"" . \Froxlor\UI\Template::getTemplate("settings/integritycheck_row") . "\";");
|
||||
}
|
||||
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") . "\";");
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -14,490 +14,368 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
if (isset($_POST['subjectid'])) {
|
||||
require ("./lib/init.php");
|
||||
|
||||
if(isset($_POST['subjectid']))
|
||||
{
|
||||
$subjectid = intval($_POST['subjectid']);
|
||||
$mailbodyid = intval($_POST['mailbodyid']);
|
||||
} elseif (isset($_GET['subjectid'])) {
|
||||
}
|
||||
elseif(isset($_GET['subjectid']))
|
||||
{
|
||||
$subjectid = intval($_GET['subjectid']);
|
||||
$mailbodyid = intval($_GET['mailbodyid']);
|
||||
}
|
||||
|
||||
if (isset($_POST['id'])) {
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
} elseif (isset($_GET['id'])) {
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
$available_templates = array(
|
||||
'createcustomer',
|
||||
'pop_success',
|
||||
'new_database_by_customer',
|
||||
'new_ftpaccount_by_customer',
|
||||
'password_reset'
|
||||
'trafficninetypercent',
|
||||
'new_ticket_by_customer',
|
||||
'new_ticket_for_customer',
|
||||
'new_ticket_by_staff',
|
||||
'new_reply_ticket_by_customer',
|
||||
'new_reply_ticket_by_staff'
|
||||
);
|
||||
|
||||
// only show templates of features that are enabled #1191
|
||||
if ((int) Settings::Get('system.report_enable') == 1) {
|
||||
array_push($available_templates, 'trafficmaxpercent', 'diskmaxpercent');
|
||||
}
|
||||
|
||||
$file_templates = array(
|
||||
'index_html'
|
||||
);
|
||||
|
||||
if ($action == '') {
|
||||
// email templates
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_templates");
|
||||
if($action == '')
|
||||
{
|
||||
//email templates
|
||||
|
||||
if (Settings::Get('panel.sendalternativemail') == 1) {
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_templates");
|
||||
|
||||
if($settings['panel']['sendalternativemail'] == 1)
|
||||
{
|
||||
$available_templates[] = 'pop_success_alternative';
|
||||
}
|
||||
|
||||
$templates_array = array();
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `id`, `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `templategroup`='mails'
|
||||
ORDER BY `language`, `varname`");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'adminid' => $userinfo['adminid']
|
||||
));
|
||||
$result = $db->query("SELECT `id`, `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `templategroup`='mails' ORDER BY `language`, `varname`");
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$parts = array();
|
||||
preg_match('/^([a-z]([a-z_]+[a-z])*)_(mailbody|subject)$/', $row['varname'], $parts);
|
||||
$templates_array[$row['language']][$parts[1]][$parts[3]] = $row['id'];
|
||||
}
|
||||
|
||||
$templates = '';
|
||||
foreach ($templates_array as $language => $template_defs) {
|
||||
foreach ($template_defs as $action => $email) {
|
||||
foreach($templates_array as $language => $template_defs)
|
||||
{
|
||||
foreach($template_defs as $action => $email)
|
||||
{
|
||||
$subjectid = $email['subject'];
|
||||
$mailbodyid = $email['mailbody'];
|
||||
$template = $lng['admin']['templates'][$action];
|
||||
eval("\$templates.=\"" . \Froxlor\UI\Template::getTemplate("templates/templates_template") . "\";");
|
||||
eval("\$templates.=\"" . getTemplate("templates/templates_template") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
$add = false;
|
||||
foreach ($languages as $language_file => $language_name) {
|
||||
|
||||
while(list($language_file, $language_name) = each($languages))
|
||||
{
|
||||
$templates_done = array();
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `language`= :lang
|
||||
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'lang' => $language_name
|
||||
));
|
||||
$result = $db->query('SELECT `varname` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($language_name) . '\' AND `templategroup`=\'mails\' AND `varname` LIKE \'%_subject\'');
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
while(($row = $db->fetch_array($result)) != false)
|
||||
{
|
||||
$templates_done[] = str_replace('_subject', '', $row['varname']);
|
||||
}
|
||||
|
||||
if (count(array_diff($available_templates, $templates_done)) > 0) {
|
||||
if(count(array_diff($available_templates, $templates_done)) > 0)
|
||||
{
|
||||
$add = true;
|
||||
}
|
||||
}
|
||||
|
||||
// filetemplates
|
||||
//filetemplates
|
||||
|
||||
$filetemplates = '';
|
||||
$filetemplateadd = false;
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `templategroup`='files'");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'adminid' => $userinfo['adminid']
|
||||
));
|
||||
$result = $db->query("SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `templategroup`='files'");
|
||||
|
||||
if (Database::num_rows() != count($file_templates)) {
|
||||
$filetemplateadd = true;
|
||||
if($db->num_rows($result) != count($file_templates))$filetemplateadd = true;
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
eval("\$filetemplates.=\"" . getTemplate("templates/templates_filetemplate") . "\";");
|
||||
}
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
eval("\$filetemplates.=\"" . \Froxlor\UI\Template::getTemplate("templates/templates_filetemplate") . "\";");
|
||||
}
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/templates") . "\";");
|
||||
} elseif ($action == 'delete' && $subjectid != 0 && $mailbodyid != 0) {
|
||||
// email templates
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `id` = :id");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'id' => $subjectid
|
||||
));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
eval("echo \"" . getTemplate("templates/templates") . "\";");
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $subjectid != 0
|
||||
&& $mailbodyid != 0)
|
||||
{
|
||||
//email templates
|
||||
|
||||
if ($result['varname'] != '') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$del_stmt = Database::prepare("
|
||||
DELETE FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid
|
||||
AND (`id` = :ida OR `id` = :idb)");
|
||||
Database::pexecute($del_stmt, array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'ida' => $subjectid,
|
||||
'idb' => $mailbodyid
|
||||
));
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "deleted template '" . $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])] . "'");
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
\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'])]);
|
||||
$result = $db->query_first("SELECT `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$subjectid . "'");
|
||||
|
||||
if($result['varname'] != '')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND (`id`='" . (int)$subjectid . "' OR `id`='" . (int)$mailbodyid . "')");
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "deleted template '" . $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])] . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
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'])]);
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'deletef' && $id != 0) {
|
||||
// file templates
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `id` = :id");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'id' => $id
|
||||
));
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $id != 0)
|
||||
{
|
||||
//file templates
|
||||
|
||||
if (Database::num_rows() > 0) {
|
||||
$result = $db->query("SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$id . "'");
|
||||
|
||||
$row = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
if($db->num_rows($result) > 0)
|
||||
{
|
||||
$row = $db->fetch_array($result);
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$del_stmt = Database::prepare("
|
||||
DELETE FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `id` = :id");
|
||||
Database::pexecute($del_stmt, array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'id' => $id
|
||||
));
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "deleted template '" . $lng['admin']['templates'][$row['varname']] . "'");
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
\Froxlor\UI\HTML::askYesNo('admin_template_reallydelete', $filename, array(
|
||||
'id' => $id,
|
||||
'page' => $page,
|
||||
'action' => $action
|
||||
), $lng['admin']['templates'][$row['varname']]);
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`=" . (int)$userinfo['adminid'] . " AND `id`=" . (int)$id . "");
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "deleted template '" . $lng['admin']['templates'][$row['varname']] . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
ask_yesno('admin_template_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $lng['admin']['templates'][$row['varname']]);
|
||||
}
|
||||
} else {
|
||||
\Froxlor\UI\Response::standard_error('templatenotfound');
|
||||
}
|
||||
} elseif ($action == 'add') {
|
||||
|
||||
if (Settings::Get('panel.sendalternativemail') == 1) {
|
||||
else
|
||||
{
|
||||
standard_error('templatenotfound');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
elseif($action == 'add')
|
||||
{
|
||||
if($settings['panel']['sendalternativemail'] == 1)
|
||||
{
|
||||
$available_templates[] = 'pop_success_alternative';
|
||||
}
|
||||
|
||||
if (isset($_POST['prepare']) && $_POST['prepare'] == 'prepare') {
|
||||
// email templates
|
||||
$language = htmlentities(\Froxlor\Validate\Validate::validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect'));
|
||||
$template = \Froxlor\Validate\Validate::validate($_POST['template'], 'template');
|
||||
if(isset($_POST['prepare'])
|
||||
&& $_POST['prepare'] == 'prepare')
|
||||
{
|
||||
//email templates
|
||||
|
||||
$lng_bak = $lng;
|
||||
foreach ($langs['English'] as $key => $value) {
|
||||
include_once \Froxlor\FileDir::makeSecurePath($value['file']);
|
||||
}
|
||||
if ($language != 'English') {
|
||||
foreach ($langs[$language] as $key => $value) {
|
||||
include \Froxlor\FileDir::makeSecurePath($value['file']);
|
||||
}
|
||||
}
|
||||
|
||||
$subject = $lng['mails'][$template]['subject'];
|
||||
$body = str_replace('\n', "\n", $lng['mails'][$template]['mailbody']);
|
||||
|
||||
$lng = $lng_bak;
|
||||
|
||||
$template_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/templates/formfield.template_add.php';
|
||||
$template_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($template_add_data);
|
||||
|
||||
$title = $template_add_data['template_add']['title'];
|
||||
$image = $template_add_data['template_add']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/templates_add_2") . "\";");
|
||||
} elseif (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
// email templates
|
||||
$language = htmlentities(\Froxlor\Validate\Validate::validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect'));
|
||||
$template = \Froxlor\Validate\Validate::validate($_POST['template'], 'template');
|
||||
$subject = \Froxlor\Validate\Validate::validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate');
|
||||
$mailbody = \Froxlor\Validate\Validate::validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate');
|
||||
$language = validate($_POST['language'], 'language');
|
||||
$templates = array();
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `language` = :lang
|
||||
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'lang' => $language
|
||||
));
|
||||
$result = $db->query('SELECT `varname` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($language) . '\' AND `templategroup`=\'mails\' AND `varname` LIKE \'%_subject\'');
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
while(($row = $db->fetch_array($result)) != false)
|
||||
{
|
||||
$templates[] = str_replace('_subject', '', $row['varname']);
|
||||
}
|
||||
|
||||
$templates = array_diff($available_templates, $templates);
|
||||
if (array_search($template, $templates) === false) {
|
||||
\Froxlor\UI\Response::standard_error('templatenotfound');
|
||||
} else {
|
||||
$ins_stmt = Database::prepare("
|
||||
INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` SET
|
||||
`adminid` = :adminid,
|
||||
`language` = :lang,
|
||||
`templategroup` = 'mails',
|
||||
`varname` = :var,
|
||||
`value` = :value");
|
||||
|
||||
// mail-subject
|
||||
$ins_data = array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'lang' => $language,
|
||||
'var' => $template . '_subject',
|
||||
'value' => $subject
|
||||
);
|
||||
Database::pexecute($ins_stmt, $ins_data);
|
||||
|
||||
// mail-body
|
||||
$ins_data = array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'lang' => $language,
|
||||
'var' => $template . '_mailbody',
|
||||
'value' => $mailbody
|
||||
);
|
||||
Database::pexecute($ins_stmt, $ins_data);
|
||||
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "added template '" . $language . ' - ' . $template . "'");
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
$template_options = '';
|
||||
foreach($templates as $template)
|
||||
{
|
||||
$template_options.= makeoption($lng['admin']['templates'][$template], $template, NULL, true);
|
||||
}
|
||||
} elseif (isset($_POST['filesend']) && $_POST['filesend'] == 'filesend') {
|
||||
// file templates
|
||||
$template = \Froxlor\Validate\Validate::validate($_POST['template'], 'template');
|
||||
$filecontent = \Froxlor\Validate\Validate::validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset');
|
||||
|
||||
$ins_stmt = Database::prepare("
|
||||
INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` SET
|
||||
`adminid` = :adminid,
|
||||
`language` = '',
|
||||
`templategroup` = 'files',
|
||||
`varname` = :var,
|
||||
`value` = :value");
|
||||
eval("echo \"" . getTemplate("templates/templates_add_2") . "\";");
|
||||
}
|
||||
elseif(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
//email templates
|
||||
|
||||
$ins_data = array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'var' => $template,
|
||||
'value' => $filecontent
|
||||
);
|
||||
Database::pexecute($ins_stmt, $ins_data);
|
||||
$language = validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect');
|
||||
$template = validate($_POST['template'], 'template');
|
||||
$subject = validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate');
|
||||
$mailbody = validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate');
|
||||
$templates = array();
|
||||
$result = $db->query('SELECT `varname` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($language) . '\' AND `templategroup`=\'mails\' AND `varname` LIKE \'%_subject\'');
|
||||
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "added template '" . $template . "'");
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} elseif (! isset($_GET['files'])) {
|
||||
while(($row = $db->fetch_array($result)) != false)
|
||||
{
|
||||
$templates[] = str_replace('_subject', '', $row['varname']);
|
||||
}
|
||||
|
||||
$templates = array_diff($available_templates, $templates);
|
||||
|
||||
if(array_search($template, $templates) === false)
|
||||
{
|
||||
standard_error('templatenotfound');
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $db->query("INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` (`adminid`, `language`, `templategroup`, `varname`, `value`)
|
||||
VALUES ('" . (int)$userinfo['adminid'] . "', '" . $db->escape($language) . "', 'mails', '" . $db->escape($template) . "_subject','" . $db->escape($subject) . "')");
|
||||
$result = $db->query("INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` (`adminid`, `language`, `templategroup`, `varname`, `value`)
|
||||
VALUES ('" . (int)$userinfo['adminid'] . "', '" . $db->escape($language) . "', 'mails', '" . $db->escape($template) . "_mailbody','" . $db->escape($mailbody) . "')");
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "added template '" . $language . ' - ' . $template . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
elseif(isset($_POST['filesend'])
|
||||
&& $_POST['filesend'] == 'filesend')
|
||||
{
|
||||
//file templates
|
||||
|
||||
$template = validate($_POST['template'], 'template');
|
||||
$filecontent = validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset');
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` (`adminid`, `language`, `templategroup`, `varname`, `value`)
|
||||
VALUES ('" . (int)$userinfo['adminid'] . "', '', 'files', '" . $db->escape($template) . "','" . $db->escape($filecontent) . "')");
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "added template '" . $template . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
elseif(!isset($_GET['files']))
|
||||
{
|
||||
//email templates
|
||||
|
||||
// email templates
|
||||
$add = false;
|
||||
$language_options = '';
|
||||
$template_options = '';
|
||||
|
||||
foreach ($languages as $language_file => $language_name) {
|
||||
while(list($language_file, $language_name) = each($languages))
|
||||
{
|
||||
$templates = array();
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `language` = :lang
|
||||
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'lang' => $language_name
|
||||
));
|
||||
$result = $db->query('SELECT `varname` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($language_name) . '\' AND `templategroup`=\'mails\' AND `varname` LIKE \'%_subject\'');
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
while(($row = $db->fetch_array($result)) != false)
|
||||
{
|
||||
$templates[] = str_replace('_subject', '', $row['varname']);
|
||||
}
|
||||
|
||||
if (count(array_diff($available_templates, $templates)) > 0) {
|
||||
if(count(array_diff($available_templates, $templates)) > 0)
|
||||
{
|
||||
$add = true;
|
||||
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $userinfo['language'], true, true);
|
||||
|
||||
$templates = array_diff($available_templates, $templates);
|
||||
|
||||
foreach ($templates as $template) {
|
||||
$template_options .= \Froxlor\UI\HTML::makeoption($lng['admin']['templates'][$template], $template, NULL, true, true, $language_file) . "\n";
|
||||
}
|
||||
$language_options.= makeoption($language_name, $language_file, $userinfo['language'], true);
|
||||
}
|
||||
}
|
||||
|
||||
if ($add) {
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/templates_add_1") . "\";");
|
||||
} else {
|
||||
\Froxlor\UI\Response::standard_error('alltemplatesdefined');
|
||||
if($add)
|
||||
{
|
||||
eval("echo \"" . getTemplate("templates/templates_add_1") . "\";");
|
||||
}
|
||||
} else {
|
||||
// filetemplates
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `templategroup`='files'");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'adminid' => $userinfo['adminid']
|
||||
));
|
||||
else
|
||||
{
|
||||
standard_error('alltemplatesdefined');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//filetemplates
|
||||
|
||||
if (Database::num_rows() == count($file_templates)) {
|
||||
\Froxlor\UI\Response::standard_error('alltemplatesdefined');
|
||||
} else {
|
||||
$result = $db->query("SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `templategroup`='files'");
|
||||
|
||||
if($db->num_rows($result) == count($file_templates))
|
||||
{
|
||||
standard_error('alltemplatesdefined');
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$templatesdefined = array();
|
||||
$free_templates = '';
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$templatesdefined[] = $row['varname'];
|
||||
while($row = $db->fetch_array($result))$templatesdefined[] = $row['varname'];
|
||||
foreach(array_diff($file_templates, $templatesdefined) as $template)
|
||||
{
|
||||
$free_templates.= makeoption($lng['admin']['templates'][$template], $template, '', true);
|
||||
}
|
||||
|
||||
foreach (array_diff($file_templates, $templatesdefined) as $template) {
|
||||
$free_templates .= \Froxlor\UI\HTML::makeoption($lng['admin']['templates'][$template], $template, '', true);
|
||||
}
|
||||
|
||||
$filetemplate_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/templates/formfield.filetemplate_add.php';
|
||||
$filetemplate_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($filetemplate_add_data);
|
||||
|
||||
$title = $filetemplate_add_data['filetemplate_add']['title'];
|
||||
$image = $filetemplate_add_data['filetemplate_add']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/filetemplates_add") . "\";");
|
||||
eval("echo \"" . getTemplate("templates/filetemplates_add") . "\";");
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'edit' && $subjectid != 0 && $mailbodyid != 0) {
|
||||
// email templates
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `language`, `varname`, `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `id` = :subjectid");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'subjectid' => $subjectid
|
||||
));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($result['varname'] != '') {
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$subject = \Froxlor\Validate\Validate::validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate');
|
||||
$mailbody = \Froxlor\Validate\Validate::validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate');
|
||||
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET
|
||||
`value` = :value
|
||||
WHERE `adminid` = :adminid AND `id` = :id");
|
||||
// subject
|
||||
Database::pexecute($upd_stmt, array(
|
||||
'value' => $subject,
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'id' => $subjectid
|
||||
));
|
||||
// same query but mailbody
|
||||
Database::pexecute($upd_stmt, array(
|
||||
'value' => $mailbody,
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'id' => $mailbodyid
|
||||
));
|
||||
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "edited template '" . $result['varname'] . "'");
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
|
||||
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
|
||||
$template = $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])];
|
||||
$subject = $result['value'];
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `language`, `varname`, `value`
|
||||
FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `id` = :id");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'id' => $mailbodyid
|
||||
));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
$template_name = str_replace('_mailbody', '', $result['varname']);
|
||||
|
||||
// don't escape the already escaped language-string so save up before htmlentities()
|
||||
$language = $result['language'];
|
||||
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
|
||||
$mailbody = $result['value'];
|
||||
|
||||
$template_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/templates/formfield.template_edit.php';
|
||||
$template_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($template_edit_data);
|
||||
|
||||
$title = $template_edit_data['template_edit']['title'];
|
||||
$image = $template_edit_data['template_edit']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/templates_edit") . "\";");
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'editf' && $id != 0) {
|
||||
// file templates
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `id` = :id");
|
||||
Database::pexecute($result_stmt, array(
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'id' => $id
|
||||
));
|
||||
|
||||
if (Database::num_rows() > 0) {
|
||||
|
||||
$row = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
// filetemplates
|
||||
if (isset($_POST['filesend']) && $_POST['filesend'] == 'filesend') {
|
||||
$filecontent = \Froxlor\Validate\Validate::validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset');
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET
|
||||
`value` = :value
|
||||
WHERE `adminid` = :adminid AND `id` = :id");
|
||||
Database::pexecute($upd_stmt, array(
|
||||
'value' => $filecontent,
|
||||
'adminid' => $userinfo['adminid'],
|
||||
'id' => $id
|
||||
));
|
||||
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_INFO, "edited template '" . $row['varname'] . "'");
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
|
||||
|
||||
$filetemplate_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/templates/formfield.filetemplate_edit.php';
|
||||
$filetemplate_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($filetemplate_edit_data);
|
||||
|
||||
$title = $filetemplate_edit_data['filetemplate_edit']['title'];
|
||||
$image = $filetemplate_edit_data['filetemplate_edit']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/filetemplates_edit") . "\";");
|
||||
}
|
||||
} else {
|
||||
\Froxlor\UI\Response::standard_error('templatenotfound');
|
||||
}
|
||||
}
|
||||
elseif($action == 'edit'
|
||||
&& $subjectid != 0
|
||||
&& $mailbodyid != 0)
|
||||
{
|
||||
//email templates
|
||||
|
||||
$result = $db->query_first("SELECT `language`, `varname`, `value` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$subjectid . "'");
|
||||
|
||||
if($result['varname'] != '')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$subject = validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate');
|
||||
$mailbody = validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate');
|
||||
$db->query("UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET `value`='" . $db->escape($subject) . "' WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$subjectid . "'");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET `value`='" . $db->escape($mailbody) . "' WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$mailbodyid . "'");
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "edited template '" . $result['varname'] . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = htmlentities_array($result);
|
||||
$template = $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])];
|
||||
$subject = $result['value'];
|
||||
$result = $db->query_first("SELECT `language`, `varname`, `value` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `id`='$mailbodyid'");
|
||||
$result = htmlentities_array($result);
|
||||
$mailbody = $result['value'];
|
||||
eval("echo \"" . getTemplate("templates/templates_edit") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($action == 'edit'
|
||||
&& $id != 0)
|
||||
{
|
||||
//file templates
|
||||
|
||||
$result = $db->query("SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$id . "'");
|
||||
|
||||
if($db->num_rows($result) > 0)
|
||||
{
|
||||
$row = $db->fetch_array($result);
|
||||
|
||||
//filetemplates
|
||||
|
||||
if(isset($_POST['filesend'])
|
||||
&& $_POST['filesend'] == 'filesend')
|
||||
{
|
||||
$filecontent = validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset');
|
||||
$db->query("UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET `value`='" . $db->escape($filecontent) . "' WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$id . "'");
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "edited template '" . $row['varname'] . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
$row = htmlentities_array($row);
|
||||
eval("echo \"" . getTemplate("templates/filetemplates_edit") . "\";");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('templatenotfound');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
807
admin_tickets.php
Normal file
@@ -0,0 +1,807 @@
|
||||
<?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
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
require ("./lib/init.php");
|
||||
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if($page == 'tickets'
|
||||
&& $userinfo['customers'] != '0')
|
||||
{
|
||||
// Let's see how many customers we have
|
||||
|
||||
$countcustomers = $db->query_first("SELECT COUNT(`customerid`) as `countcustomers` FROM `" . TABLE_PANEL_CUSTOMERS . "` " . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = '" . (int)$userinfo['adminid'] . "' ") . "");
|
||||
$countcustomers = (int)$countcustomers['countcustomers'];
|
||||
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_tickets");
|
||||
$fields = array(
|
||||
'status' => $lng['ticket']['status'],
|
||||
'priority' => $lng['ticket']['priority'],
|
||||
'lastchange' => $lng['ticket']['lastchange'],
|
||||
'ticket_answers' => $lng['ticket']['ticket_answers'],
|
||||
'subject' => $lng['ticket']['subject'],
|
||||
'lastreplier' => $lng['ticket']['lastreplier']
|
||||
);
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_TICKETS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$paging->sortfield = 'lastchange';
|
||||
$paging->sortorder = 'desc';
|
||||
$result = $db->query('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" AND `adminid` = "' . (int)$userinfo['adminid'] . '" ' . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$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 = $db->fetch_array($result))
|
||||
{
|
||||
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 = $db->query_first('SELECT `firstname`, `name`, `company`, `loginname` FROM `' . TABLE_PANEL_CUSTOMERS . '`
|
||||
WHERE `customerid` = "' . (int)$cid . '"');
|
||||
|
||||
if(isset($usr['loginname'])) {
|
||||
$customer = getCorrectFullUserDetails($usr) . ' (' . $usr['loginname'] . ')';
|
||||
//$customer = $usr['firstname'] . " " . $usr['name'] . " (" . $usr['loginname'] . ")";
|
||||
} else {
|
||||
$customer = $lng['ticket']['nonexistingcustomer'];
|
||||
}
|
||||
eval("\$tickets.=\"" . getTemplate("ticket/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;
|
||||
}
|
||||
|
||||
if(strlen($row['subject']) > 20)
|
||||
{
|
||||
$row['subject'] = substr($row['subject'], 0, 17) . '...';
|
||||
}
|
||||
|
||||
eval("\$tickets.=\"" . getTemplate("ticket/tickets_tickets") . "\";");
|
||||
$count++;
|
||||
$_cid = $row['customerid'];
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("ticket/tickets") . "\";");
|
||||
}
|
||||
elseif($action == 'new')
|
||||
{
|
||||
if($userinfo['tickets_used'] < $userinfo['tickets']
|
||||
|| $userinfo['tickets'] == '-1')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$newticket = ticket::getInstanceOf($userinfo, $db, $settings, -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', validate($_POST['customer'], 'customer'), 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('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 = '';
|
||||
$result = $db->query_first('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` WHERE `adminid` = "' . $userinfo['adminid'] . '" ORDER BY `logicalorder`, `name` ASC');
|
||||
|
||||
if(isset($result['name'])
|
||||
&& $result['name'] != '')
|
||||
{
|
||||
$result2 = $db->query('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` WHERE `adminid` = "' . $userinfo['adminid'] . '" ORDER BY `logicalorder`, `name` ASC');
|
||||
|
||||
while($row = $db->fetch_array($result2))
|
||||
{
|
||||
$categories.= makeoption($row['name'], $row['id']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$categories = makeoption($lng['ticket']['no_cat'], '0');
|
||||
}
|
||||
|
||||
$customers = '';
|
||||
$result_customers = $db->query("SELECT `customerid`, `loginname`, `name`, `firstname`, `company` FROM `" . TABLE_PANEL_CUSTOMERS . "` " . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = '" . (int)$userinfo['adminid'] . "' ") . " ORDER BY `name` ASC");
|
||||
|
||||
while($row_customer = $db->fetch_array($result_customers))
|
||||
{
|
||||
$customers.= makeoption(getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid']);
|
||||
}
|
||||
|
||||
$priorities = makeoption($lng['ticket']['unf_high'], '1', $settings['ticket']['default_priority']);
|
||||
$priorities.= makeoption($lng['ticket']['unf_normal'], '2', $settings['ticket']['default_priority']);
|
||||
$priorities.= makeoption($lng['ticket']['unf_low'], '3', $settings['ticket']['default_priority']);
|
||||
eval("echo \"" . getTemplate("ticket/tickets_new") . "\";");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('nomoreticketsavailable');
|
||||
}
|
||||
}
|
||||
elseif($action == 'answer'
|
||||
&& $id != 0)
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$replyticket = ticket::getInstanceOf($userinfo, $db, $settings, -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();
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
|
||||
$replyticket->Set('customerid', $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, $db, $settings, (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
|
||||
{
|
||||
$by = $lng['ticket']['customer'];
|
||||
}
|
||||
|
||||
$subject = $mainticket->Get('subject');
|
||||
$message = $mainticket->Get('message');
|
||||
eval("\$ticket_replies.=\"" . getTemplate("ticket/tickets_tickets_main") . "\";");
|
||||
$result = $db->query('SELECT `name` FROM `' . TABLE_PANEL_TICKET_CATS . '`
|
||||
WHERE `id`="' . (int)$mainticket->Get('category') . '"');
|
||||
$row = $db->fetch_array($result);
|
||||
$andere = $db->query('SELECT * FROM `' . TABLE_PANEL_TICKETS . '` WHERE `answerto`="' . (int)$id . '" ORDER BY `lastchange` ASC');
|
||||
|
||||
while($row2 = $db->fetch_array($andere))
|
||||
{
|
||||
$subticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$row2['id']);
|
||||
$lastchange = date("d.m.Y H:i\h", $subticket->Get('lastchange'));
|
||||
|
||||
if($subticket->Get('by') == '1')
|
||||
{
|
||||
$by = $lng['ticket']['staff'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$by = $lng['ticket']['customer'];
|
||||
}
|
||||
|
||||
$subject = $subticket->Get('subject');
|
||||
$message = $subticket->Get('message');
|
||||
eval("\$ticket_replies.=\"" . getTemplate("ticket/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 = $mainticket->Get('subject');
|
||||
$ticket_replies_count = $db->num_rows($andere) + 1;
|
||||
|
||||
// don't forget the main-ticket!
|
||||
|
||||
eval("echo \"" . getTemplate("ticket/tickets_reply") . "\";");
|
||||
}
|
||||
}
|
||||
elseif($action == 'close'
|
||||
&& $id != 0)
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$now = time();
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (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, $db, $settings, (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, $db, $settings, (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, $db, $settings, (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, $db, $settings, (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, $db, $settings, (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, $db, $settings, (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']
|
||||
);
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_TICKET_CATS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$result = $db->query("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` = '" . $userinfo['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` = '" . $userinfo['adminid'] . "'
|
||||
) as `ticketcountnotclosed`
|
||||
FROM `" . TABLE_PANEL_TICKET_CATS . "` `main` WHERE `main`.`adminid` = '" . (int)$userinfo['adminid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$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 = $db->num_rows($result);
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
$row = htmlentities_array($row);
|
||||
$closedtickets_count = ($row['ticketcount'] - $row['ticketcountnotclosed']);
|
||||
eval("\$ticketcategories.=\"" . getTemplate("ticket/tickets_categories") . "\";");
|
||||
$count++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("ticket/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)
|
||||
{
|
||||
$order = 1;
|
||||
}
|
||||
|
||||
if($category == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'mycategory'));
|
||||
}
|
||||
else
|
||||
{
|
||||
ticket::addCategory($db, $category, $userinfo['adminid'], $order);
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "added ticket-category '" . $category . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
eval("echo \"" . getTemplate("ticket/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($db, $category, $id, $order);
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "edited ticket-category '" . $category . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$row = $db->query_first('SELECT * FROM `' . TABLE_PANEL_TICKET_CATS . '` WHERE `id` = "' . (int)$id . '"');
|
||||
eval("echo \"" . getTemplate("ticket/tickets_editcategory") . "\";");
|
||||
}
|
||||
}
|
||||
elseif($action == 'deletecategory'
|
||||
&& $id != 0)
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
if(ticket::deleteCategory($db, $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($db, $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 = $db->query_first('SELECT COUNT(`id`) as `ccount` FROM `' . TABLE_PANEL_TICKET_CATS . '`');
|
||||
for ($x = 0;$x < $cat['ccount'];$x++)
|
||||
{
|
||||
$categories[$x] = isset($_POST['category' . $x]) ? $_POST['category' . $x] : '';
|
||||
}
|
||||
|
||||
$query = ticket::getArchiveSearchStatement($subject, $priority, $fromdate, $todate, $message, $customer, $userinfo['adminid'], $categories);
|
||||
$fields = array(
|
||||
'lastchange' => $lng['ticket']['lastchange'],
|
||||
'ticket_answers' => $lng['ticket']['ticket_answers'],
|
||||
'subject' => $lng['ticket']['subject'],
|
||||
'lastreplier' => $lng['ticket']['lastreplier'],
|
||||
'priority' => $lng['ticket']['priority']
|
||||
);
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_TICKETS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$result = $db->query($query . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
$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 = $db->fetch_array($result))
|
||||
{
|
||||
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 = 0;
|
||||
foreach($ticketrows as $ticket)
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
$ticket = htmlentities_array($ticket);
|
||||
$ticket['lastchange'] = date("d.m.y H:i", $ticket['lastchange']);
|
||||
|
||||
if($_cid != $ticket['customerid'])
|
||||
{
|
||||
$cid = $ticket['customerid'];
|
||||
$usr = $db->query_first('SELECT `firstname`, `name`, `company`, `loginname` FROM `' . TABLE_PANEL_CUSTOMERS . '`
|
||||
WHERE `customerid` = "' . (int)$cid . '"');
|
||||
|
||||
if(isset($usr['loginname'])) {
|
||||
$customer = getCorrectFullUserDetails($usr) . ' (' . $usr['loginname'] . ')';
|
||||
} else {
|
||||
$customer = $lng['ticket']['nonexistingcustomer'];
|
||||
}
|
||||
|
||||
eval("\$tickets.=\"" . getTemplate("ticket/tickets_customer") . "\";");
|
||||
}
|
||||
|
||||
$tickets_count++;
|
||||
$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("ticket/archived_tickets") . "\";");
|
||||
$count++;
|
||||
$_cid = $ticket['customerid'];
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("ticket/archivesearch") . "\";");
|
||||
}
|
||||
else
|
||||
{
|
||||
$archived = array();
|
||||
$archived = ticket::getLastArchived($db, 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("ticket/archived_tickets") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
$priorities_options = makecheckbox('priority1', $lng['ticket']['unf_high'], '1');
|
||||
$priorities_options.= makecheckbox('priority2', $lng['ticket']['unf_normal'], '2');
|
||||
$priorities_options.= makecheckbox('priority3', $lng['ticket']['unf_low'], '3');
|
||||
$category_options = '';
|
||||
$ccount = 0;
|
||||
$result = $db->query('SELECT * FROM `' . TABLE_PANEL_TICKET_CATS . '` ORDER BY `name` ASC');
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$category_options.= makecheckbox('category' . $ccount, $row['name'], $row['id'], true);
|
||||
$ccount++;
|
||||
}
|
||||
|
||||
$customers = makeoption($lng['ticket']['nocustomer'], '-1', '-1');
|
||||
$result_customers = $db->query("SELECT `customerid`, `loginname`, `name`, `firstname`, `company` FROM `" . TABLE_PANEL_CUSTOMERS . "` " . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = '" . (int)$userinfo['adminid'] . "' ") . " ORDER BY `name` ASC");
|
||||
|
||||
while($row_customer = $db->fetch_array($result_customers))
|
||||
{
|
||||
$customers.= makeoption(getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid']);
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("ticket/archive") . "\";");
|
||||
}
|
||||
}
|
||||
elseif($action == 'view'
|
||||
&& $id != 0)
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed archived-ticket #" . $id);
|
||||
$ticket_replies = '';
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (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
|
||||
{
|
||||
$by = $lng['ticket']['customer'];
|
||||
}
|
||||
|
||||
$subject = $mainticket->Get('subject');
|
||||
$message = $mainticket->Get('message');
|
||||
eval("\$ticket_replies.=\"" . getTemplate("ticket/tickets_tickets_main") . "\";");
|
||||
$result = $db->query('SELECT `name` FROM `' . TABLE_PANEL_TICKET_CATS . '`
|
||||
WHERE `id`="' . (int)$mainticket->Get('category') . '"');
|
||||
$row = $db->fetch_array($result);
|
||||
$andere = $db->query('SELECT * FROM `' . TABLE_PANEL_TICKETS . '` WHERE `answerto`="' . (int)$id . '"');
|
||||
|
||||
while($row2 = $db->fetch_array($andere))
|
||||
{
|
||||
$subticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$row2['id']);
|
||||
$lastchange = date("d.m.Y H:i\h", $subticket->Get('lastchange'));
|
||||
|
||||
if($subticket->Get('by') == '1')
|
||||
{
|
||||
$by = $lng['ticket']['staff'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$by = $lng['ticket']['customer'];
|
||||
}
|
||||
|
||||
$subject = $subticket->Get('subject');
|
||||
$message = $subticket->Get('message');
|
||||
eval("\$ticket_replies.=\"" . getTemplate("ticket/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 = $mainticket->Get('subject');
|
||||
$ticket_replies_count = $db->num_rows($andere) + 1;
|
||||
|
||||
// don't forget the main-ticket!
|
||||
|
||||
eval("echo \"" . getTemplate("ticket/tickets_view") . "\";");
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $id != 0)
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (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, $db, $settings, (int)$id);
|
||||
ask_yesno('ticket_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,135 +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 Morton Jonuschat <m.jonuschat@chrome-it.de>
|
||||
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
*/
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
if (isset($_POST['id'])) {
|
||||
$id = intval($_POST['id']);
|
||||
} elseif (isset($_GET['id'])) {
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
$months = array(
|
||||
'0' => 'empty',
|
||||
'1' => 'jan',
|
||||
'2' => 'feb',
|
||||
'3' => 'mar',
|
||||
'4' => 'apr',
|
||||
'5' => 'may',
|
||||
'6' => 'jun',
|
||||
'7' => 'jul',
|
||||
'8' => 'aug',
|
||||
'9' => 'sep',
|
||||
'10' => 'oct',
|
||||
'11' => 'nov',
|
||||
'12' => 'dec'
|
||||
);
|
||||
|
||||
if ($page == 'overview' || $page == 'customers') {
|
||||
|
||||
$customerview = 1;
|
||||
$stats_tables = '';
|
||||
$minyear_stmt = Database::query("SELECT `year` FROM `" . TABLE_PANEL_TRAFFIC . "` ORDER BY `year` ASC LIMIT 1");
|
||||
$minyear = $minyear_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (! isset($minyear['year']) || $minyear['year'] == 0) {
|
||||
$maxyears = 0;
|
||||
} else {
|
||||
$maxyears = date("Y") - $minyear['year'];
|
||||
}
|
||||
|
||||
for ($years = 0; $years <= $maxyears; $years ++) {
|
||||
|
||||
$overview['year'] = date("Y") - $years;
|
||||
$overview['type'] = $lng['traffic']['customer'];
|
||||
$domain_list = '';
|
||||
$totals = array(
|
||||
'jan' => 0,
|
||||
'feb' => 0,
|
||||
'mar' => 0,
|
||||
'apr' => 0,
|
||||
'may' => 0,
|
||||
'jun' => 0,
|
||||
'jul' => 0,
|
||||
'aug' => 0,
|
||||
'sep' => 0,
|
||||
'oct' => 0,
|
||||
'nov' => 0,
|
||||
'dec' => 0
|
||||
);
|
||||
|
||||
$customer_name_list_stmt = Database::prepare("
|
||||
SELECT `customerid`,`company`,`name`,`firstname`
|
||||
FROM `" . TABLE_PANEL_CUSTOMERS . "`
|
||||
WHERE `deactivated`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :id") . "
|
||||
ORDER BY name");
|
||||
Database::pexecute($customer_name_list_stmt, array(
|
||||
'id' => $userinfo['adminid']
|
||||
));
|
||||
|
||||
while ($customer_name = $customer_name_list_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
$virtual_host = array(
|
||||
'name' => ($customer_name['company'] == '' ? $customer_name['name'] . ", " . $customer_name['firstname'] : $customer_name['company']),
|
||||
'customerid' => $customer_name['customerid'],
|
||||
'jan' => '-',
|
||||
'feb' => '-',
|
||||
'mar' => '-',
|
||||
'apr' => '-',
|
||||
'may' => '-',
|
||||
'jun' => '-',
|
||||
'jul' => '-',
|
||||
'aug' => '-',
|
||||
'sep' => '-',
|
||||
'oct' => '-',
|
||||
'nov' => '-',
|
||||
'dec' => '-'
|
||||
);
|
||||
|
||||
$traffic_list_stmt = Database::prepare("
|
||||
SELECT month, SUM(http+ftp_up+ftp_down+mail)*1024 AS traffic
|
||||
FROM `" . TABLE_PANEL_TRAFFIC . "`
|
||||
WHERE year = :year AND `customerid` = :id
|
||||
GROUP BY month ORDER BY month");
|
||||
Database::pexecute($traffic_list_stmt, array(
|
||||
'year' => (date("Y") - $years),
|
||||
'id' => $customer_name['customerid']
|
||||
));
|
||||
|
||||
while ($traffic_month = $traffic_list_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$virtual_host[$months[(int) $traffic_month['month']]] = \Froxlor\PhpHelper::sizeReadable($traffic_month['traffic'], 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
|
||||
$totals[$months[(int) $traffic_month['month']]] += $traffic_month['traffic'];
|
||||
}
|
||||
eval("\$domain_list .= sprintf(\"%s\", \"" . \Froxlor\UI\Template::getTemplate("traffic/index_table_row") . "\");");
|
||||
}
|
||||
// sum up totals
|
||||
$virtual_host = array(
|
||||
'name' => $lng['traffic']['months']['total']
|
||||
);
|
||||
foreach ($totals as $month => $bytes) {
|
||||
$virtual_host[$month] = ($bytes == 0 ? '-' : \Froxlor\PhpHelper::sizeReadable($bytes, 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s'));
|
||||
}
|
||||
$customerview = 0;
|
||||
eval("\$total_list = sprintf(\"%s\", \"" . \Froxlor\UI\Template::getTemplate("traffic/index_table_row") . "\");");
|
||||
eval("\$stats_tables .= sprintf(\"%s\", \"" . \Froxlor\UI\Template::getTemplate("traffic/index_table") . "\");");
|
||||
}
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("traffic/index") . "\";");
|
||||
}
|
||||
@@ -12,101 +12,113 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
define('AREA', 'admin');
|
||||
require './lib/init.php';
|
||||
require ("./lib/init.php");
|
||||
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
if ($page == 'overview') {
|
||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_updates");
|
||||
if($page == 'overview')
|
||||
{
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_updates");
|
||||
|
||||
/**
|
||||
* this is a dirty hack but syscp 1.4.2.1 does not
|
||||
* have any version/dbversion in the database (don't know why)
|
||||
* has any version/dbversion in the database (don't know why)
|
||||
* so we have to set them both to run a correct upgrade
|
||||
*/
|
||||
if (! \Froxlor\Froxlor::isFroxlor()) {
|
||||
if (Settings::Get('panel.version') == null || Settings::Get('panel.version') == '') {
|
||||
Settings::Set('panel.version', '1.4.2.1');
|
||||
if (!isFroxlor()) {
|
||||
if (!isset($settings['panel']['version'])
|
||||
|| $settings['panel']['version'] == ''
|
||||
) {
|
||||
$settings['panel']['version'] = '1.4.2.1';
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('panel','version','".$settings['panel']['version']."')");
|
||||
}
|
||||
if (Settings::Get('system.dbversion') == null || Settings::Get('system.dbversion') == '') {
|
||||
if (!isset($settings['system']['dbversion'])
|
||||
|| $settings['system']['dbversion'] == ''
|
||||
) {
|
||||
/**
|
||||
* for syscp-stable (1.4.2.1) this value has to be 0
|
||||
* so the required table-fields are added correctly
|
||||
* and the svn-version has its value in the database
|
||||
* -> bug #54
|
||||
*/
|
||||
$result_stmt = Database::query("
|
||||
SELECT `value` FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'dbversion'");
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (isset($result['value'])) {
|
||||
Settings::Set('system.dbversion', (int) $result['value'], false);
|
||||
|
||||
$result = $db->query_first("SELECT `value` FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'dbversion'");
|
||||
|
||||
if(isset($result['value']))
|
||||
{
|
||||
$settings['system']['dbversion'] = (int)$result['value'];
|
||||
} else {
|
||||
Settings::Set('system.dbversion', 0, false);
|
||||
$settings['system']['dbversion'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (\Froxlor\Froxlor::hasDbUpdates() || \Froxlor\Froxlor::hasUpdates()) {
|
||||
if(hasUpdates($version))
|
||||
{
|
||||
$successful_update = false;
|
||||
$message = '';
|
||||
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
if ((isset($_POST['update_preconfig']) && isset($_POST['update_changesagreed']) && intval($_POST['update_changesagreed']) != 0) || ! isset($_POST['update_preconfig'])) {
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/update_start') . "\";");
|
||||
|
||||
include_once \Froxlor\Froxlor::getInstallDir() . 'install/updatesql.php';
|
||||
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
if((isset($_POST['update_preconfig'])
|
||||
&& isset($_POST['update_changesagreed'])
|
||||
&& intval($_POST['update_changesagreed']) != 0)
|
||||
|| !isset($_POST['update_preconfig'])
|
||||
) {
|
||||
eval("echo \"" . getTemplate("update/update_start") . "\";");
|
||||
|
||||
include_once './install/updatesql.php';
|
||||
|
||||
$redirect_url = 'admin_index.php?s=' . $s;
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/update_end') . "\";");
|
||||
|
||||
\Froxlor\User::updateCounters();
|
||||
\Froxlor\System\Cronjob::inserttask('1');
|
||||
@chmod(\Froxlor\Froxlor::getInstallDir() . '/lib/userdata.inc.php', 0440);
|
||||
|
||||
eval("echo \"" . getTemplate("update/update_end") . "\";");
|
||||
|
||||
updateCounters();
|
||||
inserttask('1');
|
||||
@chmod('./lib/userdata.inc.php', 0440);
|
||||
|
||||
$successful_update = true;
|
||||
} else {
|
||||
$message = '<br /><strong class="red">You have to agree that you have read the update notifications.</strong>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = '<br /><strong style="color:#ff0000;">You have to agree that you have read the update notifications.</strong>';
|
||||
}
|
||||
}
|
||||
|
||||
if (! $successful_update) {
|
||||
$current_version = Settings::Get('panel.version');
|
||||
$current_db_version = Settings::Get('panel.db_version');
|
||||
if (empty($current_db_version)) {
|
||||
$current_db_version = "0";
|
||||
}
|
||||
if(!$successful_update)
|
||||
{
|
||||
$current_version = $settings['panel']['version'];
|
||||
$new_version = $version;
|
||||
$new_db_version = $dbversion;
|
||||
|
||||
$ui_text = $lng['update']['update_information']['part_a'];
|
||||
if ($version != $current_version) {
|
||||
$ui_text = str_replace('%curversion', $current_version, $ui_text);
|
||||
$ui_text = str_replace('%newversion', $new_version, $ui_text);
|
||||
} else {
|
||||
// show db version
|
||||
$ui_text = str_replace('%curversion', $current_db_version, $ui_text);
|
||||
$ui_text = str_replace('%newversion', $new_db_version, $ui_text);
|
||||
}
|
||||
$ui_text = str_replace('%curversion', $current_version, $ui_text);
|
||||
$ui_text = str_replace('%newversion', $new_version, $ui_text);
|
||||
$update_information = $ui_text;
|
||||
|
||||
include_once \Froxlor\Froxlor::getInstallDir() . '/install/updates/preconfig.php';
|
||||
$preconfig = getPreConfig($current_version, $current_db_version);
|
||||
if ($preconfig != '') {
|
||||
$update_information .= '<br />' . $preconfig . $message;
|
||||
|
||||
include_once './install/updates/preconfig.php';
|
||||
$preconfig = getPreConfig($current_version);
|
||||
if($preconfig != '')
|
||||
{
|
||||
$update_information .= '<br />'.$preconfig.$message;
|
||||
}
|
||||
|
||||
|
||||
$update_information .= $lng['update']['update_information']['part_b'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/index') . "\";");
|
||||
eval("echo \"" . getTemplate("update/index") . "\";");
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* @TODO version-webcheck check here
|
||||
*/
|
||||
|
||||
$success_message = $lng['update']['noupdatesavail'];
|
||||
$redirect_url = 'admin_index.php?s=' . $s;
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/noupdatesavail') . "\";");
|
||||
eval("echo \"" . getTemplate("update/noupdatesavail") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
74
api.php
@@ -1,74 +0,0 @@
|
||||
<?php
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
require \Froxlor\Froxlor::getInstallDir() . '/lib/tables.inc.php';
|
||||
|
||||
// check whether API interface is enabled after all
|
||||
if (\Froxlor\Settings::Get('api.enabled') != 1) {
|
||||
// not enabled
|
||||
header("Status: 404 Not found", 404);
|
||||
header($_SERVER["SERVER_PROTOCOL"] . " 404 Not found", 404);
|
||||
exit();
|
||||
}
|
||||
|
||||
// we're talking json here
|
||||
header("Content-Type:application/json");
|
||||
|
||||
// get our request
|
||||
$request = @file_get_contents('php://input');
|
||||
|
||||
// check if present
|
||||
if (empty($request)) {
|
||||
json_response(400, "Invalid request");
|
||||
}
|
||||
|
||||
// decode json request
|
||||
$decoded_request = json_decode(stripslashes($request), true);
|
||||
|
||||
// is it valid?
|
||||
if (is_null($decoded_request)) {
|
||||
json_response(400, "Invalid JSON");
|
||||
}
|
||||
|
||||
// validate content
|
||||
try {
|
||||
$request = \Froxlor\Api\FroxlorRPC::validateRequest($decoded_request);
|
||||
// now actually do it
|
||||
$cls = "\\Froxlor\\Api\\Commands\\" . $request['command']['class'];
|
||||
$method = $request['command']['method'];
|
||||
$apiObj = new $cls($decoded_request['header'], $request['params']);
|
||||
// call the method with the params if any
|
||||
echo $apiObj->$method();
|
||||
} catch (Exception $e) {
|
||||
json_response($e->getCode(), $e->getMessage());
|
||||
}
|
||||
|
||||
exit();
|
||||
|
||||
/**
|
||||
* output json result
|
||||
*
|
||||
* @param int $status
|
||||
* @param string $status_message
|
||||
* @param mixed $data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function json_response($status, $status_message = '', $data = null)
|
||||
{
|
||||
if (isset($_SERVER["SERVER_PROTOCOL"]) && ! empty($_SERVER["SERVER_PROTOCOL"])) {
|
||||
$resheader = $_SERVER["SERVER_PROTOCOL"] . " " . $status;
|
||||
if (! empty($status_message)) {
|
||||
$resheader .= ' ' . str_replace("\n", " ", $status_message);
|
||||
}
|
||||
header($resheader);
|
||||
}
|
||||
$response = array();
|
||||
$response['status'] = $status;
|
||||
$response['status_message'] = $status_message;
|
||||
$response['data'] = $data;
|
||||
|
||||
$json_response = json_encode($response, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);
|
||||
echo $json_response;
|
||||
exit();
|
||||
}
|
||||
235
api_keys.php
@@ -1,235 +0,0 @@
|
||||
<?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
@@ -1,293 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,80 +0,0 @@
|
||||
{
|
||||
"name": "froxlor/froxlor",
|
||||
"description": "The server administration software for your needs. Developed by experienced server administrators, this panel simplifies the effort of managing your hosting platform.",
|
||||
"keywords": [
|
||||
"server",
|
||||
"administration",
|
||||
"php"
|
||||
],
|
||||
"homepage": "https://www.froxlor.org",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michael Kaufmann",
|
||||
"email": "team@froxlor.org",
|
||||
"role": "Lead Developer"
|
||||
},
|
||||
{
|
||||
"name": "Robert Förster",
|
||||
"email": "team@froxlor.org",
|
||||
"role": "Package Maintainer"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"email": "team@froxlor.org",
|
||||
"issues": "https://github.com/Froxlor/Froxlor/issues",
|
||||
"forum": "https://forum.froxlor.org/",
|
||||
"wiki": "https://github.com/Froxlor/Froxlor/wiki",
|
||||
"irc": "irc://chat.freenode.net/froxlor",
|
||||
"source": "https://github.com/Froxlor/Froxlor",
|
||||
"docs": "https://github.com/Froxlor/Froxlor/wiki"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.0",
|
||||
"ext-session": "*",
|
||||
"ext-ctype": "*",
|
||||
"ext-pdo": "*",
|
||||
"ext-pdo_mysql": "*",
|
||||
"ext-simplexml": "*",
|
||||
"ext-xml": "*",
|
||||
"ext-filter": "*",
|
||||
"ext-posix": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-openssl": "*",
|
||||
"phpmailer/phpmailer": "~6.0",
|
||||
"monolog/monolog": "^1.24",
|
||||
"robthree/twofactorauth": "^1.6",
|
||||
"algo26-matthias/idna-convert": "^2.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^8",
|
||||
"php": ">=7.3",
|
||||
"ext-pcntl": "*",
|
||||
"phpcompatibility/php-compatibility": "*",
|
||||
"squizlabs/php_codesniffer": "*",
|
||||
"pdepend/pdepend": "^2.5",
|
||||
"sebastian/phpcpd": "^4.1",
|
||||
"theseer/phpdox": "^0.12.0",
|
||||
"phploc/phploc": "^5.0",
|
||||
"phpmd/phpmd": "^2.6"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-bcmath": "*",
|
||||
"ext-zip": "*",
|
||||
"ext-apcu": "*",
|
||||
"ext-readline": "*"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Froxlor\\": [
|
||||
"lib/Froxlor"
|
||||
]
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"post-install-cmd": "if [ -f ./vendor/bin/phpcs ]; then \"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility ; fi",
|
||||
"post-update-cmd" : "if [ -f ./vendor/bin/phpcs ]; then \"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility ; fi"
|
||||
}
|
||||
}
|
||||
2963
composer.lock
generated
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 6.2 KiB |
1893
css/jquery-ui.min.css
vendored
34
customer_aps.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?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
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
// Required code
|
||||
|
||||
define('AREA', 'customer');
|
||||
require ("./lib/init.php");
|
||||
$Id = 0;
|
||||
|
||||
if(isset($_GET['id']))$Id = (int)$_GET['id'];
|
||||
|
||||
if(isset($_POST['id']))$Id = (int)$_POST['id'];
|
||||
eval("echo \"" . getTemplate("aps/header") . "\";");
|
||||
$Aps = new ApsParser($userinfo, $settings, $db);
|
||||
$Aps->MainHandler($action);
|
||||
eval("echo \"" . getTemplate("aps/footer") . "\";");
|
||||
|
||||
?>
|
||||
306
customer_autoresponder.php
Normal file
@@ -0,0 +1,306 @@
|
||||
<?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
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
// Required code
|
||||
|
||||
define('AREA', 'customer');
|
||||
require ("./lib/init.php");
|
||||
|
||||
// Create new autoresponder
|
||||
|
||||
if($action == "add")
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$account = trim($_POST['account']);
|
||||
$subject = trim($_POST['subject']);
|
||||
$message = trim($_POST['message']);
|
||||
|
||||
$date_from_off = isset($_POST['date_from_off']) ? -1 : 0;
|
||||
$date_until_off = isset($_POST['date_until_off']) ? -1 : 0;
|
||||
|
||||
/*
|
||||
* @TODO validate date (DD-MM-YYYY)
|
||||
*/
|
||||
$ts_from = -1;
|
||||
$ts_until = -1;
|
||||
|
||||
if($date_from_off > -1)
|
||||
{
|
||||
$date_from = $_POST['date_from'];
|
||||
$ts_from = mktime(0, 0, 0, substr($date_from, 3, 2), substr($date_from, 0, 2), substr($date_from, 6, 4));
|
||||
}
|
||||
if($date_until_off > -1)
|
||||
{
|
||||
$date_until = $_POST['date_until'];
|
||||
$ts_until = mktime(0, 0, 0, substr($date_until, 3, 2), substr($date_until, 0, 2), substr($date_until, 6, 4));
|
||||
}
|
||||
|
||||
if(empty($account)
|
||||
|| empty($subject)
|
||||
|| empty($message))
|
||||
{
|
||||
standard_error('missingfields');
|
||||
}
|
||||
|
||||
// Does account exist?
|
||||
|
||||
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1");
|
||||
|
||||
if($db->num_rows($result) == 0)
|
||||
{
|
||||
standard_error('accountnotexisting');
|
||||
}
|
||||
|
||||
// Does autoresponder exist?
|
||||
|
||||
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1");
|
||||
|
||||
if($db->num_rows($result) == 1)
|
||||
{
|
||||
standard_error('autoresponderalreadyexists');
|
||||
}
|
||||
|
||||
$db->query("INSERT INTO `" . TABLE_MAIL_AUTORESPONDER . "`
|
||||
SET `email` = '" . $db->escape($account) . "',
|
||||
`message` = '" . $db->escape($message) . "',
|
||||
`enabled` = '" . (int)$_POST['active'] . "',
|
||||
`date_from` = '" . (int)$ts_from . "',
|
||||
`date_until` = '" . (int)$ts_until . "',
|
||||
`subject` = '" . $db->escape($subject) . "',
|
||||
`customerid` = '" . $db->escape((int)$userinfo['customerid']) . "'
|
||||
");
|
||||
redirectTo($filename, Array('s' => $s));
|
||||
}
|
||||
|
||||
// Get accounts
|
||||
|
||||
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` NOT IN (SELECT `email` FROM `" . TABLE_MAIL_AUTORESPONDER . "`) ORDER BY email ASC");
|
||||
|
||||
if($db->num_rows($result) == 0)
|
||||
{
|
||||
standard_error('noemailaccount');
|
||||
}
|
||||
|
||||
$accounts = '';
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$accounts.= "<option value=\"" . $row['email'] . "\">" . $row['email'] . "</option>";
|
||||
}
|
||||
|
||||
$date_from_off = makecheckbox('date_from_off', $lng['panel']['not_activated'], '-1', false, '-1', true, true);
|
||||
$date_until_off = makecheckbox('date_from_off', $lng['panel']['not_activated'], '-1', false, '-1', true, true);
|
||||
|
||||
eval("echo \"" . getTemplate("email/autoresponder_add") . "\";");
|
||||
}
|
||||
|
||||
// Edit autoresponder
|
||||
|
||||
else
|
||||
|
||||
if($action == "edit")
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$account = trim($_POST['account']);
|
||||
$subject = trim($_POST['subject']);
|
||||
$message = trim($_POST['message']);
|
||||
|
||||
$date_from_off = isset($_POST['date_from_off']) ? -1 : 0;
|
||||
$date_until_off = isset($_POST['date_until_off']) ? -1 : 0;
|
||||
|
||||
/*
|
||||
* @TODO validate date (DD-MM-YYYY)
|
||||
*/
|
||||
$ts_from = -1;
|
||||
$ts_until = -1;
|
||||
|
||||
if($date_from_off > -1)
|
||||
{
|
||||
$date_from = $_POST['date_from'];
|
||||
$ts_from = mktime(0, 0, 0, substr($date_from, 3, 2), substr($date_from, 0, 2), substr($date_from, 6, 4));
|
||||
}
|
||||
if($date_until_off > -1)
|
||||
{
|
||||
$date_until = $_POST['date_until'];
|
||||
$ts_until = mktime(0, 0, 0, substr($date_until, 3, 2), substr($date_until, 0, 2), substr($date_until, 6, 4));
|
||||
}
|
||||
|
||||
if(empty($account)
|
||||
|| empty($subject)
|
||||
|| empty($message))
|
||||
{
|
||||
standard_error('missingfields');
|
||||
}
|
||||
|
||||
// Does account exist?
|
||||
|
||||
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1");
|
||||
|
||||
if($db->num_rows($result) == 0)
|
||||
{
|
||||
standard_error('accountnotexisting');
|
||||
}
|
||||
|
||||
// Does autoresponder exist?
|
||||
|
||||
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1");
|
||||
|
||||
if($db->num_rows($result) == 0)
|
||||
{
|
||||
standard_error('invalidautoresponder');
|
||||
}
|
||||
|
||||
$ResponderActive = 0;
|
||||
|
||||
if(isset($_POST['active'])
|
||||
&& $_POST['active'] == '1')
|
||||
{
|
||||
$ResponderActive = 1;
|
||||
}
|
||||
|
||||
$db->query("UPDATE `" . TABLE_MAIL_AUTORESPONDER . "`
|
||||
SET `message` = '" . $db->escape($message) . "',
|
||||
`enabled` = '" . (int)$ResponderActive . "',
|
||||
`date_from` = '" . (int)$ts_from . "',
|
||||
`date_until` = '" . (int)$ts_until . "',
|
||||
`subject` = '" . $db->escape($subject) . "'
|
||||
WHERE `email` = '" . $db->escape($account) . "'
|
||||
AND `customerid` = '" . $db->escape((int)$userinfo['customerid']) . "'
|
||||
");
|
||||
redirectTo($filename, Array('s' => $s));
|
||||
}
|
||||
|
||||
$email = trim(htmlspecialchars($_GET['email']));
|
||||
|
||||
// Get account data
|
||||
|
||||
$result = $db->query("SELECT * FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($email) . "' LIMIT 0,1");
|
||||
|
||||
if($db->num_rows($result) == 0)
|
||||
{
|
||||
standard_error('invalidautoresponder');
|
||||
}
|
||||
|
||||
$row = $db->fetch_array($result);
|
||||
$subject = htmlspecialchars($row['subject']);
|
||||
$message = htmlspecialchars($row['message']);
|
||||
|
||||
$date_from = (int)$row['date_from'];
|
||||
$date_until = (int)$row['date_until'];
|
||||
|
||||
if($date_from == -1)
|
||||
{
|
||||
$deactivated = '-1';
|
||||
}
|
||||
else
|
||||
{
|
||||
$deactivated = '0';
|
||||
$date_from = date('d-m-Y', $date_from);
|
||||
}
|
||||
$date_from_off = makecheckbox('date_from_off', $lng['panel']['not_activated'], '-1', false, $deactivated, true, true);
|
||||
|
||||
if($date_until == -1)
|
||||
{
|
||||
$deactivated = '-1';
|
||||
$date_until = '-1';
|
||||
}
|
||||
else
|
||||
{
|
||||
$deactivated = '0';
|
||||
$date_until = date('d-m-Y', $date_until);
|
||||
}
|
||||
$date_from_off = makecheckbox('date_until_off', $lng['panel']['not_activated'], '-1', false, $deactivated, true, true);
|
||||
|
||||
$checked = '';
|
||||
|
||||
if($row['enabled'] == 1)
|
||||
{
|
||||
$checked = "checked=\"checked\"";
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("email/autoresponder_edit") . "\";");
|
||||
}
|
||||
|
||||
// Delete autoresponder
|
||||
|
||||
else
|
||||
|
||||
if($action == "delete")
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$account = trim($_POST['account']);
|
||||
|
||||
// Does autoresponder exist?
|
||||
|
||||
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1");
|
||||
|
||||
if($db->num_rows($result) == 0)
|
||||
{
|
||||
standard_error('invalidautoresponder');
|
||||
}
|
||||
|
||||
$db->query("DELETE FROM `" . TABLE_MAIL_AUTORESPONDER . "`
|
||||
WHERE `email` = '" . $db->escape($account) . "'
|
||||
AND `customerid` = '" . $db->escape((int)$userinfo['customerid']) . "'
|
||||
");
|
||||
redirectTo($filename, Array('s' => $s));
|
||||
}
|
||||
|
||||
$email = trim(htmlspecialchars($_GET['email']));
|
||||
ask_yesno('autoresponderdelete', $filename, array('action' => $action, 'account' => $email));
|
||||
}
|
||||
|
||||
// List existing autoresponders
|
||||
|
||||
else
|
||||
{
|
||||
$autoresponder = '';
|
||||
$result = $db->query("SELECT * FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' ORDER BY email ASC");
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if($row['date_from'] == -1 && $row['date_until'] == -1)
|
||||
{
|
||||
$activated_date = $lng['panel']['not_activated'];
|
||||
}
|
||||
elseif($row['date_from'] == -1 && $row['date_until'] != -1)
|
||||
{
|
||||
$activated_date = $lng['autoresponder']['date_until'].': '.date('d-m-Y', $row['date_until']);
|
||||
}
|
||||
elseif($row['date_from'] != -1 && $row['date_until'] == -1)
|
||||
{
|
||||
$activated_date = $lng['autoresponder']['date_from'].': '.date('d-m-Y', $row['date_from']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$activated_date = date('d-m-Y', $row['date_from']) . ' - ' . date('d-m-Y', $row['date_until']);
|
||||
}
|
||||
eval("\$autoresponder.=\"" . getTemplate("email/autoresponder_autoresponder") . "\";");
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("email/autoresponder") . "\";");
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -14,51 +14,43 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
define('AREA', 'customer');
|
||||
require './lib/init.php';
|
||||
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\Api\Commands\DirOptions as DirOptions;
|
||||
use Froxlor\Api\Commands\DirProtections as DirProtections;
|
||||
use Froxlor\Api\Commands\CustomerBackups as CustomerBackups;
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
// redirect if this customer page is hidden via settings
|
||||
if (Settings::IsInList('panel.customer_hide_options', 'extras')) {
|
||||
\Froxlor\UI\Response::redirectTo('customer_index.php');
|
||||
}
|
||||
require ("./lib/init.php");
|
||||
|
||||
if (isset($_POST['id'])) {
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
} elseif (isset($_GET['id'])) {
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if ($page == 'overview') {
|
||||
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_extras");
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/extras") . "\";");
|
||||
} elseif ($page == 'htpasswds') {
|
||||
|
||||
// redirect if this customer sub-page is hidden via settings
|
||||
if (Settings::IsInList('panel.customer_hide_options', 'extras.directoryprotection')) {
|
||||
\Froxlor\UI\Response::redirectTo('customer_index.php');
|
||||
}
|
||||
|
||||
if ($action == '') {
|
||||
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_extras::htpasswds");
|
||||
if($page == 'overview')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras");
|
||||
eval("echo \"" . getTemplate("extras/extras") . "\";");
|
||||
}
|
||||
elseif($page == 'htpasswds')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras::htpasswds");
|
||||
$fields = array(
|
||||
'username' => $lng['login']['username'],
|
||||
'path' => $lng['panel']['path']
|
||||
);
|
||||
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_HTPASSWDS, $fields);
|
||||
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "`
|
||||
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
Database::pexecute($result_stmt, array(
|
||||
"customerid" => $userinfo['customerid']
|
||||
));
|
||||
$paging->setEntries(Database::num_rows());
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_HTPASSWDS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$result = $db->query("SELECT `id`, `username`, `path` FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
@@ -67,138 +59,173 @@ if ($page == 'overview') {
|
||||
$count = 0;
|
||||
$htpasswds = '';
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if ($paging->checkDisplay($i)) {
|
||||
if (strpos($row['path'], $userinfo['documentroot']) === 0) {
|
||||
$row['path'] = str_replace($userinfo['documentroot'], "/", $row['path']);
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
if(strpos($row['path'], $userinfo['documentroot']) === 0)
|
||||
{
|
||||
$row['path'] = substr($row['path'], strlen($userinfo['documentroot']));
|
||||
}
|
||||
$row['path'] = \Froxlor\FileDir::makeCorrectDir($row['path']);
|
||||
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
|
||||
eval("\$htpasswds.=\"" . \Froxlor\UI\Template::getTemplate("extras/htpasswds_htpasswd") . "\";");
|
||||
$count ++;
|
||||
|
||||
$row = htmlentities_array($row);
|
||||
eval("\$htpasswds.=\"" . getTemplate("extras/htpasswds_htpasswd") . "\";");
|
||||
$count++;
|
||||
}
|
||||
|
||||
$i ++;
|
||||
$i++;
|
||||
}
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htpasswds") . "\";");
|
||||
} elseif ($action == 'delete' && $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'];
|
||||
eval("echo \"" . getTemplate("extras/htpasswds") . "\";");
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT `id`, `customerid`, `username`, `path` FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
|
||||
if (isset($result['username']) && $result['username'] != '') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
try {
|
||||
DirProtections::getLocal($userinfo, $_POST)->delete();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
if (strpos($result['path'], $userinfo['documentroot']) === 0) {
|
||||
$result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']);
|
||||
}
|
||||
|
||||
\Froxlor\UI\HTML::askYesNo('extras_reallydelete', $filename, array(
|
||||
'id' => $id,
|
||||
'page' => $page,
|
||||
'action' => $action
|
||||
), $result['username'] . ' (' . $result['path'] . ')');
|
||||
if(isset($result['username'])
|
||||
&& $result['username'] != '')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='$id'");
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "deleted htpasswd for '" . $result['username'] . " (" . $result['path'] . ")'");
|
||||
inserttask('1');
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
} 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_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htpasswd_add.php';
|
||||
$htpasswd_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($htpasswd_add_data);
|
||||
|
||||
$title = $htpasswd_add_data['htpasswd_add']['title'];
|
||||
$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']);
|
||||
else
|
||||
{
|
||||
if(strpos($result['path'], $userinfo['documentroot']) === 0)
|
||||
{
|
||||
$result['path'] = substr($result['path'], strlen($userinfo['documentroot']));
|
||||
}
|
||||
|
||||
$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'];
|
||||
$image = $htpasswd_edit_data['htpasswd_edit']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htpasswds_edit") . "\";");
|
||||
ask_yesno('extras_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['username'] . ' (' . $result['path'] . ')');
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($page == 'htaccess') {
|
||||
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\-_]+\$?$/');
|
||||
validate($_POST['directory_password'], 'password');
|
||||
$username_path_check = $db->query_first("SELECT `id`, `username`, `path` FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `username`='" . $db->escape($username) . "' AND `path`='" . $db->escape($path) . "' AND `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
|
||||
// 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(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');
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_HTPASSWDS . "` (`customerid`, `username`, `password`, `path`) VALUES ('" . (int)$userinfo['customerid'] . "', '" . $db->escape($username) . "', '" . $db->escape($password) . "', '" . $db->escape($path) . "')");
|
||||
$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'], $settings['panel']['pathedit']);
|
||||
eval("echo \"" . getTemplate("extras/htpasswds_add") . "\";");
|
||||
}
|
||||
}
|
||||
elseif($action == 'edit'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT `id`, `username`, `path` FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
|
||||
if ($action == '') {
|
||||
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_extras::htaccess");
|
||||
if(isset($result['username'])
|
||||
&& $result['username'] != '')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
validate($_POST['directory_password'], 'password');
|
||||
|
||||
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'] == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'mypassword'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_PANEL_HTPASSWDS . "` SET `password`='" . $db->escape($password) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "edited 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'] = substr($result['path'], strlen($userinfo['documentroot']));
|
||||
}
|
||||
|
||||
$result = htmlentities_array($result);
|
||||
eval("echo \"" . getTemplate("extras/htpasswds_edit") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($page == 'htaccess')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras::htaccess");
|
||||
$fields = array(
|
||||
'path' => $lng['panel']['path'],
|
||||
'options_indexes' => $lng['extras']['view_directory'],
|
||||
'error404path' => $lng['extras']['error404path'],
|
||||
'error403path' => $lng['extras']['error403path'],
|
||||
'error500path' => $lng['extras']['error500path'],
|
||||
'options_cgi' => $lng['extras']['execute_perl']
|
||||
'error500path' => $lng['extras']['error500path']
|
||||
);
|
||||
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_HTACCESS, $fields);
|
||||
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "`
|
||||
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
Database::pexecute($result_stmt, array(
|
||||
"customerid" => $userinfo['customerid']
|
||||
));
|
||||
$paging->setEntries(Database::num_rows());
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_HTACCESS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$result = $db->query("SELECT `id`, `path`, `options_indexes`, `error404path`, `error403path`, `error500path` FROM `" . TABLE_PANEL_HTACCESS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
@@ -207,194 +234,195 @@ if ($page == 'overview') {
|
||||
$count = 0;
|
||||
$htaccess = '';
|
||||
|
||||
$cperlenabled = \Froxlor\Customer\Customer::customerHasPerlEnabled($userinfo['customerid']);
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if ($paging->checkDisplay($i)) {
|
||||
if (strpos($row['path'], $userinfo['documentroot']) === 0) {
|
||||
$row['path'] = str_replace($userinfo['documentroot'], "/", $row['path']);
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
if(strpos($row['path'], $userinfo['documentroot']) === 0)
|
||||
{
|
||||
$row['path'] = substr($row['path'], strlen($userinfo['documentroot']));
|
||||
}
|
||||
$row['path'] = \Froxlor\FileDir::makeCorrectDir($row['path']);
|
||||
|
||||
$row['options_indexes'] = str_replace('1', $lng['panel']['yes'], $row['options_indexes']);
|
||||
$row['options_indexes'] = str_replace('0', $lng['panel']['no'], $row['options_indexes']);
|
||||
$row['options_cgi'] = str_replace('1', $lng['panel']['yes'], $row['options_cgi']);
|
||||
$row['options_cgi'] = str_replace('0', $lng['panel']['no'], $row['options_cgi']);
|
||||
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
|
||||
eval("\$htaccess.=\"" . \Froxlor\UI\Template::getTemplate("extras/htaccess_htaccess") . "\";");
|
||||
$count ++;
|
||||
$row = htmlentities_array($row);
|
||||
eval("\$htaccess.=\"" . getTemplate("extras/htaccess_htaccess") . "\";");
|
||||
$count++;
|
||||
}
|
||||
|
||||
$i ++;
|
||||
$i++;
|
||||
}
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htaccess") . "\";");
|
||||
} elseif ($action == 'delete' && $id != 0) {
|
||||
try {
|
||||
$json_result = DirOptions::getLocal($userinfo, array(
|
||||
'id' => $id
|
||||
))->get();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
eval("echo \"" . getTemplate("extras/htaccess") . "\";");
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
|
||||
if (isset($result['customerid']) && $result['customerid'] != '' && $result['customerid'] == $userinfo['customerid']) {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
try {
|
||||
DirOptions::getLocal($userinfo, $_POST)->delete();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
if(isset($result['customerid'])
|
||||
&& $result['customerid'] != ''
|
||||
&& $result['customerid'] == $userinfo['customerid'])
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_HTACCESS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$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
|
||||
{
|
||||
ask_yesno('extras_reallydelete_pathoptions', $filename, array('id' => $id, 'page' => $page, 'action' => $action), str_replace($userinfo['documentroot'], '', $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);
|
||||
$path_dupe_check = $db->query_first("SELECT `id`, `path` FROM `" . TABLE_PANEL_HTACCESS . "` WHERE `path`='" . $db->escape($path) . "' AND `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
|
||||
if(!$_POST['path'])
|
||||
{
|
||||
standard_error('invalidpath');
|
||||
}
|
||||
|
||||
if(($_POST['error404path'] === '')
|
||||
|| (validateUrl($idna_convert->encode($_POST['error404path']))))
|
||||
{
|
||||
$error404path = $_POST['error404path'];
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('mustbeurl');
|
||||
}
|
||||
|
||||
if(($_POST['error403path'] === '')
|
||||
|| (validateUrl($idna_convert->encode($_POST['error403path']))))
|
||||
{
|
||||
$error403path = $_POST['error403path'];
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('mustbeurl');
|
||||
}
|
||||
|
||||
if(($_POST['error500path'] === '')
|
||||
|| (validateUrl($idna_convert->encode($_POST['error500path']))))
|
||||
{
|
||||
$error500path = $_POST['error500path'];
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('mustbeurl');
|
||||
}
|
||||
|
||||
if($path_dupe_check['path'] == $path)
|
||||
{
|
||||
standard_error('errordocpathdupe', $userpath);
|
||||
}
|
||||
elseif($path == '')
|
||||
{
|
||||
standard_error('patherror');
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->query('INSERT INTO `' . TABLE_PANEL_HTACCESS . '` (`customerid`, `path`, `options_indexes`, `error404path`, `error403path`, `error500path` ) VALUES ("' . (int)$userinfo['customerid'] . '", "' . $db->escape($path) . '", "' . $db->escape($_POST['options_indexes'] == '1' ? '1' : '0') . '", "' . $db->escape($error404path) . '", "' . $db->escape($error403path) . '", "' . $db->escape($error500path) . '" )');
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "added htaccess for '" . $path . "'");
|
||||
inserttask('1');
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
|
||||
$options_indexes = makeyesno('options_indexes', '1', '0', '1');
|
||||
eval("echo \"" . getTemplate("extras/htaccess_add") . "\";");
|
||||
}
|
||||
}
|
||||
elseif(($action == 'edit')
|
||||
&& ($id != 0))
|
||||
{
|
||||
$result = $db->query_first('SELECT * FROM `' . TABLE_PANEL_HTACCESS . '` WHERE `customerid` = "' . (int)$userinfo['customerid'] . '" AND `id` = "' . (int)$id . '"');
|
||||
|
||||
if((isset($result['customerid']))
|
||||
&& ($result['customerid'] != '')
|
||||
&& ($result['customerid'] == $userinfo['customerid']))
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$option_indexes = intval($_POST['options_indexes']);
|
||||
|
||||
if($option_indexes != '1')
|
||||
{
|
||||
$option_indexes = '0';
|
||||
}
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
\Froxlor\UI\HTML::askYesNo('extras_reallydelete_pathoptions', $filename, array(
|
||||
'id' => $id,
|
||||
'page' => $page,
|
||||
'action' => $action
|
||||
), str_replace($userinfo['documentroot'], '/', $result['path']));
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'add') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
try {
|
||||
DirOptions::getLocal($userinfo, $_POST)->add();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
|
||||
$cperlenabled = \Froxlor\Customer\Customer::customerHasPerlEnabled($userinfo['customerid']);
|
||||
|
||||
$htaccess_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htaccess_add.php';
|
||||
$htaccess_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($htaccess_add_data);
|
||||
|
||||
$title = $htaccess_add_data['htaccess_add']['title'];
|
||||
$image = $htaccess_add_data['htaccess_add']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htaccess_add") . "\";");
|
||||
}
|
||||
} elseif (($action == 'edit') && ($id != 0)) {
|
||||
try {
|
||||
$json_result = DirOptions::getLocal($userinfo, array(
|
||||
'id' => $id
|
||||
))->get();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
|
||||
if ((isset($result['customerid'])) && ($result['customerid'] != '') && ($result['customerid'] == $userinfo['customerid'])) {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
try {
|
||||
DirOptions::getLocal($userinfo, $_POST)->update();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
if(($_POST['error404path'] === '')
|
||||
|| (validateUrl($idna_convert->encode($_POST['error404path']))))
|
||||
{
|
||||
$error404path = $_POST['error404path'];
|
||||
}
|
||||
\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']);
|
||||
else
|
||||
{
|
||||
standard_error('mustbeurl');
|
||||
}
|
||||
|
||||
if(($_POST['error403path'] === '')
|
||||
|| (validateUrl($idna_convert->encode($_POST['error403path']))))
|
||||
{
|
||||
$error403path = $_POST['error403path'];
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('mustbeurl');
|
||||
}
|
||||
|
||||
if(($_POST['error500path'] === '')
|
||||
|| (validateUrl($idna_convert->encode($_POST['error500path']))))
|
||||
{
|
||||
$error500path = $_POST['error500path'];
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('mustbeurl');
|
||||
}
|
||||
|
||||
if(($option_indexes != $result['options_indexes'])
|
||||
|| ($error404path != $result['error404path'])
|
||||
|| ($error403path != $result['error403path'])
|
||||
|| ($error500path != $result['error500path']))
|
||||
{
|
||||
inserttask('1');
|
||||
$db->query('UPDATE `' . TABLE_PANEL_HTACCESS . '` SET `options_indexes` = "' . $db->escape($option_indexes) . '", `error404path` = "' . $db->escape($error404path) . '", `error403path` = "' . $db->escape($error403path) . '", `error500path` = "' . $db->escape($error500path) . '" WHERE `customerid` = "' . (int)$userinfo['customerid'] . '" AND `id` = "' . (int)$id . '"');
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "edited htaccess for '" . str_replace($userinfo['documentroot'], '', $result['path']) . "'");
|
||||
}
|
||||
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
if(strpos($result['path'], $userinfo['documentroot']) === 0)
|
||||
{
|
||||
$result['path'] = substr($result['path'], strlen($userinfo['documentroot']));
|
||||
}
|
||||
|
||||
$result['error404path'] = $result['error404path'];
|
||||
$result['error403path'] = $result['error403path'];
|
||||
$result['error500path'] = $result['error500path'];
|
||||
$cperlenabled = \Froxlor\Customer\Customer::customerHasPerlEnabled($userinfo['customerid']);
|
||||
/*
|
||||
* $options_indexes = \Froxlor\UI\HTML::makeyesno('options_indexes', '1', '0', $result['options_indexes']);
|
||||
* $options_cgi = \Froxlor\UI\HTML::makeyesno('options_cgi', '1', '0', $result['options_cgi']);
|
||||
*/
|
||||
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
|
||||
|
||||
$htaccess_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htaccess_edit.php';
|
||||
$htaccess_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($htaccess_edit_data);
|
||||
|
||||
$title = $htaccess_edit_data['htaccess_edit']['title'];
|
||||
$image = $htaccess_edit_data['htaccess_edit']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htaccess_edit") . "\";");
|
||||
$options_indexes = makeyesno('options_indexes', '1', '0', $result['options_indexes']);
|
||||
$result = htmlentities_array($result);
|
||||
eval("echo \"" . 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');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
445
customer_ftp.php
@@ -14,47 +14,43 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
define('AREA', 'customer');
|
||||
require './lib/init.php';
|
||||
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\Api\Commands\Ftps as Ftps;
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
// redirect if this customer page is hidden via settings
|
||||
if (Settings::IsInList('panel.customer_hide_options', 'ftp')) {
|
||||
\Froxlor\UI\Response::redirectTo('customer_index.php');
|
||||
}
|
||||
require ("./lib/init.php");
|
||||
|
||||
$id = 0;
|
||||
if (isset($_POST['id'])) {
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
} elseif (isset($_GET['id'])) {
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if ($page == 'overview') {
|
||||
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_ftp");
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/ftp') . "\";");
|
||||
} elseif ($page == 'accounts') {
|
||||
if ($action == '') {
|
||||
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_ftp::accounts");
|
||||
if($page == 'overview')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_ftp");
|
||||
eval("echo \"" . getTemplate("ftp/ftp") . "\";");
|
||||
}
|
||||
elseif($page == 'accounts')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_ftp::accounts");
|
||||
$fields = array(
|
||||
'username' => $lng['login']['username'],
|
||||
'homedir' => $lng['panel']['path'],
|
||||
'description' => $lng['panel']['ftpdesc']
|
||||
'homedir' => $lng['panel']['path']
|
||||
);
|
||||
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_FTP_USERS, $fields);
|
||||
|
||||
$result_stmt = Database::prepare("SELECT `id`, `username`, `description`, `homedir`, `shell` FROM `" . TABLE_FTP_USERS . "`
|
||||
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
Database::pexecute($result_stmt, array(
|
||||
"customerid" => $userinfo['customerid']
|
||||
));
|
||||
$ftps_count = Database::num_rows();
|
||||
$paging->setEntries($ftps_count);
|
||||
$paging = new paging($userinfo, $db, TABLE_FTP_USERS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$result = $db->query("SELECT `id`, `username`, `homedir` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . $userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
@@ -63,182 +59,287 @@ if ($page == 'overview') {
|
||||
$count = 0;
|
||||
$accounts = '';
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if ($paging->checkDisplay($i)) {
|
||||
if (strpos($row['homedir'], $userinfo['documentroot']) === 0) {
|
||||
$row['documentroot'] = str_replace($userinfo['documentroot'], "/", $row['homedir']);
|
||||
} else {
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
if(strpos($row['homedir'], $userinfo['documentroot']) === 0)
|
||||
{
|
||||
$row['documentroot'] = substr($row['homedir'], strlen($userinfo['documentroot']));
|
||||
}
|
||||
else
|
||||
{
|
||||
$row['documentroot'] = $row['homedir'];
|
||||
}
|
||||
|
||||
$row['documentroot'] = \Froxlor\FileDir::makeCorrectDir($row['documentroot']);
|
||||
|
||||
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
|
||||
eval("\$accounts.=\"" . \Froxlor\UI\Template::getTemplate('ftp/accounts_account') . "\";");
|
||||
$count ++;
|
||||
$row['documentroot'] = makeCorrectDir($row['documentroot']);
|
||||
|
||||
$row = htmlentities_array($row);
|
||||
eval("\$accounts.=\"" . getTemplate("ftp/accounts_account") . "\";");
|
||||
$count++;
|
||||
}
|
||||
|
||||
$i ++;
|
||||
$i++;
|
||||
}
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/accounts') . "\";");
|
||||
} elseif ($action == 'delete' && $id != 0) {
|
||||
try {
|
||||
$json_result = Ftps::getLocal($userinfo, array(
|
||||
'id' => $id
|
||||
))->get();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
$ftps_count = $db->num_rows($result);
|
||||
eval("echo \"" . getTemplate("ftp/accounts") . "\";");
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT `id`, `username`, `homedir`, `up_count`, `up_bytes`, `down_count`, `down_bytes` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
|
||||
if (isset($result['username']) && $result['username'] != $userinfo['loginname']) {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
try {
|
||||
Ftps::getLocal($userinfo, $_POST)->delete();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
if(isset($result['username'])
|
||||
&& $result['username'] != $userinfo['loginname'])
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `up_count`=`up_count`+'" . (int)$result['up_count'] . "', `up_bytes`=`up_bytes`+'" . (int)$result['up_bytes'] . "', `down_count`=`down_count`+'" . (int)$result['down_count'] . "', `down_bytes`=`down_bytes`+'" . (int)$result['down_bytes'] . "' WHERE `username`='" . $db->escape($userinfo['loginname']) . "'");
|
||||
$result = $db->query("SELECT `username` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_FTP_QUOTATALLIES . "` WHERE `name` = '" . $db->escape($row['username']) . "'");
|
||||
}
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
\Froxlor\UI\HTML::askYesNoWithCheckbox('ftp_reallydelete', 'admin_customer_alsoremoveftphomedir', $filename, array(
|
||||
'id' => $id,
|
||||
'page' => $page,
|
||||
'action' => $action
|
||||
), $result['username']);
|
||||
$db->query("DELETE FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "deleted ftp-account '" . $result['username'] . "'");
|
||||
$db->query("UPDATE `" . TABLE_FTP_GROUPS . "` SET `members`=REPLACE(`members`,'," . $db->escape($result['username']) . "','') WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
|
||||
// $db->query("DELETE FROM `".TABLE_FTP_GROUPS."` WHERE `customerid`='".$userinfo['customerid']."' AND `id`='$id'");
|
||||
|
||||
if($userinfo['ftps_used'] == '1')
|
||||
{
|
||||
$resetaccnumber = " , `ftp_lastaccountnumber`='0'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$resetaccnumber = '';
|
||||
}
|
||||
|
||||
$result = $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `ftps_used`=`ftps_used`-1 $resetaccnumber WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
ask_yesno('ftp_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['username']);
|
||||
}
|
||||
} else {
|
||||
\Froxlor\UI\Response::standard_error('ftp_cantdeletemainaccount');
|
||||
}
|
||||
} elseif ($action == 'add') {
|
||||
if ($userinfo['ftps_used'] < $userinfo['ftps'] || $userinfo['ftps'] == '-1') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
try {
|
||||
Ftps::getLocal($userinfo, $_POST)->add();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], '/');
|
||||
else
|
||||
{
|
||||
standard_error('ftp_cantdeletemainaccount');
|
||||
}
|
||||
}
|
||||
elseif($action == 'add')
|
||||
{
|
||||
if($userinfo['ftps_used'] < $userinfo['ftps']
|
||||
|| $userinfo['ftps'] == '-1')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$path = validate($_POST['path'], 'path');
|
||||
$password = validate($_POST['ftp_password'], 'password');
|
||||
$password = validatePassword($password);
|
||||
|
||||
if (Settings::Get('customer.ftpatdomain') == '1') {
|
||||
$domainlist = array();
|
||||
$sendinfomail = intval($_POST['sendinfomail']);
|
||||
if($sendinfomail != 1)
|
||||
{
|
||||
$sendinfomail = 0;
|
||||
}
|
||||
|
||||
if($settings['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 = $db->query_first("SELECT `id`, `domain`, `customerid` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `domain`='" . $db->escape($ftpdomain) . "' AND `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
if($ftpdomain_check['domain'] != $ftpdomain)
|
||||
{
|
||||
standard_error('maindomainnonexist', $domain);
|
||||
}
|
||||
$username = $ftpusername . "@" . $ftpdomain;
|
||||
}
|
||||
else
|
||||
{
|
||||
$username = $userinfo['loginname'] . $settings['customer']['ftpprefix'] . (intval($userinfo['ftp_lastaccountnumber']) + 1);
|
||||
}
|
||||
|
||||
$username_check = $db->query_first('SELECT * FROM `' . TABLE_FTP_USERS .'` WHERE `username` = \'' . $db->escape($username) . '\'');
|
||||
|
||||
if(!empty($username_check) && $username_check['username'] = $username)
|
||||
{
|
||||
standard_error('usernamealreadyexists', $username);
|
||||
}
|
||||
elseif($password == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'mypassword'));
|
||||
}
|
||||
elseif($path == '')
|
||||
{
|
||||
standard_error('patherror');
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path);
|
||||
|
||||
$db->query("INSERT INTO `" . TABLE_FTP_USERS . "` (`customerid`, `username`, `password`, `homedir`, `login_enabled`, `uid`, `gid`) VALUES ('" . (int)$userinfo['customerid'] . "', '" . $db->escape($username) . "', ENCRYPT('" . $db->escape($password) . "'), '" . $db->escape($path) . "', 'y', '" . (int)$userinfo['guid'] . "', '" . (int)$userinfo['guid'] . "')");
|
||||
$result = $db->query("SELECT `bytes_in_used` FROM `" . TABLE_FTP_QUOTATALLIES . "` WHERE `name` = '" . $userinfo['loginname'] . "'");
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$db->query("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 ('" . $db->escape($username) . "', 'user', '" . $db->escape($row[bytes_in_used]) . "', '0', '0', '0', '0', '0')");
|
||||
}
|
||||
$db->query("UPDATE `" . TABLE_FTP_GROUPS . "` SET `members`=CONCAT_WS(',',`members`,'" . $db->escape($username) . "') WHERE `customerid`='" . $userinfo['customerid'] . "' AND `gid`='" . (int)$userinfo['guid'] . "'");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `ftps_used`=`ftps_used`+1, `ftp_lastaccountnumber`=`ftp_lastaccountnumber`+1 WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "added ftp-account '" . $username . " (" . $path . ")'");
|
||||
inserttask(5);
|
||||
|
||||
if($sendinfomail == 1)
|
||||
{
|
||||
$replace_arr = array(
|
||||
'CUST_NAME' => getCorrectUserSalutation($userinfo),
|
||||
'USR_NAME' => $username,
|
||||
'USR_PASS' => $password,
|
||||
'USR_PATH' => makeCorrectDir(substr($path, strlen($userinfo['documentroot'])))
|
||||
);
|
||||
|
||||
$mail_body = replace_variables($lng['customer']['ftp_add']['infomail_body']['main'], $replace_arr);
|
||||
|
||||
$_mailerror = false;
|
||||
try {
|
||||
$mail->Subject = $lng['customer']['ftp_add']['infomail_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));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
|
||||
|
||||
if($settings['customer']['ftpatdomain'] == '1')
|
||||
{
|
||||
$domains = '';
|
||||
|
||||
$result_domains_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `customerid`= :customerid");
|
||||
Database::pexecute($result_domains_stmt, array(
|
||||
"customerid" => $userinfo['customerid']
|
||||
));
|
||||
$result_domains = $db->query("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
|
||||
while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$domainlist[] = $row_domain['domain'];
|
||||
}
|
||||
|
||||
sort($domainlist);
|
||||
|
||||
if (isset($domainlist[0]) && $domainlist[0] != '') {
|
||||
foreach ($domainlist as $dom) {
|
||||
$domains .= \Froxlor\UI\HTML::makeoption($idna_convert->decode($dom), $dom);
|
||||
}
|
||||
while($row_domain = $db->fetch_array($result_domains))
|
||||
{
|
||||
$domains.= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['domain']);
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
$sendinfomail = makeyesno('sendinfomail', '1', '0', '0');
|
||||
|
||||
// $sendinfomail = \Froxlor\UI\HTML::makeyesno('sendinfomail', '1', '0', '0');
|
||||
|
||||
$ftp_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/ftp/formfield.ftp_add.php';
|
||||
$ftp_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($ftp_add_data);
|
||||
|
||||
$title = $ftp_add_data['ftp_add']['title'];
|
||||
$image = $ftp_add_data['ftp_add']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/accounts_add') . "\";");
|
||||
eval("echo \"" . getTemplate("ftp/accounts_add") . "\";");
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'edit' && $id != 0) {
|
||||
try {
|
||||
$json_result = Ftps::getLocal($userinfo, array(
|
||||
'id' => $id
|
||||
))->get();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
}
|
||||
elseif($action == 'edit'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT `id`, `username`, `homedir`, `uid`, `gid` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
|
||||
if (isset($result['username']) && $result['username'] != '') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
try {
|
||||
Ftps::getLocal($userinfo, $_POST)->update();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
if(isset($result['username'])
|
||||
&& $result['username'] != '')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$path = validate($_POST['path'], 'path');
|
||||
|
||||
$_setnewpass = false;
|
||||
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(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
if (strpos($result['homedir'], $userinfo['documentroot']) === 0) {
|
||||
$homedir = str_replace($userinfo['documentroot'], "/", $result['homedir']);
|
||||
} else {
|
||||
|
||||
if($_setnewpass)
|
||||
{
|
||||
if($password == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'mypassword'));
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "updated ftp-account password for '" . $result['username'] . "'");
|
||||
$db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `password`=ENCRYPT('" . $db->escape($password) . "') WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
}
|
||||
}
|
||||
|
||||
if($path != '')
|
||||
{
|
||||
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path);
|
||||
|
||||
if($path != $result['homedir'])
|
||||
{
|
||||
if(!file_exists($path))
|
||||
{
|
||||
mkDirWithCorrectOwnership($userinfo['documentroot'], $path, $result['uid'], $result['gid']);
|
||||
}
|
||||
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "updated ftp-account homdir for '" . $result['username'] . "'");
|
||||
$db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `homedir`= '" . $db->escape($path) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
|
||||
}
|
||||
}
|
||||
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
if(strpos($result['homedir'], $userinfo['documentroot']) === 0)
|
||||
{
|
||||
$homedir = substr($result['homedir'], strlen($userinfo['documentroot']));
|
||||
}
|
||||
else
|
||||
{
|
||||
$homedir = $result['homedir'];
|
||||
}
|
||||
$homedir = \Froxlor\FileDir::makeCorrectDir($homedir);
|
||||
$homedir = makeCorrectDir($homedir);
|
||||
|
||||
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $homedir);
|
||||
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit'], $homedir);
|
||||
|
||||
if (Settings::Get('customer.ftpatdomain') == '1') {
|
||||
if($settings['customer']['ftpatdomain'] == '1')
|
||||
{
|
||||
$domains = '';
|
||||
|
||||
$result_domains_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `customerid` = :customerid");
|
||||
Database::pexecute($result_domains_stmt, array(
|
||||
"customerid" => $userinfo['customerid']
|
||||
));
|
||||
$result_domains = $db->query("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
|
||||
while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$domains .= \Froxlor\UI\HTML::makeoption($idna_convert->decode($row_domain['domain']), $row_domain['domain']);
|
||||
while($row_domain = $db->fetch_array($result_domains))
|
||||
{
|
||||
$domains.= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['domain']);
|
||||
}
|
||||
}
|
||||
|
||||
if (Settings::Get('system.allow_customer_shell') == '1') {
|
||||
$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'];
|
||||
$image = $ftp_edit_data['ftp_edit']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/accounts_edit') . "\";");
|
||||
|
||||
eval("echo \"" . getTemplate("ftp/accounts_edit") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -14,353 +14,171 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
define('AREA', 'customer');
|
||||
require './lib/init.php';
|
||||
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\Api\Commands\Customers as Customers;
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
if ($action == 'logout') {
|
||||
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, 'logged out');
|
||||
require ("./lib/init.php");
|
||||
|
||||
$params = array(
|
||||
"customerid" => $userinfo['customerid']
|
||||
);
|
||||
if (Settings::Get('session.allow_multiple_login') == '1') {
|
||||
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
|
||||
WHERE `userid` = :customerid
|
||||
AND `adminsession` = '0'
|
||||
AND `hash` = :hash");
|
||||
$params["hash"] = $s;
|
||||
} else {
|
||||
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
|
||||
WHERE `userid` = :customerid
|
||||
AND `adminsession` = '0'");
|
||||
if($action == 'logout')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "logged out");
|
||||
|
||||
if($settings['session']['allow_multiple_login'] == '1')
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['customerid'] . "' AND `adminsession` = '0' AND `hash` = '" . $s . "'");
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['customerid'] . "' AND `adminsession` = '0'");
|
||||
}
|
||||
Database::pexecute($stmt, $params);
|
||||
|
||||
\Froxlor\UI\Response::redirectTo('index.php');
|
||||
redirectTo('index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($page == 'overview') {
|
||||
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_index");
|
||||
|
||||
$domain_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `customerid` = :customerid
|
||||
AND `parentdomainid` = '0'
|
||||
AND `id` <> :standardsubdomain
|
||||
");
|
||||
Database::pexecute($domain_stmt, array(
|
||||
"customerid" => $userinfo['customerid'],
|
||||
"standardsubdomain" => $userinfo['standardsubdomain']
|
||||
));
|
||||
|
||||
if($page == 'overview')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_index");
|
||||
$domains = '';
|
||||
$result = $db->query("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `parentdomainid`='0' AND `id` <> '" . (int)$userinfo['standardsubdomain'] . "' ");
|
||||
$domainArray = array();
|
||||
|
||||
while ($row = $domain_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$domainArray[] = $idna_convert->decode($row['domain']);
|
||||
}
|
||||
|
||||
natsort($domainArray);
|
||||
$domains = implode(',<br />', $domainArray);
|
||||
|
||||
// standard-subdomain
|
||||
$stdsubdomain = '';
|
||||
if ($userinfo['standardsubdomain'] != '0') {
|
||||
$std_domain_stmt = Database::prepare("
|
||||
SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `customerid` = :customerid
|
||||
AND `id` = :standardsubdomain
|
||||
");
|
||||
$std_domain = Database::pexecute_first($std_domain_stmt, array(
|
||||
"customerid" => $userinfo['customerid'],
|
||||
"standardsubdomain" => $userinfo['standardsubdomain']
|
||||
));
|
||||
$stdsubdomain = $std_domain['domain'];
|
||||
}
|
||||
|
||||
$domains = implode(', ', $domainArray);
|
||||
$userinfo['email'] = $idna_convert->decode($userinfo['email']);
|
||||
$yesterday = time() - (60 * 60 * 24);
|
||||
$month = date('M Y', $yesterday);
|
||||
|
||||
// get disk-space usages for web, mysql and mail
|
||||
$usages_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_DISKSPACE . "` WHERE `customerid` = :cid ORDER BY `stamp` DESC LIMIT 1");
|
||||
$usages = Database::pexecute_first($usages_stmt, array(
|
||||
'cid' => $userinfo['customerid']
|
||||
));
|
||||
/* $traffic=$db->query_first("SELECT SUM(http) AS http_sum, SUM(ftp_up) AS ftp_up_sum, SUM(ftp_down) AS ftp_down_sum, SUM(mail) AS mail_sum FROM ".TABLE_PANEL_TRAFFIC." WHERE year='".date('Y')."' AND month='".date('m')."' AND day<='".date('d')."' AND customerid='".$userinfo['customerid']."'");
|
||||
$userinfo['traffic_used']=$traffic['http_sum']+$traffic['ftp_up_sum']+$traffic['ftp_down_sum']+$traffic['mail_sum'];*/
|
||||
|
||||
if ($usages)
|
||||
$userinfo['diskspace'] = round($userinfo['diskspace'] / 1024, $settings['panel']['decimal_places']);
|
||||
$userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, $settings['panel']['decimal_places']);
|
||||
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $settings['panel']['decimal_places']);
|
||||
$userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), $settings['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 aps_packages');
|
||||
$opentickets = 0;
|
||||
$opentickets = $db->query_first('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
|
||||
WHERE `customerid` = "' . $userinfo['customerid'] . '"
|
||||
AND `answerto` = "0"
|
||||
AND (`status` = "0" OR `status` = "2")
|
||||
AND `lastreplier`="1"');
|
||||
$awaitingtickets = $opentickets['count'];
|
||||
$awaitingtickets_text = '';
|
||||
|
||||
if($opentickets > 0)
|
||||
{
|
||||
$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'));
|
||||
} else {
|
||||
$userinfo['diskspace_used'] = 0;
|
||||
$userinfo['mailspace_used'] = 0;
|
||||
$userinfo['dbspace_used'] = 0;
|
||||
$awaitingtickets_text = strtr($lng['ticket']['awaitingticketreply'], array('%s' => '<a href="customer_tickets.php?page=tickets&s=' . $s . '">' . $opentickets['count'] . '</a>'));
|
||||
}
|
||||
$userinfo['diskspace'] = round($userinfo['diskspace'] / 1024, Settings::Get('panel.decimal_places'));
|
||||
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), Settings::Get('panel.decimal_places'));
|
||||
$userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), Settings::Get('panel.decimal_places'));
|
||||
$userinfo = \Froxlor\PhpHelper::strReplaceArray('-1', $lng['customer']['unlimited'], $userinfo, 'diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps subdomains');
|
||||
|
||||
$userinfo['custom_notes'] = ($userinfo['custom_notes'] != '') ? nl2br($userinfo['custom_notes']) : '';
|
||||
|
||||
$services_enabled = "";
|
||||
$se = array();
|
||||
if ($userinfo['imap'] == '1')
|
||||
$se[] = "IMAP";
|
||||
if ($userinfo['pop3'] == '1')
|
||||
$se[] = "POP3";
|
||||
if ($userinfo['phpenabled'] == '1')
|
||||
$se[] = "PHP";
|
||||
if ($userinfo['perlenabled'] == '1')
|
||||
$se[] = "Perl/CGI";
|
||||
$services_enabled = implode(", ", $se);
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/index') . "\";");
|
||||
} elseif ($page == 'change_password') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$old_password = \Froxlor\Validate\Validate::validate($_POST['old_password'], 'old password');
|
||||
if (! \Froxlor\System\Crypt::validatePasswordLogin($userinfo, $old_password, TABLE_PANEL_CUSTOMERS, 'customerid')) {
|
||||
\Froxlor\UI\Response::standard_error('oldpasswordnotcorrect');
|
||||
}
|
||||
|
||||
$new_password = \Froxlor\System\Crypt::validatePassword($_POST['new_password'], 'new password');
|
||||
$new_password_confirm = \Froxlor\System\Crypt::validatePassword($_POST['new_password_confirm'], 'new password confirm');
|
||||
|
||||
if ($old_password == '') {
|
||||
\Froxlor\UI\Response::standard_error(array(
|
||||
'stringisempty',
|
||||
'oldpassword'
|
||||
));
|
||||
} elseif ($new_password == '') {
|
||||
\Froxlor\UI\Response::standard_error(array(
|
||||
'stringisempty',
|
||||
'newpassword'
|
||||
));
|
||||
} elseif ($new_password_confirm == '') {
|
||||
\Froxlor\UI\Response::standard_error(array(
|
||||
'stringisempty',
|
||||
'newpasswordconfirm'
|
||||
));
|
||||
} elseif ($new_password != $new_password_confirm) {
|
||||
\Froxlor\UI\Response::standard_error('newpasswordconfirmerror');
|
||||
} else {
|
||||
// Update user password
|
||||
try {
|
||||
Customers::getLocal($userinfo, array(
|
||||
'id' => $userinfo['customerid'],
|
||||
'new_customer_password' => $new_password
|
||||
))->update();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, 'changed password');
|
||||
|
||||
// Update ftp password
|
||||
if (isset($_POST['change_main_ftp']) && $_POST['change_main_ftp'] == 'true') {
|
||||
$cryptPassword = \Froxlor\System\Crypt::makeCryptPassword($new_password);
|
||||
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "`
|
||||
SET `password` = :password
|
||||
WHERE `customerid` = :customerid
|
||||
AND `username` = :username");
|
||||
$params = array(
|
||||
"password" => $cryptPassword,
|
||||
"customerid" => $userinfo['customerid'],
|
||||
"username" => $userinfo['loginname']
|
||||
);
|
||||
Database::pexecute($stmt, $params);
|
||||
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, 'changed main ftp password');
|
||||
}
|
||||
|
||||
// Update statistics password
|
||||
if (isset($_POST['change_stats']) && $_POST['change_stats'] == 'true') {
|
||||
$new_stats_password = \Froxlor\System\Crypt::makeCryptPassword($new_password, true);
|
||||
|
||||
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_HTPASSWDS . "`
|
||||
SET `password` = :password
|
||||
WHERE `customerid` = :customerid
|
||||
AND `username` = :username");
|
||||
$params = array(
|
||||
"password" => $new_stats_password,
|
||||
"customerid" => $userinfo['customerid'],
|
||||
"username" => $userinfo['loginname']
|
||||
);
|
||||
Database::pexecute($stmt, $params);
|
||||
}
|
||||
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s
|
||||
));
|
||||
}
|
||||
} else {
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/change_password') . "\";");
|
||||
}
|
||||
} elseif ($page == 'change_language') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$def_language = \Froxlor\Validate\Validate::validate($_POST['def_language'], 'default language');
|
||||
if (isset($languages[$def_language])) {
|
||||
try {
|
||||
Customers::getLocal($userinfo, array(
|
||||
'id' => $userinfo['customerid'],
|
||||
'def_language' => $def_language
|
||||
))->update();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
|
||||
// also update current session
|
||||
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_SESSIONS . "`
|
||||
SET `language` = :lang
|
||||
WHERE `hash` = :hash");
|
||||
Database::pexecute($stmt, array(
|
||||
"lang" => $def_language,
|
||||
"hash" => $s
|
||||
));
|
||||
}
|
||||
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "changed default language to '" . $def_language . "'");
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
$default_lang = Settings::Get('panel.standardlanguage');
|
||||
if ($userinfo['def_language'] != '') {
|
||||
$default_lang = $userinfo['def_language'];
|
||||
}
|
||||
|
||||
$language_options = '';
|
||||
foreach ($languages as $language_file => $language_name) {
|
||||
$language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $default_lang, true);
|
||||
}
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/change_language') . "\";");
|
||||
}
|
||||
} elseif ($page == 'change_theme') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
$theme = \Froxlor\Validate\Validate::validate($_POST['theme'], 'theme');
|
||||
try {
|
||||
Customers::getLocal($userinfo, array(
|
||||
'id' => $userinfo['customerid'],
|
||||
'theme' => $theme
|
||||
))->update();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
|
||||
// also update current session
|
||||
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_SESSIONS . "`
|
||||
SET `theme` = :theme
|
||||
WHERE `hash` = :hash");
|
||||
Database::pexecute($stmt, array(
|
||||
"theme" => $theme,
|
||||
"hash" => $s
|
||||
));
|
||||
|
||||
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "changed default theme to '" . $theme . "'");
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
$default_theme = Settings::Get('panel.default_theme');
|
||||
if ($userinfo['theme'] != '') {
|
||||
$default_theme = $userinfo['theme'];
|
||||
}
|
||||
|
||||
$theme_options = '';
|
||||
$themes_avail = \Froxlor\UI\Template::getThemes();
|
||||
foreach ($themes_avail as $t => $d) {
|
||||
$theme_options .= \Froxlor\UI\HTML::makeoption($d, $t, $default_theme, true);
|
||||
}
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/change_theme') . "\";");
|
||||
}
|
||||
} elseif ($page == 'send_error_report' && Settings::Get('system.allow_error_report_customer') == '1') {
|
||||
|
||||
// only show this if we really have an exception to report
|
||||
if (isset($_GET['errorid']) && $_GET['errorid'] != '') {
|
||||
|
||||
$errid = $_GET['errorid'];
|
||||
// read error file
|
||||
$err_dir = \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir() . "/logs/");
|
||||
$err_file = \Froxlor\FileDir::makeCorrectFile($err_dir . "/" . $errid . "_sql-error.log");
|
||||
|
||||
if (file_exists($err_file)) {
|
||||
|
||||
$error_content = file_get_contents($err_file);
|
||||
$error = explode("|", $error_content);
|
||||
|
||||
$_error = array(
|
||||
'code' => str_replace("\n", "", substr($error[1], 5)),
|
||||
'message' => str_replace("\n", "", substr($error[2], 4)),
|
||||
'file' => str_replace("\n", "", substr($error[3], 5 + strlen(\Froxlor\Froxlor::getInstallDir()))),
|
||||
'line' => str_replace("\n", "", substr($error[4], 5)),
|
||||
'trace' => str_replace(\Froxlor\Froxlor::getInstallDir(), "", substr($error[5], 6))
|
||||
);
|
||||
|
||||
// build mail-content
|
||||
$mail_body = "Dear froxlor-team,\n\n";
|
||||
$mail_body .= "the following error has been reported by a user:\n\n";
|
||||
$mail_body .= "-------------------------------------------------------------\n";
|
||||
$mail_body .= $_error['code'] . ' ' . $_error['message'] . "\n\n";
|
||||
$mail_body .= "File: " . $_error['file'] . ':' . $_error['line'] . "\n\n";
|
||||
$mail_body .= "Trace:\n" . trim($_error['trace']) . "\n\n";
|
||||
$mail_body .= "-------------------------------------------------------------\n\n";
|
||||
$mail_body .= "Froxlor-version: " . $version . "\n";
|
||||
$mail_body .= "DB-version: " . $dbversion . "\n\n";
|
||||
$mail_body .= "End of report";
|
||||
$mail_html = str_replace("\n", "<br />", $mail_body);
|
||||
|
||||
// send actual report to dev-team
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
// send mail and say thanks
|
||||
$_mailerror = false;
|
||||
try {
|
||||
$mail->Subject = '[Froxlor] Error report by user';
|
||||
$mail->AltBody = $mail_body;
|
||||
$mail->MsgHTML($mail_html);
|
||||
$mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team');
|
||||
$mail->Send();
|
||||
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
||||
$mailerr_msg = $e->errorMessage();
|
||||
$_mailerror = true;
|
||||
} catch (Exception $e) {
|
||||
$mailerr_msg = $e->getMessage();
|
||||
$_mailerror = true;
|
||||
}
|
||||
|
||||
if ($_mailerror) {
|
||||
// error when reporting an error...LOLFUQ
|
||||
\Froxlor\UI\Response::standard_error('send_report_error', $mailerr_msg);
|
||||
}
|
||||
|
||||
// finally remove error from fs
|
||||
@unlink($err_file);
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s
|
||||
));
|
||||
}
|
||||
// show a nice summary of the error-report
|
||||
// before actually sending anything
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/send_error_report") . "\";");
|
||||
} else {
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s
|
||||
));
|
||||
}
|
||||
} else {
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
's' => $s
|
||||
));
|
||||
}
|
||||
} elseif ($page == 'apikeys' && Settings::Get('api.enabled') == 1) {
|
||||
require_once __DIR__ . '/api_keys.php';
|
||||
} elseif ($page == 'apihelp' && Settings::Get('api.enabled') == 1) {
|
||||
require_once __DIR__ . '/apihelp.php';
|
||||
} elseif ($page == '2fa' && Settings::Get('2fa.enabled') == 1) {
|
||||
require_once __DIR__ . '/2fa.php';
|
||||
eval("echo \"" . getTemplate("index/index") . "\";");
|
||||
}
|
||||
elseif($page == 'change_password')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$old_password = validate($_POST['old_password'], 'old password');
|
||||
|
||||
if(md5($old_password) != $userinfo['password'])
|
||||
{
|
||||
standard_error('oldpasswordnotcorrect');
|
||||
exit;
|
||||
}
|
||||
|
||||
$new_password = validate($_POST['new_password'], 'new password');
|
||||
$new_password_confirm = validate($_POST['new_password_confirm'], 'new password confirm');
|
||||
|
||||
if($old_password == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'oldpassword'));
|
||||
}
|
||||
elseif($new_password == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'newpassword'));
|
||||
}
|
||||
elseif($new_password_confirm == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'newpasswordconfirm'));
|
||||
}
|
||||
elseif($new_password != $new_password_confirm)
|
||||
{
|
||||
standard_error('newpasswordconfirmerror');
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `password`='" . md5($new_password) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `password`='" . md5($old_password) . "'");
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, 'changed password');
|
||||
|
||||
if(isset($_POST['change_main_ftp'])
|
||||
&& $_POST['change_main_ftp'] == 'true')
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `password`=ENCRYPT('" . $db->escape($new_password) . "') WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `username`='" . $db->escape($userinfo['loginname']) . "'");
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, 'changed main ftp password');
|
||||
}
|
||||
|
||||
if(isset($_POST['change_webalizer'])
|
||||
&& $_POST['change_webalizer'] == 'true')
|
||||
{
|
||||
if(CRYPT_STD_DES == 1)
|
||||
{
|
||||
$saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2);
|
||||
$new_webalizer_password = crypt($new_password, $saltfordescrypt);
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_webalizer_password = crypt($new_password);
|
||||
}
|
||||
|
||||
$db->query("UPDATE `" . TABLE_PANEL_HTPASSWDS . "` SET `password`='" . $db->escape($new_webalizer_password) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `username`='" . $db->escape($userinfo['loginname']) . "'");
|
||||
}
|
||||
|
||||
redirectTo($filename, Array('s' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
eval("echo \"" . getTemplate("index/change_password") . "\";");
|
||||
}
|
||||
}
|
||||
elseif($page == 'change_language')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$def_language = validate($_POST['def_language'], 'default language');
|
||||
|
||||
if(isset($languages[$def_language]))
|
||||
{
|
||||
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `def_language`='" . $db->escape($def_language) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
|
||||
$db->query("UPDATE `" . TABLE_PANEL_SESSIONS . "` SET `language`='" . $db->escape($def_language) . "' WHERE `hash`='" . $db->escape($s) . "'");
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "changed default language to '" . $def_language . "'");
|
||||
}
|
||||
|
||||
redirectTo($filename, Array('s' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
$language_options = '';
|
||||
|
||||
while(list($language_file, $language_name) = each($languages))
|
||||
{
|
||||
$language_options.= makeoption($language_name, $language_file, $userinfo['def_language'], true);
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("index/change_language") . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,124 +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';
|
||||
|
||||
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 == '') {
|
||||
$fields = array(
|
||||
'date' => $lng['logger']['date'],
|
||||
'type' => $lng['logger']['type'],
|
||||
'user' => $lng['logger']['user'],
|
||||
'text' => $lng['logger']['action']
|
||||
);
|
||||
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_LOG, $fields, null, null, 0, 'desc', 30);
|
||||
$query = 'SELECT * FROM `' . TABLE_PANEL_LOG . '` WHERE `user` = :loginname ' . $paging->getSqlWhere(true) . ' ' . $paging->getSqlOrderBy();
|
||||
$result_stmt = Database::prepare($query . ' ' . $paging->getSqlLimit());
|
||||
Database::pexecute($result_stmt, array(
|
||||
"loginname" => $userinfo['loginname']
|
||||
));
|
||||
$result_cnt_stmt = Database::prepare($query);
|
||||
Database::pexecute($result_cnt_stmt, array(
|
||||
"loginname" => $userinfo['loginname']
|
||||
));
|
||||
$res_cnt = $result_cnt_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$logs_count = $result_cnt_stmt->rowCount();
|
||||
$paging->setEntries($logs_count);
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$clog = array();
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
if (! isset($clog[$row['action']]) || ! is_array($clog[$row['action']])) {
|
||||
$clog[$row['action']] = array();
|
||||
}
|
||||
$clog[$row['action']][$row['logid']] = $row;
|
||||
}
|
||||
|
||||
if ($paging->sortfield == 'date' && $paging->sortorder == 'desc') {
|
||||
krsort($clog);
|
||||
} else {
|
||||
ksort($clog);
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
$count = 0;
|
||||
$log_count = 0;
|
||||
$log = '';
|
||||
foreach ($clog as $action => $logrows) {
|
||||
$_action = 0;
|
||||
foreach ($logrows as $row) {
|
||||
// if ($paging->checkDisplay($i)) {
|
||||
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
|
||||
$row['date'] = date("d.m.y H:i:s", $row['date']);
|
||||
|
||||
if ($_action != $action) {
|
||||
switch ($action) {
|
||||
case \Froxlor\FroxlorLogger::USR_ACTION:
|
||||
$_action = $lng['admin']['customer'];
|
||||
break;
|
||||
case \Froxlor\FroxlorLogger::RES_ACTION:
|
||||
$_action = $lng['logger']['reseller'];
|
||||
break;
|
||||
case \Froxlor\FroxlorLogger::ADM_ACTION:
|
||||
$_action = $lng['logger']['admin'];
|
||||
break;
|
||||
case \Froxlor\FroxlorLogger::CRON_ACTION:
|
||||
$_action = $lng['logger']['cron'];
|
||||
break;
|
||||
case \Froxlor\FroxlorLogger::LOGIN_ACTION:
|
||||
$_action = $lng['logger']['login'];
|
||||
break;
|
||||
case \Froxlor\FroxlorLogger::LOG_ERROR:
|
||||
$_action = $lng['logger']['intern'];
|
||||
break;
|
||||
default:
|
||||
$_action = $lng['logger']['unknown'];
|
||||
break;
|
||||
}
|
||||
|
||||
$row['action'] = $_action;
|
||||
eval("\$log.=\"" . \Froxlor\UI\Template::getTemplate('logger/logger_action') . "\";");
|
||||
}
|
||||
|
||||
$log_count ++;
|
||||
$row['type'] = \Froxlor\FroxlorLogger::getInstanceOf()->getLogLevelDesc($row['type']);
|
||||
eval("\$log.=\"" . \Froxlor\UI\Template::getTemplate('logger/logger_log') . "\";");
|
||||
$count ++;
|
||||
$_action = $action;
|
||||
// }
|
||||
$i ++;
|
||||
}
|
||||
$i ++;
|
||||
}
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('logger/logger') . "\";");
|
||||
}
|
||||
}
|
||||
@@ -14,54 +14,46 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
define('AREA', 'customer');
|
||||
require './lib/init.php';
|
||||
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\Api\Commands\Mysqls as Mysqls;
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
// redirect if this customer page is hidden via settings
|
||||
if (Settings::IsInList('panel.customer_hide_options', 'mysql')) {
|
||||
\Froxlor\UI\Response::redirectTo('customer_index.php');
|
||||
}
|
||||
$need_db_sql_data = true;
|
||||
$need_root_db_sql_data = true;
|
||||
require ("./lib/init.php");
|
||||
|
||||
// get sql-root access data
|
||||
Database::needRoot(true);
|
||||
Database::needSqlData();
|
||||
$sql_root = Database::getSqlData();
|
||||
Database::needRoot(false);
|
||||
|
||||
if (isset($_POST['id'])) {
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
} elseif (isset($_GET['id'])) {
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if ($page == 'overview') {
|
||||
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_mysql");
|
||||
Database::needSqlData();
|
||||
$sql = Database::getSqlData();
|
||||
if($page == 'overview')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_mysql");
|
||||
$lng['mysql']['description'] = str_replace('<SQL_HOST>', $sql['host'], $lng['mysql']['description']);
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('mysql/mysql') . "\";");
|
||||
} elseif ($page == 'mysqls') {
|
||||
if ($action == '') {
|
||||
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_mysql::mysqls");
|
||||
eval("echo \"" . getTemplate("mysql/mysql") . "\";");
|
||||
}
|
||||
elseif($page == 'mysqls')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_mysql::mysqls");
|
||||
$fields = array(
|
||||
'databasename' => $lng['mysql']['databasename'],
|
||||
'description' => $lng['mysql']['databasedescription']
|
||||
);
|
||||
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_DATABASES, $fields);
|
||||
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_DATABASES . "`
|
||||
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
Database::pexecute($result_stmt, array(
|
||||
"customerid" => $userinfo['customerid']
|
||||
));
|
||||
$mysqls_count = Database::num_rows();
|
||||
$paging->setEntries($mysqls_count);
|
||||
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_DATABASES, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$result = $db->query("SELECT `id`, `databasename`, `description`, `dbserver` FROM `" . TABLE_PANEL_DATABASES . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
@@ -70,151 +62,248 @@ if ($page == 'overview') {
|
||||
$count = 0;
|
||||
$mysqls = '';
|
||||
|
||||
$dbservers_stmt = Database::query("SELECT COUNT(DISTINCT `dbserver`) as numservers FROM `" . TABLE_PANEL_DATABASES . "`");
|
||||
$dbserver = $dbservers_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$count_mysqlservers = $dbserver['numservers'];
|
||||
|
||||
// Begin root-session
|
||||
Database::needRoot(true);
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if ($paging->checkDisplay($i)) {
|
||||
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
|
||||
$mbdata_stmt = Database::prepare("SELECT SUM(data_length + index_length) as MB FROM information_schema.TABLES
|
||||
WHERE table_schema = :table_schema
|
||||
GROUP BY table_schema");
|
||||
Database::pexecute($mbdata_stmt, array(
|
||||
"table_schema" => $row['databasename']
|
||||
));
|
||||
$mbdata = $mbdata_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$row['size'] = \Froxlor\PhpHelper::sizeReadable($mbdata['MB'], 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
|
||||
eval("\$mysqls.=\"" . \Froxlor\UI\Template::getTemplate('mysql/mysqls_database') . "\";");
|
||||
$count ++;
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
$row = htmlentities_array($row);
|
||||
eval("\$mysqls.=\"" . getTemplate("mysql/mysqls_database") . "\";");
|
||||
$count++;
|
||||
}
|
||||
$i ++;
|
||||
|
||||
$i++;
|
||||
}
|
||||
Database::needRoot(false);
|
||||
// End root-session
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('mysql/mysqls') . "\";");
|
||||
} elseif ($action == 'delete' && $id != 0) {
|
||||
$mysqls_count = $db->num_rows($result);
|
||||
eval("echo \"" . getTemplate("mysql/mysqls") . "\";");
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first('SELECT `id`, `databasename`, `dbserver` FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . (int)$userinfo['customerid'] . '" AND `id`="' . (int)$id . '"');
|
||||
|
||||
try {
|
||||
$json_result = Mysqls::getLocal($userinfo, array(
|
||||
'id' => $id
|
||||
))->get();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
|
||||
if (isset($result['databasename']) && $result['databasename'] != '') {
|
||||
|
||||
Database::needRoot(true, $result['dbserver']);
|
||||
Database::needSqlData();
|
||||
$sql_root = Database::getSqlData();
|
||||
Database::needRoot(false);
|
||||
|
||||
if (! isset($sql_root[$result['dbserver']]) || ! is_array($sql_root[$result['dbserver']])) {
|
||||
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') {
|
||||
try {
|
||||
Mysqls::getLocal($userinfo, $_POST)->delete();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
// Begin root-session
|
||||
|
||||
$db_root = new db($sql_root[$result['dbserver']]['host'], $sql_root[$result['dbserver']]['user'], $sql_root[$result['dbserver']]['password'], '');
|
||||
unset($db_root->password);
|
||||
foreach(array_map('trim', array_unique(explode(',', $settings['system']['mysql_access_host']))) as $mysql_access_host)
|
||||
{
|
||||
$db_root->query('REVOKE ALL PRIVILEGES ON * . * FROM `' . $db_root->escape($result['databasename']) . '`@`' . $db_root->escape($mysql_access_host) . '`');
|
||||
$db_root->query('REVOKE ALL PRIVILEGES ON `' . str_replace('_', '\_', $db_root->escape($result['databasename'])) . '` . * FROM `' . $db_root->escape($result['databasename']) . '`@`' . $db_root->escape($mysql_access_host) . '`');
|
||||
$db_root->query('DELETE FROM `mysql`.`user` WHERE `User` = "' . $db_root->escape($result['databasename']) . '" AND `Host` = "' . $db_root->escape($mysql_access_host) . '"');
|
||||
}
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
$dbnamedesc = $result['databasename'];
|
||||
if (isset($result['description']) && $result['description'] != '') {
|
||||
$dbnamedesc .= ' (' . $result['description'] . ')';
|
||||
|
||||
$db_root->query('DROP DATABASE IF EXISTS `' . $db_root->escape($result['databasename']) . '`');
|
||||
$db_root->query('FLUSH PRIVILEGES');
|
||||
$db_root->close();
|
||||
|
||||
// End root-session
|
||||
|
||||
$db->query('DELETE FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . (int)$userinfo['customerid'] . '" AND `id`="' . (int)$id . '"');
|
||||
|
||||
if($userinfo['mysqls_used'] == '1')
|
||||
{
|
||||
$resetaccnumber = " , `mysql_lastaccountnumber`='0' ";
|
||||
}
|
||||
\Froxlor\UI\HTML::askYesNo('mysql_reallydelete', $filename, array(
|
||||
'id' => $id,
|
||||
'page' => $page,
|
||||
'action' => $action
|
||||
), $dbnamedesc);
|
||||
else
|
||||
{
|
||||
$resetaccnumber = '';
|
||||
}
|
||||
|
||||
$result = $db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used`=`mysqls_used`-1 ' . $resetaccnumber . 'WHERE `customerid`="' . (int)$userinfo['customerid'] . '"');
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
ask_yesno('mysql_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['databasename']);
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'add') {
|
||||
if ($userinfo['mysqls_used'] < $userinfo['mysqls'] || $userinfo['mysqls'] == '-1') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
try {
|
||||
Mysqls::getLocal($userinfo, $_POST)->add();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
}
|
||||
elseif($action == 'add')
|
||||
{
|
||||
if($userinfo['mysqls_used'] < $userinfo['mysqls']
|
||||
|| $userinfo['mysqls'] == '-1')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$password = validate($_POST['mysql_password'], 'password');
|
||||
$password = validatePassword($password);
|
||||
|
||||
$dbservers_stmt = Database::query("SELECT DISTINCT `dbserver` FROM `" . TABLE_PANEL_DATABASES . "`");
|
||||
$sendinfomail = intval($_POST['sendinfomail']);
|
||||
if($sendinfomail != 1)
|
||||
{
|
||||
$sendinfomail = 0;
|
||||
}
|
||||
|
||||
if($password == '')
|
||||
{
|
||||
standard_error(array('stringisempty', 'mypassword'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$username = $userinfo['loginname'] . $settings['customer']['mysqlprefix'] . (intval($userinfo['mysql_lastaccountnumber']) + 1);
|
||||
|
||||
if(count($sql_root) > 1)
|
||||
{
|
||||
$dbserver = validate($_POST['mysql_server'], html_entity_decode($lng['mysql']['mysql_server']), '', '', 0);
|
||||
|
||||
if(!isset($sql_root[$dbserver]) || !is_array($sql_root[$dbserver]))
|
||||
{
|
||||
$dbserver = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$dbserver = 0;
|
||||
}
|
||||
|
||||
// Begin root-session
|
||||
|
||||
$db_root = new db($sql_root[$dbserver]['host'], $sql_root[$dbserver]['user'], $sql_root[$dbserver]['password'], '');
|
||||
unset($db_root->password);
|
||||
$db_root->query('CREATE DATABASE `' . $db_root->escape($username) . '`');
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "created database '" . $username . "'");
|
||||
foreach(array_map('trim', explode(',', $settings['system']['mysql_access_host'])) as $mysql_access_host)
|
||||
{
|
||||
$db_root->query('GRANT ALL PRIVILEGES ON `' . str_replace('_', '\_', $db_root->escape($username)) . '`.* TO `' . $db_root->escape($username) . '`@`' . $db_root->escape($mysql_access_host) . '` IDENTIFIED BY \'password\'');
|
||||
$db_root->query('SET PASSWORD FOR `' . $db_root->escape($username) . '`@`' . $db_root->escape($mysql_access_host) . '` = PASSWORD(\'' . $db_root->escape($password) . '\')');
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "grant all privileges for '" . $username . "'@'" . $mysql_access_host . "'");
|
||||
}
|
||||
|
||||
$db_root->query('FLUSH PRIVILEGES');
|
||||
$db_root->close();
|
||||
|
||||
// End root-session
|
||||
// Statement modifyed for Database description -- PH 2004-11-29
|
||||
|
||||
$databasedescription = validate($_POST['description'], 'description');
|
||||
$result = $db->query('INSERT INTO `' . TABLE_PANEL_DATABASES . '` (`customerid`, `databasename`, `description`, `dbserver`) VALUES ("' . (int)$userinfo['customerid'] . '", "' . $db->escape($username) . '", "' . $db->escape($databasedescription) . '", "' . $db->escape($dbserver) . '")');
|
||||
$result = $db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used`=`mysqls_used`+1, `mysql_lastaccountnumber`=`mysql_lastaccountnumber`+1 WHERE `customerid`="' . (int)$userinfo['customerid'] . '"');
|
||||
|
||||
if($sendinfomail == 1)
|
||||
{
|
||||
$pma = '';
|
||||
if($settings['panel']['phpmyadmin_url'] != '')
|
||||
{
|
||||
$r_arr = array('URI' => $settings['panel']['phpmyadmin_url']);
|
||||
$pma = replace_variables($lng['customer']['mysql_add']['infomail_body']['pma'], $r_arr);
|
||||
}
|
||||
|
||||
$replace_arr = array(
|
||||
'CUST_NAME' => getCorrectUserSalutation($userinfo),
|
||||
'DB_NAME' => $username,
|
||||
'DB_PASS' => $password,
|
||||
'DB_DESC' => $databasedescription,
|
||||
'DB_SRV' => $sql_root[$dbserver]['host'],
|
||||
'PMA_URI' => $pma
|
||||
);
|
||||
|
||||
$mail_body = replace_variables($lng['customer']['mysql_add']['infomail_body']['main'], $replace_arr);
|
||||
|
||||
$_mailerror = false;
|
||||
try {
|
||||
$mail->Subject = $lng['customer']['mysql_add']['infomail_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));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mysql_servers = '';
|
||||
$count_mysqlservers = 0;
|
||||
while ($dbserver = $dbservers_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
Database::needRoot(true, $dbserver['dbserver']);
|
||||
Database::needSqlData();
|
||||
$sql_root = Database::getSqlData();
|
||||
$mysql_servers .= \Froxlor\UI\HTML::makeoption($sql_root['caption'], $dbserver['dbserver']);
|
||||
$count_mysqlservers ++;
|
||||
|
||||
foreach($sql_root as $mysql_server => $mysql_server_details)
|
||||
{
|
||||
$mysql_servers .= makeoption($mysql_server_details['caption'], $mysql_server);
|
||||
}
|
||||
Database::needRoot(false);
|
||||
|
||||
$mysql_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/mysql/formfield.mysql_add.php';
|
||||
$mysql_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($mysql_add_data);
|
||||
$sendinfomail = makeyesno('sendinfomail', '1', '0', '0');
|
||||
|
||||
$title = $mysql_add_data['mysql_add']['title'];
|
||||
$image = $mysql_add_data['mysql_add']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('mysql/mysqls_add') . "\";");
|
||||
eval("echo \"" . getTemplate("mysql/mysqls_add") . "\";");
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'edit' && $id != 0) {
|
||||
try {
|
||||
$json_result = Mysqls::getLocal($userinfo, array(
|
||||
'id' => $id
|
||||
))->get();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
$result = json_decode($json_result, true)['data'];
|
||||
}
|
||||
elseif($action == 'edit'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first('SELECT `id`, `databasename`, `description`, `dbserver` FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . $userinfo['customerid'] . '" AND `id`="' . $id . '"');
|
||||
|
||||
if (isset($result['databasename']) && $result['databasename'] != '') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
try {
|
||||
$json_result = Mysqls::getLocal($userinfo, $_POST)->update();
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
if(isset($result['databasename'])
|
||||
&& $result['databasename'] != '')
|
||||
{
|
||||
if(!isset($sql_root[$result['dbserver']]) || !is_array($sql_root[$result['dbserver']]))
|
||||
{
|
||||
$result['dbserver'] = 0;
|
||||
}
|
||||
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
// Only change Password if it is set, do nothing if it is empty! -- PH 2004-11-29
|
||||
|
||||
$password = validate($_POST['mysql_password'], 'password');
|
||||
$password = validatePassword($password);
|
||||
|
||||
if($password != '')
|
||||
{
|
||||
// Begin root-session
|
||||
|
||||
$db_root = new db($sql_root[$result['dbserver']]['host'], $sql_root[$result['dbserver']]['user'], $sql_root[$result['dbserver']]['password'], '');
|
||||
unset($db_root->password);
|
||||
foreach(array_map('trim', explode(',', $settings['system']['mysql_access_host'])) as $mysql_access_host)
|
||||
{
|
||||
$db_root->query('SET PASSWORD FOR `' . $db_root->escape($result['databasename']) . '`@`' . $db_root->escape($mysql_access_host) . '` = PASSWORD(\'' . $db_root->escape($password) . '\')');
|
||||
}
|
||||
|
||||
$db_root->query('FLUSH PRIVILEGES');
|
||||
$db_root->close();
|
||||
|
||||
// End root-session
|
||||
}
|
||||
\Froxlor\UI\Response::redirectTo($filename, array(
|
||||
'page' => $page,
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
|
||||
$dbservers_stmt = Database::query("SELECT COUNT(DISTINCT `dbserver`) as numservers FROM `" . TABLE_PANEL_DATABASES . "`");
|
||||
$dbserver = $dbservers_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$count_mysqlservers = $dbserver['numservers'];
|
||||
// Update the Database description -- PH 2004-11-29
|
||||
|
||||
Database::needRoot(true, $result['dbserver']);
|
||||
Database::needSqlData();
|
||||
$sql_root = Database::getSqlData();
|
||||
Database::needRoot(false);
|
||||
|
||||
$mysql_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/mysql/formfield.mysql_edit.php';
|
||||
$mysql_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($mysql_edit_data);
|
||||
|
||||
$title = $mysql_edit_data['mysql_edit']['title'];
|
||||
$image = $mysql_edit_data['mysql_edit']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('mysql/mysqls_edit') . "\";");
|
||||
$log->logAction(USR_ACTION, LOG_INFO, "edited database '" . $result['databasename'] . "'");
|
||||
$databasedescription = validate($_POST['description'], 'description');
|
||||
$result = $db->query('UPDATE `' . TABLE_PANEL_DATABASES . '` SET `description`="' . $db->escape($databasedescription) . '" WHERE `customerid`="' . (int)$userinfo['customerid'] . '" AND `id`="' . (int)$id . '"');
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
eval("echo \"" . getTemplate("mysql/mysqls_edit") . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
414
customer_tickets.php
Normal file
@@ -0,0 +1,414 @@
|
||||
<?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
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
define('AREA', 'customer');
|
||||
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
require ("./lib/init.php");
|
||||
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
$id = intval($_POST['id']);
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if($page == 'overview')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_tickets");
|
||||
eval("echo \"" . getTemplate("ticket/ticket") . "\";");
|
||||
}
|
||||
elseif($page == 'tickets')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_tickets::tickets");
|
||||
$fields = array(
|
||||
'status' => $lng['ticket']['status'],
|
||||
'priority' => $lng['ticket']['priority'],
|
||||
'lastchange' => $lng['ticket']['lastchange'],
|
||||
'ticket_answers' => $lng['ticket']['ticket_answers'],
|
||||
'subject' => $lng['ticket']['subject'],
|
||||
'lastreplier' => $lng['ticket']['lastreplier']
|
||||
);
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_TICKETS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$paging->sortfield = 'lastchange';
|
||||
$paging->sortorder = 'desc';
|
||||
$result = $db->query('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`="' . (int)$userinfo['customerid'] . '" AND `adminid`="' . (int)$userinfo['adminid'] . '" ' . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$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 = $db->fetch_array($result))
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
if(strlen($row['subject']) > 20)
|
||||
{
|
||||
$row['subject'] = substr($row['subject'], 0, 17) . '...';
|
||||
}
|
||||
|
||||
eval("\$tickets.=\"" . getTemplate("ticket/tickets_tickets") . "\";");
|
||||
$count++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$supportavailable = 0;
|
||||
$time = date("Hi", time());
|
||||
$day = date("w", time());
|
||||
$start = substr($settings['ticket']['worktime_begin'], 0, 2) . substr($settings['ticket']['worktime_begin'], 3, 2);
|
||||
$end = substr($settings['ticket']['worktime_end'], 0, 2) . substr($settings['ticket']['worktime_end'], 3, 2);
|
||||
|
||||
if($time >= $start
|
||||
&& $time <= $end)
|
||||
{
|
||||
$supportavailable = 1;
|
||||
}
|
||||
|
||||
if($settings['ticket']['worktime_sat'] == "0"
|
||||
&& $day == "6")
|
||||
{
|
||||
$supportavailable = 0;
|
||||
}
|
||||
|
||||
if($settings['ticket']['worktime_sun'] == "0"
|
||||
&& $day == "0")
|
||||
{
|
||||
$supportavailable = 0;
|
||||
}
|
||||
|
||||
if($settings['ticket']['worktime_all'] == "1")
|
||||
{
|
||||
$supportavailable = 1;
|
||||
}
|
||||
|
||||
$ticketsopen = 0;
|
||||
$opentickets = $db->query_first('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
|
||||
WHERE `customerid` = "' . $userinfo['customerid'] . '"
|
||||
AND `answerto` = "0"
|
||||
AND (`status` = "0" OR `status` = "1" OR `status` = "2")');
|
||||
|
||||
if($settings['ticket']['concurrently_open'] != - 1
|
||||
&& $settings['ticket']['concurrently_open'] != '')
|
||||
{
|
||||
$notmorethanxopentickets = strtr($lng['ticket']['notmorethanxopentickets'], array('%s' => $settings['ticket']['concurrently_open']));
|
||||
}
|
||||
else
|
||||
{
|
||||
$notmorethanxopentickets = '';
|
||||
}
|
||||
|
||||
$ticketsopen = (int)$opentickets['count'];
|
||||
eval("echo \"" . getTemplate("ticket/tickets") . "\";");
|
||||
}
|
||||
elseif($action == 'new')
|
||||
{
|
||||
if($userinfo['tickets_used'] < $userinfo['tickets']
|
||||
|| $userinfo['tickets'] == '-1')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$newticket = ticket::getInstanceOf($userinfo, $db, $settings, -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') . "'");
|
||||
$db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '`
|
||||
SET `tickets_used`=`tickets_used`+1 WHERE `customerid`="' . (int)$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 = $db->query_first('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` ORDER BY `logicalorder`, `name` ASC');
|
||||
|
||||
if(isset($result['name'])
|
||||
&& $result['name'] != '')
|
||||
{
|
||||
$result2 = $db->query('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` ORDER BY `logicalorder`, `name` ASC');
|
||||
|
||||
while($row = $db->fetch_array($result2))
|
||||
{
|
||||
$categories.= makeoption($row['name'], $row['id']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$categories = makeoption($lng['ticket']['no_cat'], '0');
|
||||
}
|
||||
|
||||
$priorities = makeoption($lng['ticket']['unf_high'], '1', $settings['ticket']['default_priority']);
|
||||
$priorities.= makeoption($lng['ticket']['unf_normal'], '2', $settings['ticket']['default_priority']);
|
||||
$priorities.= makeoption($lng['ticket']['unf_low'], '3', $settings['ticket']['default_priority']);
|
||||
$ticketsopen = 0;
|
||||
$opentickets = $db->query_first('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
|
||||
WHERE `customerid` = "' . $userinfo['customerid'] . '"
|
||||
AND `answerto` = "0"
|
||||
AND (`status` = "0" OR `status` = "1" OR `status` = "2")');
|
||||
|
||||
if($settings['ticket']['concurrently_open'] != - 1
|
||||
&& $settings['ticket']['concurrently_open'] != '')
|
||||
{
|
||||
$notmorethanxopentickets = strtr($lng['ticket']['notmorethanxopentickets'], array('%s' => $settings['ticket']['concurrently_open']));
|
||||
}
|
||||
else
|
||||
{
|
||||
$notmorethanxopentickets = '';
|
||||
}
|
||||
|
||||
$ticketsopen = (int)$opentickets['count'];
|
||||
eval("echo \"" . getTemplate("ticket/tickets_new") . "\";");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
standard_error('nomoreticketsavailable');
|
||||
}
|
||||
}
|
||||
elseif($action == 'answer'
|
||||
&& $id != 0)
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$replyticket = ticket::getInstanceOf($userinfo, $db, $settings, -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('customerid', (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, $db, $settings, (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, $db, $settings, (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
|
||||
{
|
||||
$by = $lng['ticket']['customer'];
|
||||
}
|
||||
|
||||
$subject = $mainticket->Get('subject');
|
||||
$message = $mainticket->Get('message');
|
||||
eval("\$ticket_replies.=\"" . getTemplate("ticket/tickets_tickets_main") . "\";");
|
||||
$result = $db->query('SELECT `name` FROM `' . TABLE_PANEL_TICKET_CATS . '`
|
||||
WHERE `id`="' . (int)$mainticket->Get('category') . '"');
|
||||
$row = $db->fetch_array($result);
|
||||
$andere = $db->query('SELECT * FROM `' . TABLE_PANEL_TICKETS . '` WHERE `answerto`="' . (int)$id . '" ORDER BY `lastchange` ASC');
|
||||
|
||||
while($row2 = $db->fetch_array($andere))
|
||||
{
|
||||
$subticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$row2['id']);
|
||||
$lastchange = date("d.m.Y H:i\h", $subticket->Get('lastchange'));
|
||||
|
||||
if($subticket->Get('by') == '1')
|
||||
{
|
||||
$by = $lng['ticket']['staff'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$by = $lng['ticket']['customer'];
|
||||
}
|
||||
|
||||
$subject = $subticket->Get('subject');
|
||||
$message = $subticket->Get('message');
|
||||
eval("\$ticket_replies.=\"" . getTemplate("ticket/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 = $mainticket->Get('subject');
|
||||
$ticket_replies_count = $db->num_rows($andere) + 1;
|
||||
|
||||
// don't forget the main-ticket!
|
||||
|
||||
eval("echo \"" . getTemplate("ticket/tickets_reply") . "\";");
|
||||
}
|
||||
}
|
||||
elseif($action == 'close'
|
||||
&& $id != 0)
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$now = time();
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (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, $db, $settings, (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 = $db->query_first('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
|
||||
WHERE `customerid` = "' . $userinfo['customerid'] . '"
|
||||
AND `answerto` = "0"
|
||||
AND (`status` = "0" OR `status` = "1" OR `status` = "2")');
|
||||
$ticketsopen = (int)$opentickets['count'];
|
||||
|
||||
if($ticketsopen > $settings['ticket']['concurrently_open']
|
||||
&& $settings['ticket']['concurrently_open'] != - 1
|
||||
&& $settings['ticket']['concurrently_open'] != '')
|
||||
{
|
||||
standard_error('notmorethanxopentickets', $settings['ticket']['concurrently_open']);
|
||||
}
|
||||
|
||||
$now = time();
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (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));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -14,153 +14,271 @@
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Panel
|
||||
*
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
define('AREA', 'customer');
|
||||
$intrafficpage = 1;
|
||||
require './lib/init.php';
|
||||
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
|
||||
// redirect if this customer page is hidden via settings
|
||||
if (Settings::IsInList('panel.customer_hide_options', 'traffic')) {
|
||||
\Froxlor\UI\Response::redirectTo('customer_index.php');
|
||||
}
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
require ("./lib/init.php");
|
||||
$traffic = '';
|
||||
$month = null;
|
||||
$year = null;
|
||||
|
||||
if (isset($_POST['month']) && isset($_POST['year'])) {
|
||||
if(isset($_POST['month'])
|
||||
&& isset($_POST['year']))
|
||||
{
|
||||
$month = intval($_POST['month']);
|
||||
$year = intval($_POST['year']);
|
||||
} elseif (isset($_GET['month']) && isset($_GET['year'])) {
|
||||
}
|
||||
elseif(isset($_GET['month'])
|
||||
&& isset($_GET['year']))
|
||||
{
|
||||
$month = intval($_GET['month']);
|
||||
$year = intval($_GET['year']);
|
||||
} // BAM! $_GET???
|
||||
elseif (isset($_GET['page']) && $_GET['page'] == 'current') {
|
||||
if (date('d') != '01') {
|
||||
}
|
||||
|
||||
//BAM! $_GET???
|
||||
|
||||
elseif (isset($_GET['page'])
|
||||
&& $_GET['page'] == "current")
|
||||
{
|
||||
if(date('d') != '01')
|
||||
{
|
||||
$month = date('m');
|
||||
$year = date('Y');
|
||||
} else {
|
||||
if (date('m') == '01') {
|
||||
}
|
||||
else
|
||||
{
|
||||
if(date('m') == '01')
|
||||
{
|
||||
$month = 12;
|
||||
$year = date('Y') - 1;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$month = date('m') - 1;
|
||||
$year = date('Y');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! is_null($month) && ! is_null($year)) {
|
||||
if(!is_null($month)
|
||||
&& !is_null($year))
|
||||
{
|
||||
$traf['byte'] = 0;
|
||||
$result_stmt = Database::prepare("SELECT SUM(`http`) as 'http', SUM(`ftp_up`) AS 'ftp_up', SUM(`ftp_down`) as 'ftp_down', SUM(`mail`) as 'mail', `day`, `month`, `year`
|
||||
FROM `" . TABLE_PANEL_TRAFFIC . "`
|
||||
WHERE `customerid`= :customerid
|
||||
AND `month` = :month
|
||||
AND `year` = :year
|
||||
GROUP BY `day`
|
||||
ORDER BY `day` DESC");
|
||||
$params = array(
|
||||
"customerid" => $userinfo['customerid'],
|
||||
"month" => $month,
|
||||
"year" => $year
|
||||
);
|
||||
Database::pexecute($result_stmt, $params);
|
||||
$result = $db->query("SELECT MAX(`http`), MAX(`ftp_up`+`ftp_down`), MAX(`mail`)
|
||||
FROM `" . TABLE_PANEL_TRAFFIC . "`
|
||||
WHERE `customerid`='" . $userinfo['customerid'] . "'
|
||||
AND `month` = '" . $month . "'
|
||||
AND `year` = '" . $year . "'");
|
||||
$row = mysql_fetch_row($result);
|
||||
rsort($row);
|
||||
$traf['max'] = ($row[0] > $row[1] ? ($row[0] > $row[2] ? $row[0] : $row[2]) : ($row[1] > $row[2] ? $row[1] : $row[2]));;
|
||||
$result = $db->query("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 . "`
|
||||
WHERE `customerid`='" . $userinfo['customerid'] . "'
|
||||
AND `month` = '" . $month . "' AND `year` = '" . $year . "'
|
||||
GROUP BY `day` ORDER BY `day` ASC");
|
||||
$traffic_complete['http'] = 0;
|
||||
$traffic_complete['ftp'] = 0;
|
||||
$traffic_complete['mail'] = 0;
|
||||
$show = '';
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$http = $row['http'];
|
||||
$ftp = $row['ftp_up'] + $row['ftp_down'];
|
||||
$mail = $row['mail'];
|
||||
$traf['byte'] = $http + $ftp + $mail;
|
||||
$traffic_complete['http'] += $http;
|
||||
$traffic_complete['ftp'] += $ftp;
|
||||
$traffic_complete['mail'] += $mail;
|
||||
$traf['day'] = $row['day'] . '.';
|
||||
$traffic_complete['http']+= $http;
|
||||
$traffic_complete['ftp']+= $ftp;
|
||||
$traffic_complete['mail']+= $mail;
|
||||
$traf['day'] = $row['day'];
|
||||
|
||||
if (extension_loaded('bcmath')) {
|
||||
$traf['ftptext'] = bcdiv($row['ftp_up'], 1024, Settings::Get('panel.decimal_places')) . " MiB up/ " . bcdiv($row['ftp_down'], 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)";
|
||||
$traf['httptext'] = bcdiv($http, 1024, Settings::Get('panel.decimal_places')) . " MiB (HTTP)";
|
||||
$traf['mailtext'] = bcdiv($mail, 1024, Settings::Get('panel.decimal_places')) . " MiB (Mail)";
|
||||
$traf['ftp'] = bcdiv($ftp, 1024, Settings::Get('panel.decimal_places'));
|
||||
$traf['http'] = bcdiv($http, 1024, Settings::Get('panel.decimal_places'));
|
||||
$traf['mail'] = bcdiv($mail, 1024, Settings::Get('panel.decimal_places'));
|
||||
$traf['byte'] = bcdiv($traf['byte'], 1024, Settings::Get('panel.decimal_places'));
|
||||
} else {
|
||||
$traf['ftptext'] = round($row['ftp_up'] / 1024, Settings::Get('panel.decimal_places')) . " MiB up/ " . round($row['ftp_down'] / 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)";
|
||||
$traf['httptext'] = round($http / 1024, Settings::Get('panel.decimal_places')) . " MiB (HTTP)";
|
||||
$traf['mailtext'] = round($mail / 1024, Settings::Get('panel.decimal_places')) . " MiB (Mail)";
|
||||
$traf['http'] = round($http, Settings::Get('panel.decimal_places'));
|
||||
$traf['ftp'] = round($ftp, Settings::Get('panel.decimal_places'));
|
||||
$traf['mail'] = round($mail, Settings::Get('panel.decimal_places'));
|
||||
$traf['byte'] = round($traf['byte'] / 1024, Settings::Get('panel.decimal_places'));
|
||||
if(extension_loaded('bcmath'))
|
||||
{
|
||||
$traf['ftptext'] = bcdiv($row['ftp_up'], 1024, $settings['panel']['decimal_places']) . " MB up/ " . bcdiv($row['ftp_down'], 1024, $settings['panel']['decimal_places']) . " MB down (FTP)";
|
||||
$traf['httptext'] = bcdiv($http, 1024, $settings['panel']['decimal_places']) . " MB (HTTP)";
|
||||
$traf['mailtext'] = bcdiv($mail, 1024, $settings['panel']['decimal_places']) . " MB (Mail)";
|
||||
}
|
||||
else
|
||||
{
|
||||
$traf['ftptext'] = round($row['ftp_up'] / 1024, $settings['panel']['decimal_places']) . " MB up/ " . round($row['ftp_down'] / 1024, $settings['panel']['decimal_places']) . " MB down (FTP)";
|
||||
$traf['httptext'] = round($http / 1024, $settings['panel']['decimal_places']) . " MB (HTTP)";
|
||||
$traf['mailtext'] = round($mail / 1024, $settings['panel']['decimal_places']) . " MB (Mail)";
|
||||
}
|
||||
|
||||
eval("\$traffic.=\"" . \Froxlor\UI\Template::getTemplate('traffic/traffic_month') . "\";");
|
||||
$show = $lng['traffic']['months'][intval($row['month'])] . ' ' . $row['year'];
|
||||
if($traf['byte'] != 0
|
||||
&& $traf['max'] != 0)
|
||||
{
|
||||
$proz = $traf['max'] / 100;
|
||||
$traf['http'] = round($http / $proz, 0);
|
||||
$traf['ftp'] = round($ftp / $proz, 0);
|
||||
$traf['mail'] = round($mail / $proz, 0);
|
||||
|
||||
if($traf['http'] == 0)
|
||||
{
|
||||
$traf['http'] = 1;
|
||||
}
|
||||
|
||||
if($traf['ftp'] == 0)
|
||||
{
|
||||
$traf['ftp'] = 1;
|
||||
}
|
||||
|
||||
if($traf['mail'] == 0)
|
||||
{
|
||||
$traf['mail'] = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$traf['http'] = 0;
|
||||
$traf['ftp'] = 0;
|
||||
$traf['mail'] = 0;
|
||||
}
|
||||
|
||||
if(extension_loaded('bcmath'))
|
||||
{
|
||||
$traf['byte'] = bcdiv($traf['byte'], 1024, $settings['panel']['decimal_places']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$traf['byte'] = round($traf['byte'] / 1024, $settings['panel']['decimal_places']);
|
||||
}
|
||||
|
||||
eval("\$traffic.=\"" . getTemplate("traffic/traffic_month") . "\";");
|
||||
$show = $lng['traffic']['months'][intval($row['month'])] . " " . $row['year'];
|
||||
}
|
||||
|
||||
$traffic_complete['http'] = \Froxlor\PhpHelper::sizeReadable($traffic_complete['http'] * 1024, 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
|
||||
$traffic_complete['ftp'] = \Froxlor\PhpHelper::sizeReadable($traffic_complete['ftp'] * 1024, 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
|
||||
$traffic_complete['mail'] = \Froxlor\PhpHelper::sizeReadable($traffic_complete['mail'] * 1024, 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
|
||||
if(extension_loaded('bcmath'))
|
||||
{
|
||||
$traffic_complete['http'] = bcdiv($traffic_complete['http'], 1024, $settings['panel']['decimal_places']);
|
||||
$traffic_complete['ftp'] = bcdiv($traffic_complete['ftp'], 1024, $settings['panel']['decimal_places']);
|
||||
$traffic_complete['mail'] = bcdiv($traffic_complete['mail'], 1024, $settings['panel']['decimal_places']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$traffic_complete['http'] = round($traffic_complete['http'] / 1024, $settings['panel']['decimal_places']);
|
||||
$traffic_complete['ftp'] = round($traffic_complete['ftp'] / 1024, $settings['panel']['decimal_places']);
|
||||
$traffic_complete['mail'] = round($traffic_complete['mail'] / 1024, $settings['panel']['decimal_places']);
|
||||
}
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('traffic/traffic_details') . "\";");
|
||||
} else {
|
||||
$result_stmt = Database::prepare("SELECT `month`, `year`, SUM(`http`) AS http, SUM(`ftp_up`) AS ftp_up, SUM(`ftp_down`) AS ftp_down, SUM(`mail`) AS mail
|
||||
FROM `" . TABLE_PANEL_TRAFFIC . "`
|
||||
WHERE `customerid` = :customerid
|
||||
GROUP BY `year` DESC, `month` DESC
|
||||
LIMIT 12");
|
||||
Database::pexecute($result_stmt, array(
|
||||
"customerid" => $userinfo['customerid']
|
||||
));
|
||||
eval("echo \"" . getTemplate("traffic/traffic_details") . "\";");
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $db->query("SELECT MAX(`http`), MAX(`ftp_up`+`ftp_down`), MAX(`mail`)
|
||||
FROM `" . TABLE_PANEL_TRAFFIC . "`
|
||||
WHERE `customerid`='" . $userinfo['customerid'] . "'
|
||||
GROUP BY CONCAT(`year`,`month`) ORDER BY CONCAT(`year`,`month`) DESC LIMIT 12");
|
||||
|
||||
$nums = mysql_num_rows($result);
|
||||
if($nums > 0)
|
||||
{
|
||||
$row = mysql_fetch_row($result);
|
||||
rsort($row);
|
||||
$traf['max'] = ($row[0] > $row[1] ? ($row[0] > $row[2] ? $row[0] : $row[2]) : ($row[1] > $row[2] ? $row[1] : $row[2]));
|
||||
} else {
|
||||
// no records yet
|
||||
$traf['max'] = 0;
|
||||
}
|
||||
|
||||
$result = $db->query("SELECT `month`, `year`, SUM(`http`) AS http, SUM(`ftp_up`) AS ftp_up, SUM(`ftp_down`) AS ftp_down, SUM(`mail`) AS mail
|
||||
FROM `" . TABLE_PANEL_TRAFFIC . "` WHERE `customerid` = '" . $userinfo['customerid'] . "'
|
||||
GROUP BY CONCAT(`year`,`month`) ORDER BY CONCAT(`year`,`month`) DESC LIMIT 12");
|
||||
$traffic_complete['http'] = 0;
|
||||
$traffic_complete['ftp'] = 0;
|
||||
$traffic_complete['mail'] = 0;
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
$http = $row['http'];
|
||||
$ftp_up = $row['ftp_up'];
|
||||
$ftp_down = $row['ftp_down'];
|
||||
$mail = $row['mail'];
|
||||
$traffic_complete['http'] += $http;
|
||||
$traffic_complete['ftp'] += $ftp_up + $ftp_down;
|
||||
$traffic_complete['mail'] += $mail;
|
||||
$traffic_complete['http']+= $http;
|
||||
$traffic_complete['ftp']+= $ftp_up + $ftp_down;
|
||||
$traffic_complete['mail']+= $mail;
|
||||
$traf['month'] = $row['month'];
|
||||
$traf['year'] = $row['year'];
|
||||
$traf['monthname'] = $lng['traffic']['months'][intval($row['month'])] . " " . $row['year'];
|
||||
$traf['byte'] = $http + $ftp_up + $ftp_down + $mail;
|
||||
|
||||
if (extension_loaded('bcmath')) {
|
||||
$traf['ftptext'] = bcdiv($ftp_up, 1024, Settings::Get('panel.decimal_places')) . " MiB up/ " . bcdiv($ftp_down, 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)";
|
||||
$traf['httptext'] = bcdiv($http, 1024, Settings::Get('panel.decimal_places')) . " MiB (HTTP)";
|
||||
$traf['mailtext'] = bcdiv($mail, 1024, Settings::Get('panel.decimal_places')) . " MiB (Mail)";
|
||||
$traf['ftp'] = bcdiv(($ftp_up + $ftp_down), 1024, Settings::Get('panel.decimal_places'));
|
||||
$traf['http'] = bcdiv($http, 1024, Settings::Get('panel.decimal_places'));
|
||||
$traf['mail'] = bcdiv($mail, 1024, Settings::Get('panel.decimal_places'));
|
||||
$traf['byte'] = bcdiv($traf['byte'], 1024 * 1024, Settings::Get('panel.decimal_places'));
|
||||
} else {
|
||||
$traf['ftptext'] = round($ftp_up / 1024, Settings::Get('panel.decimal_places')) . " MiB up/ " . round($ftp_down / 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)";
|
||||
$traf['httptext'] = round($http / 1024, Settings::Get('panel.decimal_places')) . " MiB (HTTP)";
|
||||
$traf['mailtext'] = round($mail / 1024, Settings::Get('panel.decimal_places')) . " MiB (Mail)";
|
||||
$traf['ftp'] = round(($ftp_up + $ftp_down) / 1024, Settings::Get('panel.decimal_places'));
|
||||
$traf['http'] = round($http / 1024, Settings::Get('panel.decimal_places'));
|
||||
$traf['mail'] = round($mail / 1024, Settings::Get('panel.decimal_places'));
|
||||
$traf['byte'] = round($traf['byte'] / (1024 * 1024), Settings::Get('panel.decimal_places'));
|
||||
if(extension_loaded('bcmath'))
|
||||
{
|
||||
$traf['ftptext'] = bcdiv($ftp_up, 1024 * 1024, $settings['panel']['decimal_places']) . " GB up/ " . bcdiv($ftp_down, 1024 * 1024, $settings['panel']['decimal_places']) . " GB down (FTP)";
|
||||
$traf['httptext'] = bcdiv($http, 1024 * 1024, $settings['panel']['decimal_places']) . " GB (HTTP)";
|
||||
$traf['mailtext'] = bcdiv($mail, 1024 * 1024, $settings['panel']['decimal_places']) . " GB (Mail)";
|
||||
}
|
||||
else
|
||||
{
|
||||
$traf['ftptext'] = round($ftp_up / 1024 * 1024, $settings['panel']['decimal_places']) . " GB up/ " . round($ftp_down / 1024 * 1024, $settings['panel']['decimal_places']) . " GB down (FTP)";
|
||||
$traf['httptext'] = round($http / 1024 * 1024, $settings['panel']['decimal_places']) . " GB (HTTP)";
|
||||
$traf['mailtext'] = round($mail / 1024 * 1024, $settings['panel']['decimal_places']) . " GB (Mail)";
|
||||
}
|
||||
|
||||
eval("\$traffic.=\"" . \Froxlor\UI\Template::getTemplate('traffic/traffic_traffic') . "\";");
|
||||
if($traf['max'] != 0)
|
||||
{
|
||||
$proz = $traf['max'] / 100;
|
||||
$traf['ftp'] = round(($ftp_up + $ftp_down) / $proz, 0);
|
||||
$traf['http'] = round($http / $proz, 0);
|
||||
$traf['mail'] = round($mail / $proz, 0);
|
||||
|
||||
if($traf['http'] == 0)
|
||||
{
|
||||
$traf['http'] = 1;
|
||||
}
|
||||
|
||||
if($traf['ftp'] == 0)
|
||||
{
|
||||
$traf['ftp'] = 1;
|
||||
}
|
||||
|
||||
if($traf['mail'] == 0)
|
||||
{
|
||||
$traf['mail'] = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$traf['ftp'] = 0;
|
||||
$traf['http'] = 0;
|
||||
$traf['mail'] = 0;
|
||||
}
|
||||
|
||||
if(extension_loaded('bcmath'))
|
||||
{
|
||||
$traf['byte'] = bcadd($traf['byte'] / (1024 * 1024), 0.0000, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
$traf['byte'] = round($traf['byte'] + (1024 * 1024), 4);
|
||||
}
|
||||
|
||||
eval("\$traffic.=\"" . getTemplate("traffic/traffic_traffic") . "\";");
|
||||
}
|
||||
|
||||
$traffic_complete['http'] = \Froxlor\PhpHelper::sizeReadable($traffic_complete['http'] * 1024, 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
|
||||
$traffic_complete['ftp'] = \Froxlor\PhpHelper::sizeReadable($traffic_complete['ftp'] * 1024, 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
|
||||
$traffic_complete['mail'] = \Froxlor\PhpHelper::sizeReadable($traffic_complete['mail'] * 1024, 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
|
||||
if(extension_loaded('bcmath'))
|
||||
{
|
||||
$traffic_complete['http'] = bcdiv($traffic_complete['http'], 1024 * 1024, $settings['panel']['decimal_places']);
|
||||
$traffic_complete['ftp'] = bcdiv($traffic_complete['ftp'], 1024 * 1024, $settings['panel']['decimal_places']);
|
||||
$traffic_complete['mail'] = bcdiv($traffic_complete['mail'], 1024 * 1024, $settings['panel']['decimal_places']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$traffic_complete['http'] = round($traffic_complete['http'] / 1024 * 1024, $settings['panel']['decimal_places']);
|
||||
$traffic_complete['ftp'] = round($traffic_complete['ftp'] / 1024 * 1024, $settings['panel']['decimal_places']);
|
||||
$traffic_complete['mail'] = round($traffic_complete['mail'] / 1024 * 1024, $settings['panel']['decimal_places']);
|
||||
}
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('traffic/traffic') . "\";");
|
||||
eval("echo \"" . getTemplate("traffic/traffic") . "\";");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
139
dns_editor.php
@@ -1,139 +0,0 @@
|
||||
<?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\Database\Database;
|
||||
use Froxlor\Api\Commands\DomainZones as DomainZones;
|
||||
|
||||
// This file is being included in admin_domains and customer_domains
|
||||
// and therefore does not need to require lib/init.php
|
||||
|
||||
$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);
|
||||
|
||||
// select all entries
|
||||
$sel_stmt = Database::prepare("SELECT * FROM `" . TABLE_DOMAIN_DNS . "` WHERE domain_id = :did");
|
||||
Database::pexecute($sel_stmt, array(
|
||||
'did' => $domain_id
|
||||
));
|
||||
$dom_entries = $sel_stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
$errors = "";
|
||||
$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'];
|
||||
} catch (Exception $e) {
|
||||
\Froxlor\UI\Response::dynamic_error($e->getMessage());
|
||||
}
|
||||
} elseif ($action == 'delete') {
|
||||
// remove entry
|
||||
$entry_id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
|
||||
if ($entry_id > 0) {
|
||||
try {
|
||||
DomainZones::getLocal($userinfo, array(
|
||||
'entry_id' => $entry_id,
|
||||
'id' => $domain_id
|
||||
))->delete();
|
||||
} catch (Exception $e) {
|
||||
$errors = str_replace("\n", "<br>", $e->getMessage());
|
||||
}
|
||||
|
||||
if (empty($errors)) {
|
||||
// remove deleted entry from internal data array (no reread of DB necessary)
|
||||
$_t = $dom_entries;
|
||||
foreach ($_t as $idx => $entry) {
|
||||
if ($entry['id'] == $entry_id) {
|
||||
unset($dom_entries[$idx]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
unset($_t);
|
||||
// success message (inline)
|
||||
$success_message = $lng['success']['dns_record_deleted'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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) . "\";");
|
||||
@@ -1,213 +0,0 @@
|
||||
<?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
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
<?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"
|
||||
[...]
|
||||
*/
|
||||
@@ -1,22 +0,0 @@
|
||||
<?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);
|
||||
BIN
images/ball.gif
Normal file
|
After Width: | Height: | Size: 51 B |
BIN
images/changelanguage.gif
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
images/default.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
images/endsection.gif
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
images/error.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
images/error.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
images/footer.gif
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
images/header.gif
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
images/header_r.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
images/info.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
images/login.gif
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
images/logininternal.gif
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
images/order_asc.gif
Normal file
|
After Width: | Height: | Size: 62 B |
BIN
images/order_desc.gif
Normal file
|
After Width: | Height: | Size: 60 B |
BIN
images/section.gif
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
images/shadow.gif
Normal file
|
After Width: | Height: | Size: 86 B |
BIN
images/subsection.gif
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
images/title.gif
Normal file
|
After Width: | Height: | Size: 69 B |
BIN
images/traffic_blue.gif
Normal file
|
After Width: | Height: | Size: 66 B |
BIN
images/traffic_green.gif
Normal file
|
After Width: | Height: | Size: 82 B |