Compare commits

...

51 Commits

Author SHA1 Message Date
Michael Kaufmann (d00p)
3b8b973926 Tagging version 0.9.17 2011-01-26 07:24:50 +00:00
Michael Kaufmann (d00p)
f77ddac4ed set version to 0.9.17 for upcoming release 2011-01-25 06:23:31 +00:00
Michael Kaufmann (d00p)
932e1f95c5 fix maxlength of textbox in admin:edit, fixes #559 2011-01-19 06:28:48 +00:00
Michael Kaufmann (d00p)
a8b52d50af - prework for docroot-settings-extension, refs #533 2011-01-18 07:18:28 +00:00
Michael Kaufmann (d00p)
f10f63b6be add missing language-string for database_edit, fixes #554 2011-01-16 11:58:24 +00:00
Michael Kaufmann (d00p)
c5cdd9f567 - fix minor issues diskspace-usage-report, refs #466
- show current year for copyright in footer
2011-01-14 07:31:01 +00:00
Michael Kaufmann (d00p)
e5b2fd90c0 Add "Notification mail for customers when 90% percent of disk space is exhausted", fixes #466 2011-01-14 07:09:53 +00:00
Michael Kaufmann (d00p)
f7b43f470f remove double $$, fixes #552 2011-01-13 11:43:40 +00:00
Michael Kaufmann (d00p)
515e542179 - localize path setting (dropdown/manual), thx to arnoldB, fixes #547
- include diskusage- (todo) and traffic-report cron, refs #466, fixes #153
- allow customzing of warning-level in percent for diskusage- and traffic-report cron, refs #466
2011-01-11 08:40:59 +00:00
Michael Kaufmann (d00p)
cc4637095d respect ssl_redirect setting for domains, fixes #542 2011-01-09 16:25:32 +00:00
Michael Kaufmann (d00p)
bffa8817d9 ftp user cannot be edited, fixes #337 2011-01-09 13:44:10 +00:00
Michael Kaufmann (d00p)
98b82ed0c6 improve behavior of ssl-redirect, fixes #541 2011-01-08 11:58:14 +00:00
Michael Kaufmann (d00p)
4f52982a7e more fixes for freebsd (more to follow) 2011-01-07 19:22:24 +00:00
Michael Kaufmann (d00p)
1edba0c368 +mailbox_size_limit = 0 for FreeBSD-postfix 2011-01-07 18:33:14 +00:00
Michael Kaufmann (d00p)
06983ca382 some freebsd-config enhancements, fixes #537 2011-01-06 09:37:49 +00:00
Michael Kaufmann (d00p)
c53ef5b96e fix libnss-nsswitch.conf for FreeBSD, fixes 538 2011-01-06 09:17:25 +00:00
Michael Kaufmann (d00p)
a2b7f98332 add missing 'description' field to sql-query to avoid undefined index in resultset, thx to adlerweb 2011-01-04 21:27:09 +00:00
Michael Kaufmann (d00p)
c25ad76200 remove unnecessary variable $entry in error-message in autoresponder, thx to monotek for finding thi 2011-01-04 20:16:25 +00:00
Florian Aders (EleRas)
7057984534 remove now unneeded inserttasks, refs #535 2011-01-04 11:41:44 +00:00
Florian Aders (EleRas)
02a4fd4e1d Rebuild configurations after a setting is changed, fixes #535 2011-01-04 11:39:04 +00:00
Michael Kaufmann (d00p)
57ec429776 settings version for upcoming release 2010-12-28 11:07:40 +00:00
Andreas Burchert (scarya)
c52d3819af - forgot some update queries from early installations (regarding #529) 2010-12-25 23:36:26 +00:00
Andreas Burchert (scarya)
85f35abe2d - changed sql query to work with version <= 5.5 (fixes #529)
- added php-xml extension check ti installation (fixes #530)
-> thanks to lando
2010-12-25 22:43:42 +00:00
Michael Kaufmann (d00p)
58674a2f8f - fix possible undefined variable 2010-12-22 13:10:12 +00:00
Michael Kaufmann (d00p)
968137a967 - use php symlink to binary, fixes #526 2010-12-22 12:47:31 +00:00
Michael Kaufmann (d00p)
66b274c1bf - fine-tune php-fpm-config, create tmp-folder if not exists, refs #524 2010-12-21 13:15:26 +00:00
Michael Kaufmann (d00p)
b9d68a17fa fix deletion of htpasswd/diroption files if no more htpasswds/diroptions are in the database 2010-12-21 10:55:08 +00:00
Michael Kaufmann (d00p)
ced64138e8 fix order of variables in configuration-path, fixes #521 2010-12-17 22:28:28 +00:00
Michael Kaufmann (d00p)
4fdaed5cc4 fix 'new' fcgid path for froxlor's own vhost php-fcgi-starter 2010-12-14 21:19:52 +00:00
Michael Kaufmann (d00p)
0fd11afdcb use makeCorrectDir() to output sane path 2010-12-10 12:16:03 +00:00
Michael Kaufmann (d00p)
8202cc96e7 - fixed double-declaration of variable causing nginx-cron to fail on mysql_fetch_array() for htpasswd-entries, fixes #516 2010-12-09 11:49:07 +00:00
Michael Kaufmann (d00p)
59bf7ba22f - restore still used settings in 120.system.php
- check for $createifnotexists in phpinterface_* classes
2010-12-07 11:08:41 +00:00
Michael Kaufmann (d00p)
9c075c05f5 - don't create standard-openbasedir config for froxlor-panel vhost 2010-12-06 09:17:48 +00:00
Michael Kaufmann (d00p)
6815501c1d - use local-username for froxlor in fpm-config, because froxlor.panel is only the directory/loginname 2010-12-06 09:00:53 +00:00
Michael Kaufmann (d00p)
f11aa9a1c4 - forgot to save lighttpd_fcgid-class with own-vhost settings for php-fpm 2010-12-06 08:56:39 +00:00
Michael Kaufmann (d00p)
3b33dde9ac add language-strings for php-fpm settings 2010-12-06 08:49:24 +00:00
Michael Kaufmann (d00p)
7fb0e88313 - implement php-fpm for Froxlor-vhost, fixes #505 2010-12-06 07:38:55 +00:00
Michael Kaufmann (d00p)
9615aaa83a update dutch language file, thx to Frits Letteboer, fixes #506 2010-12-05 17:18:24 +00:00
Michael Kaufmann (d00p)
16cc53146c replace correct line-break when sending forgotten password, fixes #507 2010-12-05 17:15:24 +00:00
Michael Kaufmann (d00p)
56e9f748f4 beautify update (forgot one status-output) 2010-12-03 11:15:58 +00:00
Michael Kaufmann (d00p)
80e338610f don't allow activation of FCGID and PHP-FPM at the same time 2010-12-03 10:41:12 +00:00
Michael Kaufmann (d00p)
93abbf4a10 - hide php-reload and php-backend-server setting if nginx is used with php-fpm (useless settings) 2010-12-03 10:20:49 +00:00
Michael Kaufmann (d00p)
0271ccfc28 - outsource fcgid/php-fpm configurations/file-creations/etc 2010-12-03 09:23:40 +00:00
Michael Kaufmann (d00p)
dae3e416a2 - include nginx_phpfpm cron in cron_tasks.php
- show parts of fcgid also when lighttpd is used
2010-12-03 08:58:44 +00:00
Michael Kaufmann (d00p)
759213f8b9 add extra configuration for Apache + PHP-FPM, fixes #482 2010-12-02 12:51:14 +00:00
Michael Kaufmann (d00p)
01b313a3ce merged php-fpm branch 2010-12-02 12:15:58 +00:00
Michael Kaufmann (d00p)
4567f7c781 only call validatePassword() when creating a customer if the password is not empty, cause otherwise no random password can be generated if field is left empty 2010-12-02 09:52:56 +00:00
Michael Kaufmann (d00p)
ef76635508 added missing language-definitions for integer-validation 2010-12-02 08:25:01 +00:00
Michael Kaufmann (d00p)
30235ff3eb don't show settings which are not needed for used webserver, fixes #502 2010-12-02 08:18:46 +00:00
Michael Kaufmann (d00p)
ebb390a1fd fix false initialization of variable (wrong variable name) 2010-11-30 10:45:51 +00:00
Michael Kaufmann (d00p)
0c1a4f692a fix password_query for dovecot when sending e-mail, fixes #500 2010-11-30 07:50:49 +00:00
70 changed files with 3550 additions and 827 deletions

View File

@@ -64,7 +64,7 @@ return array(
'type' => 'option',
'default' => 'Manual',
'option_mode' => 'one',
'option_options' => array('Manual' => 'Manual', 'Dropdown' => 'Dropdown'),
'option_options' => array('Manual' => $lng['serversettings']['manual'], 'Dropdown' => $lng['serversettings']['dropdown']),
'save_method' => 'storeSettingField',
),
'panel_adminmail' => array(

View File

@@ -29,6 +29,7 @@ return array(
'type' => 'string',
'default' => '/var/customers/webs/',
'save_method' => 'storeSettingField',
'plausibility_check_method' => 'checkPathConflicts'
),
'system_ipaddress' => array(
'label' => $lng['serversettings']['ipaddress'],
@@ -58,6 +59,22 @@ return array(
'default' => '',
'save_method' => 'storeSettingHostname',
),
'system_froxlordirectlyviahostname' => array(
'label' => $lng['serversettings']['froxlordirectlyviahostname'],
'settinggroup' => 'system',
'varname' => 'froxlordirectlyviahostname',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'system_stdsubdomain' => array(
'label' => $lng['serversettings']['stdsubdomainhost'],
'settinggroup' => 'system',
'varname' => 'stdsubdomain',
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingHostname',
),
'system_mysql_access_host' => array(
'label' => $lng['serversettings']['mysql_access_host'],
'settinggroup' => 'system',
@@ -96,6 +113,35 @@ return array(
'type' => 'hidden',
'default' => 'www-data',
),
'system_report_enable' => array(
'label' => $lng['serversettings']['report']['report'],
'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' => 1,
'int_max' => 99,
'default' => 90,
'save_method' => 'storeSettingField',
),
'system_report_trafficmax' => array(
'label' => $lng['serversettings']['report']['trafficmax'],
'settinggroup' => 'system',
'varname' => 'report_trafficmax',
'type' => 'int',
'int_min' => 1,
'int_max' => 99,
'default' => 90,
'save_method' => 'storeSettingField',
),
'system_debug_cron' => array(
'label' => $lng['serversettings']['cron']['debug'],
'settinggroup' => 'system',

View File

@@ -76,38 +76,6 @@ return array(
'default' => '/etc/apache2/htpasswd/',
'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_phpreload_command' => array(
'label' => $lng['serversettings']['phpreload_command'],
'settinggroup' => 'system',
'varname' => 'phpreload_command',
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
),
'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',
),
'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',
@@ -144,6 +112,41 @@ return array(
'default' => '',
'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_phpreload_command' => array(
'label' => $lng['serversettings']['phpreload_command'],
'settinggroup' => 'system',
'varname' => 'phpreload_command',
'type' => (getSetting('phpfpm', 'enabled') == '1') ? 'hidden' : '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' => (getSetting('phpfpm', 'enabled') == '1') ? 'hidden' : 'string',
'default' => '127.0.0.1:8888',
'save_method' => 'storeSettingField',
'websrv_avail' => array('nginx')
),
'system_mod_log_sql' => array(
'label' => $lng['serversettings']['mod_log_sql'],
'settinggroup' => 'system',
'varname' => 'mod_log_sql',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'defaultwebsrverrhandler_enabled' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_enabled'],
'settinggroup' => 'defaultwebsrverrhandler',
@@ -159,6 +162,7 @@ return array(
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2', 'nginx')
),
'defaultwebsrverrhandler_err403' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_err403'],
@@ -167,6 +171,7 @@ return array(
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2', 'nginx')
),
'defaultwebsrverrhandler_err404' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_err404'],
@@ -183,6 +188,7 @@ return array(
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2', 'nginx')
),
'customredirect_enabled' => array(
'label' => $lng['serversettings']['customredirect_enabled'],
@@ -191,6 +197,7 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2', 'lighttpd')
),
'customredirect_default' => array(
'label' => $lng['serversettings']['customredirect_default'],
@@ -201,6 +208,7 @@ return array(
'option_mode' => 'one',
'option_options_method' => 'getRedirectCodes',
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2', 'lighttpd')
),
),
),

View File

@@ -19,6 +19,7 @@ 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'],
@@ -27,6 +28,7 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'plausibility_check_method' => 'checkFcgidPhpFpm',
'overview_option' => true
),
'system_mod_fcgid_configdir' => array(
@@ -67,6 +69,7 @@ return array(
'option_options' => array(0 => 'ScriptAlias', 1=> 'FCGIWrapper'),
'default' => 1,
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'system_mod_fcgid_starter' => array(
'label' => $lng['serversettings']['mod_fcgid']['starter'],
@@ -101,6 +104,7 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'system_mod_fcgid_httpuser' => array(
'label' => $lng['admin']['mod_fcgid_user'],
@@ -109,6 +113,7 @@ return array(
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'system_mod_fcgid_httpgroup' => array(
'label' => $lng['admin']['mod_fcgid_group'],
@@ -117,6 +122,7 @@ return array(
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'system_mod_fcgid_defaultini_ownvhost' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'],
@@ -127,6 +133,7 @@ return array(
'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs',
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
)
)

View File

@@ -0,0 +1,161 @@
<?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
* @version $Id$
*/
return array(
'groups' => array(
'phpfpm' => array(
'title' => $lng['admin']['phpfpm_settings'],
'fields' => array(
'system_phpfpm_enabled' => array(
'label' => $lng['serversettings']['phpfpm'],
'settinggroup' => 'phpfpm',
'varname' => 'enabled',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'plausibility_check_method' => 'checkFcgidPhpFpm',
'overview_option' => true
),
'system_phpfpm_enabled_ownvhost' => array(
'label' => $lng['phpfpm']['ownvhost'],
'settinggroup' => 'phpfpm',
'varname' => 'enabled_ownvhost',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
),
'system_phpfpm_httpuser' => array(
'label' => $lng['phpfpm']['vhost_httpuser'],
'settinggroup' => 'phpfpm',
'varname' => 'vhost_httpuser',
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingField'
),
'system_phpfpm_httpgroup' => array(
'label' => $lng['phpfpm']['vhost_httpgroup'],
'settinggroup' => 'phpfpm',
'varname' => 'vhost_httpgroup',
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingField'
),
/*
* @TODO implement if phpfpm knows custom php.ini files
*
'system_phpfpm_defaultini_ownvhost' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'],
'settinggroup' => 'phpfpm',
'varname' => 'vhost_defaultini',
'type' => 'option',
'default' => '1',
'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs',
'save_method' => 'storeSettingField',
),
*/
'system_phpfpm_configdir' => array(
'label' => $lng['serversettings']['phpfpm_settings']['configdir'],
'settinggroup' => 'phpfpm',
'varname' => 'configdir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/etc/php-fpm.d/',
'save_method' => 'storeSettingField',
),
'system_phpfpm_tmpdir' => array(
'label' => $lng['serversettings']['mod_fcgid']['tmpdir'],
'settinggroup' => 'phpfpm',
'varname' => 'tmpdir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/customers/tmp/',
'save_method' => 'storeSettingField',
),
'system_phpfpm_peardir' => array(
'label' => $lng['serversettings']['mod_fcgid']['peardir'],
'settinggroup' => 'phpfpm',
'varname' => 'peardir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/usr/share/php/:/usr/share/php5/',
'save_method' => 'storeSettingField',
),
'system_phpfpm_reload' => array(
'label' => $lng['serversettings']['phpfpm_settings']['reload'],
'settinggroup' => 'phpfpm',
'varname' => 'reload',
'type' => 'string',
'default' => '/etc/init.d/php-fpm restart',
'save_method' => 'storeSettingField',
),
'system_phpfpm_pm' => array(
'label' => $lng['serversettings']['phpfpm_settings']['pm'],
'settinggroup' => 'phpfpm',
'varname' => 'pm',
'type' => 'option',
'default' => 'static',
'option_mode' => 'one',
'option_options' => array('static' => 'static', 'dynamic' => 'dynamic'),
'save_method' => 'storeSettingField',
),
'system_phpfpm_max_children' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_children'],
'settinggroup' => 'phpfpm',
'varname' => 'max_children',
'type' => 'int',
'default' => 1,
'save_method' => 'storeSettingField',
),
'system_phpfpm_start_servers' => array(
'label' => $lng['serversettings']['phpfpm_settings']['start_servers'],
'settinggroup' => 'phpfpm',
'varname' => 'start_servers',
'type' => 'int',
'default' => 20,
'save_method' => 'storeSettingField',
),
'system_phpfpm_min_spare_servers' => array(
'label' => $lng['serversettings']['phpfpm_settings']['min_spare_servers'],
'settinggroup' => 'phpfpm',
'varname' => 'min_spare_servers',
'type' => 'int',
'default' => 5,
'save_method' => 'storeSettingField',
),
'system_phpfpm_max_spare_servers' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_spare_servers'],
'settinggroup' => 'phpfpm',
'varname' => 'max_spare_servers',
'type' => 'int',
'default' => 35,
'save_method' => 'storeSettingField',
),
'system_phpfpm_max_requests' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_requests'],
'settinggroup' => 'phpfpm',
'varname' => 'max_requests',
'type' => 'int',
'default' => 0,
'save_method' => 'storeSettingField',
),
),
),
),
);
?>

View File

@@ -27,6 +27,7 @@ return array(
'type' => 'string',
'default' => '/usr/bin/perl',
'save_method' => 'storeSettingField',
'websrv_avail' => array('lighttpd')
),
'system_perl_suexecworkaround' => array(
'label' => $lng['serversettings']['perl']['suexecworkaround'],
@@ -35,6 +36,7 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'system_perl_suexeccgipath' => array(
'label' => $lng['serversettings']['perl']['suexeccgipath'],
@@ -43,6 +45,7 @@ return array(
'type' => 'string',
'default' => '/var/www/cgi-bin/',
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'perl_server' => array(
'label' => $lng['serversettings']['perl_server'],
@@ -51,6 +54,7 @@ return array(
'type' => 'string',
'default' => 'unix:/var/run/nginx/cgiwrap-dispatch.sock',
'save_method' => 'storeSettingField',
'websrv_avail' => array('nginx')
),
),
),

View File

@@ -474,7 +474,12 @@ if($page == 'customers'
$createstdsubdomain = intval($_POST['createstdsubdomain']);
$password = validate($_POST['new_customer_password'], 'password');
$password = validatePassword($password);
// only check if not empty,
// cause empty == generate password automatically
if($password != '')
{
$password = validatePassword($password);
}
$sendpassword = intval($_POST['sendpassword']);
$phpenabled = intval($_POST['phpenabled']);
$perlenabled = intval($_POST['perlenabled']);

View File

@@ -75,6 +75,10 @@ if(($page == 'settings' || $page == 'overview')
$only_enabledisable
)
) {
$log->logAction(ADM_ACTION, LOG_INFO, "rebuild configfiles due to changed setting");
inserttask('1');
inserttask('4');
inserttask('5');
standard_success('settingssaved', '', array('filename' => $filename, 'action' => $action, 'page' => $page));
}
}
@@ -214,4 +218,4 @@ elseif($page == 'enforcequotas'
{
ask_yesno('admin_quotas_reallyenforce', $filename, array('page' => $page));
}
}
}

View File

@@ -48,7 +48,8 @@ elseif(isset($_GET['id']))
$available_templates = array(
'createcustomer',
'pop_success',
'trafficninetypercent',
'trafficmaxpercent',
'diskmaxpercent',
'new_ticket_by_customer',
'new_ticket_for_customer',
'new_ticket_by_staff',

View File

@@ -195,7 +195,7 @@ elseif($page == 'accounts')
$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("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'] . "'");
@@ -250,13 +250,24 @@ elseif($page == 'accounts')
if($settings['customer']['ftpatdomain'] == '1')
{
$domainlist = array();
$domains = '';
$result_domains = $db->query("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
while($row_domain = $db->fetch_array($result_domains))
{
$domains.= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['domain']);
$domainlist[] = $row_domain['domain'];
}
sort($domainlist);
if(isset($domainlist[0]) && $domainlist[0] != '')
{
foreach($domainlist as $dom)
{
$domains .= makeoption($idna_convert->decode($dom), $dom);
}
}
}

View File

@@ -80,7 +80,7 @@ elseif($page == '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 . '"');
$result = $db->query_first('SELECT `id`, `databasename`, `description`, `dbserver` FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . (int)$userinfo['customerid'] . '" AND `id`="' . (int)$id . '"');
if(isset($result['databasename'])
&& $result['databasename'] != '')
@@ -127,7 +127,7 @@ elseif($page == 'mysqls')
else
{
$dbnamedesc = $result['databasename'];
if($result['description'] != '') {
if(isset($result['description']) && $result['description'] != '') {
$dbnamedesc.= ' ('.$result['description'].')';
}
ask_yesno('mysql_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $dbnamedesc);
@@ -313,4 +313,4 @@ elseif($page == 'mysqls')
}
}
?>
?>

View File

@@ -336,7 +336,7 @@ if($action == 'forgotpwd')
try {
$mail->Subject = $mail_subject;
$mail->AltBody = $mail_body;
$mail->MsgHTML(str_replace("\\n", "<br />", $mail_body));
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
$mail->AddAddress($user['email'], $user['firstname'] . ' ' . $user['name']);
$mail->Send();
} catch(phpmailerException $e) {

View File

@@ -15,7 +15,7 @@ CREATE TABLE `ftp_groups` (
PRIMARY KEY (`id`),
UNIQUE KEY `groupname` (`groupname`),
KEY `customerid` (`customerid`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `ftp_groups`
@@ -48,7 +48,7 @@ CREATE TABLE `ftp_users` (
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`),
KEY `customerid` (`customerid`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `ftp_users`
@@ -80,7 +80,7 @@ CREATE TABLE `mail_users` (
`imap` tinyint(1) NOT NULL default '1',
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `mail_users`
@@ -105,7 +105,7 @@ CREATE TABLE `mail_virtual` (
`iscatchall` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `email` (`email`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `mail_virtual`
@@ -168,7 +168,7 @@ CREATE TABLE `panel_admins` (
`email_autoresponder_used` int(5) NOT NULL default '0',
PRIMARY KEY (`adminid`),
UNIQUE KEY `loginname` (`loginname`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
# --------------------------------------------------------
@@ -234,7 +234,7 @@ CREATE TABLE `panel_customers` (
`email_autoresponder_used` int(5) NOT NULL default '0',
PRIMARY KEY (`customerid`),
UNIQUE KEY `loginname` (`loginname`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_customers`
#
@@ -256,7 +256,7 @@ CREATE TABLE `panel_databases` (
`apsdb` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `customerid` (`customerid`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_databases`
@@ -310,7 +310,7 @@ CREATE TABLE `panel_domains` (
KEY `customerid` (`customerid`),
KEY `parentdomain` (`parentdomainid`),
KEY `domain` (`domain`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_domains`
@@ -340,7 +340,7 @@ CREATE TABLE `panel_ipsandports` (
`ssl_cert_chainfile` varchar(255) NOT NULL,
`docroot` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_ipsandports`
@@ -366,7 +366,7 @@ CREATE TABLE `panel_htaccess` (
`error401path` varchar(255) NOT NULL default '',
`options_cgi` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_htaccess`
@@ -389,7 +389,7 @@ CREATE TABLE `panel_htpasswds` (
`authname` varchar(255) NOT NULL default 'Restricted Area',
PRIMARY KEY (`id`),
KEY `customerid` (`customerid`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_htpasswds`
@@ -435,7 +435,7 @@ CREATE TABLE `panel_settings` (
`varname` varchar(255) NOT NULL default '',
`value` text NOT NULL,
PRIMARY KEY (`settingid`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
# --------------------------------------------------------
@@ -462,7 +462,7 @@ INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) V
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (18, 'system', 'vmail_homedir', '/var/customers/mail/');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (19, 'system', 'bindconf_directory', '/etc/bind/');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (20, 'system', 'bindreload_command', '/etc/init.d/bind9 reload');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '0.9.15');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (22, 'panel', 'version', '0.9.17');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (23, 'system', 'hostname', 'SERVERNAME');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (24, 'login', 'maxloginattempts', '3');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (25, 'login', 'deactivatetime', '900');
@@ -597,6 +597,23 @@ INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) V
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (156, 'system', 'nginx_php_backend', '127.0.0.1:8888');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (157, 'system', 'perl_server', 'unix:/var/run/nginx/cgiwrap-dispatch.sock');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (158, 'system', 'phpreload_command', '');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (159, 'phpfpm', 'enabled', '0');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (160, 'phpfpm', 'configdir', '/etc/php-fpm.d/');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (161, 'phpfpm', 'reload', '/etc/init.d/php-fpm restart');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (162, 'phpfpm', 'pm', 'static');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (163, 'phpfpm', 'max_children', '1');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (164, 'phpfpm', 'start_servers', '20');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (165, 'phpfpm', 'min_spare_servers', '5');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (166, 'phpfpm', 'max_spare_servers', '35');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (167, 'phpfpm', 'max_requests', '0');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (168, 'phpfpm', 'tmpdir', '/var/customers/tmp/');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (169, 'phpfpm', 'peardir', '/usr/share/php/:/usr/share/php5/');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (170, 'phpfpm', 'enabled_ownvhost', '0');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (171, 'phpfpm', 'vhost_httpuser', 'froxlorlocal');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (172, 'phpfpm', 'vhost_httpgroup', 'froxlorlocal');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (173, 'system', 'report_enable', '1');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (174, 'system', 'report_webmax', '90');
INSERT INTO `panel_settings` (`settingid`, `settinggroup`, `varname`, `value`) VALUES (175, 'system', 'report_trafficmax', '90');
# --------------------------------------------------------
@@ -610,7 +627,7 @@ CREATE TABLE `panel_tasks` (
`type` int(11) NOT NULL default '0',
`data` text NOT NULL,
PRIMARY KEY (`id`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_tasks`
@@ -633,7 +650,7 @@ CREATE TABLE `panel_templates` (
`value` longtext NOT NULL,
PRIMARY KEY (id),
KEY adminid (adminid)
) TYPE=MyISAM;
) ENGINE=MyISAM;
#
# Dumping data for table `panel_templates`
@@ -660,7 +677,7 @@ CREATE TABLE `panel_traffic` (
`mail` bigint(30) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `customerid` (`customerid`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_traffic`
@@ -687,7 +704,7 @@ CREATE TABLE `panel_traffic_admins` (
`mail` bigint(30) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `adminid` (`adminid`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_traffic_admins`
@@ -713,7 +730,7 @@ CREATE TABLE `panel_diskspace` (
`mysql` bigint(30) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `customerid` (`customerid`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_diskspace`
@@ -738,7 +755,7 @@ CREATE TABLE `panel_diskspace_admins` (
`mysql` bigint(30) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `adminid` (`adminid`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_diskspace_admins`
@@ -756,7 +773,7 @@ CREATE TABLE `panel_languages` (
`language` varchar(30) NOT NULL default '',
`file` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM ;
) ENGINE=MyISAM ;
#
# Dumping data for table `panel_languages`
@@ -1005,6 +1022,7 @@ INSERT INTO `cronjobs_run` (`id`, `module`, `cronfile`, `interval`, `isactive`,
INSERT INTO `cronjobs_run` (`id`, `module`, `cronfile`, `interval`, `isactive`, `desc_lng_key`) VALUES (5, 'froxlor/core', 'cron_traffic.php', '1 DAY', '1', 'cron_traffic');
INSERT INTO `cronjobs_run` (`id`, `module`, `cronfile`, `interval`, `isactive`, `desc_lng_key`) VALUES (6, 'froxlor/ticket', 'cron_used_tickets_reset.php', '1 DAY', '1', 'cron_ticketsreset');
INSERT INTO `cronjobs_run` (`id`, `module`, `cronfile`, `interval`, `isactive`, `desc_lng_key`) VALUES (7, 'froxlor/ticket', 'cron_ticketarchive.php', '1 MONTH', '1', 'cron_ticketarchive');
INSERT INTO `cronjobs_run` (`id`, `module`, `cronfile`, `interval`, `isactive`, `desc_lng_key`) VALUES (8, 'froxlor/reports', 'cron_usage_report.php', '1 DAY', '1', 'cron_usage_report');
# --------------------------------------------------------
@@ -1087,3 +1105,30 @@ CREATE TABLE IF NOT EXISTS `domain_redirect_codes` (
`did` int(11) unsigned NOT NULL,
UNIQUE KEY `rc` (`rid`, `did`)
) ENGINE=MyISAM;
#
# Tabellenstruktur fuer Tabelle `ipsandports_docrootsettings`
#
DROP TABLE IF EXISTS `ipsandports_docrootsettings`;
CREATE TABLE IF NOT EXISTS `ipsandports_docrootsettings` (
`id` int(5) NOT NULL auto_increment,
`fid` int(11) NOT NULL,
`docrootsettings` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM;
#
# Tabellenstruktur fuer Tabelle `domain_docrootsettings`
#
DROP TABLE IF EXISTS `domain_docrootsettings`;
CREATE TABLE IF NOT EXISTS `domain_docrootsettings` (
`id` int(5) NOT NULL auto_increment,
`fid` int(11) NOT NULL,
`docrootsettings` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM;

View File

@@ -212,6 +212,20 @@ function requirement_checks()
{
status_message('green', 'OK');
}
status_message('begin', $lng['install']['phpxml']);
if(!extension_loaded('xml'))
{
status_message('red', $lng['install']['notinstalled']);
$_die = true;
}
else
{
status_message('green', 'OK');
}
status_message('begin', $lng['install']['phpfilter']);

View File

@@ -97,5 +97,5 @@ $lng['install']['froxlor_succ_checks'] = 'All requirements are satisfied';
$lng['install']['phpmagic_quotes_runtime'] = 'Checking whether magic_quotes_runtime is off';
$lng['install']['active'] = 'no';
$lng['install']['phpmagic_quotes_runtime_description'] = 'PHP setting "magic_quotes_runtime" must be set to "Off" in order to avoid strange behavior of Froxlor. Disabling it for now (this is only temporary, please fix our php.ini).';
$lng['install']['phpxml'] = 'Testing if PHP XML-extension is installed...';
?>

View File

@@ -68,4 +68,5 @@ $lng['install']['httpgroup'] = 'Nom du la group du HTTP';
$lng['install']['webserver'] = 'Version du serveur';
$lng['install']['phpxml'] = 'Tester si PHP XML-extension est install<6C>e...';
?>

View File

@@ -97,5 +97,5 @@ $lng['install']['froxlor_succ_checks'] = 'Alle Vorraussetzungen sind erf&uuml;ll
$lng['install']['phpmagic_quotes_runtime'] = 'Pr&uuml;fe ob magic_quotes_runtime ausgeschalten ist';
$lng['install']['active'] = 'nein';
$lng['install']['phpmagic_quotes_runtime_description'] = 'Die PHP Einstellung "magic_quotes_runtime" muss deaktiviert sein ("Off"), um merkw&uuml;rdige Verhalten von Froxlor zu umgehen. Sie wurde deaktiviert (nur tempor&auml;r, bitte php.ini anpassen).';
$lng['install']['phpxml'] = 'Teste, ob die PHP XML-Erweiterung installiert ist...';
?>

View File

@@ -192,7 +192,7 @@ if(isFroxlorVersion('0.9-r1'))
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('spf', 'spf_entry', '@ IN TXT \"v=spf1 a mx -all\"');");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `varname` = 'froxlor_graphic' WHERE `varname` = 'syscp_graphic'");
if(isset($settings['admin']['syscp_graphic'])
&& $settings['admin']['syscp_graphic'] != ''
&& $settings['admin']['syscp_graphic'] != ''
){
$settings['admin']['froxlor_graphic'] = $settings['admin']['syscp_graphic'];
}
@@ -305,8 +305,8 @@ if(isFroxlorVersion('0.9.1'))
$result = $db->query_first("SELECT MAX(`guid`) as `latestguid` FROM `".TABLE_PANEL_CUSTOMERS."`");
if (isset($result['latestguid'])
&& (int)$result['latestguid'] > 0
&& $result['latestguid'] != $settings['system']['lastguid']
&& (int)$result['latestguid'] > 0
&& $result['latestguid'] != $settings['system']['lastguid']
) {
checkLastGuid();
lastStepStatus(1, 'fixed');
@@ -411,7 +411,7 @@ if(isFroxlorVersion('0.9.4'))
* To not confuse Froxlor, we just update old settings.
*/
if(isset($settings['system']['awstats_path'])
&& $settings['system']['awstats_path'] != ''
&& $settings['system']['awstats_path'] != ''
) {
showUpdateStep("Updating awstats path setting");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/usr/bin/' WHERE `settinggroup` = 'system' AND `varname` = 'awstats_path';");
@@ -425,7 +425,7 @@ if(isFroxlorVersion('0.9.4'))
}
if(isset($settings['system']['awstats_domain_file'])
&& $settings['system']['awstats_domain_file'] != ''
&& $settings['system']['awstats_domain_file'] != ''
) {
showUpdateStep("Updating awstats configuration path setting");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `varname` = 'awstats_conf' WHERE `varname` = 'awstats_domain_file';");
@@ -543,28 +543,28 @@ if(isFroxlorVersion('0.9.6-svn2'))
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('defaultwebsrverrhandler', 'enabled', '1');");
if(isset($_POST['update_deferr_500'])
&& trim($_POST['update_deferr_500']) != ''
&& trim($_POST['update_deferr_500']) != ''
) {
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('defaultwebsrverrhandler', 'err500', '".$db->escape($_POST['update_deferr_500'])."');");
$err500 = true;
}
if(isset($_POST['update_deferr_401'])
&& trim($_POST['update_deferr_401']) != ''
&& trim($_POST['update_deferr_401']) != ''
) {
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('defaultwebsrverrhandler', 'err401', '".$db->escape($_POST['update_deferr_401'])."');");
$err401 = true;
}
if(isset($_POST['update_deferr_403'])
&& trim($_POST['update_deferr_403']) != ''
&& trim($_POST['update_deferr_403']) != ''
) {
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('defaultwebsrverrhandler', 'err403', '".$db->escape($_POST['update_deferr_403'])."');");
$err403 = true;
}
if(isset($_POST['update_deferr_404'])
&& trim($_POST['update_deferr_404']) != ''
&& trim($_POST['update_deferr_404']) != ''
) {
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('defaultwebsrverrhandler', 'err404', '".$db->escape($_POST['update_deferr_404'])."');");
$err404 = true;
@@ -749,7 +749,7 @@ if(isFroxlorVersion('0.9.7-svn2'))
showUpdateStep("Updating database tables");
$db->query("ALTER TABLE `redirect_codes` ADD `desc` varchar(200) NOT NULL AFTER `code`;");
lastStepStatus(0);
showUpdateStep("Updating field-values");
$db->query("UPDATE `redirect_codes` SET `desc` = 'rc_default' WHERE `code` = '---';");
$db->query("UPDATE `redirect_codes` SET `desc` = 'rc_movedperm' WHERE `code` = '301';");
@@ -798,10 +798,10 @@ if(isFroxlorVersion('0.9.9-svn1'))
if(isFroxlorVersion('0.9.9'))
{
showUpdateStep("Updating from 0.9.9 to 0.9.10-svn1", false);
showUpdateStep("Checking whether you are missing any settings", false);
$nonefound = true;
$update_httpuser = isset($_POST['update_httpuser']) ? $_POST['update_httpuser'] : false;
$update_httpgroup = isset($_POST['update_httpgroup']) ? $_POST['update_httpgroup'] : false;
@@ -829,7 +829,7 @@ if(isFroxlorVersion('0.9.9'))
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'debug_cron', '0');");
lastStepStatus(0);
}
if($nonefound) {
showUpdateStep("No missing settings found");
lastStepStatus(0);
@@ -841,7 +841,7 @@ if(isFroxlorVersion('0.9.9'))
if(isFroxlorVersion('0.9.10-svn1'))
{
showUpdateStep("Updating from 0.9.10-svn1 to 0.9.10-svn2", false);
showUpdateStep("Updating database table definition for panel_databases");
$db->query("ALTER TABLE `" . TABLE_PANEL_DATABASES . "` ADD `apsdb` tinyint(1) NOT NULL default '0' AFTER `dbserver`;");
lastStepStatus(0);
@@ -852,7 +852,7 @@ if(isFroxlorVersion('0.9.10-svn1'))
openRootDB();
$result = $db_root->query("SHOW DATABASES;");
while($row = $db_root->fetch_array($result))
{
{
if(preg_match('/^web([0-9]+)aps([0-9]+)$/', $row['Database'], $matches))
{
$cid = $matches[1];
@@ -937,7 +937,7 @@ if(isFroxlorVersion('0.9.11'))
$update_fcgid_ownvhost = isset($_POST['update_fcgid_ownvhost']) ? (int)$_POST['update_fcgid_ownvhost'] : '0';
$update_fcgid_httpuser = isset($_POST['update_fcgid_httpuser']) ? $_POST['update_fcgid_httpuser'] : 'froxlorlocal';
$update_fcgid_httpgroup = isset($_POST['update_fcgid_ownvhost']) ? $_POST['update_fcgid_ownvhost'] : 'froxlorlocal';
$update_fcgid_httpgroup = isset($_POST['update_fcgid_httpgroup']) ? $_POST['update_fcgid_httpgroup'] : 'froxlorlocal';
if($update_fcgid_httpuser == '') {
$update_fcgid_httpuser = 'froxlorlocal';
@@ -945,7 +945,7 @@ if(isFroxlorVersion('0.9.11'))
if($update_fcgid_httpgroup == '') {
$update_fcgid_httpgroup = 'froxlorlocal';
}
showUpdateStep("Adding new settings");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'mod_fcgid_ownvhost', '".$db->escape($update_fcgid_ownvhost)."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'mod_fcgid_httpuser', '".$db->escape($update_fcgid_httpuser)."');");
@@ -965,7 +965,7 @@ if(isFroxlorVersion('0.9.12-svn1'))
if($update_perl_suexecpath == '') {
$update_perl_suexecpath = '/var/www/cgi-bin/';
}
showUpdateStep("Adding new settings for perl/CGI");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('perl', 'suexecworkaround', '".$db->escape($update_perl_suexecworkaround)."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('perl', 'suexecpath', '".$db->escape($update_perl_suexecpath)."');");
@@ -988,8 +988,8 @@ if(isFroxlorVersion('0.9.12-svn2'))
if(isFroxlorVersion('0.9.12-svn3'))
{
showUpdateStep("Updating from 0.9.12-svn3 to 0.9.12-svn4", false);
$update_awstats_awstatspath = isset($_POST['update_awstats_awstatspath']) ? makeCorrectDir($_POST['update_awstats_awstatspath']) : $settings['system']['awstats_path'];
$update_awstats_awstatspath = isset($_POST['update_awstats_awstatspath']) ? makeCorrectDir($_POST['update_awstats_awstatspath']) : $settings['system']['awstats_path'];
showUpdateStep("Adding new settings for awstats");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'awstats_awstatspath', '".$db->escape($update_awstats_awstatspath)."');");
@@ -1000,7 +1000,7 @@ if(isFroxlorVersion('0.9.12-svn3'))
if(isFroxlorVersion('0.9.12-svn4'))
{
showUpdateStep("Updating from 0.9.12-svn4 to 0.9.12-svn5", false);
showUpdateStep("Updating from 0.9.12-svn4 to 0.9.12-svn5", false);
showUpdateStep("Setting ticket-usage-reset cronjob interval to 1 day");
$db->query("UPDATE `cronjobs_run` SET `interval`='1 DAY' WHERE `cronfile`='cron_used_tickets_reset.php';");
@@ -1011,7 +1011,7 @@ if(isFroxlorVersion('0.9.12-svn4'))
if(isFroxlorVersion('0.9.12-svn5'))
{
showUpdateStep("Updating from 0.9.12-svn5 to 0.9.12-svn6", false);
showUpdateStep("Updating from 0.9.12-svn5 to 0.9.12-svn6", false);
showUpdateStep("Adding new field to table 'panel_htpasswds'");
$db->query("ALTER TABLE `".TABLE_PANEL_HTPASSWDS."` ADD `authname` varchar(255) NOT NULL default 'Restricted Area' AFTER `password`;");
@@ -1036,12 +1036,12 @@ if(isFroxlorVersion('0.9.12'))
$db->query("ALTER TABLE `".TABLE_PANEL_ADMINS."` ADD `email_autoresponder` int(5) NOT NULL default '0' AFTER `aps_packages_used`;");
$db->query("ALTER TABLE `".TABLE_PANEL_ADMINS."` ADD `email_autoresponder_used` int(5) NOT NULL default '0' AFTER `email_autoresponder`;");
lastStepStatus(0);
showUpdateStep("Adding new fields to customer-table");
$db->query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` ADD `email_autoresponder` int(5) NOT NULL default '0' AFTER `perlenabled`;");
$db->query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` ADD `email_autoresponder_used` int(5) NOT NULL default '0' AFTER `email_autoresponder`;");
lastStepStatus(0);
if((int)$settings['autoresponder']['autoresponder_active'] == 1)
{
$update_autoresponder_default = isset($_POST['update_autoresponder_default']) ? intval_ressource($_POST['update_autoresponder_default']) : 0;
@@ -1077,7 +1077,7 @@ if(isFroxlorVersion('0.9.13'))
{
showUpdateStep("Updating from 0.9.13 to 0.9.13.1 final", false);
$update_defaultini_ownvhost = isset($_POST['update_defaultini_ownvhost']) ? (int)$_POST['update_defaultini_ownvhost'] : 1;
$update_defaultini_ownvhost = isset($_POST['update_defaultini_ownvhost']) ? (int)$_POST['update_defaultini_ownvhost'] : 1;
showUpdateStep("Adding settings for Froxlor-vhost's PHP-configuration");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'mod_fcgid_defaultini_ownvhost', '".(int)$update_defaultini_ownvhost."');");
@@ -1100,7 +1100,7 @@ if(isFroxlorVersion('0.9.14-svn1'))
if(isFroxlorVersion('0.9.13.1'))
{
showUpdateStep("Updating from 0.9.13.1 to 0.9.14-svn2", false);
if($settings['ticket']['enabled'] == '1')
{
showUpdateStep("Setting INTERVAL for used-tickets cronjob");
@@ -1114,7 +1114,7 @@ if(isFroxlorVersion('0.9.14-svn2'))
{
showUpdateStep("Updating from 0.9.14-svn2 to 0.9.14-svn3", false);
$update_awstats_icons = isset($_POST['update_awstats_icons']) ? makeCorrectDir($_POST['update_awstats_icons']) : $settings['system']['awstats_icons'];
$update_awstats_icons = isset($_POST['update_awstats_icons']) ? makeCorrectDir($_POST['update_awstats_icons']) : $settings['system']['awstats_icons'];
showUpdateStep("Adding AWStats icons path to the settings");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'awstats_icons', '".$db->escape($update_awstats_icons)."');");
@@ -1127,7 +1127,7 @@ if(isFroxlorVersion('0.9.14-svn3'))
{
showUpdateStep("Updating from 0.9.14-svn3 to 0.9.14-svn4", false);
$update_ssl_cert_chainfile = isset($_POST['update_ssl_cert_chainfile']) ? $_POST['update_ssl_cert_chainfile'] : '';
$update_ssl_cert_chainfile = isset($_POST['update_ssl_cert_chainfile']) ? $_POST['update_ssl_cert_chainfile'] : '';
if($update_ssl_cert_chainfile != '')
{
@@ -1253,11 +1253,12 @@ if(isFroxlorVersion('0.9.14-svn10'))
if(isFroxlorVersion('0.9.14'))
{
showUpdateStep("Updating from 0.9.14 to 0.9.15-svn1", false);
showUpdateStep("Adding new settings for Nginx support");
$db->query("INSERT INTO `".TABLE_PANEL_SETTINGS."` (`settinggroup`, `varname`, `value`) VALUES ('system', 'nginx_php_backend', '127.0.0.1:8888')");
$db->query("INSERT INTO `".TABLE_PANEL_SETTINGS."` (`settinggroup`, `varname`, `value`) VALUES ('system', 'perl_server', 'unix:/var/run/nginx/cgiwrap-dispatch.sock')");
$db->query("INSERT INTO `".TABLE_PANEL_SETTINGS."` (`settinggroup`, `varname`, `value`) VALUES ('system', 'phpreload_command', '')");
lastStepStatus(0);
updateToVersion('0.9.15-svn1');
}
@@ -1269,3 +1270,152 @@ if(isFroxlorVersion('0.9.15-svn1'))
updateToVersion('0.9.15');
}
if(isFroxlorVersion('0.9.15'))
{
showUpdateStep("Updating from 0.9.15 to 0.9.16-svn1", false);
$update_phpfpm_enabled = isset($_POST['update_phpfpm_enabled']) ? (int)$_POST['update_phpfpm_enabled'] : '0';
$update_phpfpm_configdir = isset($_POST['update_phpfpm_configdir']) ? makeCorrectDir($_POST['update_phpfpm_configdir']) : '/etc/php-fpm.d/';
$update_phpfpm_tmpdir = isset($_POST['update_phpfpm_tmpdir']) ? makeCorrectDir($_POST['update_phpfpm_tmpdir']) : '/var/customers/tmp';
$update_phpfpm_peardir = isset($_POST['update_phpfpm_peardir']) ? makeCorrectDir($_POST['update_phpfpm_peardir']) : '/usr/share/php/:/usr/share/php5/';
$update_phpfpm_reload = isset($_POST['update_phpfpm_reload']) ? $_POST['update_phpfpm_reload'] : '/etc/init.d/php-fpm restart';
$update_phpfpm_pm = isset($_POST['update_phpfpm_pm']) ? $_POST['update_phpfpm_pm'] : 'static';
$update_phpfpm_max_children = isset($_POST['update_phpfpm_max_children']) ? (int)$_POST['update_phpfpm_max_children'] : '1';
$update_phpfpm_max_requests = isset($_POST['update_phpfpm_max_requests']) ? (int)$_POST['update_phpfpm_max_requests'] : '0';
if($update_phpfpm_pm == 'dynamic')
{
$update_phpfpm_start_servers = isset($_POST['update_phpfpm_start_servers']) ? (int)$_POST['update_phpfpm_start_servers'] : '20';
$update_phpfpm_min_spare_servers = isset($_POST['update_phpfpm_min_spare_servers']) ? (int)$_POST['update_phpfpm_min_spare_servers'] : '5';
$update_phpfpm_max_spare_servers = isset($_POST['update_phpfpm_max_spare_servers']) ? (int)$_POST['update_phpfpm_max_spare_servers'] : '35';
}
else
{
$update_phpfpm_start_servers = 20;
$update_phpfpm_min_spare_servers = 5;
$update_phpfpm_max_spare_servers = 35;
}
if($update_phpfpm_configdir == '') {
$update_phpfpm_configdir = '/etc/php-fpm.d/';
}
if($update_phpfpm_reload == '') {
$update_phpfpm_reload = '/etc/init.d/php-fpm restart';
}
showUpdateStep("Adding new settings for PHP-FPM #1");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'enabled', '".(int)$update_phpfpm_enabled."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'configdir', '".$db->escape($update_phpfpm_configdir)."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'reload', '".$db->escape($update_phpfpm_reload)."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'pm', '".$db->escape($update_phpfpm_pm)."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'max_children', '".(int)$update_phpfpm_max_children."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'max_requests', '".(int)$update_phpfpm_max_requests."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'start_servers', '".(int)$update_phpfpm_start_servers."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'min_spare_servers', '".(int)$update_phpfpm_min_spare_servers."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'max_spare_servers', '".(int)$update_phpfpm_max_spare_servers."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'tmpdir', '".$db->escape($update_phpfpm_tmpdir)."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'peardir', '".$db->escape($update_phpfpm_peardir)."');");
lastStepStatus(0);
updateToVersion('0.9.16-svn1');
}
if(isFroxlorVersion('0.9.16-svn1'))
{
showUpdateStep("Updating from 0.9.16-svn1 to 0.9.16-svn2", false);
$update_phpfpm_enabled_ownvhost = isset($_POST['update_phpfpm_enabled_ownvhost']) ? (int)$_POST['update_phpfpm_enabled_ownvhost'] : '0';
$update_phpfpm_httpuser = isset($_POST['update_phpfpm_httpuser']) ? $_POST['update_phpfpm_httpuser'] : 'froxlorlocal';
$update_phpfpm_httpgroup = isset($_POST['update_phpfpm_httpgroup']) ? $_POST['update_phpfpm_httpgroup'] : 'froxlorlocal';
if($update_phpfpm_httpuser == '') {
$update_phpfpm_httpuser = 'froxlorlocal';
}
if($update_phpfpm_httpgroup == '') {
$update_phpfpm_httpgroup = 'froxlorlocal';
}
showUpdateStep("Adding new settings for PHP-FPM #2");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'enabled_ownvhost', '".(int)$update_phpfpm_enabled_ownvhost."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'vhost_httpuser', '".$db->escape($update_phpfpm_httpuser)."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('phpfpm', 'vhost_httpgroup', '".$db->escape($update_phpfpm_httpgroup)."');");
lastStepStatus(0);
updateToVersion('0.9.16-svn2');
}
if(isFroxlorVersion('0.9.16-svn2'))
{
showUpdateStep("Updating from 0.9.16-svn2 to 0.9.16 final");
lastStepStatus(0);
updateToVersion('0.9.16');
}
if(isFroxlorVersion('0.9.16'))
{
showUpdateStep("Updating from 0.9.16 to 0.9.17-svn1", false);
$update_system_report_enable = isset($_POST['update_system_report_enable']) ? (int)$_POST['update_system_report_enable'] : '1';
$update_system_report_webmax = isset($_POST['update_system_report_webmax']) ? (int)$_POST['update_system_report_webmax'] : '90';
$update_system_report_trafficmax = isset($_POST['update_system_report_trafficmax']) ? (int)$_POST['update_system_report_trafficmax'] : '90';
showUpdateStep("Adding new settings for web- and traffic-reporting");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'report_enable', '".(int)$update_system_report_enable."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'report_webmax', '".(int)$update_system_report_webmax."');");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'report_trafficmax', '".(int)$update_system_report_trafficmax."');");
lastStepStatus(0);
showUpdateStep("Adding new cron-module for web- and traffic-reporting");
$clastrun = mktime(6, 0, 0, date('m'), date('d') - 1, date('Y'));
$db->query("INSERT INTO `" . TABLE_PANEL_CRONRUNS . "` SET `module`='froxlor/reports', `cronfile`='cron_usage_report.php', `lastrun`='".(int)$clastrun."', `interval`='1 DAY', `isactive`='".(int)$update_system_report_enable."', `desc_lng_key`='cron_usage_report';");
lastStepStatus(0);
showUpdateStep("Updating various database-fields");
$db->query("DELETE FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `settinggroup`='system' AND `varname`='last_traffic_report_run';");
$check = $db->query_first("SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `varname`='trafficninetypercent_subject';");
if(isset($check['varname']) && $check['varname'] == 'trafficninetypercent_subject')
{
$db->query("UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET `varname` = 'trafficmaxpercent_subject' WHERE `varname`='trafficninetypercent_subject';");
}
$check = $db->query_first("SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `varname`='trafficninetypercent_mailbody';");
if(isset($check['varname']) && $check['varname'] == 'trafficninetypercent_mailbody')
{
$db->query("UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET `varname` = 'trafficmaxpercent_mailbody' WHERE `varname`='trafficninetypercent_mailbody';");
}
lastStepStatus(0);
updateToVersion('0.9.17-svn1');
}
if(isFroxlorVersion('0.9.17-svn1'))
{
showUpdateStep("Updating from 0.9.17-svn1 to 0.9.17-svn2", false);
showUpdateStep("Adding new tables to database");
$db->query("CREATE TABLE IF NOT EXISTS `ipsandports_docrootsettings` (
`id` int(5) NOT NULL auto_increment,
`fid` int(11) NOT NULL,
`docrootsettings` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM;");
$db->query("CREATE TABLE IF NOT EXISTS `domain_docrootsettings` (
`id` int(5) NOT NULL auto_increment,
`fid` int(11) NOT NULL,
`docrootsettings` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM;");
lastStepStatus(0);
updateToVersion('0.9.17-svn2');
}
if(isFroxlorVersion('0.9.17-svn2'))
{
showUpdateStep("Updating from 0.9.17-svn2 to 0.9.17 final");
lastStepStatus(0);
updateToVersion('0.9.17');
}

View File

@@ -251,7 +251,7 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version)
$question.= 'Local user:&nbsp;';
$question.= '<input type="text" class="text" name="update_fcgid_httpuser" value="froxlorlocal" /><br /><br />';
$question.= 'Local group:&nbsp;';
$question.= '<input type="text" class="text" name="update_fcgid_ownvhost" value="froxlorlocal" /><br />';
$question.= '<input type="text" class="text" name="update_fcgid_httpgroup" value="froxlorlocal" /><br />';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
}
@@ -351,4 +351,68 @@ function parseAndOutputPreconfig(&$has_preconfig, &$return, $current_version)
$question = '';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
if(versionInUpdate($current_version, '0.9.16-svn1'))
{
$has_preconfig = true;
$description = 'Froxlor now features support for php-fpm.';
$question = '<strong>Do you want to enable php-fpm?:</strong>&nbsp;';
$question.= makeyesno('update_phpfpm_enabled', '1', '0', '0').'<br /><br />';
$question.= 'If \'yes\', please specify the configuration directory:&nbsp;';
$question.= '<input type="text" class="text" name="update_phpfpm_configdir" value="/etc/php-fpm.d/" /><br /><br />';
$question.= 'Please specify the temporary files directory:&nbsp;';
$question.= '<input type="text" class="text" name="update_phpfpm_tmpdir" value="/var/customers/tmp/" /><br /><br />';
$question.= 'Please specify the PEAR directory:&nbsp;';
$question.= '<input type="text" class="text" name="update_phpfpm_peardir" value="/usr/share/php/:/usr/share/php5/" /><br /><br />';
$question.= 'Please specify the php-fpm restart-command:&nbsp;';
$question.= '<input type="text" class="text" name="update_phpfpm_reload" value="/etc/init.d/php-fpm restart" /><br /><br />';
$question.= 'Please specify the php-fpm rocess manager control:&nbsp;';
$question.= '<select name="update_phpfpm_pm">';
$redirects = makeoption('static', 'static', 'static');
$redirects.= makeoption('dynamic', 'dynamic', 'static');
$question .= $redirects.'</select><br /><br />';
$question.= 'Please specify the number of child processes:&nbsp;';
$question.= '<input type="text" class="text" name="update_phpfpm_max_children" value="1" /><br /><br />';
$question.= 'Please specify the number of requests per child before respawning:&nbsp;';
$question.= '<input type="text" class="text" name="update_phpfpm_max_requests" value="0" /><br /><br />';
$question.= '<em>The following settings are only required if you chose process manager = dynamic</em><br /><br />';
$question.= 'Please specify the number of child processes created on startup:&nbsp;';
$question.= '<input type="text" class="text" name="update_phpfpm_start_servers" value="20" /><br /><br />';
$question.= 'Please specify the desired minimum number of idle server processes:&nbsp;';
$question.= '<input type="text" class="text" name="update_phpfpm_min_spare_servers" value="5" /><br /><br />';
$question.= 'Please specify the desired maximum number of idle server processes:&nbsp;';
$question.= '<input type="text" class="text" name="update_phpfpm_max_spare_servers" value="35" /><br />';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
if(versionInUpdate($current_version, '0.9.16-svn2'))
{
if((int)$settings['phpfpm']['enabled'] == 1)
{
$has_preconfig = true;
$description = 'You can chose whether you want Froxlor to use PHP-FPM itself too now.';
$question = '<strong>Use PHP-FPM for the Froxlor Panel?:</strong>&nbsp;';
$question.= makeyesno('update_phpfpm_enabled_ownvhost', '1', '0', '0').'<br /><br />';
$question.= '<strong>If \'yes\', please specify local user/group (have to exist, Froxlor does not add them automatically):</strong><br /><br />';
$question.= 'Local user:&nbsp;';
$question.= '<input type="text" class="text" name="update_phpfpm_httpuser" value="'.$settings['system']['mod_fcgid_httpuser'].'" /><br /><br />';
$question.= 'Local group:&nbsp;';
$question.= '<input type="text" class="text" name="update_phpfpm_httpgroup" value="'.$settings['system']['mod_fcgid_httpgroup'].'" /><br />';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
}
if(versionInUpdate($current_version, '0.9.17-svn1'))
{
$has_preconfig = true;
$description = 'Select if you want to enable the web- and traffic-reports';
$question = '<strong>Enable?:</strong>&nbsp;';
$question.= makeyesno('update_system_report_enable', '1', '0', '1').'<br /><br />';
$question.= '<strong>If \'yes\', please specify a percentage value for web- and traffic when reports are to be sent:</strong><br /><br />';
$question.= 'Webusage warning level:&nbsp;';
$question.= '<input type="text" class="text" name="update_system_report_webmax" value="90" /><br /><br />';
$question.= 'Traffic warning level:&nbsp;';
$question.= '<input type="text" class="text" name="update_system_report_trafficmax" value="90" /><br />';
eval("\$return.=\"" . getTemplate("update/preconfigitem") . "\";");
}
}

View File

@@ -43,9 +43,9 @@ if($settings['panel']['version'] == '1.0.10')
// Adding tables
$db->query("DROP TABLE IF EXISTS `" . TABLE_PANEL_HTACCESS . "`;");
$db->query("CREATE TABLE `" . TABLE_PANEL_HTACCESS . "` (" . " `id` int(11) unsigned NOT NULL auto_increment," . " `customerid` int(11) unsigned NOT NULL default '0'," . " `path` varchar(255) NOT NULL default ''," . " `options_indexes` tinyint(1) NOT NULL default '0'," . " PRIMARY KEY (`id`)" . ") TYPE=MyISAM ;");
$db->query("CREATE TABLE `" . TABLE_PANEL_HTACCESS . "` (" . " `id` int(11) unsigned NOT NULL auto_increment," . " `customerid` int(11) unsigned NOT NULL default '0'," . " `path` varchar(255) NOT NULL default ''," . " `options_indexes` tinyint(1) NOT NULL default '0'," . " PRIMARY KEY (`id`)" . ") ENGINE=MyISAM ;");
$db->query("DROP TABLE IF EXISTS `" . TABLE_PANEL_ADMINS . "`;");
$db->query("CREATE TABLE `" . TABLE_PANEL_ADMINS . "` (" . " `adminid` int(11) unsigned NOT NULL auto_increment," . " `loginname` varchar(50) NOT NULL default ''," . " `password` varchar(50) NOT NULL default ''," . " `name` varchar(255) NOT NULL default ''," . " `email` varchar(255) NOT NULL default ''," . " `customers` int(15) NOT NULL default '0'," . " `customers_used` int(15) NOT NULL default '0'," . " `customers_see_all` tinyint(1) NOT NULL default '0'," . " `domains` int(15) NOT NULL default '0'," . " `domains_used` int(15) NOT NULL default '0'," . " `domains_see_all` tinyint(1) NOT NULL default '0'," . " `change_serversettings` tinyint(1) NOT NULL default '0'," . " `diskspace` int(15) NOT NULL default '0'," . " `diskspace_used` int(15) NOT NULL default '0'," . " `mysqls` int(15) NOT NULL default '0'," . " `mysqls_used` int(15) NOT NULL default '0'," . " `emails` int(15) NOT NULL default '0'," . " `emails_used` int(15) NOT NULL default '0'," . " `email_forwarders` int(15) NOT NULL default '0'," . " `email_forwarders_used` int(15) NOT NULL default '0'," . " `ftps` int(15) NOT NULL default '0'," . " `ftps_used` int(15) NOT NULL default '0'," . " `subdomains` int(15) NOT NULL default '0'," . " `subdomains_used` int(15) NOT NULL default '0'," . " `traffic` int(15) NOT NULL default '0'," . " `traffic_used` int(15) NOT NULL default '0'," . " `deactivated` tinyint(1) NOT NULL default '0'," . " `lastlogin_succ` int(11) unsigned NOT NULL default '0'," . " `lastlogin_fail` int(11) unsigned NOT NULL default '0'," . " `loginfail_count` int(11) unsigned NOT NULL default '0'," . " PRIMARY KEY (`adminid`)" . ") TYPE=MyISAM ;");
$db->query("CREATE TABLE `" . TABLE_PANEL_ADMINS . "` (" . " `adminid` int(11) unsigned NOT NULL auto_increment," . " `loginname` varchar(50) NOT NULL default ''," . " `password` varchar(50) NOT NULL default ''," . " `name` varchar(255) NOT NULL default ''," . " `email` varchar(255) NOT NULL default ''," . " `customers` int(15) NOT NULL default '0'," . " `customers_used` int(15) NOT NULL default '0'," . " `customers_see_all` tinyint(1) NOT NULL default '0'," . " `domains` int(15) NOT NULL default '0'," . " `domains_used` int(15) NOT NULL default '0'," . " `domains_see_all` tinyint(1) NOT NULL default '0'," . " `change_serversettings` tinyint(1) NOT NULL default '0'," . " `diskspace` int(15) NOT NULL default '0'," . " `diskspace_used` int(15) NOT NULL default '0'," . " `mysqls` int(15) NOT NULL default '0'," . " `mysqls_used` int(15) NOT NULL default '0'," . " `emails` int(15) NOT NULL default '0'," . " `emails_used` int(15) NOT NULL default '0'," . " `email_forwarders` int(15) NOT NULL default '0'," . " `email_forwarders_used` int(15) NOT NULL default '0'," . " `ftps` int(15) NOT NULL default '0'," . " `ftps_used` int(15) NOT NULL default '0'," . " `subdomains` int(15) NOT NULL default '0'," . " `subdomains_used` int(15) NOT NULL default '0'," . " `traffic` int(15) NOT NULL default '0'," . " `traffic_used` int(15) NOT NULL default '0'," . " `deactivated` tinyint(1) NOT NULL default '0'," . " `lastlogin_succ` int(11) unsigned NOT NULL default '0'," . " `lastlogin_fail` int(11) unsigned NOT NULL default '0'," . " `loginfail_count` int(11) unsigned NOT NULL default '0'," . " PRIMARY KEY (`adminid`)" . ") ENGINE=MyISAM ;");
// Insert Admin user

View File

@@ -51,7 +51,7 @@ if($settings['panel']['version'] == '1.2.2-cvs1')
`language` varchar(30) NOT NULL default '',
`file` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM
) ENGINE=MyISAM
");
$db->query("INSERT INTO `" . TABLE_PANEL_LANGUAGE . "` (`id`, `language`, `file`) VALUES (1, 'Deutsch', 'lng/german.lng.php');");
$db->query("INSERT INTO `" . TABLE_PANEL_LANGUAGE . "` (`id`, `language`, `file`) VALUES (2, 'English', 'lng/english.lng.php');");
@@ -88,7 +88,7 @@ if($settings['panel']['version'] == '1.2.2-cvs3')
`id` int(11) unsigned NOT NULL auto_increment,
`file` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM
) ENGINE=MyISAM
");
$db->query("INSERT INTO `" . TABLE_PANEL_CRONSCRIPT . "` (`id`, `file`) VALUES (1, 'cron_traffic.php');");
$db->query("INSERT INTO `" . TABLE_PANEL_CRONSCRIPT . "` (`id`, `file`) VALUES (2, 'cron_tasks.php');");
@@ -146,7 +146,7 @@ if($settings['panel']['version'] == '1.2.3-cvs4')
PRIMARY KEY (`id`),
KEY `adminid` (`adminid`),
UNIQUE `date` (`adminid` , `year` , `month` , `day`)
) TYPE=MyISAM
) ENGINE=MyISAM
");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.2.3-cvs5' WHERE `settinggroup`='panel' AND `varname`='version'");
$settings['panel']['version'] = '1.2.3-cvs5';
@@ -267,7 +267,7 @@ if($settings['panel']['version'] == '1.2.6')
`value` longtext NOT NULL,
PRIMARY KEY (`id`),
KEY `adminid` (`adminid`)
) TYPE=MyISAM
) ENGINE=MyISAM
');
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='1.2.6-cvs1' WHERE `settinggroup`='panel' AND `varname`='version'");
$settings['panel']['version'] = '1.2.6-cvs1';
@@ -458,7 +458,7 @@ if($settings['panel']['version'] == '1.2.12-svn1')
`port` int(5) NOT NULL default \'80\',
`default` int(1) NOT NULL default \'0\',
PRIMARY KEY (`id`)
) TYPE=MyISAM');
) ENGINE=MyISAM');
$db->query('INSERT INTO `' . TABLE_PANEL_IPSANDPORTS . '` (`ip`, `port`, `default`) VALUES (\'' . $settings['system']['ipaddress'] . '\', \'80\', \'1\')');
$db->query('UPDATE `' . TABLE_PANEL_SETTINGS . '` SET `value` = \'1.2.12-svn2\' WHERE `settinggroup` = \'panel\' AND `varname` = \'version\'');
$settings['panel']['version'] = '1.2.12-svn2';

View File

@@ -620,7 +620,7 @@ else
`mysql` bigint(30) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `customerid` (`customerid`)
) TYPE=MyISAM ;");
) ENGINE=MyISAM ;");
$db->query("CREATE TABLE `" . TABLE_PANEL_DISKSPACE_ADMINS . "` (
`id` int(11) unsigned NOT NULL auto_increment,
`adminid` int(11) unsigned NOT NULL default '0',
@@ -633,7 +633,7 @@ else
`mysql` bigint(30) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `adminid` (`adminid`)
) TYPE=MyISAM ;");
) ENGINE=MyISAM ;");
$db->query("INSERT INTO `" . TABLE_BILLING_SERVICE_CATEGORIES . "` (`id`, `category_name`, `category_order`, `category_classname`, `category_classfile`, `category_cachefield`, `category_caption`, `category_rowcaption_setup`, `category_rowcaption_interval`) VALUES (1, 'hosting', 10, 'hosting', 'lib/billing_class_hosting.php', 'invoice_fee_hosting', 'hosting_caption', 'hosting_rowcaption_setup', 'hosting_rowcaption_interval');");
$db->query("INSERT INTO `" . TABLE_BILLING_SERVICE_CATEGORIES . "` (`id`, `category_name`, `category_order`, `category_classname`, `category_classfile`, `category_cachefield`, `category_caption`, `category_rowcaption_setup`, `category_rowcaption_interval`) VALUES (2, 'domains', 20, 'domains', 'lib/billing_class_domains.php', 'invoice_fee_domains', 'domains_caption', 'domains_rowcaption_setup', 'domains_rowcaption_interval');");
$db->query("INSERT INTO `" . TABLE_BILLING_SERVICE_CATEGORIES . "` (`id`, `category_name`, `category_order`, `category_classname`, `category_classfile`, `category_cachefield`, `category_caption`, `category_rowcaption_setup`, `category_rowcaption_interval`) VALUES (3, 'traffic', 30, 'traffic', 'lib/billing_class_traffic.php', 'invoice_fee_traffic', 'traffic_caption', 'traffic_rowcaption_setup', 'traffic_rowcaption_interval');");

View File

@@ -0,0 +1,198 @@
<?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 Michael Kaufmann <mkaufmann@nutime.de>
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Classes
* @version $Id$
* @link http://www.nutime.de/
* @since 0.9.17-svn2
*
*/
class docrootsettings
{
/**
* Database handler
* @var object
*/
private $_db = false;
/**
* Settings array
* @var array
*/
private $_settings = array();
/**
* main constructor
*/
public function __construct($db, $settings)
{
$this->_db = $db;
$this->_settings = $settings;
}
/**
* this function lets you add docroot-settings for a given domain (by ID)
*
* @param int $domainid id of the domain to add the settings for
* @param string $ssettings docrootsettings to add for the domain
*
* @return boolean
*/
public function addDomainDocrootsettings($domainid = 0, $ssettings = '')
{
return $this->_addDocrootSetting(TABLE_PANEL_DOMDOCROOTSETTINGS, $domainid, $ssettings);
}
/**
* this function lets you update docroot-settings for a given domain (by ID)
*
* @param int $domainid id of the domain to update the settings from
* @param string $ssettings docrootsettings to update for the domain
*
* @return boolean
*/
public function updateDomainDocrootsettings($domainid = 0, $ssettings = '')
{
return $this->_updateDocrootSetting(TABLE_PANEL_DOMDOCROOTSETTINGS, $domainid, $ssettings);
}
/**
* this function lets you add docroot-settings for a given ip/port combo (by ID)
*
* @param int $ipandportid id of the domain to add the settings for
* @param string $ssettings docrootsettings to add for the domain
*
* @return boolean
*/
public function addIpsAndPortsDocrootsettings($ipandportid = 0, $ssettings = '')
{
return $this->_addDocrootSetting(TABLE_PANEL_IPDOCROOTSETTINGS, $ipandportid, $ssettings);
}
/**
* this function lets you update docroot-settings for a given ip/port combo (by ID)
*
* @param int $ipandportid id of the domain to update the settings from
* @param string $ssettings docrootsettings to update for the domain
*
* @return boolean
*/
public function updateIpsAndPortsDocrootsettings($ipandportid = 0, $ssettings = '')
{
return $this->_updateDocrootSetting(TABLE_PANEL_IPDOCROOTSETTINGS, $ipandportid, $ssettings);
}
/**
* returns the docroot-setting
* for a given domain (by ID)
*
* @param int $domainid the id of the domain
*
* @return string the settings or empty if not set
*/
public function getDomainDocrootsettings($domainid = 0)
{
return $this->_getDocrootSettingById(TABLE_PANEL_DOMDOCROOTSETTINGS, $domainid);
}
/**
* returns the docroot-setting
* for a given ip/port combination (by ID)
*
* @param int $ipandportid the id of the ip/port combo
*
* @return string the settings or empty if not set
*/
public function getIpsAndPortsDocrootsettings($ipandportid = 0)
{
return $this->_getDocrootSettingById(TABLE_PANEL_IPDOCROOTSETTINGS, $ipandportid);
}
/**
* this function is called by addDomainDocrootsettings() and
* addIpsAndPortsDocrootsettings() to add docroot settings for an object
*
* @param string $table table to add the settings to
* @param int $fid foreign id / object id
* @param string $ssettings docroot-settings
*
* @return boolean
*/
private function _addDocrootSetting($table, $fid, $ssettings)
{
$query = "INSERT INTO `".$table."` SET
`fid` = '".(int)$fid."',
`docrootsettings` = '".$db->escape($ssettings)."';";
$this->_db->query($query);
return true;
}
/**
* this function is called by updateDomainDocrootsettings() and
* updateIpsAndPortsDocrootsettings() to update docroot settings for an object
*
* if new value is an empty string, entry is being removed
*
* @param string $table table to update the settings from
* @param int $fid foreign id / object id
* @param string $ssettings docroot-settings
*
* @return boolean
*/
private function _updateDocrootSetting($table, $fid, $ssettings)
{
// check if this object has an entry for docrootsettings
if($this->_getDocrootSettingById($table, $fid) != '')
{
if($ssettings != '')
{
// update if new value has been set
$query = "UPDATE `".$table."` SET
`docrootsettings` = '".$db->escape($ssettings)."'
WHERE `fid` = '".(int)$fid."';";
}
else
{
// remove if new value is empty
$query = "DELETE FROM `".$table."` WHERE `fid` = '".(int)$fid."';";
}
// run query
$this->_db->query($query);
return true;
}
// this object has no entry for docrootsettings yet
return false;
}
/**
* read the docrootsetting field of given table
* for given id
*
* @param string $table table where to read from
* @param int $id id of the object
*
* @return string string the settings or empty if not set
*/
private function _getDocrootSettingById($table = null, $id = 0)
{
$query = "SELECT `docrootsettings` FROM `".$table."` WHERE `fid`='".(int)$id."';";
$result = $this->_db->query_first($query);
if($result !== false && isset($result['docrootsettings']))
{
return $result['docrootsettings'];
}
return '';
}
}

View File

@@ -0,0 +1,121 @@
<?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 Michael Kaufmann <mkaufmann@nutime.de>
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Cron
* @version $Id$
* @link http://www.nutime.de/
* @since 0.9.16
*
*/
class phpinterface
{
/**
* Database handler
* @var object
*/
private $_db = false;
/**
* Settings array
* @var array
*/
private $_settings = array();
/**
* Domain-Data array
* @var array
*/
private $_domain = array();
/**
* Interface object
* @var object
*/
private $_interface = null;
/**
* Admin-User data array
* @var array
*/
private $_admin_cache = array();
/**
* main constructor
*/
public function __construct($db, $settings, $domain)
{
$this->_db = $db;
$this->_settings = $settings;
$this->_domain = $domain;
$this->_setInterface();
}
/**
* returns the interface-object
* from where we can control it
*/
public function getInterface()
{
return $this->_interface;
}
/**
* set interface-object by type of
* php-interface: fcgid or php-fpm
* sets private $_interface variable
*/
private function _setInterface()
{
// php-fpm
if((int)$this->_settings['phpfpm']['enabled'] == 1)
{
$this->_interface = new phpinterface_fpm($this->_db, $this->_settings, $this->_domain);
}
elseif((int)$this->_settings['system']['mod_fcgid'] == 1)
{
$this->_interface = new phpinterface_fcgid($this->_db, $this->_settings, $this->_domain);
}
}
/**
* return the php-configuration from the database
*
* @param int $php_config_id id of the php-configuration
*
* @return array
*/
public function getPhpConfig($php_config_id)
{
$php_config_id = intval($php_config_id);
// If domain has no config, we will use the default one.
if($php_config_id == 0)
{
$php_config_id = 1;
}
if(!isset($this->php_configs_cache[$php_config_id]))
{
$this->_php_configs_cache[$php_config_id] = $this->_db->query_first(
"SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "`
WHERE `id` = " . (int)$php_config_id
);
}
return $this->_php_configs_cache[$php_config_id];
}
}

View File

@@ -0,0 +1,291 @@
<?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 Michael Kaufmann <mkaufmann@nutime.de>
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Cron
* @version $Id$
* @link http://www.nutime.de/
* @since 0.9.16
*
*/
class phpinterface_fcgid
{
/**
* Database handler
* @var object
*/
private $_db = false;
/**
* Settings array
* @var array
*/
private $_settings = array();
/**
* Domain-Data array
* @var array
*/
private $_domain = array();
/**
* Admin-Date cache array
* @var array
*/
private $_admin_cache = array();
/**
* main constructor
*/
public function __construct($db, $settings, $domain)
{
$this->_db = $db;
$this->_settings = $settings;
$this->_domain = $domain;
}
public function createConfig($phpconfig)
{
// create starter
$starter_file = "#!/bin/sh\n\n";
$starter_file.= "#\n";
$starter_file.= "# starter created/changed on " . date("Y.m.d H:i:s") . " for domain '" . $this->_domain['domain'] . "' with id #" . $this->_domain['id'] . " from php template '" . $phpconfig['description'] . "' with id #" . $phpconfig['id'] . "\n";
$starter_file.= "# Do not change anything in this file, it will be overwritten by the Froxlor Cronjob!\n";
$starter_file.= "#\n\n";
$starter_file.= "umask 022\n";
$starter_file.= "PHPRC=" . escapeshellarg($this->getConfigDir()) . "\n";
$starter_file.= "export PHPRC\n";
// set number of processes for one domain
if((int)$this->_domain['mod_fcgid_starter'] != - 1)
{
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$this->_domain['mod_fcgid_starter'] . "\n";
}
else
{
if((int)$phpconfig['mod_fcgid_starter'] != - 1)
{
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$phpconfig['mod_fcgid_starter'] . "\n";
}
else
{
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$this->_settings['system']['mod_fcgid_starter'] . "\n";
}
}
$starter_file.= "export PHP_FCGI_CHILDREN\n";
// set number of maximum requests for one domain
if((int)$this->_domain['mod_fcgid_maxrequests'] != - 1)
{
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$this->_domain['mod_fcgid_maxrequests'] . "\n";
}
else
{
if((int)$phpconfig['mod_fcgid_maxrequests'] != - 1)
{
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$phpconfig['mod_fcgid_maxrequests'] . "\n";
}
else
{
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$this->_settings['system']['mod_fcgid_maxrequests'] . "\n";
}
}
$starter_file.= "export PHP_FCGI_MAX_REQUESTS\n";
// Set Binary
$starter_file.= "exec " . $phpconfig['binary'] . " -c " . escapeshellarg($this->getConfigDir()) . "\n";
//remove +i attibute, so starter can be overwritten
if(file_exists($this->getStarterFile()))
{
removeImmutable($this->getStarterFile());
}
$starter_file_handler = fopen($this->getStarterFile(), 'w');
fwrite($starter_file_handler, $starter_file);
fclose($starter_file_handler);
safe_exec('chmod 750 ' . escapeshellarg($this->getStarterFile()));
safe_exec('chown ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($this->getStarterFile()));
setImmutable($this->getStarterFile());
}
public function createIniFile($phpconfig)
{
$openbasedir = '';
$openbasedirc = ';';
if($this->_domain['openbasedir'] == '1')
{
$openbasedirc = '';
$_phpappendopenbasedir = '';
$_custom_openbasedir = explode(':', $this->_settings['system']['mod_fcgid_peardir']);
foreach($_custom_openbasedir as $cobd)
{
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
}
$_custom_openbasedir = explode(':', $this->_settings['system']['phpappendopenbasedir']);
foreach($_custom_openbasedir as $cobd)
{
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
}
if($this->_domain['openbasedir_path'] == '0' && strstr($this->_domain['documentroot'], ":") === false)
{
$openbasedir = appendOpenBasedirPath($this->_domain['documentroot'], true);
}
else
{
$openbasedir = appendOpenBasedirPath($this->_domain['customerroot'], true);
}
$openbasedir .= appendOpenBasedirPath($this->getTempDir());
$openbasedir .= $_phpappendopenbasedir;
$openbasedir = explode(':', $openbasedir);
$clean_openbasedir = array();
foreach($openbasedir as $number => $path)
{
if(trim($path) != '/')
{
$clean_openbasedir[] = makeCorrectDir($path);
}
}
$openbasedir = implode(':', $clean_openbasedir);
}
else
{
$openbasedir = 'none';
$openbasedirc = ';';
}
$admin = $this->_getAdminData($this->_domain['adminid']);
$php_ini_variables = array(
'SAFE_MODE' => ($this->_domain['safemode'] == '0' ? 'Off' : 'On'),
'PEAR_DIR' => $this->_settings['system']['mod_fcgid_peardir'],
'OPEN_BASEDIR' => $openbasedir,
'OPEN_BASEDIR_C' => $openbasedirc,
'OPEN_BASEDIR_GLOBAL' => $this->_settings['system']['phpappendopenbasedir'],
'TMP_DIR' => $this->getTempDir(),
'CUSTOMER_EMAIL' => $this->_domain['email'],
'ADMIN_EMAIL' => $admin['email'],
'DOMAIN' => $this->_domain['domain'],
'CUSTOMER' => $this->_domain['loginname'],
'ADMIN' => $admin['loginname']
);
//insert a small header for the file
$phpini_file = ";\n";
$phpini_file.= "; php.ini created/changed on " . date("Y.m.d H:i:s") . " for domain '" . $this->_domain['domain'] . "' with id #" . $this->_domain['id'] . " from php template '" . $phpconfig['description'] . "' with id #" . $phpconfig['id'] . "\n";
$phpini_file.= "; Do not change anything in this file, it will be overwritten by the Froxlor Cronjob!\n";
$phpini_file.= ";\n\n";
$phpini_file.= replace_variables($phpconfig['phpsettings'], $php_ini_variables);
$phpini_file = str_replace('"none"', 'none', $phpini_file);
$phpini_file = preg_replace('/\"+/', '"', $phpini_file);
$phpini_file_handler = fopen($this->getIniFile(), 'w');
fwrite($phpini_file_handler, $phpini_file);
fclose($phpini_file_handler);
safe_exec('chown root:0 ' . escapeshellarg($this->getIniFile()));
safe_exec('chmod 0644 ' . escapeshellarg($this->getIniFile()));
}
/**
* fcgid-config directory
*
* @param boolean $createifnotexists create the directory if it does not exist
*
* @return string the directory
*/
public function getConfigDir($createifnotexists = true)
{
$configdir = makeCorrectDir($this->_settings['system']['mod_fcgid_configdir'] . '/' . $this->_domain['loginname'] . '/' . $this->_domain['domain'] . '/');
if(!is_dir($configdir) && $createifnotexists)
{
safe_exec('mkdir -p ' . escapeshellarg($configdir));
safe_exec('chown ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($configdir));
}
return $configdir;
}
/**
* fcgid-temp directory
*
* @param boolean $createifnotexists create the directory if it does not exist
*
* @return string the directory
*/
public function getTempDir($createifnotexists = true)
{
$tmpdir = makeCorrectDir($this->_settings['system']['mod_fcgid_tmpdir'] . '/' . $this->_domain['loginname'] . '/');
if(!is_dir($tmpdir) && $createifnotexists)
{
safe_exec('mkdir -p ' . escapeshellarg($tmpdir));
safe_exec('chown -R ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($tmpdir));
safe_exec('chmod 0750 ' . escapeshellarg($tmpdir));
}
return $tmpdir;
}
/**
* return path of php-starter file
*
* @return string the directory
*/
public function getStarterFile()
{
$starter_filename = makeCorrectFile($this->getConfigDir() . '/php-fcgi-starter');
return $starter_filename;
}
/**
* return path of php.ini file
*
* @return string full with path file-name
*/
public function getIniFile()
{
$phpini_filename = makeCorrectFile($this->getConfigDir() . '/php.ini');
return $phpini_filename;
}
/**
* return the admin-data of a specific admin
*
* @param int $adminid id of the admin-user
*
* @return array
*/
private function _getAdminData($adminid)
{
$adminid = intval($adminid);
if(!isset($this->_admin_cache[$adminid]))
{
$this->_admin_cache[$adminid] = $this->_db->query_first(
"SELECT `email`, `loginname` FROM `" . TABLE_PANEL_ADMINS . "`
WHERE `adminid` = " . (int)$adminid
);
}
return $this->_admin_cache[$adminid];
}
}

View File

@@ -0,0 +1,174 @@
<?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 Michael Kaufmann <mkaufmann@nutime.de>
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Cron
* @version $Id$
* @link http://www.nutime.de/
* @since 0.9.16
*
*/
class phpinterface_fpm
{
/**
* Database handler
* @var object
*/
private $_db = false;
/**
* Settings array
* @var array
*/
private $_settings = array();
/**
* Domain-Data array
* @var array
*/
private $_domain = array();
/**
* main constructor
*/
public function __construct($db, $settings, $domain)
{
$this->_db = $db;
$this->_settings = $settings;
$this->_domain = $domain;
}
public function createConfig($phpconfig)
{
$fh = @fopen($this->getConfigFile(), 'w');
if($fh)
{
$fpm_pm = $this->_settings['phpfpm']['pm'];
$fpm_children = (int)$this->_settings['phpfpm']['max_children'];
$fpm_start_servers = (int)$this->_settings['phpfpm']['start_servers'];
$fpm_min_spare_servers = (int)$this->_settings['phpfpm']['min_spare_servers'];
$fpm_max_spare_servers = (int)$this->_settings['phpfpm']['max_spare_servers'];
$fpm_requests = (int)$this->_settings['phpfpm']['max_requests'];
if($fpm_children == 0) {
$fpm_children = 1;
}
$fpm_config = ';PHP-FPM configuration for "'.$this->_domain['domain'].'" created on ' . date("Y.m.d H:i:s") . "\n";
$fpm_config.= '['.$this->_domain['domain'].']'."\n";
$fpm_config.= 'listen = '.$this->getSocketFile()."\n";
if($this->_domain['loginname'] == 'froxlor.panel')
{
$fpm_config.= 'listen.owner = '.$this->_domain['guid']."\n";
$fpm_config.= 'listen.group = '.$this->_domain['guid']."\n";
}
else
{
$fpm_config.= 'listen.owner = '.$this->_domain['loginname']."\n";
$fpm_config.= 'listen.group = '.$this->_domain['loginname']."\n";
}
$fpm_config.= 'listen.mode = 0666'."\n";
if($this->_domain['loginname'] == 'froxlor.panel')
{
$fpm_config.= 'user = '.$this->_domain['guid']."\n";
$fpm_config.= 'group = '.$this->_domain['guid']."\n";
}
else
{
$fpm_config.= 'user = '.$this->_domain['loginname']."\n";
$fpm_config.= 'group = '.$this->_domain['loginname']."\n";
}
$fpm_config.= 'pm = '.$fpm_pm."\n";
$fpm_config.= 'pm.max_children = '.$fpm_children."\n";
if($fpm_pm == 'dynamic') {
$fpm_config.= 'pm.start_servers = '.$fpm_start_servers."\n";
$fpm_config.= 'pm.min_spare_servers = '.$fpm_min_spare_servers."\n";
$fpm_config.= 'pm.max_spare_servers = '.$fpm_max_spare_servers."\n";
}
$fpm_config.= 'pm.max_requests = '.$fpm_requests."\n";
$fpm_config.= ';chroot = '.makeCorrectDir($this->_domain['documentroot'])."\n";
$tmpdir = makeCorrectDir($this->_settings['phpfpm']['tmpdir'] . '/' . $this->_domain['loginname'] . '/');
if(!is_dir($tmpdir))
{
safe_exec('mkdir -p ' . escapeshellarg($tmpdir));
}
//$slowlog = makeCorrectFile($this->_settings['system']['logfiles_directory'] . $this->_domain['loginname'] . '/php-fpm_slow.log');
$fpm_config.= 'env[TMP] = '.$tmpdir."\n";
$fpm_config.= 'env[TMPDIR] = '.$tmpdir."\n";
$fpm_config.= 'env[TEMP] = '.$tmpdir."\n";
$fpm_config.= 'php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f '.$this->_domain['email']."\n";
if($this->_domain['loginname'] != 'froxlor.panel')
{
$fpm_config.= 'php_admin_value[open_basedir] = ' . makeCorrectDir($this->_settings['system']['documentroot_prefix'] . '/' . $this->_domain['loginname'] . '/') .':' . makeCorrectDir($this->_settings['phpfpm']['tmpdir'] . '/' . $this->_domain['loginname'] . '/') . ':' . $this->_settings['phpfpm']['peardir'] . "\n";
}
$fpm_config.= 'php_admin_value[session.save_path] = ' . makeCorrectDir($this->_settings['phpfpm']['tmpdir'] . '/' . $this->_domain['loginname'] . '/') . "\n";
$fpm_config.= 'php_admin_value[upload_tmp_dir] = ' . makeCorrectDir($this->_settings['phpfpm']['tmpdir'] . '/' . $this->_domain['loginname'] . '/') . "\n";
fwrite($fh, $fpm_config, strlen($fpm_config));
fclose($fh);
}
}
public function createIniFile($phpconfig)
{
return;
}
/**
* fpm-config file
*
* @param boolean $createifnotexists create the directory if it does not exist
*
* @return string the full path to the file
*/
public function getConfigFile($createifnotexists = true)
{
$configdir = makeCorrectDir($this->_settings['phpfpm']['configdir']);
$config = makeCorrectFile($configdir.'/'.$this->_domain['domain'].'.conf');
if(!is_dir($configdir) && $createifnotexists)
{
safe_exec('mkdir -p ' . escapeshellarg($configdir));
}
return $config;
}
/**
* return path of fpm-socket file
*
* @param boolean $createifnotexists create the directory if it does not exist
*
* @return string the full path to the socket
*/
public function getSocketFile($createifnotexists = true)
{
$socketdir = makeCorrectDir('/var/run/'.$this->_settings['system']['webserver'].'/');
$socket = makeCorrectFile($socketdir.'/'.$this->_domain['loginname'].'-'.$this->_domain['domain'].'-php-fpm.socket');
if(!is_dir($socketdir) && $createifnotexists)
{
safe_exec('mkdir -p '.$socketdir);
safe_exec('chown -R '.$this->_settings['system']['httpuser'].':'.$this->_settings['system']['httpgroup'].' '.$socketdir);
}
return $socket;
}
}

View File

@@ -28,10 +28,10 @@ return Array(
'cd /usr/ports/www/apache22',
'make config',
'make install',
'touch ' . $settings['system']['apacheconf_vhost'],
$configcommand['vhost'],
'chown root:0 ' . $settings['system']['apacheconf_vhost'],
'chmod 0600 ' . $settings['system']['apacheconf_vhost'],
'touch ' . $settings['system']['apacheconf_diroptions'],
$configcommand['diroptions'],
'chown root:0 ' . $settings['system']['apacheconf_diroptions'],
'chmod 0600 ' . $settings['system']['apacheconf_diroptions'],
'mkdir -p ' . $settings['system']['documentroot_prefix'],
@@ -57,6 +57,7 @@ return Array(
'commands_1' => Array(
'cd /usr/ports/dns/powerdns',
'make config',
'set MySQL backend',
'make install',
'echo "pdns_enable=\"YES\"" >> /etc/rc.conf',
),
@@ -113,6 +114,21 @@ return Array(
'sh /usr/local/etc/rc.d/postfix restart'
)
),
'postgrey' => Array(
'label' => 'Postgrey',
'commands_1' => Array(
'cd /usr/ports/mail/postgrey',
'make install clean'
),
'commands_2' => Array(
'sed -i.bak \'s/# *check_policy_service *inet:127\.0\.0\.1:10023/ check_policy_service inet:127\.0\.0\.1:10023/\' /usr/local/etc/postfix/main.cf',
'echo "postgrey_enable=\"YES\"" >> /etc/rc.conf'
),
'restart' => Array(
'/usr/local/etc/rc.d/postgrey restart',
'/usr/local/etc/rc.d/postfix restart'
)
),
'postfix_mxaccess' => Array(
'label' => 'Postfix MX-Access (anti spam)',
'files' => Array(
@@ -178,14 +194,22 @@ return Array(
'daemons' => Array(
'proftpd' => Array(
'label' => 'ProFTPd',
'commands_1' => Array(
'cd /usr/ports/ftp/proftpd',
'make config',
'set MySQL auth',
'set Include mod_quota',
'make install clean'
),
'commands_2' => Array(
'touch /usr/local/etc/proftpd.conf',
'chown root:0 /usr/local/etc/proftpd.conf',
'chmod 0600 /usr/local/etc/proftpd.conf',
'echo "proftpd_enable=\"YES\"" >> /etc/rc.conf'
),
'files' => Array(
'etc_proftpd_proftpd.conf' => '/usr/local/etc/proftpd.conf'
),
'commands' => Array(
'touch /usr/local/etc/proftpd.conf',
'chown root:0 /usr/local/etc/proftpd.conf',
'chmod 0600 /usr/local/etc/proftpd.conf'
),
'restart' => Array(
'/usr/local/etc/rc.d/proftpd restart'
)
@@ -195,18 +219,28 @@ return Array(
'etc' => Array(
'label' => $lng['admin']['configfiles']['etc'],
'daemons' => Array(
'cron' => Array(
'label' => 'Crond (cronscript)',
'commands' => Array(
'echo "*/1 * * * * root /usr/local/bin/php -q /var/customers/froxlor/scripts/froxlor_master_cronjob.php" >> /etc/crontab'
),
'restart' => Array(
'/etc/rc.d/cron restart'
)
),
'awstats' => Array(
'label' => 'Awstats',
'commands' => Array(
'cd /usr/ports/www/awstats/',
'make install clean',
'cp /usr/local/www/awstats/cgi-bin/awstats.model.conf '.makeCorrectDir($settings['system']['awstats_conf']),
'sed -i.bak \'s/^LogFile/# LogFile/\' '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.conf'),
'sed -i.bak \'s/^LogType/# LogType/\' '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.conf'),
'sed -i.bak \'s/^LogFormat/# LogFormat/\' '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.conf'),
'sed -i.bak \'s/^LogSeparator/# LogSeparator/\' '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.conf'),
'sed -i.bak \'s/^SiteDomain/# SiteDomain/\' '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.conf'),
'sed -i.bak \'s/^DirData/# DirData/\' '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.conf')
'sed -i.bak \'s/^LogFile/# LogFile/\' '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.model.conf'),
'sed -i.bak \'s/^LogType/# LogType/\' '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.model.conf'),
'sed -i.bak \'s/^LogFormat/# LogFormat/\' '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.model.conf'),
'sed -i.bak \'s/^LogSeparator/# LogSeparator/\' '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.model.conf'),
'sed -i.bak \'s/^SiteDomain/# SiteDomain/\' '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.model.conf'),
'sed -i.bak \'s/^DirData/# DirData/\' '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.model.conf'),
'sed -i.bak \'s/^DirIcons=\"\/awstatsicons\"/DirIcons=\"\/awstats-icon\"/\' '.makeCorrectFile($settings['system']['awstats_conf'].'/awstats.model.conf')
)
),
'libnss' => Array(

View File

@@ -39,6 +39,12 @@ return Array(
'mkdir -p ' . $settings['system']['mod_fcgid_tmpdir'],
'chmod 1777 ' . $settings['system']['mod_fcgid_tmpdir']
),
'files' => ((int)$settings['phpfpm']['enabled'] == 1) ?
Array(
'etc_apache2_modules.d_70_fastcgi.conf' => '/etc/apache2/modules.d/70_fastcgi.conf'
)
:
null,
'restart' => Array(
'rc-update add apache2 default',
'/etc/init.d/apache2 restart'

View File

@@ -34,6 +34,12 @@ return Array(
'chmod 1777 ' . $settings['system']['mod_fcgid_tmpdir'],
'a2dismod userdir'
),
'files' => ((int)$settings['phpfpm']['enabled'] == 1) ?
Array(
'etc_apache2_mods-enabled_fastcgi.conf' => '/etc/apache2/mods-enabled/fastcgi.conf'
)
:
null,
'restart' => Array(
'/etc/init.d/apache2 restart'
)

View File

@@ -34,6 +34,12 @@ return Array(
'chmod 1777 ' . $settings['system']['mod_fcgid_tmpdir'],
'a2dismod userdir'
),
'files' => ((int)$settings['phpfpm']['enabled'] == 1) ?
Array(
'etc_apache2_mods-enabled_fastcgi.conf' => '/etc/apache2/mods-enabled/fastcgi.conf'
)
:
null,
'restart' => Array(
'/etc/init.d/apache2 restart'
),

View File

@@ -34,6 +34,12 @@ return Array(
'chmod 1777 ' . $settings['system']['mod_fcgid_tmpdir'],
'a2dismod userdir'
),
'files' => ((int)$settings['phpfpm']['enabled'] == 1) ?
Array(
'etc_apache2_mods-enabled_fastcgi.conf' => '/etc/apache2/mods-enabled/fastcgi.conf'
)
:
null,
'restart' => Array(
'/etc/init.d/apache2 restart'
),

View File

@@ -17,6 +17,7 @@
function buildFormEx($form, $part = '')
{
global $settings;
$fields = '';
if(validateFormDefinition($form))
@@ -34,24 +35,42 @@ function buildFormEx($form, $part = '')
// only show one section
elseif($part != '' && ($groupname == $part || $part == 'all'))
{
if(isset($groupdetails['title']) && $groupdetails['title'] != '')
/**
* this part checks for the 'websrv_avail' entry in the settings-array
* if found, we check if the current webserver is in the array. If this
* is not the case, we change the setting type to "hidden", #502
*/
$do_show = true;
if(isset($groupdetails['websrv_avail']) && is_array($groupdetails['websrv_avail']))
{
$fields .= getFormGroupOutput($groupname, $groupdetails);
}
if(validateFieldDefinition($groupdetails))
{
// Prefetch form fields
foreach($groupdetails['fields'] as $fieldname => $fielddetails)
$websrv = $settings['system']['webserver'];
if(!in_array($websrv, $groupdetails['websrv_avail']))
{
$groupdetails['fields'][$fieldname] = array_merge_prefix($fielddetails, $fielddetails['type'], prefetchFormFieldData($fieldname, $fielddetails));
$form['groups'][$groupname]['fields'][$fieldname] = $groupdetails['fields'][$fieldname];
$do_show = false;
}
// Collect form field output
foreach($groupdetails['fields'] as $fieldname => $fielddetails)
}
if($do_show)
{
if(isset($groupdetails['title']) && $groupdetails['title'] != '')
{
$fields .= getFormFieldOutput($fieldname, $fielddetails);
$fields .= getFormGroupOutput($groupname, $groupdetails);
}
if(validateFieldDefinition($groupdetails))
{
// Prefetch form fields
foreach($groupdetails['fields'] as $fieldname => $fielddetails)
{
$groupdetails['fields'][$fieldname] = array_merge_prefix($fielddetails, $fielddetails['type'], prefetchFormFieldData($fieldname, $fielddetails));
$form['groups'][$groupname]['fields'][$fieldname] = $groupdetails['fields'][$fieldname];
}
// Collect form field output
foreach($groupdetails['fields'] as $fieldname => $fielddetails)
{
$fields .= getFormFieldOutput($fieldname, $fielddetails);
}
}
}
}

View File

@@ -19,6 +19,8 @@
function getFormFieldOutput($fieldname, $fielddata)
{
global $settings;
$returnvalue = '';
if(is_array($fielddata) && isset($fielddata['type']) && $fielddata['type'] != '' && function_exists('getFormFieldOutput' . ucfirst($fielddata['type'])))
{
@@ -44,7 +46,26 @@ function getFormFieldOutput($fieldname, $fielddata)
$fielddata['value'] = null;
}
}
$returnvalue = call_user_func('getFormFieldOutput' . ucfirst($fielddata['type']), $fieldname, $fielddata);
/**
* this part checks for the 'websrv_avail' entry in the settings-array
* if found, we check if the current webserver is in the array. If this
* is not the case, we change the setting type to "hidden", #502
*/
$do_show = true;
if(isset($fielddata['websrv_avail']) && is_array($fielddata['websrv_avail']))
{
$websrv = $settings['system']['webserver'];
if(!in_array($websrv, $fielddata['websrv_avail']))
{
$do_show = false;
}
}
if($do_show)
{
$returnvalue = call_user_func('getFormFieldOutput' . ucfirst($fielddata['type']), $fieldname, $fielddata);
}
}
return $returnvalue;
}

View File

@@ -71,6 +71,24 @@ function getFormOverviewGroupOutput($groupname, $groupdetails)
}
}
eval("\$group = \"" . getTemplate("settings/settings_overviewgroup") . "\";");
/**
* this part checks for the 'websrv_avail' entry in the settings-array
* if found, we check if the current webserver is in the array. If this
* is not the case, we change the setting type to "hidden", #502
*/
$do_show = true;
if(isset($groupdetails['websrv_avail']) && is_array($groupdetails['websrv_avail']))
{
$websrv = $settings['system']['webserver'];
if(!in_array($websrv, $groupdetails['websrv_avail']))
{
$do_show = false;
}
}
if($do_show)
{
eval("\$group = \"" . getTemplate("settings/settings_overviewgroup") . "\";");
}
return $group;
}

View File

@@ -37,8 +37,6 @@ function storeSettingDefaultIp($fieldname, $fielddata, $newfieldvalue)
{
$db->query('UPDATE `' . TABLE_PANEL_DOMAINS . '` SET `ipandport`=\'' . (int)$newfieldvalue . '\' WHERE `id` IN (\'' . implode('\',\'', $ids) . '\') AND `ipandport` = \'' . $db->escape(getSetting('system', 'defaultip')) . '\'');
}
inserttask('1');
}
return $returnvalue;

View File

@@ -61,7 +61,6 @@ function storeSettingFieldInsertBindTask($fieldname, $fielddata, $newfieldvalue)
{
if(saveSetting($fielddata['settinggroup'], $fielddata['varname'], $newfieldvalue) != false)
{
inserttask('4');
return array($fielddata['settinggroup'] . '.' . $fielddata['varname'] => $newfieldvalue);
}
else

View File

@@ -37,7 +37,6 @@ function storeSettingHostname($fieldname, $fielddata, $newfieldvalue)
if(count($ids) > 0)
{
$db->query('UPDATE `' . TABLE_PANEL_DOMAINS . '` SET `domain` = REPLACE(`domain`, \'' . $db->escape(getSetting('system', 'hostname')) . '\', \'' . $db->escape($newfieldvalue) . '\') WHERE `id` IN (\'' . implode('\',\'', $ids) . '\')');
inserttask('1');
}
}

View File

@@ -0,0 +1,44 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Functions
* @version $Id$
*/
function checkFcgidPhpFpm($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
{
global $settings;
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK);
/*
* check whether fcgid should be enabled but php-fpm is
*/
if($fieldname == 'system_mod_fcgid_enabled'
&& (int)$newfieldvalue == 1
&& (int)$settings['phpfpm']['enabled'] == 1
) {
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'phpfpmstillenabled');
}
/*
* check whether php-fpm should be enabled but fcgid is
*/
elseif($fieldname == 'system_phpfpm_enabled'
&& (int)$newfieldvalue == 1
&& (int)$settings['system']['mod_fcgid'] == 1
) {
$returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'fcgidstillenabled');
}
return $returnvalue;
}

View File

@@ -408,6 +408,8 @@ if(AREA == 'admin' || AREA == 'customer')
}
eval("\$header = \"" . getTemplate('header', '1') . "\";");
$current_year = date('Y', time());
eval("\$footer = \"" . getTemplate('footer', '1') . "\";");
if(isset($_POST['action']))

View File

@@ -218,7 +218,14 @@ return array (
array (
'url' => 'admin_phpsettings.php?page=overview',
'label' => $lng['menue']['phpsettings']['maintitle'],
'show_element' => ( getSetting('system', 'mod_fcgid') == true ),
'show_element' => (
getSetting('system', 'mod_fcgid') == true
/*
* @TODO activate if phpfpm knows custom php.ini files
*
* || getSetting('phpfpm', 'enabled') == true
*/
),
),
),
),

View File

@@ -52,6 +52,8 @@ define('TABLE_APS_TEMP_SETTINGS', 'aps_temp_settings');
define('TABLE_PANEL_CRONRUNS', 'cronjobs_run');
define('TABLE_PANEL_REDIRECTCODES', 'redirect_codes');
define('TABLE_PANEL_DOMAINREDIRECTS', 'domain_redirect_codes');
define('TABLE_PANEL_IPDOCROOTSETTINGS', 'ipsandports_docrootsettings');
define('TABLE_PANEL_DOMDOCROOTSETTINGS', 'domain_docrootsettings');
// APS constants
@@ -71,7 +73,7 @@ define('PACKAGE_ENABLED', 2);
// VERSION INFO
$version = '0.9.15';
$version = '0.9.17';
$dbversion = '2';
$branding = '';

File diff suppressed because it is too large Load Diff

View File

@@ -502,11 +502,8 @@ $lng['panel']['pathDescriptionEx'] = '<br /><br />If you want a redirect to anot
// ADDED IN 1.2.16-svn6
$lng['mails']['trafficninetypercent']['mailbody'] = 'Dear {NAME},\n\nyou used {TRAFFICUSED} MB of your available {TRAFFIC} MB of traffic.\nThis is more than 90%.\n\nYours sincerely, the Froxlor-Team';
$lng['mails']['trafficninetypercent']['subject'] = 'Reaching your traffic limit';
$lng['admin']['templates']['trafficninetypercent'] = 'Notification mail for customers when ninety percent of traffic is exhausted';
$lng['admin']['templates']['TRAFFIC'] = 'Replaced with the traffic, which was assigned to the customer.';
$lng['admin']['templates']['TRAFFICUSED'] = 'Replaced with the traffic, which was exhausted by the customer.';
$lng['admin']['templates']['TRAFFIC'] = 'Replaced with the traffic in mB, which was assigned to the customer.';
$lng['admin']['templates']['TRAFFICUSED'] = 'Replaced with the traffic in MB, which was exhausted by the customer.';
// ADDED IN 1.2.16-svn7
@@ -547,8 +544,8 @@ $lng['panel']['back'] = 'Back';
$lng['serversettings']['mod_log_sql']['title'] = 'Temporary save logs in the database';
$lng['serversettings']['mod_log_sql']['description'] = 'Use <a href="http://www.outoforder.cc/projects/apache/mod_log_sql/" title="mod_log_sql">mod_log_sql</a> to save webrequests temporarily<br /><b>This needs a special <a href="http://files.froxlor.org/docs/mod_log_sql/" title="mod_log_sql - documentation">apache-configuration</a>!</b>';
$lng['serversettings']['mod_fcgid']['title'] = 'Include PHP via mod_fcgid/suexec';
$lng['serversettings']['mod_fcgid']['description'] = 'Use mod_fcgid/suexec/libnss_mysql to run PHP with the corresponding useraccount.<br/><b>This needs a special webserver configuration, see <a href="http://wiki.froxlor.org/contrib/fcgid-handbook">http://wiki.froxlor.org/contrib/fcgid-handbook</a></b><br /><br /><div style="color:red">NOTE: This folder\'s content gets deleted regulary so avoid storing data in there manually.</div>';
$lng['serversettings']['mod_fcgid']['title'] = 'Enable FCGID';
$lng['serversettings']['mod_fcgid']['description'] = 'Use this to run PHP with the corresponding useraccount.<br /><br /><b>This needs a special webserver configuration for Apache, see <a href="http://wiki.froxlor.org/contrib/fcgid-handbook">http://wiki.froxlor.org/contrib/fcgid-handbook</a></b>';
$lng['serversettings']['sendalternativemail']['title'] = 'Use alternative email-address';
$lng['serversettings']['sendalternativemail']['description'] = 'Send the password-email to a different address during email-account-creation';
$lng['emails']['alternative_emailaddress'] = 'Alternative e-mail-address';
@@ -708,7 +705,7 @@ $lng['serversettings']['ticket']['noreply_name'] = 'Ticket e-mail sendername';
// ADDED IN 1.2.19-svn1
$lng['serversettings']['mod_fcgid']['configdir']['title'] = 'Configuration directory';
$lng['serversettings']['mod_fcgid']['configdir']['description'] = 'Where should all fcgid-configuration files be stored? If you don\'t use a self compiled suexec binary, which is the normal situation, this path must be under /var/www/';
$lng['serversettings']['mod_fcgid']['configdir']['description'] = 'Where should all fcgid-configuration files be stored? If you don\'t use a self compiled suexec binary, which is the normal situation, this path must be under /var/www/<br /><br /><div style="color:red">NOTE: This folder\'s content gets deleted regulary so avoid storing data in there manually.</div>';
$lng['serversettings']['mod_fcgid']['tmpdir']['title'] = 'Temp directory';
// ADDED IN 1.2.19-svn3
@@ -1442,7 +1439,7 @@ $lng['admin']['perlenabled'] = 'Perl enabled';
// ADDED IN FROXLOR 0.9.11-svn3
$lng['serversettings']['perl_path']['title'] = 'Path to perl';
$lng['serversettings']['perl_path']['description'] = 'Only relevant if you use lighttpd. Default is /usr/bin/perl';
$lng['serversettings']['perl_path']['description'] = 'Default is /usr/bin/perl';
// ADDED IN FROXLOR 0.9.12-svn1
$lng['admin']['fcgid_settings'] = 'FCGID';
@@ -1453,7 +1450,7 @@ $lng['admin']['mod_fcgid_group'] = 'Local group to use for FCGID (Froxlor vHost)
// ADDED IN FROXLOR 0.9.12-svn2
$lng['admin']['perl_settings'] = 'Perl/CGI';
$lng['serversettings']['perl']['suexecworkaround']['title'] = 'Enable SuExec workaround (Apache only)';
$lng['serversettings']['perl']['suexecworkaround']['title'] = 'Enable SuExec workaround';
$lng['serversettings']['perl']['suexecworkaround']['description'] = 'Enable only if customer docroots are not within the apache suexec path.<br />If enabled, Froxlor will generate a symlink from the customers perl-enabled directory + /cgi-bin/ to the given path.<br />Note that perl will then only work in the folders subdirectory /cgi-bin/ and not in the folder itself (as it does without this fix!)';
$lng['serversettings']['perl']['suexeccgipath']['title'] = 'Path for customer perl-enabled directory symlinks';
$lng['serversettings']['perl']['suexeccgipath']['description'] = 'You only need to set this if the SuExec-workaround is enabled.<br />ATTENTION: Be sure this path is within the suexec path or else this workaround is uselsess';
@@ -1517,8 +1514,53 @@ $lng['question']['customer_reallyunlock'] = 'Do you really want to unlock custom
// ADDED IN FROXLOR 0.9.15-svn1
$lng['serversettings']['perl_server']['title'] = 'Perl server location';
$lng['serversettings']['perl_server']['description'] = 'This is only used for Nginx<br />default is set for using the guide found at: http://wiki.nginx.org/SimpleCGI';
$lng['serversettings']['nginx_php_backend']['title'] = 'Nginx php backend';
$lng['serversettings']['perl_server']['description'] = 'Default is set for using the guide found at: http://wiki.nginx.org/SimpleCGI';
$lng['serversettings']['nginx_php_backend']['title'] = 'Nginx PHP backend';
$lng['serversettings']['nginx_php_backend']['description'] = 'this is where the PHP process is listening for requests from nginx, can be a unix socket of ip:port combination';
$lng['serversettings']['phpreload_command']['title'] = 'PHP reload command';
$lng['serversettings']['phpreload_command']['description'] = 'this is used to reload the Php backend if any is used (this is required to be set for Nginx) Default: Blank';
$lng['serversettings']['phpreload_command']['description'] = 'this is used to reload the PHP backend if any is used<br />Default: blank';
// ADDED IN FROXLOR 0.9.16
$lng['error']['intvaluetoolow'] = 'The given number is too low (field %s)';
$lng['error']['intvaluetoohigh'] = 'The given number is too high (field %s)';
$lng['admin']['phpfpm_settings'] = 'PHP-FPM';
$lng['serversettings']['phpfpm'] = 'Enable php-fpm';
$lng['serversettings']['phpfpm_settings']['configdir'] = 'Configuration directory of php-fpm';
$lng['serversettings']['phpfpm_settings']['reload'] = 'php-fpm restart command';
$lng['serversettings']['phpfpm_settings']['pm'] = 'Process manager control (pm)';
$lng['serversettings']['phpfpm_settings']['max_children']['title'] = 'The number of child processes';
$lng['serversettings']['phpfpm_settings']['max_children']['description'] = 'The number of child processes to be created when pm is set to \'static\' and the maximum number of child processes to be created when pm is set to \'dynamic\'<br />Equivalent to the PHP_FCGI_CHILDREN';
$lng['serversettings']['phpfpm_settings']['start_servers']['title'] = 'The number of child processes created on startup';
$lng['serversettings']['phpfpm_settings']['start_servers']['description'] = 'Note: Used only when pm is set to \'dynamic\'';
$lng['serversettings']['phpfpm_settings']['min_spare_servers']['title'] = 'The desired minimum number of idle server processes';
$lng['serversettings']['phpfpm_settings']['min_spare_servers']['description'] = 'Note: Used only when pm is set to \'dynamic\'<br />Note: Mandatory when pm is set to \'dynamic\'';
$lng['serversettings']['phpfpm_settings']['max_spare_servers']['title'] = 'The desired maximum number of idle server processes';
$lng['serversettings']['phpfpm_settings']['max_spare_servers']['description'] = 'Note: Used only when pm is set to \'dynamic\'<br />Note: Mandatory when pm is set to \'dynamic\'';
$lng['serversettings']['phpfpm_settings']['max_requests']['title'] = 'Requests per child before respawning';
$lng['serversettings']['phpfpm_settings']['max_requests']['description'] = 'For endless request processing specify \'0\'. Equivalent to PHP_FCGI_MAX_REQUESTS.';
$lng['error']['phpfpmstillenabled'] = 'PHP-FPM is currently active. Please deactivate it before activating FCGID';
$lng['error']['fcgidstillenabled'] = 'FCGID is currently active. Please deactivate it before activating PHP-FPM';
$lng['phpfpm']['vhost_httpuser'] = 'Local user to use for PHP-FPM (Froxlor vHost)';
$lng['phpfpm']['vhost_httpgroup'] = 'Local group to use for PHP-FPM (Froxlor vHost)';
$lng['phpfpm']['ownvhost']['title'] = 'Enable PHP-FPM for the Froxlor vHost';
$lng['phpfpm']['ownvhost']['description'] = 'If enabled, Froxlor will also be running under a local user';
// ADDED IN FROXLOR 0.9.17
$lng['crondesc']['cron_usage_report'] = 'sends reports about web- and traffic-usage';
$lng['serversettings']['report']['report'] = 'Enable sending of reports about web- and traffic-usage';
$lng['serversettings']['report']['webmax'] = 'Warning-level in percent for webspace';
$lng['serversettings']['report']['trafficmax'] = 'Warning-level in percent for traffic';
$lng['mails']['trafficmaxpercent']['mailbody'] = 'Dear {NAME},\n\nyou used {TRAFFICUSED} MB of your available {TRAFFIC} MB of traffic.\nThis is more than {MAX_PERCENT}%.\n\nYours sincerely, the Froxlor-Team';
$lng['mails']['trafficmaxpercent']['subject'] = 'Reaching your traffic limit';
$lng['admin']['templates']['trafficmaxpercent'] = 'Notification mail for customers when given maximum of percent of traffic is exhausted';
$lng['admin']['templates']['MAX_PERCENT'] = 'Replaced with the diskusage/traffic limit for sending reports in percent.';
$lng['admin']['templates']['USAGE_PERCENT'] = 'Replaced with the diskusage/traffic, which was exhausted by the customer in percent.';
$lng['admin']['templates']['diskmaxpercent'] = 'Notification mail for customers when given maximum of percent of diskspace is exhausted';
$lng['admin']['templates']['DISKAVAILABLE'] = 'Replaced with the diskusage in MB, which was assigned to the customer.';
$lng['admin']['templates']['DISKUSED'] = 'Replaced with the diskusage in MB, which was exhausted by the customer.';
$lng['serversettings']['dropdown'] = 'Dropdown';
$lng['serversettings']['manual'] = 'Manual';
$lng['mails']['webmaxpercent']['mailbody'] = 'Dear {NAME},\n\nyou used {DISKUSED} MB of your available {DISKAVAILABLE} MB of diskspace.\nThis is more than {MAX_PERCENT}%.\n\nYours sincerely, the Froxlor-Team';
$lng['mails']['webmaxpercent']['subject'] = 'Reaching your diskspace limit';
$lng['mysql']['database_edit'] = 'Edit database';

View File

@@ -377,7 +377,7 @@ $lng['serversettings']['maxloginattempts']['description'] = 'Maximale Anzahl an
$lng['serversettings']['deactivatetime']['title'] = 'L&auml;nge der Deaktivierung';
$lng['serversettings']['deactivatetime']['description'] = 'Zeitraum (in sek.) f&uuml;r den der Account deaktiviert ist.';
$lng['serversettings']['pathedit']['title'] = 'Pfad-Eingabemethode';
$lng['serversettings']['pathedit']['description'] = 'Soll ein Pfad via Dropdown-Men&uuml; ausgew&auml;hlt oder manuell eingegeben werden k&ouml;nnen.';
$lng['serversettings']['pathedit']['description'] = 'Soll ein Pfad via Auswahlliste ausgew&auml;hlt oder manuell eingegeben werden k&ouml;nnen.';
$lng['serversettings']['nameservers']['title'] = 'Nameserver';
$lng['serversettings']['nameservers']['description'] = 'Eine durch Komma getrennte Liste mit den Hostnamen aller Nameserver. Der erste ist der prim&auml;re.';
$lng['serversettings']['mxservers']['title'] = 'MX Server';
@@ -501,11 +501,8 @@ $lng['panel']['pathDescriptionEx'] = '<br /><br />Sollte eine Weiterleitung auf
// ADDED IN 1.2.16-svn6
$lng['mails']['trafficninetypercent']['mailbody'] = 'Sehr geehrte(r) {NAME},\n\nSie haben bereits {TRAFFICUSED} MB von Ihren insgesamt {TRAFFIC} MB Traffic verbraucht.\nDies sind mehr als 90%.\n\nVielen Dank,\ndas Froxlor-Team';
$lng['mails']['trafficninetypercent']['subject'] = 'Sie erreichen bald Ihr Traffic-Limit';
$lng['admin']['templates']['trafficninetypercent'] = 'Hinweismail f&uuml;r Kunden, wenn sie 90% des Traffics verbraucht haben';
$lng['admin']['templates']['TRAFFIC'] = 'Wird mit Traffic, der dem Kunden zugewiesen wurde, ersetzt.';
$lng['admin']['templates']['TRAFFICUSED'] = 'Wird mit Traffic, der vom Kunden bereits verbraucht wurde, ersetzt.';
$lng['admin']['templates']['TRAFFIC'] = 'Wird mit Traffic, der dem Kunden zugewiesen wurde, ersetzt (in MB).';
$lng['admin']['templates']['TRAFFICUSED'] = 'Wird mit Traffic, der vom Kunden bereits verbraucht wurde, ersetzt (in MB).';
// ADDED IN 1.2.16-svn7
@@ -547,7 +544,7 @@ $lng['panel']['back'] = 'Zur&uuml;ck';
$lng['serversettings']['mod_log_sql']['title'] = 'Logs in Datenbank zwischenspeichern';
$lng['serversettings']['mod_log_sql']['description'] = '<a href="http://www.outoforder.cc/projects/apache/mod_log_sql/" title="mod_log_sql">mod_log_sql</a> benutzen um die Webzugriffe tempor&auml;r zu speichern<br /><b>Dies ben&ouml;tigt eine spezielle Apache-Konfiguration</b>';
$lng['serversettings']['mod_fcgid']['title'] = 'PHP &uuml;ber mod_fcgid/suexec einbinden';
$lng['serversettings']['mod_fcgid']['description'] = 'mod_fcgid/suexec/libnss_mysql benutzen um PHP unter dem jeweiligen Useraccount laufen zu lassen<br /><b>Dies ben&ouml;tigt eine spezielle <a href="http://files.froxlor.org/docs/mod_log_sql/" title="mod_log_sql - Dokumentation">Apache-Konfiguration</a></b><br /><br /><div style="color:red">ACHTUNG: Der Inhalt dieses Ordners wird regelm&auml;&szlig;ig geleert, daher sollten keinerlei Daten dort manuell abgelegt werden.</div>';
$lng['serversettings']['mod_fcgid']['description'] = 'PHP unter dem jeweiligen Useraccount laufen lassen.<br /><br /><b>Dies ben&ouml;tigt eine spezielle Webserver-Konfiguration f&uuml;r Apache, siehe <a href="http://wiki.froxlor.org/contrib/fcgid-handbook">http://wiki.froxlor.org/contrib/fcgid-handbook</a>.</b>';
$lng['serversettings']['sendalternativemail']['title'] = 'Alternative E-Mail-Adresse benutzen';
$lng['serversettings']['sendalternativemail']['description'] = 'W&auml;hrend des Erstellens eines Accounts das Passwort an eine andere E-Mail-Adresse senden';
$lng['emails']['alternative_emailaddress'] = 'Alternative E-Mail-Adresse';
@@ -578,7 +575,6 @@ $lng['serversettings']['mysql_access_host']['description'] = 'Eine durch Komma g
// CHANGED IN 1.2.18
$lng['serversettings']['mod_log_sql']['description'] = '<a href="http://www.outoforder.cc/projects/apache/mod_log_sql/" title="mod_log_sql">mod_log_sql</a> benutzen um die Webzugriffe tempor&auml;r zu speichern<br /><b>Dies ben&ouml;tigt eine spezielle <a href="http://files.froxlor.org/docs/mod_log_sql/" title="mod_log_sql - Dokumentation">Apache-Konfiguration</a></b>';
$lng['serversettings']['mod_fcgid']['description'] = 'mod_fcgid/suexec/libnss_mysql benutzen um PHP unter dem jeweiligen Useraccount laufen zu lassen<br /><b>Dies ben&ouml;tigt eine spezielle Webserver-Konfiguration, siehe <a href="http://wiki.froxlor.org/contrib/fcgid-handbook">http://wiki.froxlor.org/contrib/fcgid-handbook</a>.</b>';
// ADDED IN 1.2.18-svn1
@@ -712,7 +708,7 @@ $lng['serversettings']['ticket']['noreply_name'] = 'Ticket E-Mail Absendername';
// ADDED IN 1.2.19-svn
$lng['serversettings']['mod_fcgid']['configdir']['title'] = 'Konfigurations-Verzeichnis';
$lng['serversettings']['mod_fcgid']['configdir']['description'] = 'Wo sollen alle Konfigurationsdateien von fcgid liegen? Wenn Sie keine selbst kompilierte suexec Binary benutzen, was in der Regel der Fall ist, muss dieser Pfad unter /var/www/ liegen.';
$lng['serversettings']['mod_fcgid']['configdir']['description'] = 'Wo sollen alle Konfigurationsdateien von fcgid liegen? Wenn Sie keine selbst kompilierte suexec Binary benutzen, was in der Regel der Fall ist, muss dieser Pfad unter /var/www/ liegen.<br /><br /><div style="color:red">ACHTUNG: Der Inhalt dieses Ordners wird regelm&auml;&szlig;ig geleert, daher sollten keinerlei Daten dort manuell abgelegt werden.</div>';
$lng['serversettings']['mod_fcgid']['tmpdir']['title'] = 'Tempor&auml;res Verzeichnis';
// ADDED IN 1.2.19-svn3
@@ -1425,7 +1421,7 @@ $lng['admin']['perlenabled'] = 'Perl verf&uuml;gbar';
// ADDED IN FROXLOR 0.9.11-svn3
$lng['serversettings']['perl_path']['title'] = 'Pfad zu Perl';
$lng['serversettings']['perl_path']['description'] = 'Nur n&ouml;tig f&uuml;r lighttpd-Nutzer. Standard ist /usr/bin/perl';
$lng['serversettings']['perl_path']['description'] = 'Standard ist /usr/bin/perl';
// ADDED IN FROXLOR 0.9.12-svn1
$lng['admin']['fcgid_settings'] = 'FCGID';
@@ -1436,7 +1432,7 @@ $lng['admin']['mod_fcgid_group'] = 'Lokale Gruppe f&uuml;r FCGID (Froxlor Vhost)
// ADDED IN FROXLOR 0.9.12-svn2
$lng['admin']['perl_settings'] = 'Perl/CGI';
$lng['serversettings']['perl']['suexecworkaround']['title'] = 'Aktiviere SuExec Workaround (nur f&uuml;r Apache)';
$lng['serversettings']['perl']['suexecworkaround']['title'] = 'Aktiviere SuExec Workaround';
$lng['serversettings']['perl']['suexecworkaround']['description'] = 'Aktivieren Sie den Workaround nur, wenn die Kunden-Heimatverzeichnisse sich nicht unterhalb des suexec-Pfades liegen.<br />Wenn aktiviert erstellt Froxlor eine Verkn&uuml;pfung des vom Kunden f&uuml;r Perl aktiviertem Pfad + /cgi-bin/ im angegebenen suexec-Pfad.<br />Bitte beachten Sie, dass Perl dann nur im Unterordner /cgi-bin/ des Kunden-Ordners funktioniert und nicht direkt in diesem Ordner (wie es ohne den Workaround w&auml;re!)';
$lng['serversettings']['perl']['suexeccgipath']['title'] = 'Pfad f&uuml;r Verkn&uuml;pfungen zu Kunden-Perl-Verzeichnis';
$lng['serversettings']['perl']['suexeccgipath']['description'] = 'Diese Einstellung wird nur ben&ouml;tigt, wenn der SuExec-Workaround aktiviert ist.<br />ACHTUNG: Stellen Sie sicher, dass sich der angegebene Pfad innerhalb des Suexec-Pfades befindet ansonsten ist der Workaround nutzlos';
@@ -1500,8 +1496,50 @@ $lng['question']['customer_reallyunlock'] = 'Wollen Sie den Kunden %s wirklich e
// ADDED IN FROXLOR 0.9.15-svn1
$lng['serversettings']['perl_server']['title'] = 'Perl Server Ort';
$lng['serversettings']['perl_server']['description'] = 'Nur f&uuml;r nginx<br />Der Standardwert ist diesem Guide entnommen: http://wiki.nginx.org/SimpleCGI';
$lng['serversettings']['perl_server']['description'] = 'Der Standardwert ist diesem Guide entnommen: http://wiki.nginx.org/SimpleCGI';
$lng['serversettings']['nginx_php_backend']['title'] = 'Nginx PHP Backend';
$lng['serversettings']['nginx_php_backend']['description'] = 'Dies ist das Backend, auf dem PHP auf Anfragen von Nginx h&ouml;rt. Kann ein UNIX Socket oder eine IP:Port Kombination sein';
$lng['serversettings']['phpreload_command']['title'] = 'PHP Reload Befehl';
$lng['serversettings']['phpreload_command']['description'] = 'Dieser wird ben&ouml;tigt, um das PHP Backend f&uuml;r Nginx bei Bedarf durch den Cronjob neu zu laden. (Nur f&uuml;r Nginx, Standard: leer)';
$lng['serversettings']['phpreload_command']['description'] = 'Dieser wird ben&ouml;tigt, um das PHP Backend bei Bedarf durch den Cronjob neu zu laden. (Standard: leer)';
// ADDED IN FROXLOR 0.9.16
$lng['error']['intvaluetoolow'] = 'Die angegebene Zahl ist zu klein (Feld %s)';
$lng['error']['intvaluetoohigh'] = 'Die angegebene Zahl ist zu gro&szlig; (Feld %s)';
$lng['admin']['phpfpm_settings'] = 'PHP-FPM';
$lng['serversettings']['phpfpm'] = 'Aktiviere php-fpm';
$lng['serversettings']['phpfpm_settings']['configdir'] = 'Pfad zu php-fpm Konfigurationen';
$lng['serversettings']['phpfpm_settings']['reload'] = 'Kommando zum Neustarten von php-fpm';
$lng['serversettings']['phpfpm_settings']['pm'] = 'Prozess Manager Control (PM)';
$lng['serversettings']['phpfpm_settings']['max_children']['title'] = 'Anzahl der Kind-Prozesse';
$lng['serversettings']['phpfpm_settings']['max_children']['description'] = 'Die Anzahl der zu startenden Kind-Prozesse wenn PM auf \'static\' steht und die maximale Anzahl der Prozesse wenn PM auf \'dynamic\' steht.<br />Equivalent zu PHP_FCGI_CHILDREN';
$lng['serversettings']['phpfpm_settings']['start_servers']['title'] = 'Anzahl der beim Starten zu erstellenden Kind-Prozesse';
$lng['serversettings']['phpfpm_settings']['start_servers']['description'] = 'Hinweis: Nur wenn PM auf \'dynamic\' steht';
$lng['serversettings']['phpfpm_settings']['min_spare_servers']['title'] = 'Mindestanzahl der Idle-Prozesse';
$lng['serversettings']['phpfpm_settings']['min_spare_servers']['description'] = 'Hinweis: Nur wenn PM auf \'dynamic\' steht<br />Wichtig: Pflichtangabe wenn PM auf \'dynamic\' steht';
$lng['serversettings']['phpfpm_settings']['max_spare_servers']['title'] = 'Maximale Anzahl der Idle-Prozesse';
$lng['serversettings']['phpfpm_settings']['max_spare_servers']['description'] = 'Hinweis: Nur wenn PM auf \'dynamic\' steht<br />Wichtig: Pflichtangabe wenn PM auf \'dynamic\' steht';
$lng['serversettings']['phpfpm_settings']['max_requests']['title'] = 'Requests pro Kindprozess bevor Neuerstellung (respawning)';
$lng['serversettings']['phpfpm_settings']['max_requests']['description'] = 'F&uuml;r keine Begrenzung \'0\' angeben. Equivalent zu PHP_FCGI_MAX_REQUESTS.';
$lng['error']['phpfpmstillenabled'] = 'PHP-FPM ist derzeit aktiviert. Bitte deaktiviere es, um FCGID zu aktivieren';
$lng['error']['fcgidstillenabled'] = 'FCGID ist derzeit aktiviert. Bitte deaktiviere es, um PHP-FPM zu aktivieren';
$lng['phpfpm']['vhost_httpuser'] = 'Lokaler Benutzer f&uuml;r PHP-FPM (Froxlor Vhost)';
$lng['phpfpm']['vhost_httpgroup'] = 'Lokale Gruppe f&uuml;r PHP-FPM (Froxlor Vhost)';
$lng['phpfpm']['ownvhost']['title'] = 'Verwende PHP-FPM im Froxlor Vhost';
$lng['phpfpm']['ownvhost']['description'] = 'Wenn verwendet, wird Froxlor selbst unter einem lokalem Benutzer ausgef&uuml;hrt';
// ADDED IN FROXLOR 0.9.17
$lng['crondesc']['cron_usage_report'] = 'Sende Reports &uuml;ber Webspace- und Trafficverbrauch';
$lng['serversettings']['report']['report'] = 'Aktiviere das Senden von Reports &uuml;ber Webspace- und Trafficverbrauch';
$lng['serversettings']['report']['webmax'] = 'Warn-Level in Prozent f&uuml;r Webspace';
$lng['serversettings']['report']['trafficmax'] = 'Warn-Level in Prozent f&uuml;r Traffic';
$lng['mails']['trafficmaxpercent']['mailbody'] = 'Sehr geehrte(r) {NAME},\n\nSie haben bereits {TRAFFICUSED} MB von Ihren insgesamt {TRAFFIC} MB Traffic verbraucht.\nDies sind mehr als {MAX_PERCENT}%.\n\nVielen Dank,\ndas Froxlor-Team';
$lng['mails']['trafficmaxpercent']['subject'] = 'Sie erreichen bald Ihr Traffic-Limit';
$lng['admin']['templates']['trafficmaxpercent'] = 'Hinweismail f&uuml;r Kunden, wenn sie die angegebenen Prozent des Traffics verbraucht haben';
$lng['admin']['templates']['MAX_PERCENT'] = 'Wird mit dem Webspace/Traffic-Limit, welches dem Kunden zugewiesen wurde, ersetzt.';
$lng['admin']['templates']['USAGE_PERCENT'] = 'Wird mit dem Webspace/Traffic, welcher vom Kunden bereits verbraucht wurde, ersetzt.';
$lng['admin']['templates']['diskmaxpercent'] = 'Hinweismail f&uuml;r Kunden, wenn sie die angegebenen Prozent des Webspaces verbraucht haben';
$lng['admin']['templates']['DISKAVAILABLE'] = 'Wird mit dem Webspace, der dem Kunden zugewiesen wurde, ersetzt (in MB).';
$lng['admin']['templates']['DISKUSED'] = 'Wird mit dem Webspace, welcher vom Kunden bereits verbraucht wurde, ersetzt (in MB).';
$lng['serversettings']['dropdown'] = 'Auswahlliste';
$lng['serversettings']['manual'] = 'Manuelle Eingabe';
$lng['mysql']['database_edit'] = 'Datenbank bearbeiten';

View File

@@ -201,7 +201,7 @@ if($db->num_rows($result) > 0)
//error while parsing mail
if($to == '' || $from == '')
{
$cronlog->logAction(CRON_ACTION, LOG_WARNING, "No valid headers found in mail to parse: " . $entry);
$cronlog->logAction(CRON_ACTION, LOG_WARNING, "No valid headers found in mail to parse");
continue;
}

View File

@@ -57,6 +57,12 @@ class apache
public function reload()
{
if((int)$this->settings['phpfpm']['enabled'] == 1)
{
fwrite($this->debugHandler, ' apache::reload: reloading php-fpm' . "\n");
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'reloading php-fpm');
safe_exec(escapeshellcmd($this->settings['phpfpm']['reload']));
}
fwrite($this->debugHandler, ' apache::reload: reloading apache' . "\n");
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'reloading apache');
safe_exec(escapeshellcmd($this->settings['system']['apachereload_command']));
@@ -76,9 +82,10 @@ class apache
}
$vhosts_filename = makeCorrectFile($vhosts_folder . '/05_froxlor_dirfix_nofcgid.conf');
if($this->settings['system']['mod_fcgid'] == '1')
{
// if we use fcgid we don't need this file
if($this->settings['system']['mod_fcgid'] == '1'
|| $this->settings['phpfpm']['enabled'] == '1'
) {
// if we use fcgid or php-fpm we don't need this file
if(file_exists($vhosts_filename))
{
fwrite($this->debugHandler, ' apache::_createStandardDirectoryEntry: unlinking ' . basename($vhosts_filename) . "\n");
@@ -220,7 +227,7 @@ class apache
if($this->settings['system']['mod_fcgid_ownvhost'] == '1')
{
$configdir = makeCorrectDir($this->settings['system']['mod_fcgid_configdir'] . '/froxlor.panel/');
$configdir = makeCorrectDir($this->settings['system']['mod_fcgid_configdir'] . '/froxlor.panel/' . $this->settings['system']['hostname']);
if((int)$this->settings['system']['mod_fcgid_wrapper'] == 0)
{
$this->virtualhosts_data[$vhosts_filename].= ' SuexecUserGroup "' . $this->settings['system']['mod_fcgid_httpuser'] . '" "' . $this->settings['system']['mod_fcgid_httpgroup'] . '"' . "\n";
@@ -239,6 +246,35 @@ class apache
$this->virtualhosts_data[$vhosts_filename].= ' </Directory>' . "\n";
}
}
// create php-fpm <Directory>-Part (config is created in apache_fcgid)
elseif($this->settings['phpfpm']['enabled'] == '1')
{
$domain = array(
'id' => 'none',
'domain' => $this->settings['system']['hostname'],
'adminid' => 1, /* first admin-user (superadmin) */
'mod_fcgid_starter' => -1,
'mod_fcgid_maxrequests' => -1,
'guid' => $this->settings['phpfpm']['vhost_httpuser'],
'openbasedir' => 0,
'safemode' => '0',
'email' => $this->settings['panel']['adminmail'],
'loginname' => 'froxlor.panel',
'documentroot' => $mypath
);
$php = new phpinterface($this->getDB(), $this->settings, $domain);
$this->virtualhosts_data[$vhosts_filename].= ' SuexecUserGroup "' . $this->settings['system']['mod_fcgid_httpuser'] . '" "' . $this->settings['system']['mod_fcgid_httpgroup'] . '"' . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' FastCgiExternalServer ' . $mypath . 'fpm.external -socket ' . $php->getInterface()->getSocketFile() . ' -user ' . $this->settings['system']['mod_fcgid_httpuser'] . ' -group ' . $this->settings['system']['mod_fcgid_httpuser'] . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' <Directory "' . $mypath . '">' . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' AddHandler php5-fastcgi .php'. "\n";
$this->virtualhosts_data[$vhosts_filename].= ' Action php5-fastcgi /fastcgiphp' . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' Options +ExecCGI' . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' Order allow,deny' . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' allow from all' . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' </Directory>' . "\n";
$this->virtualhosts_data[$vhosts_filename].= ' Alias /fastcgiphp ' . $mypath . 'fpm.external' . "\n";
}
/**
* dirprotection, see #72
@@ -721,6 +757,14 @@ class apache
if(preg_match('/^https?\:\/\//', $domain['documentroot']))
{
// redirect everything, not only root-directory, #541
$vhost_content.= ' <IfModule mod_rewrite.c>'."\n";
$vhost_content.= ' RewriteEngine On' . "\n";
$vhost_content.= ' RewriteCond %{HTTPS} off' . "\n";
$vhost_content.= ' RewriteRule (.*) '. $this->idnaConvert->encode($domain['documentroot']).'%{REQUEST_URI}'. "\n";
$vhost_content.= ' </IfModule>' . "\n";
$code = getDomainRedirectCode($domain['id']);
$vhost_content.= ' Redirect '.$code.' / ' . $this->idnaConvert->encode($domain['documentroot']) . "\n";
}
@@ -1089,6 +1133,11 @@ class apache
$this->wipeOutOldDiroptionConfigs();
}
}
else
{
// no more diroptions, but there might be some file-corpses which have to be removed
$this->wipeOutOldDiroptionConfigs();
}
// Write htpasswds
@@ -1124,6 +1173,11 @@ class apache
$this->logger->logAction(CRON_ACTION, LOG_WARNING, 'WARNING!!! ' . $this->settings['system']['apacheconf_htpasswddir'] . ' is not a directory. htpasswd directory protection is disabled!!!');
}
}
else
{
// no more htpasswds, but there might be some file-corpses which have to be removed
$this->wipeOutOldHtpasswdConfigs();
}
// Write virtualhosts

View File

@@ -26,219 +26,58 @@ if(@php_sapi_name() != 'cli'
class apache_fcgid extends apache
{
private $php_configs_cache = array();
private $admin_cache = array();
/*
* We put together the needed php options in the virtualhost entries
*/
protected function composePhpOptions($domain)
{
$php_options_text = '';
if($domain['phpenabled'] == '1')
{
// This vHost has PHP enabled and we are using mod_fcgid
//create basic variables for config
$php = new phpinterface($this->getDB(), $this->settings, $domain);
$phpconfig = $php->getPhpConfig((int)$domain['phpsettingid']);
$configdir = makeCorrectDir($this->settings['system']['mod_fcgid_configdir'] . '/' . $domain['loginname'] . '/' . $domain['domain'] . '/');
$starter_filename = makeCorrectFile($configdir . '/php-fcgi-starter');
$phpini_filename = makeCorrectFile($configdir . '/php.ini');
$tmpdir = makeCorrectDir($this->settings['system']['mod_fcgid_tmpdir'] . '/' . $domain['loginname'] . '/');
// create config dir if necessary
if(!is_dir($configdir))
{
safe_exec('mkdir -p ' . escapeshellarg($configdir));
safe_exec('chown ' . $domain['guid'] . ':' . $domain['guid'] . ' ' . escapeshellarg($configdir));
}
// create tmp dir if necessary
if(!is_dir($tmpdir))
{
safe_exec('mkdir -p ' . escapeshellarg($tmpdir));
safe_exec('chown -R ' . $domain['guid'] . ':' . $domain['guid'] . ' ' . escapeshellarg($tmpdir));
safe_exec('chmod 0750 ' . escapeshellarg($tmpdir));
}
// Load php config
$phpconfig = $this->getPhpConfig((int)$domain['phpsettingid']);
if((int)$this->settings['system']['mod_fcgid_wrapper'] == 0)
if((int)$this->settings['phpfpm']['enabled'] == 1)
{
$php_options_text.= ' SuexecUserGroup "' . $domain['loginname'] . '" "' . $domain['loginname'] . '"' . "\n";
$php_options_text.= ' ScriptAlias /php/ ' . $configdir . "\n";
}
else
{
$php_options_text.= ' SuexecUserGroup "' . $domain['loginname'] . '" "' . $domain['loginname'] . '"' . "\n";
$php_options_text.= ' <Directory "' . $domain['documentroot'] . '">' . "\n";
$file_extensions = explode(' ', $phpconfig['file_extensions']);
$php_options_text.= ' AddHandler fcgid-script .' . implode(' .', $file_extensions) . "\n";
foreach($file_extensions as $file_extension)
{
$php_options_text.= ' FCGIWrapper ' . $starter_filename . ' .' . $file_extension . "\n";
}
$php_options_text.= ' FastCgiExternalServer ' . makeCorrectDir($domain['documentroot']) . 'fpm.external -socket ' . $php->getInterface()->getSocketFile() . ' -user ' . $domain['loginname'] . ' -group ' . $domain['loginname'] . "\n";
$php_options_text.= ' <Directory "' . makeCorrectDir($domain['documentroot']) . '">' . "\n";
$php_options_text.= ' AddHandler php5-fastcgi .php'. "\n";
$php_options_text.= ' Action php5-fastcgi /fastcgiphp' . "\n";
$php_options_text.= ' Options +ExecCGI' . "\n";
$php_options_text.= ' Order allow,deny' . "\n";
$php_options_text.= ' allow from all' . "\n";
$php_options_text.= ' </Directory>' . "\n";
}
// create starter
$starter_file = "#!/bin/sh\n\n";
$starter_file.= "#\n";
$starter_file.= "# starter created/changed on " . date("Y.m.d H:i:s") . " for domain '" . $domain['domain'] . "' with id #" . $domain['id'] . " from php template '" . $phpconfig['description'] . "' with id #" . $phpconfig['id'] . "\n";
$starter_file.= "# Do not change anything in this file, it will be overwritten by the Froxlor Cronjob!\n";
$starter_file.= "#\n\n";
$starter_file.= "umask 022\n";
$starter_file.= "PHPRC=" . escapeshellarg($configdir) . "\n";
$starter_file.= "export PHPRC\n";
// set number of processes for one domain
if((int)$domain['mod_fcgid_starter'] != - 1)
{
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$domain['mod_fcgid_starter'] . "\n";
$php_options_text.= ' Alias /fastcgiphp ' . makeCorrectDir($domain['documentroot']) . 'fpm.external' . "\n";
}
else
{
if((int)$phpconfig['mod_fcgid_starter'] != - 1)
if((int)$this->settings['system']['mod_fcgid_wrapper'] == 0)
{
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$phpconfig['mod_fcgid_starter'] . "\n";
$php_options_text.= ' SuexecUserGroup "' . $domain['loginname'] . '" "' . $domain['loginname'] . '"' . "\n";
$php_options_text.= ' ScriptAlias /php/ ' . $php->getInterface()->getConfigDir() . "\n";
}
else
{
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$this->settings['system']['mod_fcgid_starter'] . "\n";
}
}
$starter_file.= "export PHP_FCGI_CHILDREN\n";
// set number of maximum requests for one domain
if((int)$domain['mod_fcgid_maxrequests'] != - 1)
{
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$domain['mod_fcgid_maxrequests'] . "\n";
}
else
{
if((int)$phpconfig['mod_fcgid_maxrequests'] != - 1)
{
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$phpconfig['mod_fcgid_maxrequests'] . "\n";
}
else
{
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$this->settings['system']['mod_fcgid_maxrequests'] . "\n";
}
}
$starter_file.= "export PHP_FCGI_MAX_REQUESTS\n";
// Set Binary
$starter_file.= "exec " . $phpconfig['binary'] . " -c " . escapeshellarg($configdir) . "\n";
//remove +i attibute, so starter can be overwritten
if(file_exists($starter_filename))
{
removeImmutable($starter_filename);
}
$starter_file_handler = fopen($starter_filename, 'w');
fwrite($starter_file_handler, $starter_file);
fclose($starter_file_handler);
safe_exec('chmod 750 ' . escapeshellarg($starter_filename));
safe_exec('chown ' . $domain['guid'] . ':' . $domain['guid'] . ' ' . escapeshellarg($starter_filename));
setImmutable($starter_filename);
// define the php.ini
$openbasedir = '';
$openbasedirc = ';';
if($domain['openbasedir'] == '1')
{
$openbasedirc = '';
$_phpappendopenbasedir = '';
$_custom_openbasedir = explode(':', $this->settings['system']['mod_fcgid_peardir']);
foreach($_custom_openbasedir as $cobd)
{
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
}
$_custom_openbasedir = explode(':', $this->settings['system']['phpappendopenbasedir']);
foreach($_custom_openbasedir as $cobd)
{
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
}
if($domain['openbasedir_path'] == '0' && strstr($domain['documentroot'], ":") === false)
{
$openbasedir = appendOpenBasedirPath($domain['documentroot'], true);
}
else
{
$openbasedir = appendOpenBasedirPath($domain['customerroot'], true);
}
$openbasedir .= appendOpenBasedirPath($tmpdir);
$openbasedir .= $_phpappendopenbasedir;
$openbasedir = explode(':', $openbasedir);
$clean_openbasedir = array();
foreach($openbasedir as $number => $path)
{
if(trim($path) != '/')
$php_options_text.= ' SuexecUserGroup "' . $domain['loginname'] . '" "' . $domain['loginname'] . '"' . "\n";
$php_options_text.= ' <Directory "' . $domain['documentroot'] . '">' . "\n";
$file_extensions = explode(' ', $phpconfig['file_extensions']);
$php_options_text.= ' AddHandler fcgid-script .' . implode(' .', $file_extensions) . "\n";
foreach($file_extensions as $file_extension)
{
$clean_openbasedir[] = makeCorrectDir($path);
$php_options_text.= ' FCGIWrapper ' . $php->getInterface()->getStarterFile() . ' .' . $file_extension . "\n";
}
$php_options_text.= ' Options +ExecCGI' . "\n";
$php_options_text.= ' Order allow,deny' . "\n";
$php_options_text.= ' allow from all' . "\n";
$php_options_text.= ' </Directory>' . "\n";
}
$openbasedir = implode(':', $clean_openbasedir);
}
else
{
$openbasedir = 'none';
$openbasedirc = ';';
}
$admin = $this->getAdminData($domain['adminid']);
$php_ini_variables = array(
'SAFE_MODE' => ($domain['safemode'] == '0' ? 'Off' : 'On'),
'PEAR_DIR' => $this->settings['system']['mod_fcgid_peardir'],
'OPEN_BASEDIR' => $openbasedir,
'OPEN_BASEDIR_C' => $openbasedirc,
'OPEN_BASEDIR_GLOBAL' => $this->settings['system']['phpappendopenbasedir'],
'TMP_DIR' => $tmpdir,
'CUSTOMER_EMAIL' => $domain['email'],
'ADMIN_EMAIL' => $admin['email'],
'DOMAIN' => $domain['domain'],
'CUSTOMER' => $domain['loginname'],
'ADMIN' => $admin['loginname']
);
//insert a small header for the file
$phpini_file = ";\n";
$phpini_file.= "; php.ini created/changed on " . date("Y.m.d H:i:s") . " for domain '" . $domain['domain'] . "' with id #" . $domain['id'] . " from php template '" . $phpconfig['description'] . "' with id #" . $phpconfig['id'] . "\n";
$phpini_file.= "; Do not change anything in this file, it will be overwritten by the Froxlor Cronjob!\n";
$phpini_file.= ";\n\n";
$phpini_file.= replace_variables($phpconfig['phpsettings'], $php_ini_variables);
$phpini_file = str_replace('"none"', 'none', $phpini_file);
$phpini_file = preg_replace('/\"+/', '"', $phpini_file);
$phpini_file_handler = fopen($phpini_filename, 'w');
fwrite($phpini_file_handler, $phpini_file);
fclose($phpini_file_handler);
safe_exec('chown root:0 ' . escapeshellarg($phpini_filename));
safe_exec('chmod 0644 ' . escapeshellarg($phpini_filename));
// create starter-file | config-file
$php->getInterface()->createConfig($phpconfig);
// create php.ini
// @TODO make php-fpm support this
$php->getInterface()->createIniFile($phpconfig);
}
else
{
@@ -248,149 +87,56 @@ class apache_fcgid extends apache
return $php_options_text;
}
private function getPhpConfig($php_config_id)
{
$php_config_id = intval($php_config_id);
// If domain has no config, we will use the default one.
if($php_config_id == 0)
{
$php_config_id = 1;
}
if(!isset($this->php_configs_cache[$php_config_id]))
{
$this->php_configs_cache[$php_config_id] = $this->getDB()->query_first("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = " . (int)$php_config_id);
}
return $this->php_configs_cache[$php_config_id];
}
private function getAdminData($adminid)
{
$adminid = intval($adminid);
if(!isset($this->admin_cache[$adminid]))
{
$this->admin_cache[$adminid] = $this->getDB()->query_first("SELECT `email`, `loginname` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid` = " . (int)$adminid);
}
return $this->admin_cache[$adminid];
}
public function createOwnVhostStarter()
{
if ($this->settings['system']['mod_fcgid_ownvhost'] == '1')
{
if ($this->settings['system']['mod_fcgid_ownvhost'] == '1'
|| ($this->settings['phpfpm']['enabled'] == '1'
&& $this->settings['phpfpm']['enabled_ownvhost'] == '1')
) {
$mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__)))); // /var/www/froxlor, needed for chown
$configdir = makeCorrectDir($this->settings['system']['mod_fcgid_configdir'] . '/froxlor.panel/');
$starter_filename = makeCorrectFile($configdir . '/php-fcgi-starter');
$phpini_filename = makeCorrectFile($configdir . '/php.ini');
$tmpdir = makeCorrectDir($this->settings['system']['mod_fcgid_tmpdir'] . '/froxlor.panel/');
$user = $this->settings['system']['mod_fcgid_httpuser'];
$group = $this->settings['system']['mod_fcgid_httpgroup'];
if ($this->settings['system']['mod_fcgid_ownvhost'] == '1')
{
$user = $this->settings['system']['mod_fcgid_httpuser'];
$group = $this->settings['system']['mod_fcgid_httpgroup'];
}
elseif($this->settings['phpfpm']['enabled'] == '1'
&& $this->settings['phpfpm']['enabled_ownvhost'] == '1'
) {
$user = $this->settings['phpfpm']['vhost_httpuser'];
$group = $this->settings['phpfpm']['vhost_httpgroup'];
}
$domain = array(
'id' => 'none',
'domain' => $this->settings['system']['hostname'],
'adminid' => 1, /* first admin-user (superadmin) */
'mod_fcgid_starter' => -1,
'mod_fcgid_maxrequests' => -1,
'guid' => $user,
'openbasedir' => 0,
'safemode' => '0',
'email' => $this->settings['panel']['adminmail'],
'loginname' => 'froxlor.panel',
'documentroot' => $mypath
);
// all the files and folders have to belong to the local user
// now because we also use fcgid for our own vhost
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath));
// create config dir if necessary
if(!is_dir($configdir))
{
safe_exec('mkdir -p ' . escapeshellarg($configdir));
safe_exec('chown ' . $user . ':' . $group . ' ' . escapeshellarg($configdir));
}
// create tmp dir if necessary
if(!is_dir($tmpdir))
{
safe_exec('mkdir -p ' . escapeshellarg($tmpdir));
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($tmpdir));
safe_exec('chmod 0750 ' . escapeshellarg($tmpdir));
}
// get php.ini for our own vhost
$phpconfig = $this->getPhpConfig((int)$this->settings['system']['mod_fcgid_defaultini_ownvhost']);
$php = new phpinterface($this->getDB(), $this->settings, $domain);
// create starter
$starter_file = "#!/bin/sh\n\n";
$starter_file.= "#\n";
$starter_file.= "# starter created/changed on " . date("Y.m.d H:i:s") . " for the Froxlor vhost\n";
$starter_file.= "# Do not change anything in this file, it will be overwritten by the Froxlor Cronjob!\n";
$starter_file.= "#\n\n";
$starter_file.= "umask 022\n";
$starter_file.= "PHPRC=" . escapeshellarg($configdir) . "\n";
$starter_file.= "export PHPRC\n";
if((int)$phpconfig['mod_fcgid_starter'] != - 1)
{
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$phpconfig['mod_fcgid_starter'] . "\n";
}
else
{
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$this->settings['system']['mod_fcgid_starter'] . "\n";
}
$starter_file.= "export PHP_FCGI_CHILDREN\n";
if((int)$phpconfig['mod_fcgid_maxrequests'] != - 1)
{
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$phpconfig['mod_fcgid_maxrequests'] . "\n";
}
else
{
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$this->settings['system']['mod_fcgid_maxrequests'] . "\n";
}
$starter_file.= "export PHP_FCGI_MAX_REQUESTS\n";
// @FIXME don't use fcgid settings if not fcgid in use, but we don't have anything else atm
$phpconfig = $php->getPhpConfig($this->settings['system']['mod_fcgid_defaultini_ownvhost']);
// Set Binary
$starter_file.= "exec " . $phpconfig['binary'] . " -c " . escapeshellarg($configdir) . "\n";
//remove +i attibute, so starter can be overwritten
if(file_exists($starter_filename))
{
removeImmutable($starter_filename);
}
$starter_file_handler = fopen($starter_filename, 'w');
fwrite($starter_file_handler, $starter_file);
fclose($starter_file_handler);
safe_exec('chmod 750 ' . escapeshellarg($starter_filename));
safe_exec('chown ' . $user . ':' . $group . ' ' . escapeshellarg($starter_filename));
setImmutable($starter_filename);
// define the php.ini
$php_ini_variables = array(
'SAFE_MODE' => 'Off',
'PEAR_DIR' => $this->settings['system']['mod_fcgid_peardir'],
'OPEN_BASEDIR' => 'none',
'OPEN_BASEDIR_C' => ';',
'OPEN_BASEDIR_GLOBAL' => '',
'TMP_DIR' => $tmpdir,
'CUSTOMER_EMAIL' => $this->settings['panel']['adminmail'],
'ADMIN_EMAIL' => $this->settings['panel']['adminmail'],
'DOMAIN' => $this->settings['system']['hostname'],
'CUSTOMER' => $user,
'ADMIN' => $user
);
//insert a small header for the file
$phpini_file = ";\n";
$phpini_file.= "; php.ini created/changed on " . date("Y.m.d H:i:s") . " for Froxlor-vhost from php template '" . $phpconfig['description'] . "' with id #" . $phpconfig['id'] . "\n";
$phpini_file.= "; Do not change anything in this file, it will be overwritten by the Froxlor Cronjob!\n";
$phpini_file.= ";\n\n";
$phpini_file.= replace_variables($phpconfig['phpsettings'], $php_ini_variables);
$phpini_file = str_replace('"none"', 'none', $phpini_file);
$phpini_file = preg_replace('/\"+/', '"', $phpini_file);
$phpini_file_handler = fopen($phpini_filename, 'w');
fwrite($phpini_file_handler, $phpini_file);
fclose($phpini_file_handler);
safe_exec('chown root:0 ' . escapeshellarg($phpini_filename));
safe_exec('chmod 0644 ' . escapeshellarg($phpini_filename));
// create starter-file | config-file
$php->getInterface()->createConfig($phpconfig);
// create php.ini
// @TODO make php-fpm support this
$php->getInterface()->createIniFile($phpconfig);
}
}
}
?>

View File

@@ -61,6 +61,12 @@ class lighttpd
public function reload()
{
if((int)$this->settings['phpfpm']['enabled'] == 1)
{
fwrite($this->debugHandler, ' lighttpd::reload: reloading php-fpm' . "\n");
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'reloading php-fpm');
safe_exec(escapeshellcmd($this->settings['phpfpm']['reload']));
}
fwrite($this->debugHandler, ' lighttpd::reload: reloading lighttpd' . "\n");
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'reloading lighttpd');
safe_exec(escapeshellcmd($this->settings['system']['apachereload_command']));
@@ -138,6 +144,38 @@ class lighttpd
$this->lighttpd_data[$vhost_filename].= ' }' . "\n";
*/
/**
* own php-fpm vhost
*/
if((int)$this->settings['phpfpm']['enabled'] == 1)
{
$domain = array(
'id' => 'none',
'domain' => $this->settings['system']['hostname'],
'adminid' => 1, /* first admin-user (superadmin) */
'mod_fcgid_starter' => -1,
'mod_fcgid_maxrequests' => -1,
'guid' => $this->settings['phpfpm']['vhost_httpuser'],
'openbasedir' => 0,
'safemode' => '0',
'email' => $this->settings['panel']['adminmail'],
'loginname' => 'froxlor.panel',
'documentroot' => $mypath
);
$php = new phpinterface($this->getDB(), $this->settings, $domain);
$this->lighttpd_data[$vhost_filename].= ' fastcgi.server = ( '."\n";
$this->lighttpd_data[$vhost_filename].= "\t".'".php" => ('."\n";
$this->lighttpd_data[$vhost_filename].= "\t\t".'"localhost" => ('."\n";
$this->lighttpd_data[$vhost_filename].= "\t\t".'"socket" => "'.$php->getInterface()->getSocketFile().'",'."\n";
$this->lighttpd_data[$vhost_filename].= "\t\t".'"check-local" => "enable",'."\n";
$this->lighttpd_data[$vhost_filename].= "\t\t".'"disable-time" => 1'."\n";
$this->lighttpd_data[$vhost_filename].= "\t".')'."\n";
$this->lighttpd_data[$vhost_filename].= "\t".')'."\n";
$this->lighttpd_data[$vhost_filename].= ' )'."\n";
}
if($row_ipsandports['specialsettings'] != '')
{
$this->lighttpd_data[$vhost_filename].= $row_ipsandports['specialsettings'] . "\n";
@@ -403,7 +441,15 @@ class lighttpd
$vhost_content = '';
$vhost_content.= $this->getServerNames($domain) . " {\n";
// respect ssl_redirect settings, #542
if($ssl_vhost == false
&& $domain['ssl'] == '1'
&& $domain['ssl_redirect'] == '1'
) {
$domain['documentroot'] = 'https://' . $domain['domain'] . '/';
}
if(preg_match('/^https?\:\/\//', $domain['documentroot']))
{
$vhost_content.= ' url.redirect = (' . "\n";

View File

@@ -28,241 +28,86 @@ if(@php_sapi_name() != 'cli'
class lighttpd_fcgid extends lighttpd
{
private $php_configs_cache = array();
private $admin_cache = array();
protected function composePhpOptions($domain)
{
$php_options_text = '';
if($domain['phpenabled'] == '1')
{
// This vHost has PHP enabled and we are using mod_fcgid
//create basic variables for config
$php = new phpinterface($this->getDB(), $this->settings, $domain);
$phpconfig = $php->getPhpConfig((int)$domain['phpsettingid']);
$configdir = makeCorrectDir($this->settings['system']['mod_fcgid_configdir'] . '/' . $domain['loginname'] . '/' . $domain['domain'] . '/');
$starter_filename = makeCorrectFile($configdir . '/php-fcgi-starter');
$phpini_filename = makeCorrectFile($configdir . '/php.ini');
$tmpdir = makeCorrectDir($this->settings['system']['mod_fcgid_tmpdir'] . '/' . $domain['loginname'] . '/');
// create config dir if necessary
if(!is_dir($configdir))
// vhost data for php-fpm
if((int)$this->settings['phpfpm']['enabled'] == 1)
{
safe_exec('mkdir -p ' . escapeshellarg($configdir));
safe_exec('chown ' . $domain['guid'] . ':' . $domain['guid'] . ' ' . escapeshellarg($configdir));
}
// create tmp dir if necessary
if(!is_dir($tmpdir))
{
safe_exec('mkdir -p ' . escapeshellarg($tmpdir));
safe_exec('chown -R ' . $domain['guid'] . ':' . $domain['guid'] . ' ' . escapeshellarg($tmpdir));
safe_exec('chmod 0750 ' . escapeshellarg($tmpdir));
}
// Load php config
$phpconfig = $this->getPhpConfig((int)$domain['phpsettingid']);
$php_options_text = ' fastcgi.server = ( '."\n";
$file_extensions = explode(' ', $phpconfig['file_extensions']);
foreach($file_extensions as $f_extension)
{
$php_options_text.= "\t".'".'.$f_extension.'" => ('."\n";
$php_options_text = ' fastcgi.server = ( '."\n";
$php_options_text.= "\t".'".php" => ('."\n";
$php_options_text.= "\t\t".'"localhost" => ('."\n";
$php_options_text.= "\t\t".'"socket" => "/var/run/lighttpd/'.$domain['loginname'].'-'.$domain['domain'].'-php.socket",'."\n";
$php_options_text.= "\t\t".'"bin-path" => "'.$phpconfig['binary'].' -c '.$phpini_filename.'",'."\n";
$php_options_text.= "\t\t".'"bin-environment" => ('."\n";
if((int)$domain['mod_fcgid_starter'] != - 1)
$php_options_text.= "\t\t".'"socket" => "'.$php->getInterface()->getSocketFile().'",'."\n";
$php_options_text.= "\t\t".'"check-local" => "enable",'."\n";
$php_options_text.= "\t\t".'"disable-time" => 1'."\n";
$php_options_text.= "\t".')'."\n";
$php_options_text.= "\t".')'."\n";
$php_options_text.= ' )'."\n";
}
// vhost data for fcgid
elseif((int)$this->settings['system']['mod_fcgid'] == 1)
{
$php_options_text = ' fastcgi.server = ( '."\n";
$file_extensions = explode(' ', $phpconfig['file_extensions']);
foreach($file_extensions as $f_extension)
{
$php_options_text.= "\t\t\t".'"PHP_FCGI_CHILDREN" => "' . (int)$domain['mod_fcgid_starter'] . '",'."\n";
}
else
{
if((int)$phpconfig['mod_fcgid_starter'] != - 1)
$php_options_text.= "\t".'".'.$f_extension.'" => ('."\n";
$php_options_text.= "\t\t".'"localhost" => ('."\n";
$php_options_text.= "\t\t".'"socket" => "/var/run/lighttpd/'.$domain['loginname'].'-'.$domain['domain'].'-php.socket",'."\n";
$php_options_text.= "\t\t".'"bin-path" => "'.$phpconfig['binary'].' -c '.$php->getInterface()->getIniFile().'",'."\n";
$php_options_text.= "\t\t".'"bin-environment" => ('."\n";
if((int)$domain['mod_fcgid_starter'] != - 1)
{
$php_options_text.= "\t\t\t".'"PHP_FCGI_CHILDREN" => "' . (int)$phpconfig['mod_fcgid_starter'] . '",'."\n";
$php_options_text.= "\t\t\t".'"PHP_FCGI_CHILDREN" => "' . (int)$domain['mod_fcgid_starter'] . '",'."\n";
}
else
{
$php_options_text.= "\t\t\t".'"PHP_FCGI_CHILDREN" => "' . (int)$this->settings['system']['mod_fcgid_starter'] . '",'."\n";
if((int)$phpconfig['mod_fcgid_starter'] != - 1)
{
$php_options_text.= "\t\t\t".'"PHP_FCGI_CHILDREN" => "' . (int)$phpconfig['mod_fcgid_starter'] . '",'."\n";
}
else
{
$php_options_text.= "\t\t\t".'"PHP_FCGI_CHILDREN" => "' . (int)$this->settings['system']['mod_fcgid_starter'] . '",'."\n";
}
}
}
if((int)$domain['mod_fcgid_maxrequests'] != - 1)
{
$php_options_text.= "\t\t\t".'"PHP_FCGI_MAX_REQUESTS" => "' . (int)$domain['mod_fcgid_maxrequests'] . '"'."\n";
}
else
{
if((int)$phpconfig['mod_fcgid_maxrequests'] != - 1)
if((int)$domain['mod_fcgid_maxrequests'] != - 1)
{
$php_options_text.= "\t\t\t".'"PHP_FCGI_MAX_REQUESTS" => "' . (int)$phpconfig['mod_fcgid_maxrequests'] . '"'."\n";
$php_options_text.= "\t\t\t".'"PHP_FCGI_MAX_REQUESTS" => "' . (int)$domain['mod_fcgid_maxrequests'] . '"'."\n";
}
else
{
$php_options_text.= "\t\t\t".'"PHP_FCGI_MAX_REQUESTS" => "' . (int)$this->settings['system']['mod_fcgid_maxrequests'] . '"'."\n";
if((int)$phpconfig['mod_fcgid_maxrequests'] != - 1)
{
$php_options_text.= "\t\t\t".'"PHP_FCGI_MAX_REQUESTS" => "' . (int)$phpconfig['mod_fcgid_maxrequests'] . '"'."\n";
}
else
{
$php_options_text.= "\t\t\t".'"PHP_FCGI_MAX_REQUESTS" => "' . (int)$this->settings['system']['mod_fcgid_maxrequests'] . '"'."\n";
}
}
}
$php_options_text.= "\t\t".')'."\n";
$php_options_text.= "\t".')'."\n";
$php_options_text.= "\t".')'."\n";
} // foreach extension
$php_options_text.= ' )'."\n";
// create starter
$starter_file = "#!/bin/sh\n\n";
$starter_file.= "#\n";
$starter_file.= "# starter created/changed on " . date("Y.m.d H:i:s") . " for domain '" . $domain['domain'] . "' with id #" . $domain['id'] . " from php template '" . $phpconfig['description'] . "' with id #" . $phpconfig['id'] . "\n";
$starter_file.= "# Do not change anything in this file, it will be overwritten by the Froxlor Cronjob!\n";
$starter_file.= "#\n\n";
$starter_file.= "umask 022\n";
$starter_file.= "PHPRC=" . escapeshellarg($configdir) . "\n";
$starter_file.= "export PHPRC\n";
// set number of processes for one domain
if((int)$domain['mod_fcgid_starter'] != - 1)
{
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$domain['mod_fcgid_starter'] . "\n";
}
else
{
if((int)$phpconfig['mod_fcgid_starter'] != - 1)
{
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$phpconfig['mod_fcgid_starter'] . "\n";
}
else
{
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$this->settings['system']['mod_fcgid_starter'] . "\n";
}
$php_options_text.= "\t\t".')'."\n";
$php_options_text.= "\t".')'."\n";
$php_options_text.= "\t".')'."\n";
} // foreach extension
$php_options_text.= ' )'."\n";
}
$starter_file.= "export PHP_FCGI_CHILDREN\n";
// set number of maximum requests for one domain
if((int)$domain['mod_fcgid_maxrequests'] != - 1)
{
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$domain['mod_fcgid_maxrequests'] . "\n";
}
else
{
if((int)$phpconfig['mod_fcgid_maxrequests'] != - 1)
{
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$phpconfig['mod_fcgid_maxrequests'] . "\n";
}
else
{
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$this->settings['system']['mod_fcgid_maxrequests'] . "\n";
}
}
$starter_file.= "export PHP_FCGI_MAX_REQUESTS\n";
// Set Binary
$starter_file.= "exec " . $phpconfig['binary'] . " -c " . escapeshellarg($configdir) . "\n";
//remove +i attibute, so starter can be overwritten
if(file_exists($starter_filename))
{
removeImmutable($starter_filename);
}
$starter_file_handler = fopen($starter_filename, 'w');
fwrite($starter_file_handler, $starter_file);
fclose($starter_file_handler);
safe_exec('chmod 750 ' . escapeshellarg($starter_filename));
safe_exec('chown ' . $domain['guid'] . ':' . $domain['guid'] . ' ' . escapeshellarg($starter_filename));
setImmutable($starter_filename);
// define the php.ini
$openbasedir = '';
$openbasedirc = ';';
if($domain['openbasedir'] == '1')
{
$openbasedirc = '';
$_phpappendopenbasedir = '';
$_custom_openbasedir = explode(':', $this->settings['system']['mod_fcgid_peardir']);
foreach($_custom_openbasedir as $cobd)
{
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
}
$_custom_openbasedir = explode(':', $this->settings['system']['phpappendopenbasedir']);
foreach($_custom_openbasedir as $cobd)
{
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
}
if($domain['openbasedir_path'] == '0' && strstr($domain['documentroot'], ":") === false)
{
$openbasedir = appendOpenBasedirPath($domain['documentroot'], true);
}
else
{
$openbasedir = appendOpenBasedirPath($domain['customerroot'], true);
}
$openbasedir .= appendOpenBasedirPath($tmpdir);
$openbasedir .= $_phpappendopenbasedir;
$openbasedir = explode(':', $openbasedir);
$clean_openbasedir = array();
foreach($openbasedir as $number => $path)
{
if(trim($path) != '/')
{
$clean_openbasedir[] = makeCorrectDir($path);
}
}
$openbasedir = implode(':', $clean_openbasedir);
}
else
{
$openbasedir = 'none';
$openbasedirc = ';';
}
$admin = $this->getAdminData($domain['adminid']);
$php_ini_variables = array(
'SAFE_MODE' => ($domain['safemode'] == '0' ? 'Off' : 'On'),
'PEAR_DIR' => $this->settings['system']['mod_fcgid_peardir'],
'OPEN_BASEDIR' => $openbasedir,
'OPEN_BASEDIR_C' => $openbasedirc,
'OPEN_BASEDIR_GLOBAL' => $this->settings['system']['phpappendopenbasedir'],
'TMP_DIR' => $tmpdir,
'CUSTOMER_EMAIL' => $domain['email'],
'ADMIN_EMAIL' => $admin['email'],
'DOMAIN' => $domain['domain'],
'CUSTOMER' => $domain['loginname'],
'ADMIN' => $admin['loginname']
);
//insert a small header for the file
$phpini_file = ";\n";
$phpini_file.= "; php.ini created/changed on " . date("Y.m.d H:i:s") . " for domain '" . $domain['domain'] . "' with id #" . $domain['id'] . " from php template '" . $phpconfig['description'] . "' with id #" . $phpconfig['id'] . "\n";
$phpini_file.= "; Do not change anything in this file, it will be overwritten by the Froxlor Cronjob!\n";
$phpini_file.= ";\n\n";
$phpini_file.= replace_variables($phpconfig['phpsettings'], $php_ini_variables);
$phpini_file = str_replace('"none"', 'none', $phpini_file);
$phpini_file = preg_replace('/\"+/', '"', $phpini_file);
$phpini_file_handler = fopen($phpini_filename, 'w');
fwrite($phpini_file_handler, $phpini_file);
fclose($phpini_file_handler);
safe_exec('chown root:0 ' . escapeshellarg($phpini_filename));
safe_exec('chmod 0644 ' . escapeshellarg($phpini_filename));
// create starter-file | config-file
$php->getInterface()->createConfig($phpconfig);
// create php.ini
// @TODO make php-fpm support this
$php->getInterface()->createIniFile($phpconfig);
}
else
{
@@ -272,36 +117,46 @@ class lighttpd_fcgid extends lighttpd
return $php_options_text;
}
private function getPhpConfig($php_config_id)
public function createOwnVhostStarter()
{
$php_config_id = intval($php_config_id);
if ($this->settings['phpfpm']['enabled'] == '1'
&& $this->settings['phpfpm']['enabled_ownvhost'] == '1'
) {
$mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__)))); // /var/www/froxlor, needed for chown
// If domain has no config, we will use the default one.
$user = $this->settings['phpfpm']['vhost_httpuser'];
$group = $this->settings['phpfpm']['vhost_httpgroup'];
if($php_config_id == 0)
{
$php_config_id = 1;
$domain = array(
'id' => 'none',
'domain' => $this->settings['system']['hostname'],
'adminid' => 1, /* first admin-user (superadmin) */
'mod_fcgid_starter' => -1,
'mod_fcgid_maxrequests' => -1,
'guid' => $user,
'openbasedir' => 0,
'safemode' => '0',
'email' => $this->settings['panel']['adminmail'],
'loginname' => 'froxlor.panel',
'documentroot' => $mypath
);
// all the files and folders have to belong to the local user
// now because we also use fcgid for our own vhost
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath));
// get php.ini for our own vhost
$php = new phpinterface($this->getDB(), $this->settings, $domain);
// @FIXME don't use fcgid settings, but we don't have anything else atm
$phpconfig = $php->getPhpConfig($this->settings['system']['mod_fcgid_defaultini_ownvhost']);
// create starter-file | config-file
$php->getInterface()->createConfig($phpconfig);
// create php.ini
// @TODO make php-fpm support this
$php->getInterface()->createIniFile($phpconfig);
}
if(!isset($this->php_configs_cache[$php_config_id]))
{
$this->php_configs_cache[$php_config_id] = $this->getDB()->query_first("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = " . (int)$php_config_id);
}
return $this->php_configs_cache[$php_config_id];
}
private function getAdminData($adminid)
{
$adminid = intval($adminid);
if(!isset($this->admin_cache[$adminid]))
{
$this->admin_cache[$adminid] = $this->getDB()->query_first("SELECT `email`, `loginname` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid` = " . (int)$adminid);
}
return $this->admin_cache[$adminid];
}
}
?>

View File

@@ -11,7 +11,7 @@
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Configfiles
* @package Cron
* @version $Id$
*/
@@ -64,12 +64,19 @@ class nginx
/**
* nginx does not auto-spawn fcgi-processes
*/
if ($this->settings['system']['phpreload_command'] != '')
{
fwrite($this->debugHandler, ' nginx::reload: restarting php processes' . "\n");
if ($this->settings['system']['phpreload_command'] != ''
&& (int)$this->settings['phpfpm']['enabled'] == 0
) {
fwrite($this->debugHandler, ' nginx::reload: restarting php processes' . "\n");
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'restarting php processes');
safe_exec($this->settings['system']['phpreload_command']);
}
elseif((int)$this->settings['phpfpm']['enabled'] == 1)
{
fwrite($this->debugHandler, ' nginx::reload: reloading php-fpm' . "\n");
$this->logger->logAction(CRON_ACTION, LOG_INFO, 'reloading php-fpm');
safe_exec(escapeshellcmd($this->settings['phpfpm']['reload']));
}
}
public function createVirtualHosts()
@@ -103,7 +110,7 @@ class nginx
if(!isset($this->nginx_data[$vhosts_filename]))
{
$this->vnginx_data[$vhosts_filename] = '';
$this->nginx_data[$vhosts_filename] = '';
}
if($this->settings['defaultwebsrverrhandler']['err401'] != '')
@@ -221,8 +228,30 @@ class nginx
$this->nginx_data[$vhost_filename].= "\t".'location ~ \.php$ {'."\n";
$this->nginx_data[$vhost_filename].= "\t\t".'fastcgi_index index.php;'."\n";
$this->nginx_data[$vhost_filename].= "\t\t".'include /etc/nginx/fastcgi_params;'."\n";
$this->nginx_data[$vhost_filename].= "\t\t".'fastcgi_param SCRIPT_FILENAME $document_root' . '$fastcgi_script_name;'."\n";
$this->nginx_data[$vhost_filename].= "\t\t".'fastcgi_pass ' . $this->settings['system']['nginx_php_backend'] . ';' . "\n";
$this->nginx_data[$vhost_filename].= "\t\t".'fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;'."\n";
if((int)$this->settings['phpfpm']['enabled'] == 1)
{
$domain = array(
'id' => 'none',
'domain' => $this->settings['system']['hostname'],
'adminid' => 1, /* first admin-user (superadmin) */
'mod_fcgid_starter' => -1,
'mod_fcgid_maxrequests' => -1,
'guid' => $this->settings['phpfpm']['vhost_httpuser'],
'openbasedir' => 0,
'safemode' => '0',
'email' => $this->settings['panel']['adminmail'],
'loginname' => 'froxlor.panel',
'documentroot' => $mypath
);
$php = new phpinterface($this->getDB(), $this->settings, $domain);
$this->nginx_data[$vhost_filename].= "\t\t".'fastcgi_pass unix:' . $php->getInterface()->getSocketFile() . ';' . "\n";
}
else
{
$this->nginx_data[$vhost_filename].= "\t\t".'fastcgi_pass ' . $this->settings['system']['nginx_php_backend'] . ';' . "\n";
}
$this->nginx_data[$vhost_filename].= "\t".'}'."\n";
$this->nginx_data[$vhost_filename].= '}' . "\n\n";
@@ -362,6 +391,14 @@ class nginx
$vhost_content.= $this->getServerNames($domain);
// respect ssl_redirect settings, #542
if($ssl_vhost == false
&& $domain['ssl'] == '1'
&& $domain['ssl_redirect'] == '1'
) {
$domain['documentroot'] = 'https://' . $domain['domain'] . '/';
}
if(preg_match('/^https?\:\/\//', $domain['documentroot']))
{
$vhost_content.= "\t".'rewrite ^(.*) '.$this->idnaConvert->encode($domain['documentroot']).'$1 permanent;'."\n";
@@ -495,7 +532,7 @@ class nginx
$query = "SELECT * FROM " . TABLE_PANEL_HTPASSWDS . " WHERE `customerid`='" . $domain['customerid'] . "'";
$result = $this->db->query($query);
$result = array();
$returnval = array();
$x = 0;
while($row_htpasswds = $this->db->fetch_array($result))
{
@@ -515,13 +552,13 @@ class nginx
$path = makeCorrectDir(substr($row['path'], strlen($domain['documentroot']) - 1));
$result[$x]['path'] = $path;
$result[$x]['root'] = makeCorrectDir($domain['documentroot']);
$result[$x]['usrf'] = $htpasswd_filename;
$returnval[$x]['path'] = $path;
$returnval[$x]['root'] = makeCorrectDir($domain['documentroot']);
$returnval[$x]['usrf'] = $htpasswd_filename;
$x++;
}
}
return $result;
return $returnval;
}
protected function composePhpOptions($domain)
@@ -532,7 +569,7 @@ class nginx
$phpopts = "\t".'location ~ \.php$ {'."\n";
$phpopts.= "\t\t".'fastcgi_index index.php;'."\n";
$phpopts.= "\t\t".'include /etc/nginx/fastcgi_params;'."\n";
$phpopts.= "\t\t".'fastcgi_param SCRIPT_FILENAME $document_root' . '$fastcgi_script_name;'."\n";
$phpopts.= "\t\t".'fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;'."\n";
$phpopts.= "\t\t".'fastcgi_pass ' . $this->settings['system']['nginx_php_backend'] . ';' . "\n";
$phpopts.= "\t".'}'."\n";
}

View File

@@ -0,0 +1,104 @@
<?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 Cron
* @version $Id$
*/
/*
* This script creates the php.ini's used by mod_suPHP+php-cgi
*/
if(@php_sapi_name() != 'cli'
&& @php_sapi_name() != 'cgi'
&& @php_sapi_name() != 'cgi-fcgi')
{
die('This script only works in the shell.');
}
class nginx_phpfpm extends nginx
{
protected function composePhpOptions($domain)
{
$php_options_text = '';
if($domain['phpenabled'] == '1')
{
$php = new phpinterface($this->getDB(), $this->settings, $domain);
$phpconfig = $php->getPhpConfig((int)$domain['phpsettingid']);
$php_options_text = "\t".'location ~ \.php$ {'."\n";
$php_options_text.= "\t\t".'fastcgi_index index.php;'."\n";
$php_options_text.= "\t\t".'include /etc/nginx/fastcgi_params;'."\n";
$php_options_text.= "\t\t".'fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;'."\n";
$php_options_text.= "\t\t".'fastcgi_pass unix:' . $php->getInterface()->getSocketFile() . ';' . "\n";
$php_options_text.= "\t".'}'."\n";
// create starter-file | config-file
$php->getInterface()->createConfig($phpconfig);
// create php.ini
// @TODO make php-fpm support this
$php->getInterface()->createIniFile($phpconfig);
}
else
{
$php_options_text.= ' # PHP is disabled for this vHost' . "\n";
}
return $php_options_text;
}
public function createOwnVhostStarter()
{
if ($this->settings['phpfpm']['enabled'] == '1'
&& $this->settings['phpfpm']['enabled_ownvhost'] == '1'
) {
$mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__)))); // /var/www/froxlor, needed for chown
$user = $this->settings['phpfpm']['vhost_httpuser'];
$group = $this->settings['phpfpm']['vhost_httpgroup'];
$domain = array(
'id' => 'none',
'domain' => $this->settings['system']['hostname'],
'adminid' => 1, /* first admin-user (superadmin) */
'mod_fcgid_starter' => -1,
'mod_fcgid_maxrequests' => -1,
'guid' => $user,
'openbasedir' => 0,
'safemode' => '0',
'email' => $this->settings['panel']['adminmail'],
'loginname' => 'froxlor.panel',
'documentroot' => $mypath
);
// all the files and folders have to belong to the local user
// now because we also use fcgid for our own vhost
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath));
// get php.ini for our own vhost
$php = new phpinterface($this->getDB(), $this->settings, $domain);
// @FIXME don't use fcgid settings, but we don't have anything else atm
$phpconfig = $php->getPhpConfig($this->settings['system']['mod_fcgid_defaultini_ownvhost']);
// create starter-file | config-file
$php->getInterface()->createConfig($phpconfig);
// create php.ini
// @TODO make php-fpm support this
$php->getInterface()->createIniFile($phpconfig);
}
}
}

View File

@@ -26,6 +26,7 @@ require_once(makeCorrectFile(dirname(__FILE__) . '/cron_tasks.inc.http.15.apache
require_once(makeCorrectFile(dirname(__FILE__) . '/cron_tasks.inc.http.20.lighttpd.php'));
require_once(makeCorrectFile(dirname(__FILE__) . '/cron_tasks.inc.http.25.lighttpd_fcgid.php'));
require_once(makeCorrectFile(dirname(__FILE__) . '/cron_tasks.inc.http.30.nginx.php'));
require_once(makeCorrectFile(dirname(__FILE__) . '/cron_tasks.inc.http.35.nginx_phpfpm.php'));
/**
* LOOK INTO TASKS TABLE TO SEE IF THERE ARE ANY UNDONE JOBS
@@ -67,7 +68,7 @@ while($row = $db->fetch_array($result_tasks))
{
$awstatsclean['dir'] = dir($awstatsclean['path']);
while($awstatsclean['entry'] = $awstatsclean['dir']->read()) {
$awstatsclean['fullentry'] = $awstatsclean['path'].'/'.$awstatsclean['entry'];
$awstatsclean['fullentry'] = makeCorrectFile($awstatsclean['path'].'/'.$awstatsclean['entry']);
/**
* dont do anything if the file does not exist
*/
@@ -77,8 +78,9 @@ while($row = $db->fetch_array($result_tasks))
$awstatsclean['headerRead'] = fgets($awstatsclean['fh'], strlen($awstatsclean['header'])+1);
fclose($awstatsclean['fh']);
if($awstatsclean['headerRead'] == $awstatsclean['header'] || $awstatsclean['headerRead'] == $awstatsclean['headerold']) {
$cronlog->logAction(CRON_ACTION, LOG_INFO, "Removing awstats configuration ".$awstatsclean['fullentry']." for re-creation");
@unlink($awstatsclean['fullentry']);
$awstats_conf_file = makeCorrectFile($awstatsclean['fullentry']);
$cronlog->logAction(CRON_ACTION, LOG_INFO, "Removing awstats configuration ".$awstats_conf_file." for re-creation");
@unlink($awstats_conf_file);
}
}
else
@@ -120,11 +122,25 @@ while($row = $db->fetch_array($result_tasks))
}
}
// clear php-fpm-configurations prior to re-creation to keep it clean
if ($settings['phpfpm']['enabled'] == '1')
{
$configdir = makeCorrectDir($settings['phpfpm']['configdir']);
if (is_dir($configdir))
{
// now get rid of old stuff
//(but append /* so we don't delete the directory)
$configdir.='/*';
safe_exec('rm -rf '. makeCorrectFile($configdir));
}
}
if(!isset($webserver))
{
if($settings['system']['webserver'] == "apache2")
{
if($settings['system']['mod_fcgid'] == 1)
if($settings['system']['mod_fcgid'] == 1 || $settings['phpfpm']['enabled'] == 1)
{
$webserver = new apache_fcgid($db, $cronlog, $debugHandler, $idna_convert, $settings);
}
@@ -135,7 +151,7 @@ while($row = $db->fetch_array($result_tasks))
}
elseif($settings['system']['webserver'] == "lighttpd")
{
if($settings['system']['mod_fcgid'] == 1)
if($settings['system']['mod_fcgid'] == 1 || $settings['phpfpm']['enabled'] == 1)
{
$webserver = new lighttpd_fcgid($db, $cronlog, $debugHandler, $idna_convert, $settings);
}
@@ -146,7 +162,14 @@ while($row = $db->fetch_array($result_tasks))
}
elseif($settings['system']['webserver'] == "nginx")
{
$webserver = new nginx($db, $cronlog, $debugHandler, $idna_convert, $settings);
if($settings['phpfpm']['enabled'] == 1)
{
$webserver = new nginx_phpfpm($db, $cronlog, $debugHandler, $idna_convert, $settings);
}
else
{
$webserver = new nginx($db, $cronlog, $debugHandler, $idna_convert, $settings);
}
}
}

View File

@@ -0,0 +1,181 @@
<?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 Cron
* @version $Id$
*/
/**
* report about diskusage for customers
*/
$result = $db->query("SELECT
`c`.`customerid`, `c`.`adminid`, `c`.`name`, `c`.`firstname`, `c`.`diskspace`,
`c`.`diskspace_used`, `c`.`email`, `c`.`def_language`,
`a`.`name` AS `adminname`, `a`.`email` AS `adminmail`
FROM `" . TABLE_PANEL_CUSTOMERS . "` AS `c`
LEFT JOIN `" . TABLE_PANEL_ADMINS . "` AS `a`
ON `a`.`adminid` = `c`.`adminid`
WHERE `c`.`diskspace` > '0' AND `c`.`reportsent` <> '2'");
while($row = $db->fetch_array($result))
{
if(isset($row['diskspace'])
&& $row['diskspace_used'] != NULL
&& $row['diskspace_used'] > 0
&& (($row['diskspace_used'] * 100) / $row['diskspace']) >= (int)$settings['system']['report_webmax']
) {
$replace_arr = array(
'NAME' => $row['name'],
'DISKAVAILABLE' => ($row['diskspace'] / 1024), /* traffic is stored in KB, template uses MB */
'DISKUSED' => round($row['diskspace_used'] / 1024, 2), /* traffic is stored in KB, template uses MB */
'USAGE_PERCENT' => ($row['diskspace_used'] * 100) / $row['diskspace'],
'MAX_PERCENT' => $settings['system']['report_webmax']
);
$lngfile = $db->query_first("SELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "`
WHERE `language` ='" . $row['def_language'] . "'");
if($lngfile !== NULL)
{
$langfile = $lngfile['file'];
}
else
{
$lngfile = $db->query_first("SELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "`
WHERE `language` ='" . $settings['panel']['standardlanguage'] . "'");
$langfile = $lngfile['file'];
}
include_once makeCorrectFile($pathtophpfiles . '/' . $langfile);
// Get mail templates from database; the ones from 'admin' are fetched for fallback
$result2 = $db->query_first("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid`='" . (int)$row['adminid'] . "'
AND `language`='" . $db->escape($row['def_language']) . "'
AND `templategroup`='mails'
AND `varname`='webmaxpercent_subject'");
$mail_subject = html_entity_decode(replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['webmaxpercent']['subject']), $replace_arr));
$result2 = $db->query_first("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid`='" . (int)$row['adminid'] . "'
AND `language`='" . $db->escape($row['def_language']) . "'
AND `templategroup`='mails'
AND `varname`='webmaxpercent_mailbody'");
$mail_body = html_entity_decode(replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['webmaxpercent']['mailbody']), $replace_arr));
$_mailerror = false;
try {
$mail->SetFrom($row['email'], $row['firstname'] . " " . $row['name']);
$mail->Subject = $mail_subject;
$mail->AltBody = $mail_body;
$mail->MsgHTML(nl2br($mail_body));
$mail->AddAddress($row['email'], $row['name']);
$mail->Send();
} catch(phpmailerException $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
$mailerr_msg = $e->getMessage();
$_mailerror = true;
}
if ($_mailerror) {
$cronlog->logAction(CRON_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
standard_error('errorsendingmail', $row["email"]);
}
$mail->ClearAddresses();
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `reportsent`='2'
WHERE `customerid`='" . (int)$row['customerid'] . "'");
}
}
/**
* report about diskusage for admins/reseller
*/
$result = $db->query("SELECT `a`.* FROM `" . TABLE_PANEL_ADMINS . "` `a` WHERE `a`.`reportsent` <> '2'");
while($row = $db->fetch_array($result))
{
if(isset($row['diskspace'])
&& $row['diskspace_used'] != NULL
&& $row['diskspace_used'] > 0
&& (($row['diskspace_used'] * 100) / $row['diskspace']) >= (int)$settings['system']['report_webmax']
) {
$replace_arr = array(
'NAME' => $row['name'],
'DISKAVAILABLE' => ($row['diskspace'] / 1024), /* traffic is stored in KB, template uses MB */
'DISKUSED' => round($row['diskspace_used'] / 1024, 2), /* traffic is stored in KB, template uses MB */
'USAGE_PERCENT' => ($row['diskspace_used'] * 100) / $row['diskspace'],
'MAX_PERCENT' => $settings['system']['report_webmax']
);
$lngfile = $db->query_first("SELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "`
WHERE `language` ='" . $row['def_language'] . "'");
if($lngfile !== NULL)
{
$langfile = $lngfile['file'];
}
else
{
$lngfile = $db->query_first("SELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "`
WHERE `language` ='" . $settings['panel']['standardlanguage'] . "'");
$langfile = $lngfile['file'];
}
include_once makeCorrectFile($pathtophpfiles . '/' . $langfile);
// Get mail templates from database; the ones from 'admin' are fetched for fallback
$result2 = $db->query_first("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid`='" . (int)$row['adminid'] . "'
AND `language`='" . $db->escape($row['def_language']) . "'
AND `templategroup`='mails'
AND `varname`='webmaxpercent_subject'");
$mail_subject = html_entity_decode(replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['webmaxpercent']['subject']), $replace_arr));
$result2 = $db->query_first("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid`='" . (int)$row['adminid'] . "'
AND `language`='" . $db->escape($row['def_language']) . "'
AND `templategroup`='mails'
AND `varname`='webmaxpercent_mailbody'");
$mail_body = html_entity_decode(replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['webmaxpercent']['mailbody']), $replace_arr));
$_mailerror = false;
try {
$mail->SetFrom($row['email'], $row['name']);
$mail->Subject = $mail_subject;
$mail->AltBody = $mail_body;
$mail->MsgHTML(nl2br($mail_body));
$mail->AddAddress($row['email'], $row['name']);
$mail->Send();
} catch(phpmailerException $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
$mailerr_msg = $e->getMessage();
$_mailerror = true;
}
if ($_mailerror) {
$cronlog->logAction(CRON_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
standard_error('errorsendingmail', $row["email"]);
}
$mail->ClearAddresses();
$db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `reportsent`='2'
WHERE `adminid`='" . (int)$row['adminid'] . "'");
}
}

View File

@@ -17,18 +17,16 @@
* @version $Id$
*/
fwrite($debugHandler, 'Trafficreport run started...' . "\n");
fwrite($debugHandler, 'Web- and Traffic-usage reporting started...' . "\n");
$yesterday = time() - (60 * 60 * 24);
/**
* Initialize the mailingsystem
*/
require (dirname(__FILE__) . '/../lib/class.phpmailer.php');
$mail = new PHPMailer(true);
$mail->SetFrom($settings['panel']['adminmail'], 'Froxlor Administrator');
// Warn the customers at 90% traffic-usage
// Warn the customers at xx% traffic-usage
$result = $db->query("SELECT `c`.`customerid`, `c`.`adminid`, `c`.`name`, `c`.`firstname`, `c`.`traffic`,
`c`.`email`, `c`.`def_language`, `a`.`name` AS `adminname`, `a`.`email` AS `adminmail`,
@@ -38,19 +36,21 @@ $result = $db->query("SELECT `c`.`customerid`, `c`.`adminid`, `c`.`name`, `c`.`f
AND `t`.`month` = '" . date("m", $yesterday) . "') as `traffic_used`
FROM `" . TABLE_PANEL_CUSTOMERS . "` AS `c`
LEFT JOIN `" . TABLE_PANEL_ADMINS . "` AS `a` ON `a`.`adminid` = `c`.`adminid`
WHERE `c`.`reportsent` = '0'");
WHERE `c`.`reportsent` <> '1'");
while($row = $db->fetch_array($result))
{
if(isset($row['traffic'])
&& $row['traffic'] > 0
&& $row['traffic_used'] != NULL
&& (($row['traffic_used'] * 100) / $row['traffic']) >= 90)
&& (($row['traffic_used'] * 100) / $row['traffic']) >= (int)$settings['system']['report_trafficmax'])
{
$replace_arr = array(
'NAME' => $row['name'],
'TRAFFIC' => $row['traffic'],
'TRAFFICUSED' => $row['traffic_used']
'TRAFFIC' => ($row['traffic'] / 1024), /* traffic is stored in KB, template uses MB */
'TRAFFICUSED' => ($row['traffic_used'] / 1024), /* traffic is stored in KB, template uses MB */
'USAGE_PERCENT' => ($row['traffic_used'] * 100) / $row['traffic'],
'MAX_PERCENT' => $settings['system']['report_trafficmax']
);
$lngfile = $db->query_first("SELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "`
WHERE `language` ='" . $row['def_language'] . "'");
@@ -74,21 +74,21 @@ while($row = $db->fetch_array($result))
WHERE `adminid`='" . (int)$row['adminid'] . "'
AND `language`='" . $db->escape($row['def_language']) . "'
AND `templategroup`='mails'
AND `varname`='trafficninetypercent_subject'");
$mail_subject = html_entity_decode(replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['trafficninetypercent']['subject']), $replace_arr));
AND `varname`='trafficmaxpercent_subject'");
$mail_subject = html_entity_decode(replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['trafficmaxpercent']['subject']), $replace_arr));
$result2 = $db->query_first("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid`='" . (int)$row['adminid'] . "'
AND `language`='" . $db->escape($row['def_language']) . "'
AND `templategroup`='mails'
AND `varname`='trafficninetypercent_mailbody'");
$mail_body = html_entity_decode(replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['trafficninetypercent']['mailbody']), $replace_arr));
AND `varname`='trafficmaxpercent_mailbody'");
$mail_body = html_entity_decode(replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['trafficmaxpercent']['mailbody']), $replace_arr));
$_mailerror = false;
try {
$mail->SetFrom($row['adminmail'], $row['adminname']);
$mail->Subject = $mail_subject;
$mail->AltBody = $mail_body;
$mail->MsgHTML($mail_body);
$mail->MsgHTML(nl2br($mail_body));
$mail->AddAddress($row['email'], $row['firstname'] . ' ' . $row['name']);
$mail->Send();
} catch(phpmailerException $e) {
@@ -101,8 +101,8 @@ while($row = $db->fetch_array($result))
if($_mailerror)
{
$cronlog->logAction(CRON_ACTION, LOG_ERR, "Error sending mail: " . $_mailerror);
standard_error('errorsendingmail', $row["email"]);
$cronlog->logAction(CRON_ACTION, LOG_ERR, 'Error sending mail: ' . $_mailerror);
standard_error('errorsendingmail', $row['email']);
}
$mail->ClearAddresses();
@@ -111,7 +111,7 @@ while($row = $db->fetch_array($result))
}
}
// Warn the admins at 90% traffic-usage
// Warn the admins at xx% traffic-usage
$result = $db->query("SELECT `a`.*,
(SELECT SUM(`t`.`http` + `t`.`ftp_up` + `t`.`ftp_down` + `t`.`mail`)
@@ -124,12 +124,14 @@ while($row = $db->fetch_array($result))
{
if(isset($row['traffic'])
&& $row['traffic'] > 0
&& (($row['traffic_used_total'] * 100) / $row['traffic']) >= 90)
&& (($row['traffic_used_total'] * 100) / $row['traffic']) >= (int)$settings['system']['report_trafficmax'])
{
$replace_arr = array(
'NAME' => $row['name'],
'TRAFFIC' => $row['traffic'],
'TRAFFICUSED' => $row['traffic_used_total']
'TRAFFIC' => ($row['traffic'] / 1024), /* traffic is stored in KB, template uses MB */
'TRAFFICUSED' => ($row['traffic_used_total'] / 1024), /* traffic is stored in KB, template uses MB */
'USAGE_PERCENT' => ($row['traffic_used_total'] * 100) / $row['traffic'],
'MAX_PERCENT' => $settings['system']['report_trafficmax']
);
$lngfile = $db->query_first("SELECT `file` FROM `" . TABLE_PANEL_LANGUAGE . "`
WHERE `language` ='" . $row['def_language'] . "'");
@@ -153,21 +155,21 @@ while($row = $db->fetch_array($result))
WHERE `adminid`='" . (int)$row['adminid'] . "'
AND `language`='" . $db->escape($row['def_language']) . "'
AND `templategroup`='mails'
AND `varname`='trafficninetypercent_subject'");
$mail_subject = html_entity_decode(replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['trafficninetypercent']['subject']), $replace_arr));
AND `varname`='trafficmaxpercent_subject'");
$mail_subject = html_entity_decode(replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['trafficmaxpercent']['subject']), $replace_arr));
$result2 = $db->query_first("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid`='" . (int)$row['adminid'] . "'
AND `language`='" . $db->escape($row['def_language']) . "'
AND `templategroup`='mails'
AND `varname`='trafficninetypercent_mailbody'");
$mail_body = html_entity_decode(replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['trafficninetypercent']['mailbody']), $replace_arr));
AND `varname`='trafficmaxpercent_mailbody'");
$mail_body = html_entity_decode(replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['trafficmaxpercent']['mailbody']), $replace_arr));
$_mailerror = false;
try {
$mail->SetFrom($row['email'], $row['firstname'] . " " . $row['name']);
$mail->SetFrom($row['email'], $row['name']);
$mail->Subject = $mail_subject;
$mail->AltBody = $mail_body;
$mail->MsgHTML($mail_body);
$mail->MsgHTML(nl2br($mail_body));
$mail->AddAddress($row['email'], $row['name']);
$mail->Send();
} catch(phpmailerException $e) {
@@ -185,7 +187,7 @@ while($row = $db->fetch_array($result))
$mail->ClearAddresses();
$db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `reportsent`='1'
WHERE `customerid`='" . (int)$row['adminid'] . "'");
WHERE `adminid`='" . (int)$row['adminid'] . "'");
}
// Another month, let's build our report
@@ -228,14 +230,17 @@ while($row = $db->fetch_array($result))
}
if ($_mailerror) {
$cronlog->logAction(CRON_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
standard_error('errorsendingmail', $row["email"]);
$cronlog->logAction(CRON_ACTION, LOG_ERR, 'Error sending mail: ' . $mailerr_msg);
standard_error('errorsendingmail', $row['email']);
}
$mail->ClearAddresses();
}
}
// include diskspace-usage report, #466
include dirname(__FILE__).'/cron_usage.inc.diskspace.php';
// Another month, reset the reportstatus
if(date('d') == '01')
@@ -243,9 +248,3 @@ if(date('d') == '01')
$db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `reportsent` = \'0\';');
$db->query('UPDATE `' . TABLE_PANEL_ADMINS . '` SET `reportsent` = \'0\';');
}
$db->query('UPDATE `' . TABLE_PANEL_SETTINGS . '` SET `value` = UNIX_TIMESTAMP()
WHERE `settinggroup` = \'system\' AND `varname` = \'last_traffic_report_run\' ');
?>

View File

@@ -124,7 +124,7 @@ $header
<if $settings['system']['mail_quota_enabled'] == 1>
<tr>
<td class="main_field_name">{$lng['customer']['email_quota']}: *</td>
<td class="main_field_display" nowrap="nowrap"><input type="text" class="textul" name="email_quota" value="{$result['email_quota']}" maxlength="3" />&nbsp;{$email_quota_ul}</td>
<td class="main_field_display" nowrap="nowrap"><input type="text" class="textul" name="email_quota" value="{$result['email_quota']}" maxlength="9" />&nbsp;{$email_quota_ul}</td>
</tr>
</if>
<if $settings['autoresponder']['autoresponder_active'] == 1>

View File

@@ -96,7 +96,7 @@ $header
<td class="field_name">{$lng['admin']['templates']['PASSWORD']}</td>
</tr>
<tr>
<td class="field_display_border_left" colspan="2"><b>{$lng['admin']['templates']['trafficninetypercent']}</b></td>
<td class="field_display_border_left" colspan="2"><b>{$lng['admin']['templates']['trafficmaxpercent']}</b></td>
</tr>
<tr>
<td class="field_name_border_left"><i>{TRAFFIC}</i>:</td>
@@ -106,6 +106,33 @@ $header
<td class="field_name_border_left"><i>{TRAFFICUSED}</i>:</td>
<td class="field_name">{$lng['admin']['templates']['TRAFFICUSED']}</td>
</tr>
<tr>
<td class="field_name_border_left"><i>{MAX_PERCENT}</i>:</td>
<td class="field_name">{$lng['admin']['templates']['MAX_PERCENT']}</td>
</tr>
<tr>
<td class="field_name_border_left"><i>{USAGE_PERCENT}</i>:</td>
<td class="field_name">{$lng['admin']['templates']['USAGE_PERCENT']}</td>
</tr>
<tr>
<td class="field_display_border_left" colspan="2"><b>{$lng['admin']['templates']['diskmaxpercent']}</b></td>
</tr>
<tr>
<td class="field_name_border_left"><i>{DISKAVAILABLE}</i>:</td>
<td class="field_name">{$lng['admin']['templates']['DISKAVAILABLE']}</td>
</tr>
<tr>
<td class="field_name_border_left"><i>{DISKUSED}</i>:</td>
<td class="field_name">{$lng['admin']['templates']['DISKUSED']}</td>
</tr>
<tr>
<td class="field_name_border_left"><i>{MAX_PERCENT}</i>:</td>
<td class="field_name">{$lng['admin']['templates']['MAX_PERCENT']}</td>
</tr>
<tr>
<td class="field_name_border_left"><i>{USAGE_PERCENT}</i>:</td>
<td class="field_name">{$lng['admin']['templates']['USAGE_PERCENT']}</td>
</tr>
<tr>
<td class="field_display_border_left" colspan="2"><b>{$lng['admin']['templates']['ticket']}</b></td>
</tr>

View File

@@ -12,16 +12,6 @@ $header
<td class="main_field_name">{$lng['login']['username']}:</td>
<td class="main_field_display" nowrap="nowrap">{$result['username']}</td>
</tr>
<if $settings['customer']['ftpatdomain'] == '1'>
<tr>
<td class="main_field_name">{$lng['login']['username']}:</td>
<td class="main_field_display" nowrap="nowrap"><input type="text" class="text" name="ftp_username" size="30" /></td>
</tr>
<tr>
<td class="main_field_name">{$lng['domains']['domainname']}:</td>
<td class="main_field_display" nowrap="nowrap"><select class="dropdown_noborder" name="ftp_domain">$domains</select></td>
</tr>
</if>
<tr>
<td class="main_field_name">{$lng['panel']['path']}:<if $settings['panel']['pathedit'] != 'Dropdown'><br /><font size="1">{$lng['panel']['pathDescription']}</font></if></td>
<td class="main_field_display" nowrap="nowrap">{$pathSelect}</td>

View File

@@ -8,7 +8,7 @@
<if ($settings['admin']['show_version_login'] == '1' && $filename == 'index.php') || ($filename != 'index.php' && $settings['admin']['show_version_footer'] == '1')>
{$version}{$branding}
</if>
&copy; 2009-2010 by <a href="http://www.froxlor.org/" target="_blank">the Froxlor Team</a>
&copy; 2009-{$current_year} by <a href="http://www.froxlor.org/" target="_blank">the Froxlor Team</a>
<br />Theme based on work by: Luca Piona and Luca Longinotti
<if $lng['translator'] != ''>
<br />{$lng['panel']['translator']}: {$lng['translator']}

View File

@@ -0,0 +1,11 @@
<IfModule mod_fastcgi.c>
FastCgiWrapper /usr/lib/apache2/suexec
FastCgiIpcDir /var/run/apache2/
<Location "/fastcgiphp">
Order Deny,Allow
Deny from All
# Prevent accessing this path directly
Allow from env=REDIRECT_STATUS
</Location>
</IfModule>

View File

@@ -1,5 +1,5 @@
driver = mysql
connect = host=<SQL_HOST> dbname=<SQL_DB> user=<SQL_UNPRIVILEGED_USER> password=<SQL_UNPRIVILEGED_PASSWORD>
default_pass_scheme = CRYPT
password_query = SELECT username AS user, password_enc AS password, CONCAT(homedir, maildir) AS userdb_home, uid AS userdb_uid, gid AS userdb_gid, CONCAT('maildir:', homedir, maildir) AS userdb_mail, CONCAT('maildir:storage=', (quota*1024)) as userdb_quota FROM mail_users WHERE (username = '%u' OR email = '%u') AND ((imap = 1 AND '%Ls' = 'imap') OR (pop3 = 1 AND '%Ls' = 'pop3'))
password_query = SELECT username AS user, password_enc AS password, CONCAT(homedir, maildir) AS userdb_home, uid AS userdb_uid, gid AS userdb_gid, CONCAT('maildir:', homedir, maildir) AS userdb_mail, CONCAT('maildir:storage=', (quota*1024)) as userdb_quota FROM mail_users WHERE (username = '%u' OR email = '%u') AND ((imap = 1 AND '%Ls' = 'imap') OR (pop3 = 1 AND '%Ls' = 'pop3') OR '%Ls' = 'smtp')
user_query = SELECT CONCAT(homedir, maildir) AS home, CONCAT('maildir:', homedir, maildir) AS mail, uid, gid, CONCAT('maildir:storage=', (quota*1024)) as quota FROM mail_users WHERE (username = '%u' OR email = '%u')

View File

@@ -1,5 +1,5 @@
driver = mysql
connect = host=<SQL_HOST> dbname=<SQL_DB> user=<SQL_UNPRIVILEGED_USER> password=<SQL_UNPRIVILEGED_PASSWORD>
default_pass_scheme = CRYPT
password_query = SELECT username AS user, password_enc AS password FROM mail_users WHERE (username = '%u' OR email = '%u') AND ((imap = 1 AND '%Ls' = 'imap') OR (pop3 = 1 AND '%Ls' = 'pop3'))
password_query = SELECT username AS user, password_enc AS password FROM mail_users WHERE (username = '%u' OR email = '%u') AND ((imap = 1 AND '%Ls' = 'imap') OR (pop3 = 1 AND '%Ls' = 'pop3') OR '%Ls' = 'smtp')
user_query = SELECT CONCAT(homedir,maildir) AS home, concat('maildir:',homedir,maildir) AS mail, uid, gid FROM mail_users where (username = '%u' OR email = '%u')

View File

@@ -1,20 +1,15 @@
# Make sure that `passwd`, `group` and `shadow` have mysql in their lines
# Make sure that `passwd` and `group` have mysql in their lines
# You should place mysql at the end, so that it is queried after the other mechanisams
#
passwd: compat mysql
group: compat mysql
shadow: compat mysql
group: files mysql
group_compat: nis
hosts: files dns
networks: files
passwd: files mysql
passwd_compat: nis
shells: files
services: compat
services_compat: nis
protocols: files
rpc: files
hosts: files dns
networks: files dns
services: db files
protocols: db files
rpc: db files
ethers: db files
netmasks: files
netgroup: files
bootparams: files
automount: files
aliases: files

View File

@@ -17,8 +17,11 @@ smtpd_recipient_restrictions =
reject_unauth_pipelining,
reject_invalid_hostname,
reject_rbl_client sbl-xbl.spamhaus.org,
reject_rbl_client ix.dnsbl.manitu.net,
# sqlgrey enable
# check_policy_service inet:127.0.0.1:2501,
# postgrey enable
# check_policy_service inet:127.0.0.1:10023,
smtpd_client_restrictions =
permit_mynetworks,
@@ -35,17 +38,18 @@ smtpd_sasl_path = private/auth
soft_bounce = yes
# Maximum size of Message in bytes (50MB)
message_size_limit = 52428800
# Maximum size of Message in bytes (0 = unlimited)
message_size_limit = 0
mailbox_size_limit = 0
smtp_use_tls = yes
smtpd_use_tls = yes
smtp_tls_security_level = may
smtpd_tls_security_level = may
smtpd_tls_auth_only = no
smtp_tls_note_starttls_offer = yes
smtpd_tls_key_file = /etc/ssl/<SERVERNAME>.key.unencrypted
smtpd_tls_cert_file = /etc/ssl/<SERVERNAME>.crt
smtpd_tls_CAfile = /etc/ssl/cacert.class3.crt # Just an example for CACert.org
# Just an example for CACert.org
smtpd_tls_CAfile = /etc/ssl/cacert.class3.crt
smtpd_tls_loglevel = 0
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s

View File

@@ -0,0 +1,11 @@
<IfModule mod_fastcgi.c>
FastCgiWrapper /usr/sbin/suexec
FastCgiIpcDir /var/run/apache2/
<Location "/fastcgiphp">
Order Deny,Allow
Deny from All
# Prevent accessing this path directly
Allow from env=REDIRECT_STATUS
</Location>
</IfModule>

View File

@@ -7,4 +7,4 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin
#
# Please check that all following paths are correct
#
*/5 * * * * root /usr/lib/php5/bin/php -q <BASE_PATH>scripts/froxlor_master_cronjob.php
*/5 * * * * root /usr/bin/php -q <BASE_PATH>scripts/froxlor_master_cronjob.php

View File

@@ -1,5 +1,5 @@
driver = mysql
connect = host=<SQL_HOST> dbname=<SQL_DB> user=<SQL_UNPRIVILEGED_USER> password=<SQL_UNPRIVILEGED_PASSWORD>
default_pass_scheme = CRYPT
password_query = "SELECT username AS user, password_enc AS password, CONCAT(homedir, maildir) AS userdb_home, uid AS userdb_uid, gid AS userdb_gid, CONCAT('*:storage=', quota,'M') AS userdb_quota_rule FROM mail_users WHERE (username = '%u' OR email = '%u') AND ((imap = 1 AND '%Ls' = 'imap') OR (pop3 = 1 AND '%Ls' = 'pop3'))"
password_query = "SELECT username AS user, password_enc AS password, CONCAT(homedir, maildir) AS userdb_home, uid AS userdb_uid, gid AS userdb_gid, CONCAT('*:storage=', quota,'M') AS userdb_quota_rule FROM mail_users WHERE (username = '%u' OR email = '%u') AND ((imap = 1 AND '%Ls' = 'imap') OR (pop3 = 1 AND '%Ls' = 'pop3') OR '%Ls' = 'smtp')"
user_query = "SELECT CONCAT(homedir, maildir) AS home, uid, gid, CONCAT('*:storage=', quota,'M') AS quota_rule FROM mail_users WHERE (username = '%u' OR email = '%u')"

View File

@@ -0,0 +1,11 @@
<IfModule mod_fastcgi.c>
FastCgiWrapper /usr/lib/apache2/suexec
FastCgiIpcDir /var/run/apache2/
<Location "/fastcgiphp">
Order Deny,Allow
Deny from All
# Prevent accessing this path directly
Allow from env=REDIRECT_STATUS
</Location>
</IfModule>

View File

@@ -1,5 +1,5 @@
driver = mysql
connect = host=<SQL_HOST> dbname=<SQL_DB> user=<SQL_UNPRIVILEGED_USER> password=<SQL_UNPRIVILEGED_PASSWORD>
default_pass_scheme = CRYPT
password_query = SELECT username AS user, password_enc AS password, CONCAT(homedir, maildir) AS userdb_home, uid AS userdb_uid, gid AS userdb_gid, CONCAT('maildir:', homedir, maildir) AS userdb_mail, CONCAT('maildir:storage=', (quota*1024)) as userdb_quota FROM mail_users WHERE (username = '%u' OR email = '%u') AND ((imap = 1 AND '%Ls' = 'imap') OR (pop3 = 1 AND '%Ls' = 'pop3'))
password_query = SELECT username AS user, password_enc AS password, CONCAT(homedir, maildir) AS userdb_home, uid AS userdb_uid, gid AS userdb_gid, CONCAT('maildir:', homedir, maildir) AS userdb_mail, CONCAT('maildir:storage=', (quota*1024)) as userdb_quota FROM mail_users WHERE (username = '%u' OR email = '%u') AND ((imap = 1 AND '%Ls' = 'imap') OR (pop3 = 1 AND '%Ls' = 'pop3') OR '%Ls' = 'smtp')
user_query = SELECT CONCAT(homedir, maildir) AS home, CONCAT('maildir:', homedir, maildir) AS mail, uid, gid, CONCAT('maildir:storage=', (quota*1024)) as quota FROM mail_users WHERE (username = '%u' OR email = '%u')

View File

@@ -0,0 +1,11 @@
<IfModule mod_fastcgi.c>
FastCgiWrapper /usr/lib/apache2/suexec
FastCgiIpcDir /var/run/apache2/
<Location "/fastcgiphp">
Order Deny,Allow
Deny from All
# Prevent accessing this path directly
Allow from env=REDIRECT_STATUS
</Location>
</IfModule>

View File

@@ -1,6 +1,6 @@
driver = mysql
connect = host=<SQL_HOST> dbname=<SQL_DB> user=<SQL_UNPRIVILEGED_USER> password=<SQL_UNPRIVILEGED_PASSWORD>
default_pass_scheme = CRYPT
password_query = SELECT username AS user, password_enc AS password, CONCAT(homedir, maildir) AS userdb_home, uid AS userdb_uid, gid AS userdb_gid, CONCAT('maildir:', homedir, maildir) AS userdb_mail, CONCAT('maildir:storage=', (quota*1024)) as userdb_quota FROM mail_users WHERE (username = '%u' OR email = '%u') AND ((imap = 1 AND '%Ls' = 'imap') OR (pop3 = 1 AND '%Ls' = 'pop3'))
password_query = SELECT username AS user, password_enc AS password, CONCAT(homedir, maildir) AS userdb_home, uid AS userdb_uid, gid AS userdb_gid, CONCAT('maildir:', homedir, maildir) AS userdb_mail, CONCAT('maildir:storage=', (quota*1024)) as userdb_quota FROM mail_users WHERE (username = '%u' OR email = '%u') AND ((imap = 1 AND '%Ls' = 'imap') OR (pop3 = 1 AND '%Ls' = 'pop3') OR '%Ls' = 'smtp')
user_query = SELECT CONCAT(homedir, maildir) AS home, CONCAT('maildir:', homedir, maildir) AS mail, uid, gid, CONCAT('*:storage=', (quota*1024)) as quota_rule FROM mail_users WHERE (username = '%u' OR email = '%u')