Compare commits

..

2 Commits

Author SHA1 Message Date
Florian Aders (EleRas)
530021ddb2 Now: tagging Froxlor 0.9.9 2010-06-14 08:34:31 +00:00
Florian Aders (EleRas)
3a99dbc041 Tagging Froxlor 0.9.9 2010-06-14 08:32:14 +00:00
2169 changed files with 24479 additions and 116561 deletions

10
.gitignore vendored
View File

@@ -1,10 +0,0 @@
packages/*
lib/classes/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer/*/
temp/*
templates/*
install/update.log
.buildpath
.project
.settings/
*.diff
*~

11
COPYING
View File

@@ -2,7 +2,7 @@
Version 2, June 1991 Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc. Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.
@@ -55,7 +55,7 @@ patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and The precise terms and conditions for copying, distribution and
modification follow. modification follow.
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
License. (Exception: if the Program itself is interactive but License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on does not normally print such an announcement, your work based on
the Program is not required to print an announcement.) the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program, identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in and can be reasonably considered independent and separate works in
@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not distribution of the source code, even though third parties are not
compelled to copy the source along with the object code. compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program 4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is otherwise to copy, modify, sublicense or distribute the Program is
@@ -225,7 +225,7 @@ impose that choice.
This section is intended to make thoroughly clear what is believed to This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License. be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in 8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License original copyright holder who places the Program under this License
@@ -278,3 +278,4 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES. POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS END OF TERMS AND CONDITIONS

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Language * @package Language
* * @version $Id$
*/ */
return array( return array(
@@ -32,32 +32,6 @@ return array(
'option_options_method' => 'getLanguages', 'option_options_method' => 'getLanguages',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'panel_default_theme' => array(
'label' => array('title' => $lng['panel']['theme'], 'description' => $lng['serversettings']['default_theme']),
'settinggroup' => 'panel',
'varname' => 'default_theme',
'type' => 'option',
'default' => 'Froxlor',
'option_mode' => 'one',
'option_options_method' => 'getThemes',
'save_method' => 'storeSettingDefaultTheme',
),
'panel_allow_theme_change_customer' => array(
'label' => $lng['serversettings']['panel_allow_theme_change_customer'],
'settinggroup' => 'panel',
'varname' => 'allow_theme_change_customer',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'panel_allow_theme_change_admin' => array(
'label' => $lng['serversettings']['panel_allow_theme_change_admin'],
'settinggroup' => 'panel',
'varname' => 'allow_theme_change_admin',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField'
),
'panel_natsorting' => array( 'panel_natsorting' => array(
'label' => $lng['serversettings']['natsorting'], 'label' => $lng['serversettings']['natsorting'],
'settinggroup' => 'panel', 'settinggroup' => 'panel',
@@ -90,24 +64,7 @@ return array(
'type' => 'option', 'type' => 'option',
'default' => 'Manual', 'default' => 'Manual',
'option_mode' => 'one', 'option_mode' => 'one',
'option_options' => array('Manual' => $lng['serversettings']['manual'], 'Dropdown' => $lng['serversettings']['dropdown']), 'option_options' => array('Manual' => 'Manual', 'Dropdown' => 'Dropdown'),
'save_method' => 'storeSettingField',
),
'use_webfonts' => array(
'label' => $lng['serversettings']['enablewebfonts'],
'settinggroup' => 'panel',
'varname' => 'use_webfonts',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'webfont' => array(
'label' => $lng['serversettings']['definewebfont']['title'],
'settinggroup' => 'panel',
'varname' => 'webfont',
'type' => 'string',
'default' => 'Numans',
'string_emptyallowed' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'panel_adminmail' => array( 'panel_adminmail' => array(
@@ -194,6 +151,14 @@ return array(
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'admin_froxlor_graphic' => array(
'label' => $lng['admin']['froxlor_graphic'],
'settinggroup' => 'admin',
'varname' => 'froxlor_graphic',
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
),
'panel_allow_domain_change_admin' => array( 'panel_allow_domain_change_admin' => array(
'label' => $lng['serversettings']['panel_allow_domain_change_admin'], 'label' => $lng['serversettings']['panel_allow_domain_change_admin'],
'settinggroup' => 'panel', 'settinggroup' => 'panel',
@@ -210,14 +175,6 @@ return array(
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'panel_phpconfigs_hidestdsubdomain' => array(
'label' => $lng['serversettings']['panel_phpconfigs_hidestdsubdomain'],
'settinggroup' => 'panel',
'varname' => 'phpconfigs_hidestdsubdomain',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
), ),
), ),
), ),

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(
@@ -38,14 +38,6 @@ return array(
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'login_domain_login' => array(
'label' => $lng['serversettings']['login_domain_login'],
'settinggroup' => 'login',
'varname' => 'domain_login',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'login_maxloginattempts' => array( 'login_maxloginattempts' => array(
'label' => $lng['serversettings']['maxloginattempts'], 'label' => $lng['serversettings']['maxloginattempts'],
'settinggroup' => 'login', 'settinggroup' => 'login',
@@ -70,15 +62,6 @@ return array(
'default' => 0, 'default' => 0,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'panel_password_regex' => array(
'label' => $lng['serversettings']['panel_password_regex'],
'settinggroup' => 'panel',
'varname' => 'password_regex',
'type' => 'string',
'default' => '',
/* 'plausibility_check_method' => 'checkValidRegEx', */
'save_method' => 'storeSettingField',
),
'customer_accountprefix' => array( 'customer_accountprefix' => array(
'label' => $lng['serversettings']['accountprefix'], 'label' => $lng['serversettings']['accountprefix'],
'settinggroup' => 'customer', 'settinggroup' => 'customer',

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(
@@ -27,18 +27,8 @@ return array(
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'documentroot_prefix', 'varname' => 'documentroot_prefix',
'type' => 'string', 'type' => 'string',
'string_type' => 'dir',
'default' => '/var/customers/webs/', 'default' => '/var/customers/webs/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'plausibility_check_method' => 'checkPathConflicts'
),
'system_documentroot_use_default_value' => array(
'label' => $lng['serversettings']['documentroot_use_default_value'],
'settinggroup' => 'system',
'varname' => 'documentroot_use_default_value',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
), ),
'system_ipaddress' => array( 'system_ipaddress' => array(
'label' => $lng['serversettings']['ipaddress'], 'label' => $lng['serversettings']['ipaddress'],
@@ -67,23 +57,6 @@ return array(
'type' => 'string', 'type' => 'string',
'default' => '', 'default' => '',
'save_method' => 'storeSettingHostname', 'save_method' => 'storeSettingHostname',
'plausibility_check_method' => 'checkHostname',
),
'system_froxlordirectlyviahostname' => array(
'label' => $lng['serversettings']['froxlordirectlyviahostname'],
'settinggroup' => 'system',
'varname' => 'froxlordirectlyviahostname',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'system_validatedomain' => array(
'label' => $lng['serversettings']['validate_domain'],
'settinggroup' => 'system',
'varname' => 'validate_domain',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
), ),
'system_stdsubdomain' => array( 'system_stdsubdomain' => array(
'label' => $lng['serversettings']['stdsubdomainhost'], 'label' => $lng['serversettings']['stdsubdomainhost'],
@@ -102,6 +75,15 @@ return array(
'plausibility_check_method' => 'checkMysqlAccessHost', 'plausibility_check_method' => 'checkMysqlAccessHost',
'save_method' => 'storeSettingMysqlAccessHost', 'save_method' => 'storeSettingMysqlAccessHost',
), ),
'system_realtime_port' => array(
'label' => $lng['serversettings']['system_realtime_port'],
'settinggroup' => 'system',
'varname' => 'realtime_port',
'type' => (function_exists('socket_create') ? 'int' : 'hidden'),
'int_max' => 65535,
'default' => 0,
'save_method' => 'storeSettingField',
),
'system_index_file_extension' => array( 'system_index_file_extension' => array(
'label' => $lng['serversettings']['index_file_extension'], 'label' => $lng['serversettings']['index_file_extension'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -131,35 +113,6 @@ return array(
'type' => 'hidden', 'type' => 'hidden',
'default' => 'www-data', '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' => 150,
'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' => 150,
'default' => 90,
'save_method' => 'storeSettingField',
),
'system_debug_cron' => array( 'system_debug_cron' => array(
'label' => $lng['serversettings']['cron']['debug'], 'label' => $lng['serversettings']['cron']['debug'],
'settinggroup' => 'system', 'settinggroup' => 'system',

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(
@@ -27,37 +27,12 @@ return array(
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'webserver', 'varname' => 'webserver',
'type' => 'option', 'type' => 'option',
'default' => 'apache2', 'default' => 'Apache2',
'option_mode' => 'one', 'option_mode' => 'one',
'option_options' => array('apache2' => 'Apache 2', 'lighttpd' => 'ligHTTPd', 'nginx' => 'Nginx'), 'option_options' => array('apache2' => 'Apache 2', 'lighttpd' => 'ligHTTPd'),
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'overview_option' => true 'overview_option' => true
), ),
'system_apache_24' => array(
'label' => $lng['serversettings']['apache_24'],
'settinggroup' => 'system',
'varname' => 'apache24',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'system_httpuser' => array(
'label' => $lng['admin']['webserver_user'],
'settinggroup' => 'system',
'varname' => 'httpuser',
'type' => 'string',
'default' => 'www-data',
'save_method' => 'storeSettingField',
),
'system_httpgroup' => array(
'label' => $lng['admin']['webserver_group'],
'settinggroup' => 'system',
'varname' => 'httpgroup',
'type' => 'string',
'default' => 'www-data',
'save_method' => 'storeSettingField',
),
'system_apacheconf_vhost' => array( 'system_apacheconf_vhost' => array(
'label' => $lng['serversettings']['apacheconf_vhost'], 'label' => $lng['serversettings']['apacheconf_vhost'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -81,10 +56,26 @@ return array(
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'apacheconf_htpasswddir', 'varname' => 'apacheconf_htpasswddir',
'type' => 'string', 'type' => 'string',
'string_type' => 'confdir', 'string_type' => 'dir',
'default' => '/etc/apache2/htpasswd/', 'default' => '/etc/apache2/htpasswd/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_apachereload_command' => array(
'label' => $lng['serversettings']['apachereload_command'],
'settinggroup' => 'system',
'varname' => 'apachereload_command',
'type' => 'string',
'default' => '/etc/init.d/apache2 reload',
'save_method' => 'storeSettingField',
),
'system_mod_log_sql' => array(
'label' => $lng['serversettings']['mod_log_sql'],
'settinggroup' => 'system',
'varname' => 'mod_log_sql',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'system_logfiles_directory' => array( 'system_logfiles_directory' => array(
'label' => $lng['serversettings']['logfiles_directory'], 'label' => $lng['serversettings']['logfiles_directory'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -94,15 +85,6 @@ return array(
'default' => '/var/customers/logs/', 'default' => '/var/customers/logs/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_customersslpath' => array(
'label' => $lng['serversettings']['customerssl_directory'],
'settinggroup' => 'system',
'varname' => 'customer_ssl_path',
'type' => 'string',
'string_type' => 'confdir',
'default' => '/etc/ssl/froxlor-custom/',
'save_method' => 'storeSettingField',
),
'system_phpappendopenbasedir' => array( 'system_phpappendopenbasedir' => array(
'label' => $lng['serversettings']['phpappendopenbasedir'], 'label' => $lng['serversettings']['phpappendopenbasedir'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -130,42 +112,6 @@ return array(
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_apachereload_command' => array(
'label' => $lng['serversettings']['apachereload_command'],
'settinggroup' => 'system',
'varname' => 'apachereload_command',
'type' => 'string',
'default' => '/etc/init.d/apache2 reload',
'save_method' => 'storeSettingField',
),
'system_phpreload_command' => array(
'label' => $lng['serversettings']['phpreload_command'],
'settinggroup' => 'system',
'varname' => 'phpreload_command',
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
'websrv_avail' => array('nginx')
),
'system_nginx_php_backend' => array(
'label' => $lng['serversettings']['nginx_php_backend'],
'settinggroup' => 'system',
'varname' => 'nginx_php_backend',
'type' => 'string',
'default' => '127.0.0.1:8888',
'save_method' => 'storeSettingField',
'websrv_avail' => array('nginx')
),
'nginx_fastcgiparams' => array(
'label' => $lng['serversettings']['nginx_fastcgiparams'],
'settinggroup' => 'nginx',
'varname' => 'fastcgiparams',
'type' => 'string',
'string_type' => 'file',
'default' => '/etc/nginx/fastcgi_params',
'save_method' => 'storeSettingField',
'websrv_avail' => array('nginx')
),
'defaultwebsrverrhandler_enabled' => array( 'defaultwebsrverrhandler_enabled' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_enabled'], 'label' => $lng['serversettings']['defaultwebsrverrhandler_enabled'],
'settinggroup' => 'defaultwebsrverrhandler', 'settinggroup' => 'defaultwebsrverrhandler',
@@ -181,7 +127,6 @@ return array(
'type' => 'string', 'type' => 'string',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2', 'nginx')
), ),
'defaultwebsrverrhandler_err403' => array( 'defaultwebsrverrhandler_err403' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_err403'], 'label' => $lng['serversettings']['defaultwebsrverrhandler_err403'],
@@ -190,7 +135,6 @@ return array(
'type' => 'string', 'type' => 'string',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2', 'nginx')
), ),
'defaultwebsrverrhandler_err404' => array( 'defaultwebsrverrhandler_err404' => array(
'label' => $lng['serversettings']['defaultwebsrverrhandler_err404'], 'label' => $lng['serversettings']['defaultwebsrverrhandler_err404'],
@@ -207,7 +151,6 @@ return array(
'type' => 'string', 'type' => 'string',
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2', 'nginx')
), ),
'customredirect_enabled' => array( 'customredirect_enabled' => array(
'label' => $lng['serversettings']['customredirect_enabled'], 'label' => $lng['serversettings']['customredirect_enabled'],
@@ -216,7 +159,6 @@ return array(
'type' => 'bool', 'type' => 'bool',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2', 'lighttpd')
), ),
'customredirect_default' => array( 'customredirect_default' => array(
'label' => $lng['serversettings']['customredirect_default'], 'label' => $lng['serversettings']['customredirect_default'],
@@ -227,9 +169,61 @@ return array(
'option_mode' => 'one', 'option_mode' => 'one',
'option_options_method' => 'getRedirectCodes', 'option_options_method' => 'getRedirectCodes',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2', 'lighttpd') ),
) ),
) ),
) 'ssl' => array(
) 'title' => $lng['admin']['sslsettings'],
'fields' => array(
'system_ssl_enabled' => array(
'label' => $lng['serversettings']['ssl']['use_ssl'],
'settinggroup' => 'system',
'varname' => 'use_ssl',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'system_ssl_cert_file' => array(
'label' => $lng['serversettings']['ssl']['ssl_cert_file'],
'settinggroup' => 'system',
'varname' => 'ssl_cert_file',
'type' => 'string',
'string_type' => 'file',
'string_emptyallowed' => true,
'default' => '/etc/apache2/apache2.pem',
'save_method' => 'storeSettingField',
),
'system_ssl_key_file' => array(
'label' => $lng['serversettings']['ssl']['ssl_key_file'],
'settinggroup' => 'system',
'varname' => 'ssl_key_file',
'type' => 'string',
'string_type' => 'file',
'string_emptyallowed' => true,
'default' => '/etc/apache2/apache2.key',
'save_method' => 'storeSettingField',
),
'system_ssl_ca_file' => array(
'label' => $lng['serversettings']['ssl']['ssl_ca_file'],
'settinggroup' => 'system',
'varname' => 'ssl_ca_file',
'type' => 'string',
'string_type' => 'file',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField',
),
'system_ssl_openssl_cnf' => array(
'label' => $lng['serversettings']['ssl']['openssl_cnf'],
'settinggroup' => 'system',
'varname' => 'openssl_cnf',
'type' => 'text',
'default' => '',
'save_method' => 'storeSettingField',
),
),
),
),
); );
?>

View File

@@ -1,86 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings
*
*/
return array(
'groups' => array(
'ssl' => array(
'title' => $lng['admin']['sslsettings'],
'fields' => array(
'system_ssl_enabled' => array(
'label' => $lng['serversettings']['ssl']['use_ssl'],
'settinggroup' => 'system',
'varname' => 'use_ssl',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'overview_option' => true
),
'system_ssl_cipher_list' => array(
'label' => $lng['serversettings']['ssl']['ssl_cipher_list'],
'settinggroup' => 'system',
'varname' => 'ssl_cipher_list',
'type' => 'string',
'string_emptyallowed' => false,
'default' => 'ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH',
'save_method' => 'storeSettingField',
),
'system_ssl_cert_file' => array(
'label' => $lng['serversettings']['ssl']['ssl_cert_file'],
'settinggroup' => 'system',
'varname' => 'ssl_cert_file',
'type' => 'string',
'string_type' => 'file',
'string_emptyallowed' => true,
'default' => '/etc/apache2/apache2.pem',
'save_method' => 'storeSettingField',
),
'system_ssl_key_file' => array(
'label' => $lng['serversettings']['ssl']['ssl_key_file'],
'settinggroup' => 'system',
'varname' => 'ssl_key_file',
'type' => 'string',
'string_type' => 'file',
'string_emptyallowed' => true,
'default' => '/etc/apache2/apache2.key',
'save_method' => 'storeSettingField',
),
'system_ssl_cert_chainfile' => array(
'label' => $lng['admin']['ipsandports']['ssl_cert_chainfile'],
'settinggroup' => 'system',
'varname' => 'ssl_cert_chainfile',
'type' => 'string',
'string_type' => 'file',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField',
),
'system_ssl_ca_file' => array(
'label' => $lng['serversettings']['ssl']['ssl_ca_file'],
'settinggroup' => 'system',
'varname' => 'ssl_ca_file',
'type' => 'string',
'string_type' => 'file',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField',
)
)
)
)
);

View File

@@ -1,151 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings
*
*/
return array(
'groups' => array(
'fcgid' => array(
'title' => $lng['admin']['fcgid_settings'],
'websrv_avail' => array('apache2', 'lighttpd'),
'fields' => array(
'system_mod_fcgid_enabled' => array(
'label' => $lng['serversettings']['mod_fcgid'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'plausibility_check_method' => 'checkFcgidPhpFpm',
'overview_option' => true
),
'system_mod_fcgid_configdir' => array(
'label' => $lng['serversettings']['mod_fcgid']['configdir'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_configdir',
'type' => 'string',
'string_type' => 'confdir',
'default' => '/var/www/php-fcgi-scripts/',
'plausibility_check_method' => 'checkPathConflicts',
'save_method' => 'storeSettingField',
),
'system_mod_fcgid_tmpdir' => array(
'label' => $lng['serversettings']['mod_fcgid']['tmpdir'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_tmpdir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/customers/tmp/',
'save_method' => 'storeSettingField',
),
'system_mod_fcgid_peardir' => array(
'label' => $lng['serversettings']['mod_fcgid']['peardir'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_peardir',
'type' => 'string',
'string_type' => 'dir',
'string_delimiter' => ':',
'string_emptyallowed' => true,
'default' => '/usr/share/php/:/usr/share/php5/',
'save_method' => 'storeSettingField',
),
'system_mod_fcgid_wrapper' => array(
'label' => $lng['serversettings']['mod_fcgid']['wrapper'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_wrapper',
'type' => 'option',
'option_options' => array(0 => 'ScriptAlias', 1=> 'FcgidWrapper'),
'default' => 1,
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'system_mod_fcgid_starter' => array(
'label' => $lng['serversettings']['mod_fcgid']['starter'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_starter',
'type' => 'int',
'default' => 0,
'save_method' => 'storeSettingField',
),
'system_mod_fcgid_maxrequests' => array(
'label' => $lng['serversettings']['mod_fcgid']['maxrequests'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_maxrequests',
'type' => 'int',
'default' => 250,
'save_method' => 'storeSettingField',
),
'system_mod_fcgid_defaultini' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_defaultini',
'type' => 'option',
'default' => '1',
'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs',
'save_method' => 'storeSettingField',
),
'system_mod_fcgid_enabled_ownvhost' => array(
'label' => $lng['serversettings']['mod_fcgid_ownvhost'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_ownvhost',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'system_mod_fcgid_httpuser' => array(
'label' => $lng['admin']['mod_fcgid_user'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_httpuser',
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'system_mod_fcgid_httpgroup' => array(
'label' => $lng['admin']['mod_fcgid_group'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_httpgroup',
'type' => 'string',
'default' => 'froxlorlocal',
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'system_mod_fcgid_defaultini_ownvhost' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_defaultini_ownvhost',
'type' => 'option',
'default' => '1',
'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs',
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'system_mod_fcgid_idle_timeout' => array(
'label' => $lng['serversettings']['mod_fcgid']['idle_timeout'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_idle_timeout',
'type' => 'int',
'default' => 30,
'save_method' => 'storeSettingField'
),
)
)
)
);
?>

View File

@@ -1,184 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings
*
*/
return array(
'groups' => array(
'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'
),
'system_phpfpm_defaultini' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini'],
'settinggroup' => 'phpfpm',
'varname' => 'defaultini',
'type' => 'option',
'default' => '1',
'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs',
'save_method' => 'storeSettingField',
),
'system_phpfpm_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' => 'confdir',
'default' => '/etc/php-fpm.d/',
'save_method' => 'storeSettingField',
),
'system_phpfpm_aliasconfigdir' => array(
'label' => $lng['serversettings']['phpfpm_settings']['aliasconfigdir'],
'settinggroup' => 'phpfpm',
'varname' => 'aliasconfigdir',
'type' => 'string',
'string_type' => 'confdir',
'default' => '/var/www/php-fpm/',
'save_method' => 'storeSettingField',
),
'system_phpfpm_tmpdir' => array(
'label' => $lng['serversettings']['mod_fcgid']['tmpdir'],
'settinggroup' => 'phpfpm',
'varname' => 'tmpdir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/customers/tmp/',
'save_method' => 'storeSettingField',
),
'system_phpfpm_peardir' => array(
'label' => $lng['serversettings']['mod_fcgid']['peardir'],
'settinggroup' => 'phpfpm',
'varname' => 'peardir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/usr/share/php/:/usr/share/php5/',
'save_method' => 'storeSettingField',
),
'system_phpfpm_reload' => array(
'label' => $lng['serversettings']['phpfpm_settings']['reload'],
'settinggroup' => 'phpfpm',
'varname' => 'reload',
'type' => 'string',
'default' => '/etc/init.d/php-fpm restart',
'save_method' => 'storeSettingField',
),
'system_phpfpm_pm' => array(
'label' => $lng['serversettings']['phpfpm_settings']['pm'],
'settinggroup' => 'phpfpm',
'varname' => 'pm',
'type' => 'option',
'default' => 'static',
'option_mode' => 'one',
'option_options' => array('static' => 'static', 'dynamic' => 'dynamic', 'ondemand' => 'ondemand'),
'save_method' => 'storeSettingField',
),
'system_phpfpm_max_children' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_children'],
'settinggroup' => 'phpfpm',
'varname' => 'max_children',
'type' => 'int',
'default' => 1,
'save_method' => 'storeSettingField',
),
'system_phpfpm_start_servers' => array(
'label' => $lng['serversettings']['phpfpm_settings']['start_servers'],
'settinggroup' => 'phpfpm',
'varname' => 'start_servers',
'type' => 'int',
'default' => 20,
'save_method' => 'storeSettingField',
),
'system_phpfpm_min_spare_servers' => array(
'label' => $lng['serversettings']['phpfpm_settings']['min_spare_servers'],
'settinggroup' => 'phpfpm',
'varname' => 'min_spare_servers',
'type' => 'int',
'default' => 5,
'save_method' => 'storeSettingField',
),
'system_phpfpm_max_spare_servers' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_spare_servers'],
'settinggroup' => 'phpfpm',
'varname' => 'max_spare_servers',
'type' => 'int',
'default' => 35,
'save_method' => 'storeSettingField',
),
'system_phpfpm_max_requests' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_requests'],
'settinggroup' => 'phpfpm',
'varname' => 'max_requests',
'type' => 'int',
'default' => 0,
'save_method' => 'storeSettingField',
),
'system_phpfpm_idle_timeout' => array(
'label' => $lng['serversettings']['phpfpm_settings']['idle_timeout'],
'settinggroup' => 'phpfpm',
'varname' => 'idle_timeout',
'type' => 'int',
'default' => 30,
'save_method' => 'storeSettingField'
),
),
),
),
);
?>

View File

@@ -1,65 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings
*
*/
return array(
'groups' => array(
'perl' => array(
'title' => $lng['admin']['perl_settings'],
'fields' => array(
'perl_path' => array(
'label' => $lng['serversettings']['perl_path'],
'settinggroup' => 'system',
'varname' => 'perl_path',
'type' => 'string',
'default' => '/usr/bin/perl',
'save_method' => 'storeSettingField',
'websrv_avail' => array('lighttpd')
),
'system_perl_suexecworkaround' => array(
'label' => $lng['serversettings']['perl']['suexecworkaround'],
'settinggroup' => 'perl',
'varname' => 'suexecworkaround',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'system_perl_suexeccgipath' => array(
'label' => $lng['serversettings']['perl']['suexeccgipath'],
'settinggroup' => 'perl',
'varname' => 'suexecpath',
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/www/cgi-bin/',
'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
),
'perl_server' => array(
'label' => $lng['serversettings']['perl_server'],
'settinggroup' => 'serversettings',
'varname' => 'perl_server',
'type' => 'string',
'default' => 'unix:/var/run/nginx/cgiwrap-dispatch.sock',
'save_method' => 'storeSettingField',
'websrv_avail' => array('nginx')
),
),
),
),
);
?>

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(
@@ -49,15 +49,6 @@ return array(
'default' => '/usr/bin/', 'default' => '/usr/bin/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_awstats_awstatspath' => array(
'label' => $lng['serversettings']['awstats_awstatspath'],
'settinggroup' => 'system',
'varname' => 'awstats_awstatspath',
'type' => 'string',
'string_type' => 'dir',
'default' => '/usr/bin/',
'save_method' => 'storeSettingField',
),
'system_awstats_conf' => array( 'system_awstats_conf' => array(
'label' => $lng['serversettings']['awstats_conf'], 'label' => $lng['serversettings']['awstats_conf'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -66,15 +57,6 @@ return array(
'string_type' => 'dir', 'string_type' => 'dir',
'default' => '/etc/awstats/', 'default' => '/etc/awstats/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
),
'system_awstats_icons' => array(
'label' => $lng['serversettings']['awstats_icons'],
'settinggroup' => 'system',
'varname' => 'awstats_icons',
'type' => 'string',
'string_type' => 'dir',
'default' => '/usr/share/awstats/icon/',
'save_method' => 'storeSettingField',
) )
) )
) )

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(
@@ -51,16 +51,6 @@ return array(
'default' => '/var/customers/mail/', 'default' => '/var/customers/mail/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_vmail_maildirname' => array(
'label' => $lng['serversettings']['vmail_maildirname'],
'settinggroup' => 'system',
'varname' => 'vmail_maildirname',
'type' => 'string',
'string_type' => 'dir',
'default' => 'Maildir',
'string_emptyallowed' => true,
'save_method' => 'storeSettingField',
),
'panel_sendalternativemail' => array( 'panel_sendalternativemail' => array(
'label' => $lng['serversettings']['sendalternativemail'], 'label' => $lng['serversettings']['sendalternativemail'],
'settinggroup' => 'panel', 'settinggroup' => 'panel',
@@ -100,14 +90,6 @@ return array(
'type' => 'hidden', 'type' => 'hidden',
'default' => 0, 'default' => 0,
), ),
'system_catchall_enabled' => array(
'label' => $lng['serversettings']['catchall_enabled'],
'settinggroup' => 'catchall',
'varname' => 'catchall_enabled',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingResetCatchall',
),
), ),
), ),
), ),

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id: 220.ftpserver.php 1 2010-04-07 10:00:00Z monotek $
*/ */
return array( return array(

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(
@@ -22,15 +22,6 @@ return array(
'nameserver' => array( 'nameserver' => array(
'title' => $lng['admin']['nameserversettings'], 'title' => $lng['admin']['nameserversettings'],
'fields' => array( 'fields' => array(
'nameserver_enable' => array(
'label' => $lng['serversettings']['bindenable'],
'settinggroup' => 'system',
'varname' => 'bind_enable',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
'overview_option' => true
),
'system_bindconf_directory' => array( 'system_bindconf_directory' => array(
'label' => $lng['serversettings']['bindconf_directory'], 'label' => $lng['serversettings']['bindconf_directory'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -68,16 +59,6 @@ return array(
'default' => '', 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_axfrservers' => array(
'label' => $lng['serversettings']['axfrservers'],
'settinggroup' => 'system',
'varname' => 'axfrservers',
'type' => 'string',
'string_type' => 'validate_ip',
'string_emptyallowed' => true,
'default' => '',
'save_method' => 'storeSettingField',
),
'system_dns_createmailentry' => array( 'system_dns_createmailentry' => array(
'label' => $lng['serversettings']['mail_also_with_mxservers'], 'label' => $lng['serversettings']['mail_also_with_mxservers'],
'settinggroup' => 'system', 'settinggroup' => 'system',

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(

View File

@@ -14,11 +14,9 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
global $settings;
return array( return array(
'groups' => array( 'groups' => array(
'dkim' => array( 'dkim' => array(
@@ -38,7 +36,6 @@ return array(
'settinggroup' => 'dkim', 'settinggroup' => 'dkim',
'varname' => 'dkim_prefix', 'varname' => 'dkim_prefix',
'type' => 'string', 'type' => 'string',
'string_type' => 'dir',
'default' => '/etc/postfix/dkim/', 'default' => '/etc/postfix/dkim/',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
@@ -81,10 +78,7 @@ return array(
'save_method' => 'storeSettingFieldInsertBindTask', 'save_method' => 'storeSettingFieldInsertBindTask',
), ),
'dkim_keylength' => array( 'dkim_keylength' => array(
'label' => array( 'label' => $lng['dkim']['dkim_keylength'],
'title' => $lng['dkim']['dkim_keylength']['title'],
'description' => sprintf($lng['dkim']['dkim_keylength']['description'],$settings['dkim']['dkim_prefix'])
),
'settinggroup' => 'dkim', 'settinggroup' => 'dkim',
'varname' => 'dkim_keylength', 'varname' => 'dkim_keylength',
'type' => 'option', 'type' => 'option',

View File

@@ -12,7 +12,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(
@@ -58,7 +58,6 @@ return array(
'option_mode' => 'one', 'option_mode' => 'one',
'option_options' => array(0 => html_entity_decode($lng['admin']['tickets']['daily']), 1 => html_entity_decode($lng['admin']['tickets']['weekly']), 2 => html_entity_decode($lng['admin']['tickets']['monthly']), 3 => html_entity_decode($lng['admin']['tickets']['yearly'])), 'option_options' => array(0 => html_entity_decode($lng['admin']['tickets']['daily']), 1 => html_entity_decode($lng['admin']['tickets']['weekly']), 2 => html_entity_decode($lng['admin']['tickets']['monthly']), 3 => html_entity_decode($lng['admin']['tickets']['yearly'])),
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'plausibility_check_method' => 'setCycleOfCronjob',
), ),
'ticket_concurrently_open' => array( 'ticket_concurrently_open' => array(
'label' => $lng['serversettings']['ticket']['concurrentlyopen'], 'label' => $lng['serversettings']['ticket']['concurrentlyopen'],
@@ -133,7 +132,7 @@ return array(
'type' => 'option', 'type' => 'option',
'default' => 2, 'default' => 2,
'option_mode' => 'one', 'option_mode' => 'one',
'option_options' => array(1 => $lng['ticket']['high'], 2 => $lng['ticket']['normal'], 3 => $lng['ticket']['low']), 'option_options' => array(1 => $lng['ticket']['unf_high'], 2 => $lng['ticket']['unf_normal'], 3 => $lng['ticket']['unf_low']),
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
), ),

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(
@@ -59,7 +59,7 @@ return array(
'type' => 'option', 'type' => 'option',
'default' => '', 'default' => '',
'option_mode' => 'multiple', 'option_mode' => 'multiple',
'option_options' => array('gd' => 'GD Library', 'pcre' => 'PCRE', 'ioncube' => 'ionCube', 'ioncube loader' => 'ionCube Loader', 'curl' => 'curl', 'mcrypt' => 'mcrypt', 'imap' => 'imap', 'json' => 'json', 'ldap' => 'LDAP', 'hash' => 'hash', 'mbstring' => 'mbstring', 'Zend Optimizer' => 'Zend Guard'), 'option_options' => array('gd' => 'GD Library', 'pcre' => 'PCRE', 'ioncube' => 'ionCube', 'ioncube loader' => 'ionCube Loader', 'curl' => 'curl', 'mcrypt' => 'mcrypt', 'imap' => 'imap', 'json' => 'json', 'ldap' => 'LDAP', 'hash' => 'hash', 'mbstring' => 'mbstring'),
'save_method' => 'storeSettingApsPhpExtensions', 'save_method' => 'storeSettingApsPhpExtensions',
), ),
'aps_php-function' => array( 'aps_php-function' => array(

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings * @package Settings
* * @version $Id$
*/ */
return array( return array(
@@ -38,17 +38,81 @@ return array(
'default' => true, 'default' => true,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_passwordcryptfunc' => array( 'system_mod_fcgid_enabled' => array(
'label' => $lng['serversettings']['passwordcryptfunc'], 'label' => $lng['serversettings']['mod_fcgid'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'passwordcryptfunc', 'varname' => 'mod_fcgid',
'type' => 'option', 'type' => 'bool',
'default' => 0, 'default' => false,
'option_mode' => 'one',
'option_options' => array(0 => $lng['serversettings']['systemdefault'], 1 => 'MD5', 2 => 'BLOWFISH', 3 => 'SHA-256', 4 => 'SHA-512'),
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
) ),
) 'system_mod_fcgid_configdir' => array(
) 'label' => $lng['serversettings']['mod_fcgid']['configdir'],
) 'settinggroup' => 'system',
'varname' => 'mod_fcgid_configdir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/www/php-fcgi-scripts/',
'save_method' => 'storeSettingField',
),
'system_mod_fcgid_tmpdir' => array(
'label' => $lng['serversettings']['mod_fcgid']['tmpdir'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_tmpdir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/customers/tmp/',
'save_method' => 'storeSettingField',
),
'system_mod_fcgid_peardir' => array(
'label' => $lng['serversettings']['mod_fcgid']['peardir'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_peardir',
'type' => 'string',
'string_type' => 'dir',
'string_delimiter' => ':',
'string_emptyallowed' => true,
'default' => '/usr/share/php/:/usr/share/php5/',
'save_method' => 'storeSettingField',
),
'system_mod_fcgid_wrapper' => array(
'label' => $lng['serversettings']['mod_fcgid']['wrapper'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_wrapper',
'type' => 'option',
'option_options' => array(0 => 'ScriptAlias', 1=> 'FCGIWrapper'),
'default' => 0,
'save_method' => 'storeSettingField',
),
'system_mod_fcgid_starter' => array(
'label' => $lng['serversettings']['mod_fcgid']['starter'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_starter',
'type' => 'int',
'default' => 0,
'save_method' => 'storeSettingField',
),
'system_mod_fcgid_maxrequests' => array(
'label' => $lng['serversettings']['mod_fcgid']['maxrequests'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_maxrequests',
'type' => 'int',
'default' => 250,
'save_method' => 'storeSettingField',
),
'system_mod_fcgid_defaultini' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini'],
'settinggroup' => 'system',
'varname' => 'mod_fcgid_defaultini',
'type' => 'option',
'default' => '1',
'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs',
'save_method' => 'storeSettingField',
),
),
),
),
); );
?>

View File

@@ -1,118 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings
*
*/
return array(
'groups' => array(
'backup' => array(
'title' => $lng['backup'],
'fields' => array(
'backup_enabled' => array(
'label' => $lng['serversettings']['backup_enabled'],
'settinggroup' => 'system',
'varname' => 'backup_enabled',
'type' => 'bool',
'default' => false,
'cronmodule' => 'froxlor/backup',
'save_method' => 'storeSettingField',
'overview_option' => true
),
'backup_dir' => array(
'label' => $lng['serversettings']['backupdir']['description'],
'settinggroup' => 'system',
'varname' => 'backup_dir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/customers/backups/',
'string_regexp' => '#^/.*/$#',
'save_method' => 'storeSettingField',
),
'backup_mysqldump_path' => array(
'label' => $lng['serversettings']['mysqldump_path']['description'],
'settinggroup' => 'system',
'varname' => 'backup_mysqldump_path',
'type' => 'string',
'default' => '/usr/bin/mysqldump',
'save_method' => 'storeSettingField',
),
'backup_count' => array(
'label' => $lng['serversettings']['backup_count'],
'settinggroup' => 'system',
'varname' => 'backup_count',
'type' => 'bool',
'default' => 'true',
'save_method' => 'storeSettingField',
'overview_option' => false
),
'backup_bigfile' => array(
'label' => $lng['serversettings']['backup_bigfile'],
'settinggroup' => 'system',
'varname' => 'backup_bigfile',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'overview_option' => false
),
'backup_ftp_enabled_' => array(
'label' => $lng['serversettings']['backup_ftp_enabled'],
'settinggroup' => 'system',
'varname' => 'backup_ftp_enabled',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'overview_option' => false
),
'backup_server' => array(
'label' => $lng['serversettings']['backup_ftp_server'],
'settinggroup' => 'system',
'varname' => 'backup_ftp_server',
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
),
'backup_user' => array(
'label' => $lng['serversettings']['backup_ftp_user'],
'settinggroup' => 'system',
'varname' => 'backup_ftp_user',
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
),
'backup_pass' => array(
'label' => $lng['serversettings']['backup_ftp_pass'],
'settinggroup' => 'system',
'varname' => 'backup_ftp_pass',
'type' => 'hiddenstring',
'default' => '',
'save_method' => 'storeSettingField',
),
'backup_passive_mode' => array(
'label' => $lng['serversettings']['backup_ftp_passive_mode'],
'settinggroup' => 'system',
'varname' => 'backup_ftp_passive',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
'overview_option' => false,
),
),
),
),
);
?>

View File

@@ -1,60 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2011- the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2011-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings
*
*/
return array(
'groups' => array(
'diskquota' => array(
'title' => $lng['diskquota'],
'fields' => array(
'diskquota_enabled' => array(
'label' => $lng['serversettings']['diskquota_enabled'],
'settinggroup' => 'system',
'varname' => 'diskquota_enabled',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'overview_option' => true
),
'diskquota_repquota_path' => array(
'label' => $lng['serversettings']['diskquota_repquota_path']['description'],
'settinggroup' => 'system',
'varname' => 'diskquota_repquota_path',
'type' => 'string',
'default' => '/usr/sbin/repquota',
'save_method' => 'storeSettingField',
),
'diskquota_quotatool_path' => array(
'label' => $lng['serversettings']['diskquota_quotatool_path']['description'],
'settinggroup' => 'system',
'varname' => 'diskquota_quotatool_path',
'type' => 'string',
'default' => '/usr/bin/quotatool',
'save_method' => 'storeSettingField',
),
'diskquota_customer_partition' => array(
'label' => $lng['serversettings']['diskquota_customer_partition']['description'],
'settinggroup' => 'system',
'varname' => 'diskquota_customer_partition',
'type' => 'string',
'default' => '/dev/root',
'save_method' => 'storeSettingField',
),
),
),
),
);
?>

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
@@ -47,6 +47,22 @@ if($page == 'admins'
'diskspace_used' => $lng['customer']['diskspace'] . ' (' . $lng['panel']['used'] . ')', 'diskspace_used' => $lng['customer']['diskspace'] . ' (' . $lng['panel']['used'] . ')',
'traffic' => $lng['customer']['traffic'], 'traffic' => $lng['customer']['traffic'],
'traffic_used' => $lng['customer']['traffic'] . ' (' . $lng['panel']['used'] . ')', 'traffic_used' => $lng['customer']['traffic'] . ' (' . $lng['panel']['used'] . ')',
'mysqls' => $lng['customer']['mysqls'],
'mysqls_used' => $lng['customer']['mysqls'] . ' (' . $lng['panel']['used'] . ')',
'ftps' => $lng['customer']['ftps'],
'ftps_used' => $lng['customer']['ftps'] . ' (' . $lng['panel']['used'] . ')',
'tickets' => $lng['customer']['tickets'],
'tickets_used' => $lng['customer']['tickets'] . ' (' . $lng['panel']['used'] . ')',
'subdomains' => $lng['customer']['subdomains'],
'subdomains_used' => $lng['customer']['subdomains'] . ' (' . $lng['panel']['used'] . ')',
'emails' => $lng['customer']['emails'],
'emails_used' => $lng['customer']['emails'] . ' (' . $lng['panel']['used'] . ')',
'email_accounts' => $lng['customer']['accounts'],
'email_accounts_used' => $lng['customer']['accounts'] . ' (' . $lng['panel']['used'] . ')',
'email_forwarders' => $lng['customer']['forwarders'],
'email_forwarders_used' => $lng['customer']['forwarders'] . ' (' . $lng['panel']['used'] . ')',
'email_quota' => $lng['customer']['email_quota'],
'email_quota_used' => $lng['customer']['email_quota'] . ' (' . $lng['panel']['used'] . ')',
'deactivated' => $lng['admin']['deactivated'] 'deactivated' => $lng['admin']['deactivated']
); );
$paging = new paging($userinfo, $db, TABLE_PANEL_ADMINS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']); $paging = new paging($userinfo, $db, TABLE_PANEL_ADMINS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
@@ -68,30 +84,7 @@ if($page == 'admins'
$row['traffic'] = round($row['traffic'] / (1024 * 1024), $settings['panel']['decimal_places']); $row['traffic'] = round($row['traffic'] / (1024 * 1024), $settings['panel']['decimal_places']);
$row['diskspace_used'] = round($row['diskspace_used'] / 1024, $settings['panel']['decimal_places']); $row['diskspace_used'] = round($row['diskspace_used'] / 1024, $settings['panel']['decimal_places']);
$row['diskspace'] = round($row['diskspace'] / 1024, $settings['panel']['decimal_places']); $row['diskspace'] = round($row['diskspace'] / 1024, $settings['panel']['decimal_places']);
$row = str_replace_array('-1', 'UL', $row, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps subdomains tickets');
/**
* percent-values for progressbar
*/
//For Disk usage
if ($row['diskspace'] > 0) {
$disk_percent = round(($row['diskspace_used']*100)/$row['diskspace'], 2);
$disk_doublepercent = round($disk_percent*2, 2);
} else {
$disk_percent = 0;
$disk_doublepercent = 0;
}
//For Traffic usage
if ($row['traffic'] > 0) {
$traffic_percent = round(($row['traffic_used']*100)/$row['traffic'], 2);
$traffic_doublepercent = round($traffic_percent*2, 2);
} else {
$traffic_percent = 0;
$traffic_doublepercent = 0;
}
/* */
$row = str_replace_array('-1', 'UL', $row, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota email_autoresponder ftps subdomains tickets');
$row = htmlentities_array($row); $row = htmlentities_array($row);
eval("\$admins.=\"" . getTemplate("admins/admins_admin") . "\";"); eval("\$admins.=\"" . getTemplate("admins/admins_admin") . "\";");
$count++; $count++;
@@ -220,20 +213,6 @@ if($page == 'admins'
$email_quota = - 1; $email_quota = - 1;
} }
if($settings['autoresponder']['autoresponder_active'] == '1')
{
$email_autoresponder = intval_ressource($_POST['email_autoresponder']);
if(isset($_POST['email_autoresponder_ul']))
{
$email_autoresponder = - 1;
}
}
else
{
$email_autoresponder = 0;
}
$ftps = intval_ressource($_POST['ftps']); $ftps = intval_ressource($_POST['ftps']);
if(isset($_POST['ftps_ul'])) if(isset($_POST['ftps_ul']))
@@ -241,18 +220,12 @@ if($page == 'admins'
$ftps = - 1; $ftps = - 1;
} }
if($settings['ticket']['enabled'] == 1) $tickets = intval_ressource($_POST['tickets']);
{
$tickets = intval_ressource($_POST['tickets']);
if(isset($_POST['tickets_ul'])) if(isset($_POST['tickets_ul'])
{ && $settings['ticket']['enabled'] == '1')
$tickets = - 1;
}
}
else
{ {
$tickets = 0; $tickets = - 1;
} }
$mysqls = intval_ressource($_POST['mysqls']); $mysqls = intval_ressource($_POST['mysqls']);
@@ -271,7 +244,7 @@ if($page == 'admins'
$number_of_aps_packages = - 1; $number_of_aps_packages = - 1;
} }
$can_manage_aps_packages = isset($_POST['can_manage_aps_packages']) ? 1 : 0; $can_manage_aps_packages = intval($_POST['can_manage_aps_packages']);
} }
else else
{ {
@@ -279,21 +252,10 @@ if($page == 'admins'
$can_manage_aps_packages = 0; $can_manage_aps_packages = 0;
} }
$customers_see_all = 0; $customers_see_all = intval($_POST['customers_see_all']);
if(isset($_POST['customers_see_all'])) $domains_see_all = intval($_POST['domains_see_all']);
$customers_see_all = intval($_POST['customers_see_all']); $caneditphpsettings = intval($_POST['caneditphpsettings']);
$change_serversettings = intval($_POST['change_serversettings']);
$domains_see_all = 0;
if(isset($_POST['domains_see_all']))
$domains_see_all = intval($_POST['domains_see_all']);
$caneditphpsettings = 0;
if(isset($_POST['caneditphpsettings']))
$caneditphpsettings = intval($_POST['caneditphpsettings']);
$change_serversettings = 0;
if(isset($_POST['change_serversettings']))
$change_serversettings = intval($_POST['change_serversettings']);
$diskspace = intval_ressource($_POST['diskspace']); $diskspace = intval_ressource($_POST['diskspace']);
@@ -309,10 +271,6 @@ if($page == 'admins'
$traffic = - 1; $traffic = - 1;
} }
$tickets_see_all = 0;
if(isset($_POST['tickets_see_all']))
$tickets_see_all = intval($_POST['tickets_see_all']);
$diskspace = $diskspace * 1024; $diskspace = $diskspace * 1024;
$traffic = $traffic * 1024 * 1024; $traffic = $traffic * 1024 * 1024;
$ipaddress = intval_ressource($_POST['ipaddress']); $ipaddress = intval_ressource($_POST['ipaddress']);
@@ -380,43 +338,8 @@ if($page == 'admins'
$change_serversettings = '0'; $change_serversettings = '0';
} }
if ($tickets_see_all != '1') { $result = $db->query("INSERT INTO `" . TABLE_PANEL_ADMINS . "` (`loginname`, `password`, `name`, `email`, `def_language`, `change_serversettings`, `customers`, `customers_see_all`, `domains`, `domains_see_all`, `caneditphpsettings`, `diskspace`, `traffic`, `subdomains`, `emails`, `email_accounts`, `email_forwarders`, `email_quota`, `ftps`, `tickets`, `mysqls`, `ip`, `can_manage_aps_packages`, `aps_packages`)
$tickets_see_all = '0'; VALUES ('" . $db->escape($loginname) . "', '" . md5($password) . "', '" . $db->escape($name) . "', '" . $db->escape($email) . "','" . $db->escape($def_language) . "', '" . $db->escape($change_serversettings) . "', '" . $db->escape($customers) . "', '" . $db->escape($customers_see_all) . "', '" . $db->escape($domains) . "', '" . $db->escape($domains_see_all) . "', '" . (int)$caneditphpsettings . "', '" . $db->escape($diskspace) . "', '" . $db->escape($traffic) . "', '" . $db->escape($subdomains) . "', '" . $db->escape($emails) . "', '" . $db->escape($email_accounts) . "', '" . $db->escape($email_forwarders) . "', '" . $db->escape($email_quota) . "', '" . $db->escape($ftps) . "', '" . $db->escape($tickets) . "', '" . $db->escape($mysqls) . "', '" . (int)$ipaddress . "', " . (int)$can_manage_aps_packages . ", " . (int)$number_of_aps_packages . ")");
}
$_theme = $settings['panel']['default_theme'];
$result = $db->query("INSERT INTO
`" . TABLE_PANEL_ADMINS . "`
SET
`loginname` = '" . $db->escape($loginname) . "',
`password` = '" . md5($password) . "',
`name` = '" . $db->escape($name) . "',
`email` = '" . $db->escape($email) . "',
`def_language` = '" . $db->escape($def_language) . "',
`change_serversettings` = '" . $db->escape($change_serversettings) . "',
`customers` = '" . $db->escape($customers) . "',
`customers_see_all` = '" . $db->escape($customers_see_all) . "',
`domains` = '" . $db->escape($domains) . "',
`domains_see_all` = '" . $db->escape($domains_see_all) . "',
`caneditphpsettings` = '" . (int)$caneditphpsettings . "',
`diskspace` = '" . $db->escape($diskspace) . "',
`traffic` = '" . $db->escape($traffic) . "',
`subdomains` = '" . $db->escape($subdomains) . "',
`emails` = '" . $db->escape($emails) . "',
`email_accounts` = '" . $db->escape($email_accounts) . "',
`email_forwarders` = '" . $db->escape($email_forwarders) . "',
`email_quota` = '" . $db->escape($email_quota) . "',
`ftps` = '" . $db->escape($ftps) . "',
`tickets` = '" . $db->escape($tickets) . "',
`tickets_see_all` = '" . $db->escape($tickets_see_all) . "',
`mysqls` = '" . $db->escape($mysqls) . "',
`ip` = '" . (int)$ipaddress . "',
`can_manage_aps_packages` = '" . (int)$can_manage_aps_packages . "',
`aps_packages` = '" . (int)$number_of_aps_packages . "',
`email_autoresponder` = '" . $db->escape($email_autoresponder) . "',
`theme` = '".$db->escape($_theme)."';
");
$adminid = $db->insert_id(); $adminid = $db->insert_id();
$log->logAction(ADM_ACTION, LOG_INFO, "added admin '" . $loginname . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "added admin '" . $loginname . "'");
redirectTo($filename, Array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
@@ -458,25 +381,16 @@ if($page == 'admins'
$email_accounts_ul = makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $email_accounts_ul = makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$email_forwarders_ul = makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $email_forwarders_ul = makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$email_quota_ul = makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $email_quota_ul = makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$email_autoresponder_ul = makecheckbox('email_autoresponder_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$ftps_ul = makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $ftps_ul = makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$tickets_ul = makecheckbox('tickets_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $tickets_ul = makecheckbox('tickets_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$mysqls_ul = makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $mysqls_ul = makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
/*
$change_serversettings = makeyesno('change_serversettings', '1', '0', '0'); $change_serversettings = makeyesno('change_serversettings', '1', '0', '0');
$customers_see_all = makeyesno('customers_see_all', '1', '0', '0'); $customers_see_all = makeyesno('customers_see_all', '1', '0', '0');
$domains_see_all = makeyesno('domains_see_all', '1', '0', '0'); $domains_see_all = makeyesno('domains_see_all', '1', '0', '0');
$caneditphpsettings = makeyesno('caneditphpsettings', '1', '0', '0'); $caneditphpsettings = makeyesno('caneditphpsettings', '1', '0', '0');
$can_manage_aps_packages = makeyesno('can_manage_aps_packages', '1', '0', '0'); $can_manage_aps_packages = makeyesno('can_manage_aps_packages', '1', '0', '0');
*/
$number_of_aps_packages_ul = makecheckbox('number_of_aps_packages_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $number_of_aps_packages_ul = makecheckbox('number_of_aps_packages_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$admin_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/admin/formfield.admin_add.php';
$admin_add_form = htmlform::genHTMLForm($admin_add_data);
$title = $admin_add_data['admin_add']['title'];
$image = $admin_add_data['admin_add']['image'];
eval("echo \"" . getTemplate("admins/admins_add") . "\";"); eval("echo \"" . getTemplate("admins/admins_add") . "\";");
} }
} }
@@ -505,11 +419,9 @@ if($page == 'admins'
$email_accounts = $result['email_accounts']; $email_accounts = $result['email_accounts'];
$email_forwarders = $result['email_forwarders']; $email_forwarders = $result['email_forwarders'];
$email_quota = $result['email_quota']; $email_quota = $result['email_quota'];
$email_autoresponder = $result['email_autoresponder'];
$ftps = $result['ftps']; $ftps = $result['ftps'];
$tickets = $result['tickets']; $tickets = $result['tickets'];
$mysqls = $result['mysqls']; $mysqls = $result['mysqls'];
$tickets_see_all = $result['tickets_see_all'];
$customers_see_all = $result['customers_see_all']; $customers_see_all = $result['customers_see_all'];
$domains_see_all = $result['domains_see_all']; $domains_see_all = $result['domains_see_all'];
$caneditphpsettings = $result['caneditphpsettings']; $caneditphpsettings = $result['caneditphpsettings'];
@@ -524,113 +436,109 @@ if($page == 'admins'
{ {
$password = validate($_POST['admin_password'], 'new password'); $password = validate($_POST['admin_password'], 'new password');
$def_language = validate($_POST['def_language'], 'default language'); $def_language = validate($_POST['def_language'], 'default language');
$deactivated = isset($_POST['deactivated']) ? 1 : 0; $deactivated = intval($_POST['deactivated']);
$customers = intval_ressource($_POST['customers']); $customers = intval_ressource($_POST['customers']);
if (isset($_POST['customers_ul'])) {
$customers = -1; if(isset($_POST['customers_ul']))
{
$customers = - 1;
} }
$domains = intval_ressource($_POST['domains']); $domains = intval_ressource($_POST['domains']);
if (isset($_POST['domains_ul'])) {
$domains = -1; if(isset($_POST['domains_ul']))
{
$domains = - 1;
} }
$subdomains = intval_ressource($_POST['subdomains']); $subdomains = intval_ressource($_POST['subdomains']);
if (isset($_POST['subdomains_ul'])) {
$subdomains = -1; if(isset($_POST['subdomains_ul']))
{
$subdomains = - 1;
} }
$emails = intval_ressource($_POST['emails']); $emails = intval_ressource($_POST['emails']);
if (isset($_POST['emails_ul'])) {
$emails = -1; if(isset($_POST['emails_ul']))
{
$emails = - 1;
} }
$email_accounts = intval_ressource($_POST['email_accounts']); $email_accounts = intval_ressource($_POST['email_accounts']);
if (isset($_POST['email_accounts_ul'])) {
$email_accounts = -1; if(isset($_POST['email_accounts_ul']))
{
$email_accounts = - 1;
} }
$email_forwarders = intval_ressource($_POST['email_forwarders']); $email_forwarders = intval_ressource($_POST['email_forwarders']);
if (isset($_POST['email_forwarders_ul'])) {
$email_forwarders = -1; if(isset($_POST['email_forwarders_ul']))
{
$email_forwarders = - 1;
} }
if ($settings['system']['mail_quota_enabled'] == '1') { if($settings['system']['mail_quota_enabled'] == '1')
{
$email_quota = validate($_POST['email_quota'], 'email_quota', '/^\d+$/', 'vmailquotawrong', array('0', '')); $email_quota = validate($_POST['email_quota'], 'email_quota', '/^\d+$/', 'vmailquotawrong', array('0', ''));
if (isset($_POST['email_quota_ul'])) {
$email_quota = -1;
}
} else {
$email_quota = -1;
}
if ($settings['autoresponder']['autoresponder_active'] == '1') { if(isset($_POST['email_quota_ul']))
$email_autoresponder = intval_ressource($_POST['email_autoresponder']); {
if (isset($_POST['email_autoresponder_ul'])) { $email_quota = - 1;
$email_autoresponder = -1;
} }
} else { }
$email_autoresponder = 0; else
{
$email_quota = - 1;
} }
$ftps = intval_ressource($_POST['ftps']); $ftps = intval_ressource($_POST['ftps']);
if (isset($_POST['ftps_ul'])) {
$ftps = -1; if(isset($_POST['ftps_ul']))
{
$ftps = - 1;
} }
if ($settings['ticket']['enabled'] == 1) { $tickets = intval_ressource($_POST['tickets']);
$tickets = intval_ressource($_POST['tickets']);
if (isset($_POST['tickets_ul'])) { if(isset($_POST['tickets_ul']))
$tickets = -1; {
} $tickets = - 1;
} else {
$tickets = 0;
} }
$mysqls = intval_ressource($_POST['mysqls']); $mysqls = intval_ressource($_POST['mysqls']);
if (isset($_POST['mysqls_ul'])) {
if(isset($_POST['mysqls_ul']))
{
$mysqls = - 1; $mysqls = - 1;
} }
if ($settings['aps']['aps_active'] == '1') { $number_of_aps_packages = intval_ressource($_POST['number_of_aps_packages']);
$number_of_aps_packages = intval_ressource($_POST['number_of_aps_packages']);
if (isset($_POST['number_of_aps_packages_ul'])) { if(isset($_POST['number_of_aps_packages_ul']))
$number_of_aps_packages = -1; {
} $number_of_aps_packages = - 1;
$can_manage_aps_packages = isset($_POST['can_manage_aps_packages']) ? 1 : 0;
} else {
$number_of_aps_packages = 0;
} }
$customers_see_all = 0; $customers_see_all = intval($_POST['customers_see_all']);
if(isset($_POST['customers_see_all'])) $domains_see_all = intval($_POST['domains_see_all']);
$customers_see_all = intval($_POST['customers_see_all']); $caneditphpsettings = intval($_POST['caneditphpsettings']);
$change_serversettings = intval($_POST['change_serversettings']);
$domains_see_all = 0; $can_manage_aps_packages = intval($_POST['can_manage_aps_packages']);
if(isset($_POST['domains_see_all']))
$domains_see_all = intval($_POST['domains_see_all']);
$caneditphpsettings = 0;
if(isset($_POST['caneditphpsettings']))
$caneditphpsettings = intval($_POST['caneditphpsettings']);
$change_serversettings = 0;
if(isset($_POST['change_serversettings']))
$change_serversettings = isset($_POST['change_serversettings']) ? 1 : 0;
$tickets_see_all = 0;
if (isset($_POST['tickets_see_all']))
$tickets_see_all = intval($_POST['tickets_see_all']);
$diskspace = intval($_POST['diskspace']); $diskspace = intval($_POST['diskspace']);
if (isset($_POST['diskspace_ul'])) {
$diskspace = -1; if(isset($_POST['diskspace_ul']))
{
$diskspace = - 1;
} }
$traffic = doubleval_ressource($_POST['traffic']); $traffic = doubleval_ressource($_POST['traffic']);
if (isset($_POST['traffic_ul'])) {
$traffic = -1; if(isset($_POST['traffic_ul']))
{
$traffic = - 1;
} }
$diskspace = $diskspace * 1024; $diskspace = $diskspace * 1024;
@@ -687,88 +595,7 @@ if($page == 'admins'
$change_serversettings = '0'; $change_serversettings = '0';
} }
if ($tickets_see_all != '1') { $db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `name`='" . $db->escape($name) . "', `email`='" . $db->escape($email) . "', `def_language`='" . $db->escape($def_language) . "', `change_serversettings` = '" . $db->escape($change_serversettings) . "', `customers` = '" . $db->escape($customers) . "', `customers_see_all` = '" . $db->escape($customers_see_all) . "', `domains` = '" . $db->escape($domains) . "', `domains_see_all` = '" . $db->escape($domains_see_all) . "', `caneditphpsettings` = '" . (int)$caneditphpsettings . "', `password` = '" . $password . "', `diskspace`='" . $db->escape($diskspace) . "', `traffic`='" . $db->escape($traffic) . "', `subdomains`='" . $db->escape($subdomains) . "', `emails`='" . $db->escape($emails) . "', `email_accounts` = '" . $db->escape($email_accounts) . "', `email_forwarders`='" . $db->escape($email_forwarders) . "', `email_quota`='" . $db->escape($email_quota) . "', `ftps`='" . $db->escape($ftps) . "', `tickets`='" . $db->escape($tickets) . "', `mysqls`='" . $db->escape($mysqls) . "', `ip`='" . (int)$ipaddress . "', `deactivated`='" . $db->escape($deactivated) . "', `can_manage_aps_packages`=" . (int)$can_manage_aps_packages . ", `aps_packages`=" . (int)$number_of_aps_packages . " WHERE `adminid`='" . $db->escape($id) . "'");
$tickets_see_all = '0';
}
// check if a resource was set to something lower
// than actually used by the admin/reseller
$res_warning = "";
if ($customers != $result['customers'] && $customers < $result['customers_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'customers');
}
if ($domains != $result['domains'] && $domains < $result['domains_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'domains');
}
if ($diskspace != $result['diskspace'] && ($diskspace / 1024) != -1 && $diskspace < $result['diskspace_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'diskspace');
}
if ($traffic != $result['traffic'] && ($traffic / 1024 / 1024) != -1 && $traffic < $result['traffic_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'traffic');
}
if ($emails != $result['emails'] && $emails < $result['emails_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'emails');
}
if ($email_accounts != $result['email_accounts'] && $email_accounts < $result['email_accounts_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'email accounts');
}
if ($email_forwarders != $result['email_forwarders'] && $email_forwarders < $result['email_forwarders_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'email forwarders');
}
if ($email_quota != $result['email_quota'] && $email_quota < $result['email_quota_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'email quota');
}
if ($email_autoresponder != $result['email_autoresponder'] && $email_autoresponder < $result['email_autoresponder_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'email autoresponder');
}
if ($ftps != $result['ftps'] && $ftps < $result['ftps_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'ftps');
}
if ($tickets != $result['tickets'] && $tickets < $result['tickets_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'tickets');
}
if ($mysqls != $result['mysqls'] && $mysqls < $result['mysqls_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'mysqls');
}
if ($number_of_aps_packages != $result['aps_packages'] && $number_of_aps_packages < $result['aps_packages_used']) {
$res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'aps packages');
}
if ($res_warning != "") {
$link = '';
$error = $res_warning;
eval("echo \"" . getTemplate('misc/error', '1') . "\";");
exit;
}
$db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET
`name`='" . $db->escape($name) . "',
`email`='" . $db->escape($email) . "',
`def_language`='" . $db->escape($def_language) . "',
`change_serversettings` = '" . $db->escape($change_serversettings) . "',
`customers` = '" . $db->escape($customers) . "',
`customers_see_all` = '" . $db->escape($customers_see_all) . "',
`domains` = '" . $db->escape($domains) . "',
`domains_see_all` = '" . $db->escape($domains_see_all) . "',
`caneditphpsettings` = '" . (int)$caneditphpsettings . "',
`password` = '" . $password . "',
`diskspace`='" . $db->escape($diskspace) . "',
`traffic`='" . $db->escape($traffic) . "',
`subdomains`='" . $db->escape($subdomains) . "',
`emails`='" . $db->escape($emails) . "',
`email_accounts` = '" . $db->escape($email_accounts) . "',
`email_forwarders`='" . $db->escape($email_forwarders) . "',
`email_quota`='" . $db->escape($email_quota) . "',
`email_autoresponder`='" . $db->escape($email_autoresponder) . "',
`ftps`='" . $db->escape($ftps) . "',
`tickets`='" . $db->escape($tickets) . "',
`tickets_see_all`='".$db->escape($tickets_see_all) . "',
`mysqls`='" . $db->escape($mysqls) . "',
`ip`='" . (int)$ipaddress . "',
`deactivated`='" . $db->escape($deactivated) . "',
`can_manage_aps_packages`=" . (int)$can_manage_aps_packages . ",
`aps_packages`=" . (int)$number_of_aps_packages . "
WHERE `adminid`='" . $db->escape($id) . "'");
$log->logAction(ADM_ACTION, LOG_INFO, "edited admin '#" . $id . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "edited admin '#" . $id . "'");
$redirect_props = Array( $redirect_props = Array(
'page' => $page, 'page' => $page,
@@ -846,13 +673,6 @@ if($page == 'admins'
$result['email_quota'] = ''; $result['email_quota'] = '';
} }
$email_autoresponder_ul = makecheckbox('email_autoresponder_ul', $lng['customer']['unlimited'], '-1', false, $result['email_autoresponder'], true, true);
if($result['email_autoresponder'] == '-1')
{
$result['email_autoresponder'] = '';
}
$ftps_ul = makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, $result['ftps'], true, true); $ftps_ul = makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, $result['ftps'], true, true);
if($result['ftps'] == '-1') if($result['ftps'] == '-1')
@@ -906,22 +726,14 @@ if($page == 'admins'
} }
} }
/*
$change_serversettings = makeyesno('change_serversettings', '1', '0', $result['change_serversettings']); $change_serversettings = makeyesno('change_serversettings', '1', '0', $result['change_serversettings']);
$customers_see_all = makeyesno('customers_see_all', '1', '0', $result['customers_see_all']); $customers_see_all = makeyesno('customers_see_all', '1', '0', $result['customers_see_all']);
$domains_see_all = makeyesno('domains_see_all', '1', '0', $result['domains_see_all']); $domains_see_all = makeyesno('domains_see_all', '1', '0', $result['domains_see_all']);
$caneditphpsettings = makeyesno('caneditphpsettings', '1', '0', $result['caneditphpsettings']); $caneditphpsettings = makeyesno('caneditphpsettings', '1', '0', $result['caneditphpsettings']);
$deactivated = makeyesno('deactivated', '1', '0', $result['deactivated']); $deactivated = makeyesno('deactivated', '1', '0', $result['deactivated']);
$can_manage_aps_packages = makeyesno('can_manage_aps_packages', '1', '0', $result['can_manage_aps_packages']); $can_manage_aps_packages = makeyesno('can_manage_aps_packages', '1', '0', $result['can_manage_aps_packages']);
*/
$result = htmlentities_array($result); $result = htmlentities_array($result);
$admin_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/admin/formfield.admin_edit.php';
$admin_edit_form = htmlform::genHTMLForm($admin_edit_data);
$title = $admin_edit_data['admin_edit']['title'];
$image = $admin_edit_data['admin_edit']['image'];
eval("echo \"" . getTemplate("admins/admins_edit") . "\";"); eval("echo \"" . getTemplate("admins/admins_edit") . "\";");
} }
} }

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
// Required code // Required code

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
@@ -96,11 +96,8 @@ if($userinfo['change_serversettings'] == '1')
'<VIRTUAL_UID_MAPS>' => $settings['system']['vmail_uid'], '<VIRTUAL_UID_MAPS>' => $settings['system']['vmail_uid'],
'<VIRTUAL_GID_MAPS>' => $settings['system']['vmail_gid'], '<VIRTUAL_GID_MAPS>' => $settings['system']['vmail_gid'],
'<SSLPROTOCOLS>' => ($settings['system']['use_ssl'] == '1') ? 'imaps pop3s' : '', '<SSLPROTOCOLS>' => ($settings['system']['use_ssl'] == '1') ? 'imaps pop3s' : '',
'<CUSTOMER_TMP>' => ($settings['system']['mod_fcgid_tmpdir'] != '') ? makeCorrectDir($settings['system']['mod_fcgid_tmpdir']) : '/tmp/', '<REALTIME_PORT>' => $settings['system']['realtime_port'],
'<BASE_PATH>' => makeCorrectDir(dirname(__FILE__)), '<CUSTOMER_TMP>' => ($settings['system']['mod_fcgid_tmpdir'] != '') ? makeCorrectDir($settings['system']['mod_fcgid_tmpdir']) : '/tmp/'
'<BIND_CONFIG_PATH>' => makeCorrectDir($settings['system']['bindconf_directory']),
'<WEBSERVER_RELOAD_CMD>' => $settings['system']['apachereload_command'],
'<CUSTOMER_LOGS>' => makeCorrectDir($settings['system']['logfiles_directory'])
); );
$files = ''; $files = '';
$configpage = ''; $configpage = '';

View File

@@ -12,21 +12,28 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require_once('./lib/init.php');
if (isset($_POST['id'])) { require_once("./lib/init.php");
if(isset($_POST['id']))
{
$id = intval($_POST['id']); $id = intval($_POST['id']);
} elseif(isset($_GET['id'])) { }
elseif(isset($_GET['id']))
{
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
if ($page == 'cronjobs' || $page == 'overview') { if($page == 'cronjobs'
if ($action == '') { || $page == 'overview')
$log->logAction(ADM_ACTION, LOG_NOTICE, 'viewed admin_cronjobs'); {
if($action == '')
{
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_cronjobs");
$fields = array( $fields = array(
'c.lastrun' => $lng['cron']['lastrun'], 'c.lastrun' => $lng['cron']['lastrun'],
@@ -49,41 +56,61 @@ if ($page == 'cronjobs' || $page == 'overview') {
$i = 0; $i = 0;
$count = 0; $count = 0;
while ($row = $db->fetch_array($result)) { while($row = $db->fetch_array($result))
if ($paging->checkDisplay($i)) { {
if($paging->checkDisplay($i))
{
$row = htmlentities_array($row); $row = htmlentities_array($row);
$row['lastrun'] = date('d.m.Y H:i', $row['lastrun']); $row['lastrun'] = date('d.m.Y H:i', $row['lastrun']);
$row['isactive'] = ((int)$row['isactive'] == 1) ? $lng['panel']['yes'] : $lng['panel']['no'];
if((int)$row['isactive'] == 1)
{
$row['isactive'] = $lng['panel']['yes'];
}
else
{
$row['isactive'] = $lng['panel']['no'];
}
$description = $lng['crondesc'][$row['desc_lng_key']]; $description = $lng['crondesc'][$row['desc_lng_key']];
eval("\$crons.=\"" . getTemplate('cronjobs/cronjobs_cronjob') . "\";"); eval("\$crons.=\"" . getTemplate("cronjobs/cronjobs_cronjob") . "\";");
$count++; $count++;
} }
$i++; $i++;
} }
eval("echo \"" . getTemplate('cronjobs/cronjobs') . "\";"); eval("echo \"" . getTemplate("cronjobs/cronjobs") . "\";");
} elseif ($action == 'new') { }
elseif($action == 'new')
{
/* /*
* @TODO later * @TODO later
*/ */
} elseif ($action == 'edit' && $id != 0) { }
elseif($action == 'edit'
&& $id != 0)
{
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_CRONRUNS . "` WHERE `id`='" . (int)$id . "'"); $result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_CRONRUNS . "` WHERE `id`='" . (int)$id . "'");
if ($result['cronfile'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if ($result['cronfile'] != '')
$isactive = isset($_POST['isactive']) ? 1 : 0; {
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$isactive = intval($_POST['isactive']);
$interval_value = validate($_POST['interval_value'], 'interval_value', '/^([0-9]+)$/Di', 'stringisempty'); $interval_value = validate($_POST['interval_value'], 'interval_value', '/^([0-9]+)$/Di', 'stringisempty');
$interval_interval = validate($_POST['interval_interval'], 'interval_interval'); $interval_interval = validate($_POST['interval_interval'], 'interval_interval');
if ($isactive != 1) { if($isactive != 1)
{
$isactive = 0; $isactive = 0;
} }
$interval = $interval_value . ' ' . strtoupper($interval_interval); $interval = $interval_value.' '.strtoupper($interval_interval);
$db->query("UPDATE `" . TABLE_PANEL_CRONRUNS . "` $db->query("UPDATE `" . TABLE_PANEL_CRONRUNS . "`
SET `isactive` = '".(int)$isactive."', SET `isactive` = '".(int)$isactive."',
@@ -91,39 +118,40 @@ if ($page == 'cronjobs' || $page == 'overview') {
WHERE `id` = '" . (int)$id . "'"); WHERE `id` = '" . (int)$id . "'");
redirectTo($filename, Array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} else { }
//$isactive = makeyesno('isactive', '1', '0', $result['isactive']); else
{
$isactive = makeyesno('isactive', '1', '0', $result['isactive']);
// interval // interval
$interval_nfo = explode(' ', $result['interval']); $interval_nfo = explode(' ', $result['interval']);
$interval_value = $interval_nfo[0]; $interval_value = $interval_nfo[0];
$interval_interval = ''; $interval_interval = '';
$interval_interval .= makeoption($lng['cronmgmt']['seconds'], 'SECOND', $interval_nfo[1]); $interval_interval.= makeoption($lng['cronmgmt']['seconds'], 'SECOND', $interval_nfo[1]);
$interval_interval .= makeoption($lng['cronmgmt']['minutes'], 'MINUTE', $interval_nfo[1]); $interval_interval.= makeoption($lng['cronmgmt']['minutes'], 'MINUTE', $interval_nfo[1]);
$interval_interval .= makeoption($lng['cronmgmt']['hours'], 'HOUR', $interval_nfo[1]); $interval_interval.= makeoption($lng['cronmgmt']['hours'], 'HOUR', $interval_nfo[1]);
$interval_interval .= makeoption($lng['cronmgmt']['days'], 'DAY', $interval_nfo[1]); $interval_interval.= makeoption($lng['cronmgmt']['days'], 'DAY', $interval_nfo[1]);
$interval_interval .= makeoption($lng['cronmgmt']['weeks'], 'WEEK', $interval_nfo[1]); $interval_interval.= makeoption($lng['cronmgmt']['weeks'], 'WEEK', $interval_nfo[1]);
$interval_interval .= makeoption($lng['cronmgmt']['months'], 'MONTH', $interval_nfo[1]); $interval_interval.= makeoption($lng['cronmgmt']['months'], 'MONTH', $interval_nfo[1]);
// end of interval // end of interval
$change_cronfile = false; $change_cronfile = false;
if (substr($result['module'], 0, strpos($result['module'], '/')) != 'froxlor') { if (substr($result['module'], 0, strpos($result['module'], '/')) != 'froxlor')
{
$change_cronfile = true; $change_cronfile = true;
} }
$cronjobs_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/cronjobs/formfield.cronjobs_edit.php'; eval("echo \"" . getTemplate("cronjobs/cronjob_edit") . "\";");
$cronjobs_edit_form = htmlform::genHTMLForm($cronjobs_edit_data);
$title = $cronjobs_edit_data['cronjobs_edit']['title'];
$image = $cronjobs_edit_data['cronjobs_edit']['image'];
eval("echo \"" . getTemplate('cronjobs/cronjob_edit') . "\";");
} }
} }
} }
elseif ($action == 'delete' && $id != 0) { elseif($action == 'delete'
&& $id != 0)
{
/* /*
* @TODO later * @TODO later
*/ */
} }
} }
?>

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
@@ -40,30 +40,45 @@ if($page == 'customers'
{ {
if($action == '') if($action == '')
{ {
// clear request data
unset($_SESSION['requestData']);
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_customers"); $log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_customers");
$fields = array( $fields = array(
'c.loginname' => $lng['login']['username'], 'c.loginname' => $lng['login']['username'],
'a.loginname' => $lng['admin']['admin'], 'a.loginname' => $lng['admin']['admin'],
'c.name' => $lng['customer']['name'], 'c.name' => $lng['customer']['name'],
'c.email' => $lng['customer']['email'],
'c.firstname' => $lng['customer']['firstname'], 'c.firstname' => $lng['customer']['firstname'],
'c.company' => $lng['customer']['company'], 'c.company' => $lng['customer']['company'],
'c.diskspace' => $lng['customer']['diskspace'], 'c.diskspace' => $lng['customer']['diskspace'],
'c.diskspace_used' => $lng['customer']['diskspace'] . ' (' . $lng['panel']['used'] . ')', 'c.diskspace_used' => $lng['customer']['diskspace'] . ' (' . $lng['panel']['used'] . ')',
'c.traffic' => $lng['customer']['traffic'], 'c.traffic' => $lng['customer']['traffic'],
'c.traffic_used' => $lng['customer']['traffic'] . ' (' . $lng['panel']['used'] . ')' 'c.traffic_used' => $lng['customer']['traffic'] . ' (' . $lng['panel']['used'] . ')',
'c.mysqls' => $lng['customer']['mysqls'],
'c.mysqls_used' => $lng['customer']['mysqls'] . ' (' . $lng['panel']['used'] . ')',
'c.ftps' => $lng['customer']['ftps'],
'c.ftps_used' => $lng['customer']['ftps'] . ' (' . $lng['panel']['used'] . ')',
'c.subdomains' => $lng['customer']['subdomains'],
'c.subdomains_used' => $lng['customer']['subdomains'] . ' (' . $lng['panel']['used'] . ')',
'c.emails' => $lng['customer']['emails'],
'c.emails_used' => $lng['customer']['emails'] . ' (' . $lng['panel']['used'] . ')',
'c.email_accounts' => $lng['customer']['accounts'],
'c.email_accounts_used' => $lng['customer']['accounts'] . ' (' . $lng['panel']['used'] . ')',
'c.email_forwarders' => $lng['customer']['forwarders'],
'c.email_forwarders_used' => $lng['customer']['forwarders'] . ' (' . $lng['panel']['used'] . ')',
'c.email_quota' => $lng['customer']['email_quota'],
'c.email_quota_used' => $lng['customer']['email_quota'] . ' (' . $lng['panel']['used'] . ')',
'c.deactivated' => $lng['admin']['deactivated'],
'c.lastlogin_succ' => $lng['admin']['lastlogin_succ'],
'c.phpenabled' => $lng['admin']['phpenabled']
); );
if ($settings['system']['backup_enabled'] == '1') { if($settings['ticket']['enabled'] == 1)
$field['c.backup_allowed'] = $lng['backup_allowed']; {
$fields['c.tickets'] = $lng['customer']['tickets'];
$fields['c.tickets_used'] = $lng['customer']['tickets'] . ' (' . $lng['panel']['used'] . ')';
} }
$paging = new paging($userinfo, $db, TABLE_PANEL_CUSTOMERS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']); $paging = new paging($userinfo, $db, TABLE_PANEL_CUSTOMERS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$customers = ''; $customers = '';
$result = $db->query("SELECT `c`.*, `a`.`loginname` AS `adminname` " . "FROM `" . TABLE_PANEL_CUSTOMERS . "` `c`, `" . TABLE_PANEL_ADMINS . "` `a` " . "WHERE " . ($userinfo['customers_see_all'] ? '' : " `c`.`adminid` = '" . (int)$userinfo['adminid'] . "' AND ") . "`c`.`adminid`=`a`.`adminid` " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy($settings['panel']['natsorting']) . " " . $paging->getSqlLimit()); $result = $db->query("SELECT `c`.*, `a`.`loginname` AS `adminname` " . "FROM `" . TABLE_PANEL_CUSTOMERS . "` `c`, `" . TABLE_PANEL_ADMINS . "` `a` " . "WHERE " . ($userinfo['customers_see_all'] ? '' : " `c`.`adminid` = '" . (int)$userinfo['adminid'] . "' AND ") . "`c`.`adminid`=`a`.`adminid` " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
$paging->setEntries($db->num_rows($result)); $paging->setEntries($db->num_rows($result));
$sortcode = $paging->getHtmlSortCode($lng, true); $sortcode = $paging->getHtmlSortCode($lng, true);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
@@ -84,34 +99,14 @@ if($page == 'customers'
$row['diskspace'] = round($row['diskspace'] / 1024, $settings['panel']['decimal_places']); $row['diskspace'] = round($row['diskspace'] / 1024, $settings['panel']['decimal_places']);
$last_login = ((int)$row['lastlogin_succ'] == 0) ? $lng['panel']['neverloggedin'] : date('d.m.Y', $row['lastlogin_succ']); $last_login = ((int)$row['lastlogin_succ'] == 0) ? $lng['panel']['neverloggedin'] : date('d.m.Y', $row['lastlogin_succ']);
/** $column_style = '';
* percent-values for progressbar
*/
//For Disk usage
if ($row['diskspace'] > 0) {
$disk_percent = round(($row['diskspace_used']*100)/$row['diskspace'], 2);
$disk_doublepercent = round($disk_percent*2, 2);
} else {
$disk_percent = 0;
$disk_doublepercent = 0;
}
if ($row['traffic'] > 0) {
$traffic_percent = round(($row['traffic_used']*100)/$row['traffic'], 2);
$traffic_doublepercent = round($traffic_percent*2, 2);
} else {
$traffic_percent = 0;
$traffic_doublepercent = 0;
}
$islocked = 0;
if($row['loginfail_count'] >= $settings['login']['maxloginattempts'] if($row['loginfail_count'] >= $settings['login']['maxloginattempts']
&& $row['lastlogin_fail'] > (time() - $settings['login']['deactivatetime']) && $row['lastlogin_fail'] > (time() - $settings['login']['deactivatetime'])
) { ) {
$islocked = 1; $column_style = ' style="background-color: #f99122;"';
} }
$row = str_replace_array('-1', 'UL', $row, 'diskspace traffic mysqls emails email_accounts email_forwarders ftps tickets subdomains email_autoresponder'); $row = str_replace_array('-1', 'UL', $row, 'diskspace traffic mysqls emails email_accounts email_forwarders ftps tickets subdomains');
$row = htmlentities_array($row); $row = htmlentities_array($row);
eval("\$customers.=\"" . getTemplate("customers/customers_customer") . "\";"); eval("\$customers.=\"" . getTemplate("customers/customers_customer") . "\";");
$count++; $count++;
@@ -131,45 +126,17 @@ if($page == 'customers'
if($destination_user != '') if($destination_user != '')
{ {
if ($result['deactivated'] == '1') {
standard_error("usercurrentlydeactivated", $destination_user);
}
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid`='" . (int)$userinfo['userid'] . "' AND `hash`='" . $db->escape($s) . "'"); $result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid`='" . (int)$userinfo['userid'] . "' AND `hash`='" . $db->escape($s) . "'");
$s = md5(uniqid(microtime(), 1)); $s = md5(uniqid(microtime(), 1));
$db->query("INSERT INTO `" . TABLE_PANEL_SESSIONS . "` (`hash`, `userid`, `ipaddress`, `useragent`, `lastactivity`, `language`, `adminsession`) VALUES ('" . $db->escape($s) . "', '" . (int)$id . "', '" . $db->escape($result['ipaddress']) . "', '" . $db->escape($result['useragent']) . "', '" . time() . "', '" . $db->escape($result['language']) . "', '0')"); $db->query("INSERT INTO `" . TABLE_PANEL_SESSIONS . "` (`hash`, `userid`, `ipaddress`, `useragent`, `lastactivity`, `language`, `adminsession`) VALUES ('" . $db->escape($s) . "', '" . (int)$id . "', '" . $db->escape($result['ipaddress']) . "', '" . $db->escape($result['useragent']) . "', '" . time() . "', '" . $db->escape($result['language']) . "', '0')");
$log->logAction(ADM_ACTION, LOG_INFO, "switched user and is now '" . $destination_user . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "switched user and is now '" . $destination_user . "'");
redirectTo('customer_index.php', Array('s' => $s), true); redirectTo('customer_index.php', Array('s' => $s));
} }
else else
{ {
redirectTo('index.php', Array('action' => 'login')); redirectTo('index.php', Array('action' => 'login'));
} }
} }
elseif($action == 'unlock'
&& $id != 0)
{
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `customerid`='" . (int)$id . "' " . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = '" . $db->escape($userinfo['adminid']) . "' "));
if($result['loginname'] != '')
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$result = $db->query("UPDATE
`" . TABLE_PANEL_CUSTOMERS . "`
SET
`loginfail_count` = '0'
WHERE
`customerid`= '" . (int)$id . "'"
);
redirectTo($filename, Array('page' => $page, 's' => $s));
}
else
{
ask_yesno('customer_reallyunlock', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['loginname']);
}
}
}
elseif($action == 'delete' elseif($action == 'delete'
&& $id != 0) && $id != 0)
{ {
@@ -182,6 +149,7 @@ if($page == 'customers'
{ {
$databases = $db->query("SELECT * FROM " . TABLE_PANEL_DATABASES . " WHERE customerid='" . (int)$id . "' ORDER BY `dbserver`"); $databases = $db->query("SELECT * FROM " . TABLE_PANEL_DATABASES . " WHERE customerid='" . (int)$id . "' ORDER BY `dbserver`");
$db_root = new db($sql_root[0]['host'], $sql_root[0]['user'], $sql_root[0]['password'], ''); $db_root = new db($sql_root[0]['host'], $sql_root[0]['user'], $sql_root[0]['password'], '');
unset($db_root->password);
$last_dbserver = 0; $last_dbserver = 0;
while($row_database = $db->fetch_array($databases)) while($row_database = $db->fetch_array($databases))
@@ -191,20 +159,16 @@ if($page == 'customers'
$db_root->query('FLUSH PRIVILEGES;'); $db_root->query('FLUSH PRIVILEGES;');
$db_root->close(); $db_root->close();
$db_root = new db($sql_root[$row_database['dbserver']]['host'], $sql_root[$row_database['dbserver']]['user'], $sql_root[$row_database['dbserver']]['password'], ''); $db_root = new db($sql_root[$row_database['dbserver']]['host'], $sql_root[$row_database['dbserver']]['user'], $sql_root[$row_database['dbserver']]['password'], '');
unset($db_root->password);
$last_dbserver = $row_database['dbserver']; $last_dbserver = $row_database['dbserver'];
} }
if(mysql_get_server_info() < '5.0.2') { foreach(array_unique(explode(',', $settings['system']['mysql_access_host'])) as $mysql_access_host)
// failsafe if user has been deleted manually (requires MySQL 4.1.2+)
$db_root->query('REVOKE ALL PRIVILEGES, GRANT OPTION FROM \'' . $db_root->escape($row_database['databasename']) .'\'',false,true);
}
$host_res = $db_root->query("SELECT `Host` FROM `mysql`.`user` WHERE `User`='" . $db_root->escape($row_database['databasename']) . "'");
while($host = $db_root->fetch_array($host_res))
{ {
// as of MySQL 5.0.2 this also revokes privileges. (requires MySQL 4.1.2+) $mysql_access_host = trim($mysql_access_host);
$db_root->query('DROP USER \'' . $db_root->escape($row_database['databasename']). '\'@\'' . $db_root->escape($host['Host']) . '\'', false, true); $db_root->query('REVOKE ALL PRIVILEGES ON * . * FROM `' . $db_root->escape($row_database['databasename']) . '`@`' . $db_root->escape($mysql_access_host) . '`');
$db_root->query('REVOKE ALL PRIVILEGES ON `' . str_replace('_', '\_', $db_root->escape($row_database['databasename'])) . '` . * FROM `' . $db_root->escape($row_database['databasename']) . '`@`' . $db_root->escape($mysql_access_host) . '`');
$db_root->query('DELETE FROM `mysql`.`user` WHERE `User` = "' . $db_root->escape($row_database['databasename']) . '" AND `Host` = "' . $db_root->escape($mysql_access_host) . '"');
} }
$db_root->query('DROP DATABASE IF EXISTS `' . $db_root->escape($row_database['databasename']) . '`'); $db_root->query('DROP DATABASE IF EXISTS `' . $db_root->escape($row_database['databasename']) . '`');
@@ -217,7 +181,6 @@ if($page == 'customers'
$db->query("DELETE FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$id . "'"); $db->query("DELETE FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$id . "'");
$domains_deleted = $db->affected_rows(); $domains_deleted = $db->affected_rows();
$db->query("DELETE FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$id . "'"); $db->query("DELETE FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$id . "'");
$db->query("DELETE FROM `" . TABLE_PANEL_HTACCESS . "` WHERE `customerid`='" . (int)$id . "'");
$db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid`='" . (int)$id . "' AND `adminsession` = '0'"); $db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid`='" . (int)$id . "' AND `adminsession` = '0'");
$db->query("DELETE FROM `" . TABLE_PANEL_TRAFFIC . "` WHERE `customerid`='" . (int)$id . "'"); $db->query("DELETE FROM `" . TABLE_PANEL_TRAFFIC . "` WHERE `customerid`='" . (int)$id . "'");
$db->query("DELETE FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid`='" . (int)$id . "'"); $db->query("DELETE FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid`='" . (int)$id . "'");
@@ -231,10 +194,6 @@ if($page == 'customers'
$db->query("DELETE FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$id . "'"); $db->query("DELETE FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$id . "'");
$db->query("DELETE FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid`='" . (int)$id . "'"); $db->query("DELETE FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid`='" . (int)$id . "'");
// Delete all waiting "create user" -tasks for this user, #276
// Note: the WHERE selects part of a serialized array, but it should be safe this way
$db->query("DELETE FROM `" . TABLE_PANEL_TASKS . "` WHERE `type` = '2' AND `data` LIKE '%:\"" . $db->escape($result['loginname']) . "\";%';");
// remove everything APS-related, #216 // remove everything APS-related, #216
$apsresult = $db->query("SELECT `ID` FROM `".TABLE_APS_INSTANCES."` WHERE `CustomerID`='".(int)$id."'"); $apsresult = $db->query("SELECT `ID` FROM `".TABLE_APS_INSTANCES."` WHERE `CustomerID`='".(int)$id."'");
while($apsrow = $db->fetch_array($apsresult)) while($apsrow = $db->fetch_array($apsresult))
@@ -278,11 +237,6 @@ if($page == 'customers'
$admin_update_query.= ", `email_quota_used` = `email_quota_used` - 0" . (int)$result['email_quota']; $admin_update_query.= ", `email_quota_used` = `email_quota_used` - 0" . (int)$result['email_quota'];
} }
if($result['email_autoresponder'] != '-1')
{
$admin_update_query.= ", `email_autoresponder_used` = `email_autoresponder_used` - 0" . (int)$result['email_autoresponder'];
}
if($result['subdomains'] != '-1') if($result['subdomains'] != '-1')
{ {
$admin_update_query.= ", `subdomains_used` = `subdomains_used` - 0" . (int)$result['subdomains']; $admin_update_query.= ", `subdomains_used` = `subdomains_used` - 0" . (int)$result['subdomains'];
@@ -300,7 +254,7 @@ if($page == 'customers'
if($result['aps_packages'] != '-1') if($result['aps_packages'] != '-1')
{ {
$admin_update_query.= ", `aps_packages_used` = `aps_packages_used` - 0" . (int)$result['aps_packages']; $admin_update_query.= ", `aps_packages` = `aps_packages` - 0" . (int)$result['aps_packages'];
} }
if(($result['diskspace'] / 1024) != '-1') if(($result['diskspace'] / 1024) != '-1')
@@ -312,19 +266,14 @@ if($page == 'customers'
$db->query($admin_update_query); $db->query($admin_update_query);
$log->logAction(ADM_ACTION, LOG_INFO, "deleted user '" . $result['loginname'] . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "deleted user '" . $result['loginname'] . "'");
inserttask('1'); inserttask('1');
// Using nameserver, insert a task which rebuilds the server config
inserttask('4'); inserttask('4');
if (isset($_POST['delete_userfiles']) if(isset($_POST['delete_userfiles'])
&& (int)$_POST['delete_userfiles'] == 1 && (int)$_POST['delete_userfiles'] == 1)
) { {
inserttask('6', $result['loginname']); inserttask('6', $result['loginname']);
} }
// Using filesystem - quota, insert a task which cleans the filesystem - quota
inserttask('10');
/* /*
* move old tickets to archive * move old tickets to archive
*/ */
@@ -372,7 +321,6 @@ if($page == 'customers'
$customernumber = validate($_POST['customernumber'], 'customer number', '/^[A-Za-z0-9 \-]*$/Di'); $customernumber = validate($_POST['customernumber'], 'customer number', '/^[A-Za-z0-9 \-]*$/Di');
$def_language = validate($_POST['def_language'], 'default language'); $def_language = validate($_POST['def_language'], 'default language');
$diskspace = intval_ressource($_POST['diskspace']); $diskspace = intval_ressource($_POST['diskspace']);
$gender = intval_ressource($_POST['gender']);
if(isset($_POST['diskspace_ul'])) if(isset($_POST['diskspace_ul']))
{ {
@@ -428,31 +376,9 @@ if($page == 'customers'
$email_quota = - 1; $email_quota = - 1;
} }
if($settings['autoresponder']['autoresponder_active'] == '1') $email_imap = intval_ressource($_POST['email_imap']);
{ $email_pop3 = intval_ressource($_POST['email_pop3']);
$email_autoresponder = intval_ressource($_POST['email_autoresponder']); $ftps = intval_ressource($_POST['ftps']);
if(isset($_POST['email_autoresponder_ul']))
{
$email_autoresponder = - 1;
}
}
else
{
$email_autoresponder = 0;
}
$email_imap = 0;
if(isset($_POST['email_imap']))
$email_imap = intval_ressource($_POST['email_imap']);
$email_pop3 = 0;
if(isset($_POST['email_pop3']))
$email_pop3 = intval_ressource($_POST['email_pop3']);
$ftps = 0;
if(isset($_POST['ftps']))
$ftps = intval_ressource($_POST['ftps']);
if(isset($_POST['ftps_ul'])) if(isset($_POST['ftps_ul']))
{ {
@@ -488,47 +414,11 @@ if($page == 'customers'
$number_of_aps_packages = 0; $number_of_aps_packages = 0;
} }
$createstdsubdomain = 0; $createstdsubdomain = intval($_POST['createstdsubdomain']);
if(isset($_POST['createstdsubdomain']))
$createstdsubdomain = intval($_POST['createstdsubdomain']);
$password = validate($_POST['new_customer_password'], 'password'); $password = validate($_POST['new_customer_password'], 'password');
// only check if not empty, $password = validatePassword($password);
// cause empty == generate password automatically $sendpassword = intval($_POST['sendpassword']);
if($password != '') $phpenabled = intval($_POST['phpenabled']);
{
$password = validatePassword($password);
}
$backup_allowed = 0;
if(isset($_POST['backup_allowed']))
$backup_allowed = intval($_POST['backup_allowed']);
if ($backup_allowed != 0)
{
$backup_allowed = 1;
}
// gender out of range? [0,2]
if ($gender < 0 || $gender > 2) {
$gender = 0;
}
$sendpassword = 0;
if(isset($_POST['sendpassword']))
$sendpassword = intval($_POST['sendpassword']);
$phpenabled = 0;
if(isset($_POST['phpenabled']))
$phpenabled = intval($_POST['phpenabled']);
$perlenabled = 0;
if(isset($_POST['perlenabled']))
$perlenabled = intval($_POST['perlenabled']);
$store_defaultindex = 0;
if(isset($_POST['store_defaultindex']))
$store_defaultindex = intval($_POST['store_defaultindex']);
$diskspace = $diskspace * 1024; $diskspace = $diskspace * 1024;
$traffic = $traffic * 1024 * 1024; $traffic = $traffic * 1024 * 1024;
@@ -538,7 +428,6 @@ if($page == 'customers'
|| ((($userinfo['email_accounts_used'] + $email_accounts) > $userinfo['email_accounts']) && $userinfo['email_accounts'] != '-1') || ((($userinfo['email_accounts_used'] + $email_accounts) > $userinfo['email_accounts']) && $userinfo['email_accounts'] != '-1')
|| ((($userinfo['email_forwarders_used'] + $email_forwarders) > $userinfo['email_forwarders']) && $userinfo['email_forwarders'] != '-1') || ((($userinfo['email_forwarders_used'] + $email_forwarders) > $userinfo['email_forwarders']) && $userinfo['email_forwarders'] != '-1')
|| ((($userinfo['email_quota_used'] + $email_quota) > $userinfo['email_quota']) && $userinfo['email_quota'] != '-1' && $settings['system']['mail_quota_enabled'] == '1') || ((($userinfo['email_quota_used'] + $email_quota) > $userinfo['email_quota']) && $userinfo['email_quota'] != '-1' && $settings['system']['mail_quota_enabled'] == '1')
|| ((($userinfo['email_autoresponder_used'] + $email_autoresponder) > $userinfo['email_autoresponder']) && $userinfo['email_autoresponder'] != '-1' && $settings['autoresponder']['autoresponder_active'] == '1')
|| ((($userinfo['ftps_used'] + $ftps) > $userinfo['ftps']) && $userinfo['ftps'] != '-1') || ((($userinfo['ftps_used'] + $ftps) > $userinfo['ftps']) && $userinfo['ftps'] != '-1')
|| ((($userinfo['tickets_used'] + $tickets) > $userinfo['tickets']) && $userinfo['tickets'] != '-1') || ((($userinfo['tickets_used'] + $tickets) > $userinfo['tickets']) && $userinfo['tickets'] != '-1')
|| ((($userinfo['subdomains_used'] + $subdomains) > $userinfo['subdomains']) && $userinfo['subdomains'] != '-1') || ((($userinfo['subdomains_used'] + $subdomains) > $userinfo['subdomains']) && $userinfo['subdomains'] != '-1')
@@ -549,7 +438,6 @@ if($page == 'customers'
|| ($email_accounts == '-1' && $userinfo['email_accounts'] != '-1') || ($email_accounts == '-1' && $userinfo['email_accounts'] != '-1')
|| ($email_forwarders == '-1' && $userinfo['email_forwarders'] != '-1') || ($email_forwarders == '-1' && $userinfo['email_forwarders'] != '-1')
|| ($email_quota == '-1' && $userinfo['email_quota'] != '-1' && $settings['system']['mail_quota_enabled'] == '1') || ($email_quota == '-1' && $userinfo['email_quota'] != '-1' && $settings['system']['mail_quota_enabled'] == '1')
|| ($email_autoresponder == '-1' && $userinfo['email_autoresponder'] != '-1' && $settings['autoresponder']['autoresponder_active'] == '1')
|| ($ftps == '-1' && $userinfo['ftps'] != '-1') || ($ftps == '-1' && $userinfo['ftps'] != '-1')
|| ($tickets == '-1' && $userinfo['tickets'] != '-1') || ($tickets == '-1' && $userinfo['tickets'] != '-1')
|| ($subdomains == '-1' && $userinfo['subdomains'] != '-1') || ($subdomains == '-1' && $userinfo['subdomains'] != '-1')
@@ -593,11 +481,6 @@ if($page == 'customers'
{ {
standard_error('loginnameissystemaccount', $settings['customer']['accountprefix']); standard_error('loginnameissystemaccount', $settings['customer']['accountprefix']);
} }
//Additional filtering for Bug #962
if(function_exists('posix_getpwnam') && !in_array("posix_getpwnam",explode(",",ini_get('disable_functions'))) && posix_getpwnam($loginname)) {
standard_error('loginnameissystemaccount', $settings['customer']['accountprefix']);
}
} }
else else
{ {
@@ -638,57 +521,12 @@ if($page == 'customers'
$phpenabled = '1'; $phpenabled = '1';
} }
if($perlenabled != '0')
{
$perlenabled = '1';
}
if($password == '') if($password == '')
{ {
$password = substr(md5(uniqid(microtime(), 1)), 12, 6); $password = substr(md5(uniqid(microtime(), 1)), 12, 6);
} }
$_theme = $settings['panel']['default_theme']; $result = $db->query("INSERT INTO `" . TABLE_PANEL_CUSTOMERS . "` (`adminid`, `loginname`, `password`, `name`, `firstname`, `company`, `street`, `zipcode`, `city`, `phone`, `fax`, `email`, `customernumber`, `def_language`, `documentroot`, `guid`, `diskspace`, `traffic`, `subdomains`, `emails`, `email_accounts`, `email_forwarders`, `email_quota`, `ftps`, `tickets`, `mysqls`, `standardsubdomain`, `phpenabled`, `imap`, `pop3`, `aps_packages`) VALUES ('" . (int)$userinfo['adminid'] . "', '" . $db->escape($loginname) . "', '" . md5($password) . "', '" . $db->escape($name) . "', '" . $db->escape($firstname) . "', '" . $db->escape($company) . "', '" . $db->escape($street) . "', '" . $db->escape($zipcode) . "', '" . $db->escape($city) . "', '" . $db->escape($phone) . "', '" . $db->escape($fax) . "', '" . $db->escape($email) . "', '" . $db->escape($customernumber) . "','" . $db->escape($def_language) . "', '" . $db->escape($documentroot) . "', '" . $db->escape($guid) . "', '" . $db->escape($diskspace) . "', '" . $db->escape($traffic) . "', '" . $db->escape($subdomains) . "', '" . $db->escape($emails) . "', '" . $db->escape($email_accounts) . "', '" . $db->escape($email_forwarders) . "', '" . $db->escape($email_quota) . "', '" . $db->escape($ftps) . "', '" . $db->escape($tickets) . "', '" . $db->escape($mysqls) . "', '0', '" . $db->escape($phpenabled) . "', '" . $db->escape($email_imap) . "', '" . $db->escape($email_pop3) . "', '" . (int)$number_of_aps_packages . "')");
$result = $db->query(
"INSERT INTO `" . TABLE_PANEL_CUSTOMERS . "` SET
`adminid` = '" . (int)$userinfo['adminid'] . "',
`loginname` = '" . $db->escape($loginname) . "',
`password` = '" . md5($password) . "',
`name` = '" . $db->escape($name) . "',
`firstname` = '" . $db->escape($firstname) . "',
`gender` = '" . (int)$gender . "',
`company` = '" . $db->escape($company) . "',
`street` = '" . $db->escape($street) . "',
`zipcode` = '" . $db->escape($zipcode) . "',
`city` = '" . $db->escape($city) . "',
`phone` = '" . $db->escape($phone) . "',
`fax` = '" . $db->escape($fax) . "',
`email` = '" . $db->escape($email) . "',
`customernumber` = '" . $db->escape($customernumber) . "',
`def_language` = '" . $db->escape($def_language) . "',
`documentroot` = '" . $db->escape($documentroot) . "',
`guid` = '" . $db->escape($guid) . "',
`diskspace` = '" . $db->escape($diskspace) . "',
`traffic` = '" . $db->escape($traffic) . "',
`subdomains` = '" . $db->escape($subdomains) . "',
`emails` = '" . $db->escape($emails) . "',
`email_accounts` = '" . $db->escape($email_accounts) . "',
`email_forwarders` = '" . $db->escape($email_forwarders) . "',
`email_quota` = '" . $db->escape($email_quota) . "',
`ftps` = '" . $db->escape($ftps) . "',
`tickets` = '" . $db->escape($tickets) . "',
`mysqls` = '" . $db->escape($mysqls) . "',
`standardsubdomain` = '0',
`phpenabled` = '" . $db->escape($phpenabled) . "',
`imap` = '" . $db->escape($email_imap) . "',
`pop3` = '" . $db->escape($email_pop3) . "',
`aps_packages` = '" . (int)$number_of_aps_packages . "',
`perlenabled` = '" . $db->escape($perlenabled) . "',
`email_autoresponder` = '" . $db->escape($email_autoresponder) . "',
`backup_allowed` = '" . $db->escape($backup_allowed) . "',
`theme` = '" . $db->escape($_theme) . "'"
);
$customerid = $db->insert_id(); $customerid = $db->insert_id();
$admin_update_query = "UPDATE `" . TABLE_PANEL_ADMINS . "` SET `customers_used` = `customers_used` + 1"; $admin_update_query = "UPDATE `" . TABLE_PANEL_ADMINS . "` SET `customers_used` = `customers_used` + 1";
@@ -717,12 +555,6 @@ if($page == 'customers'
$admin_update_query.= ", `email_quota_used` = `email_quota_used` + 0" . (int)$email_quota; $admin_update_query.= ", `email_quota_used` = `email_quota_used` + 0" . (int)$email_quota;
} }
if($email_autoresponder != '-1'
&& $settings['autoresponder']['autoresponder_active'] == 1)
{
$admin_update_query.= ", `email_autoresponder_used` = `email_autoresponder_used` + 0" . (int)$email_autoresponder;
}
if($subdomains != '-1') if($subdomains != '-1')
{ {
$admin_update_query.= ", `subdomains_used` = `subdomains_used` + 0" . (int)$subdomains; $admin_update_query.= ", `subdomains_used` = `subdomains_used` + 0" . (int)$subdomains;
@@ -759,12 +591,10 @@ if($page == 'customers'
} }
$log->logAction(ADM_ACTION, LOG_INFO, "added user '" . $loginname . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "added user '" . $loginname . "'");
inserttask('2', $loginname, $guid, $guid, $store_defaultindex); inserttask('2', $loginname, $guid, $guid);
// Using filesystem - quota, insert a task which cleans the filesystem - quota
inserttask('10');
// Add htpasswd for the webalizer stats // Add htpasswd for the webalizer stats
if(CRYPT_STD_DES == 1) if(CRYPT_STD_DES == 1)
{ {
$saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2); $saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2);
@@ -787,8 +617,7 @@ if($page == 'customers'
} }
inserttask('1'); inserttask('1');
$cryptPassword = makeCryptPassword($password); $result = $db->query("INSERT INTO `" . TABLE_FTP_USERS . "` " . "(`customerid`, `username`, `password`, `homedir`, `login_enabled`, `uid`, `gid`) " . "VALUES ('" . (int)$customerid . "', '" . $db->escape($loginname) . "', ENCRYPT('" . $db->escape($password) . "'), '" . $db->escape($documentroot) . "', 'y', '" . (int)$guid . "', '" . (int)$guid . "')");
$result = $db->query("INSERT INTO `" . TABLE_FTP_USERS . "` " . "(`customerid`, `username`, `password`, `homedir`, `login_enabled`, `uid`, `gid`) " . "VALUES ('" . (int)$customerid . "', '" . $db->escape($loginname) . "', '" . $db->escape($cryptPassword) . "', '" . $db->escape($documentroot) . "', 'y', '" . (int)$guid . "', '" . (int)$guid . "')");
$result = $db->query("INSERT INTO `" . TABLE_FTP_GROUPS . "` " . "(`customerid`, `groupname`, `gid`, `members`) " . "VALUES ('" . (int)$customerid . "', '" . $db->escape($loginname) . "', '" . $db->escape($guid) . "', '" . $db->escape($loginname) . "')"); $result = $db->query("INSERT INTO `" . TABLE_FTP_GROUPS . "` " . "(`customerid`, `groupname`, `gid`, `members`) " . "VALUES ('" . (int)$customerid . "', '" . $db->escape($loginname) . "', '" . $db->escape($guid) . "', '" . $db->escape($loginname) . "')");
$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($loginname) . "', 'user', '0', '0', '0', '0', '0', '0')"); $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($loginname) . "', 'user', '0', '0', '0', '0', '0', '0')");
$log->logAction(ADM_ACTION, LOG_NOTICE, "automatically added ftp-account for user '" . $loginname . "'"); $log->logAction(ADM_ACTION, LOG_NOTICE, "automatically added ftp-account for user '" . $loginname . "'");
@@ -810,21 +639,16 @@ if($page == 'customers'
"`customerid` = '" . (int)$customerid . "', " . "`customerid` = '" . (int)$customerid . "', " .
"`adminid` = '" . (int)$userinfo['adminid'] . "', " . "`adminid` = '" . (int)$userinfo['adminid'] . "', " .
"`parentdomainid` = '-1', " . "`parentdomainid` = '-1', " .
"`ipandport` = '" . $db->escape($settings['system']['defaultip']) . "', " .
"`documentroot` = '" . $db->escape($documentroot) . "', " . "`documentroot` = '" . $db->escape($documentroot) . "', " .
"`zonefile` = '', " . "`zonefile` = '', " .
"`isemaildomain` = '0', " . "`isemaildomain` = '0', " .
"`caneditdomain` = '0', " . "`caneditdomain` = '0', " .
"`openbasedir` = '1', " . "`openbasedir` = '1', " .
"`safemode` = '1', " .
"`speciallogfile` = '0', " . "`speciallogfile` = '0', " .
"`specialsettings` = '', " . "`specialsettings` = ''");
"`add_date` = '".date('Y-m-d')."'");
$domainid = $db->insert_id(); $domainid = $db->insert_id();
// set ip <-> domain connection
$db->query("INSERT INTO `".TABLE_DOMAINTOIP."` SET
`id_domain` = '".$domainid."',
`id_ipandports` = '".(int)$settings['system']['defaultip']."'"
);
$db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `standardsubdomain`=\'' . (int)$domainid . '\' WHERE `customerid`=\'' . (int)$customerid . '\''); $db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `standardsubdomain`=\'' . (int)$domainid . '\' WHERE `customerid`=\'' . (int)$customerid . '\'');
$log->logAction(ADM_ACTION, LOG_NOTICE, "automatically added standardsubdomain for user '" . $loginname . "'"); $log->logAction(ADM_ACTION, LOG_NOTICE, "automatically added standardsubdomain for user '" . $loginname . "'");
inserttask('1'); inserttask('1');
@@ -835,6 +659,7 @@ if($page == 'customers'
$replace_arr = array( $replace_arr = array(
'FIRSTNAME' => $firstname, 'FIRSTNAME' => $firstname,
'NAME' => $name, 'NAME' => $name,
'TITLE' => $title,
'COMPANY' => $company, 'COMPANY' => $company,
'SALUTATION' => getCorrectUserSalutation(array('firstname' => $firstname, 'name' => $name, 'company' => $company)), 'SALUTATION' => getCorrectUserSalutation(array('firstname' => $firstname, 'name' => $name, 'company' => $company)),
'USERNAME' => $loginname, 'USERNAME' => $loginname,
@@ -881,7 +706,7 @@ if($page == 'customers'
while(list($language_file, $language_name) = each($languages)) while(list($language_file, $language_name) = each($languages))
{ {
$language_options.= makeoption($language_name, $language_file, $settings['panel']['standardlanguage'], true); $language_options.= makeoption($language_name, $language_file, $userinfo['def_language'], true);
} }
$diskspace_ul = makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $diskspace_ul = makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
@@ -891,22 +716,15 @@ if($page == 'customers'
$email_accounts_ul = makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $email_accounts_ul = makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$email_forwarders_ul = makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $email_forwarders_ul = makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$email_quota_ul = makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $email_quota_ul = makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$email_autoresponder_ul = makecheckbox('email_autoresponder_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$ftps_ul = makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $ftps_ul = makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$tickets_ul = makecheckbox('tickets_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $tickets_ul = makecheckbox('tickets_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$mysqls_ul = makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $mysqls_ul = makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$number_of_aps_packages_ul = makecheckbox('number_of_aps_packages_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $number_of_aps_packages_ul = makecheckbox('number_of_aps_packages_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$createstdsubdomain = makeyesno('createstdsubdomain', '1', '0', '1');
$gender_options = makeoption($lng['gender']['undef'], 0, true, true, true); $email_imap = makeyesno('email_imap', '1', '0', '1');
$gender_options .= makeoption($lng['gender']['male'], 1, null, true, true); $email_pop3 = makeyesno('email_pop3', '1', '0', '1');
$gender_options .= makeoption($lng['gender']['female'], 2, null, true, true); $sendpassword = makeyesno('sendpassword', '1', '0', '1');
$phpenabled = makeyesno('phpenabled', '1', '0', '1');
$customer_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/customer/formfield.customer_add.php';
$customer_add_form = htmlform::genHTMLForm($customer_add_data);
$title = $customer_add_data['customer_add']['title'];
$image = $customer_add_data['customer_add']['image'];
eval("echo \"" . getTemplate("customers/customers_add") . "\";"); eval("echo \"" . getTemplate("customers/customers_add") . "\";");
} }
} }
@@ -934,7 +752,6 @@ if($page == 'customers'
$def_language = validate($_POST['def_language'], 'default language'); $def_language = validate($_POST['def_language'], 'default language');
$password = validate($_POST['new_customer_password'], 'new password'); $password = validate($_POST['new_customer_password'], 'new password');
$diskspace = intval_ressource($_POST['diskspace']); $diskspace = intval_ressource($_POST['diskspace']);
$gender = intval_ressource($_POST['gender']);
if(isset($_POST['diskspace_ul'])) if(isset($_POST['diskspace_ul']))
{ {
@@ -990,31 +807,9 @@ if($page == 'customers'
$email_quota = - 1; $email_quota = - 1;
} }
if($settings['autoresponder']['autoresponder_active'] == '1') $email_imap = intval_ressource($_POST['email_imap']);
{ $email_pop3 = intval_ressource($_POST['email_pop3']);
$email_autoresponder = intval_ressource($_POST['email_autoresponder']); $ftps = intval_ressource($_POST['ftps']);
if(isset($_POST['email_autoresponder_ul']))
{
$email_autoresponder = - 1;
}
}
else
{
$email_autoresponder = 0;
}
$email_imap = 0;
if(isset($_POST['email_imap']))
$email_imap = intval_ressource($_POST['email_imap']);
$email_pop3 = 0;
if(isset($_POST['email_pop3']))
$email_pop3 = intval_ressource($_POST['email_pop3']);
$ftps = 0;
if(isset($_POST['ftps']))
$ftps = intval_ressource($_POST['ftps']);
if(isset($_POST['ftps_ul'])) if(isset($_POST['ftps_ul']))
{ {
@@ -1029,22 +824,7 @@ if($page == 'customers'
$tickets = - 1; $tickets = - 1;
} }
$backup_allowed = 0; $mysqls = intval_ressource($_POST['mysqls']);
if (isset($_POST['backup_allowed']))
$backup_allowed = intval($_POST['backup_allowed']);
if($backup_allowed != '0'){
$backup_allowed = 1;
}
// gender out of range? [0,2]
if ($gender < 0 || $gender > 2) {
$gender = 0;
}
$mysqls = 0;
if(isset($_POST['mysqls']))
$mysqls = intval_ressource($_POST['mysqls']);
if(isset($_POST['mysqls_ul'])) if(isset($_POST['mysqls_ul']))
{ {
@@ -1065,21 +845,9 @@ if($page == 'customers'
$number_of_aps_packages = 0; $number_of_aps_packages = 0;
} }
$createstdsubdomain = 0; $createstdsubdomain = intval($_POST['createstdsubdomain']);
if(isset($_POST['createstdsubdomain'])) $deactivated = intval($_POST['deactivated']);
$createstdsubdomain = intval($_POST['createstdsubdomain']); $phpenabled = intval($_POST['phpenabled']);
$deactivated = 0;
if(isset($_POST['deactivated']))
$deactivated = intval($_POST['deactivated']);
$phpenabled = 0;
if(isset($_POST['phpenabled']))
$phpenabled = intval($_POST['phpenabled']);
$perlenabled = 0;
if(isset($_POST['perlenabled']))
$perlenabled = intval($_POST['perlenabled']);
$diskspace = $diskspace * 1024; $diskspace = $diskspace * 1024;
$traffic = $traffic * 1024 * 1024; $traffic = $traffic * 1024 * 1024;
@@ -1089,7 +857,6 @@ if($page == 'customers'
|| ((($userinfo['email_accounts_used'] + $email_accounts - $result['email_accounts']) > $userinfo['email_accounts']) && $userinfo['email_accounts'] != '-1') || ((($userinfo['email_accounts_used'] + $email_accounts - $result['email_accounts']) > $userinfo['email_accounts']) && $userinfo['email_accounts'] != '-1')
|| ((($userinfo['email_forwarders_used'] + $email_forwarders - $result['email_forwarders']) > $userinfo['email_forwarders']) && $userinfo['email_forwarders'] != '-1') || ((($userinfo['email_forwarders_used'] + $email_forwarders - $result['email_forwarders']) > $userinfo['email_forwarders']) && $userinfo['email_forwarders'] != '-1')
|| ((($userinfo['email_quota_used'] + $email_quota - $result['email_quota']) > $userinfo['email_quota']) && $userinfo['email_quota'] != '-1' && $settings['system']['mail_quota_enabled'] == '1') || ((($userinfo['email_quota_used'] + $email_quota - $result['email_quota']) > $userinfo['email_quota']) && $userinfo['email_quota'] != '-1' && $settings['system']['mail_quota_enabled'] == '1')
|| ((($userinfo['email_autoresponder_used'] + $email_autoresponder - $result['email_autoresponder']) > $userinfo['email_autoresponder']) && $userinfo['email_autoresponder'] != '-1' && $settings['autoresponder']['autoresponder_active'] == '1')
|| ((($userinfo['ftps_used'] + $ftps - $result['ftps']) > $userinfo['ftps']) && $userinfo['ftps'] != '-1') || ((($userinfo['ftps_used'] + $ftps - $result['ftps']) > $userinfo['ftps']) && $userinfo['ftps'] != '-1')
|| ((($userinfo['tickets_used'] + $tickets - $result['tickets']) > $userinfo['tickets']) && $userinfo['tickets'] != '-1') || ((($userinfo['tickets_used'] + $tickets - $result['tickets']) > $userinfo['tickets']) && $userinfo['tickets'] != '-1')
|| ((($userinfo['subdomains_used'] + $subdomains - $result['subdomains']) > $userinfo['subdomains']) && $userinfo['subdomains'] != '-1') || ((($userinfo['subdomains_used'] + $subdomains - $result['subdomains']) > $userinfo['subdomains']) && $userinfo['subdomains'] != '-1')
@@ -1100,7 +867,6 @@ if($page == 'customers'
|| ($email_accounts == '-1' && $userinfo['email_accounts'] != '-1') || ($email_accounts == '-1' && $userinfo['email_accounts'] != '-1')
|| ($email_forwarders == '-1' && $userinfo['email_forwarders'] != '-1') || ($email_forwarders == '-1' && $userinfo['email_forwarders'] != '-1')
|| ($email_quota == '-1' && $userinfo['email_quota'] != '-1' && $settings['system']['mail_quota_enabled'] == '1') || ($email_quota == '-1' && $userinfo['email_quota'] != '-1' && $settings['system']['mail_quota_enabled'] == '1')
|| ($email_autoresponder == '-1' && $userinfo['email_autoresponder'] != '-1' && $settings['autoresponder']['autoresponder_active'] == '1')
|| ($ftps == '-1' && $userinfo['ftps'] != '-1') || ($ftps == '-1' && $userinfo['ftps'] != '-1')
|| ($tickets == '-1' && $userinfo['tickets'] != '-1') || ($tickets == '-1' && $userinfo['tickets'] != '-1')
|| ($subdomains == '-1' && $userinfo['subdomains'] != '-1') || ($subdomains == '-1' && $userinfo['subdomains'] != '-1')
@@ -1160,30 +926,9 @@ if($page == 'customers'
$_stdsubdomain = $result['loginname'] . '.' . $settings['system']['hostname']; $_stdsubdomain = $result['loginname'] . '.' . $settings['system']['hostname'];
} }
$db->query("INSERT INTO `" . TABLE_PANEL_DOMAINS . "` SET $db->query("INSERT INTO `" . TABLE_PANEL_DOMAINS . "` " . "(`domain`, `customerid`, `adminid`, `parentdomainid`, `ipandport`, `documentroot`, `zonefile`, `isemaildomain`, `caneditdomain`, `openbasedir`, `safemode`, `speciallogfile`, `specialsettings`) " . "VALUES ('" . $db->escape($_stdsubdomain) . "', '" . (int)$result['customerid'] . "', '" . (int)$userinfo['adminid'] . "', '-1', '" . $db->escape($settings['system']['defaultip']) . "', '" . $db->escape($result['documentroot']) . "', '', '0', '0', '1', '1', '0', '')");
`domain` = '" . $db->escape($_stdsubdomain) . "',
`customerid` = '" . (int)$result['customerid'] . "',
`adminid` = '" . (int)$userinfo['adminid'] . "',
`parentdomainid` = '-1',
`documentroot` = '" . $db->escape($result['documentroot']) . "',
`zonefile` = '',
`isemaildomain` = '0',
`caneditdomain` = '0',
`openbasedir` = '1',
`speciallogfile` = '0',
`specialsettings` = '',
`add_date` = '".date('Y-m-d')."'"
);
$domainid = $db->insert_id(); $domainid = $db->insert_id();
// set ip <-> domain connection $db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `standardsubdomain`=\'' . (int)$domainid . '\' WHERE `customerid`=\'' . (int)$result['customerid'] . '\'');
$db->query("INSERT INTO `".TABLE_DOMAINTOIP."` SET
`id_domain` = '".$domainid."',
`id_ipandports` = '".(int)$settings['system']['defaultip']."'"
);
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET
`standardsubdomain`='" . (int)$domainid . "'
WHERE `customerid`='" . (int)$result['customerid'] . "'"
);
$log->logAction(ADM_ACTION, LOG_NOTICE, "automatically added standardsubdomain for user '" . $result['loginname'] . "'"); $log->logAction(ADM_ACTION, LOG_NOTICE, "automatically added standardsubdomain for user '" . $result['loginname'] . "'");
inserttask('1'); inserttask('1');
} }
@@ -1191,12 +936,8 @@ if($page == 'customers'
if($createstdsubdomain == '0' if($createstdsubdomain == '0'
&& $result['standardsubdomain'] != '0') && $result['standardsubdomain'] != '0')
{ {
$db->query("DELETE FROM `" . TABLE_PANEL_DOMAINS . "` $db->query('DELETE FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `id`=\'' . (int)$result['standardsubdomain'] . '\'');
WHERE `id`='" . (int)$result['standardsubdomain'] . "'"); $db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `standardsubdomain`=\'0\' WHERE `customerid`=\'' . (int)$result['customerid'] . '\'');
$db->query("DELETE FROM `" . TABLE_DOMAINTOIP . "`
WHERE `id_domain`='" . (int)$result['standardsubdomain'] . "'");
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET
`standardsubdomain`= '0' WHERE `customerid`= '" . (int)$result['customerid'] . "'");
$log->logAction(ADM_ACTION, LOG_NOTICE, "automatically deleted standardsubdomain for user '" . $result['loginname'] . "'"); $log->logAction(ADM_ACTION, LOG_NOTICE, "automatically deleted standardsubdomain for user '" . $result['loginname'] . "'");
inserttask('1'); inserttask('1');
} }
@@ -1211,61 +952,16 @@ if($page == 'customers'
$phpenabled = '1'; $phpenabled = '1';
} }
if($perlenabled != '0') if($phpenabled != $result['phpenabled'])
{
$perlenabled = '1';
}
if($phpenabled != $result['phpenabled']
|| $perlenabled != $result['perlenabled'])
{ {
inserttask('1'); inserttask('1');
} }
if($deactivated != $result['deactivated']) if($deactivated != $result['deactivated'])
{ {
$db->query("UPDATE `" . TABLE_MAIL_USERS . "` SET `postfix`='" . (($deactivated) ? 'N' : 'Y') . "', `pop3`='" . (($deactivated) ? '0' : (int)$result['pop3']) . "', `imap`='" . (($deactivated) ? '0' : (int)$result['imap']) . "' WHERE `customerid`='" . (int)$id . "'"); $db->query("UPDATE `" . TABLE_MAIL_USERS . "` SET `postfix`='" . (($deactivated) ? 'N' : 'Y') . "', `pop3`='" . (($deactivated) ? '0' : '1') . "', `imap`='" . (($deactivated) ? '0' : '1') . "' WHERE `customerid`='" . (int)$id . "'");
$db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `login_enabled`='" . (($deactivated) ? 'N' : 'Y') . "' WHERE `customerid`='" . (int)$id . "'"); $db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `login_enabled`='" . (($deactivated) ? 'N' : 'Y') . "' WHERE `customerid`='" . (int)$id . "'");
$db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `deactivated`='" . (int)$deactivated . "' WHERE `customerid`='" . (int)$id . "'"); $db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `deactivated`='" . (int)$deactivated . "' WHERE `customerid`='" . (int)$id . "'");
/* Retrieve customer's databases */
$databases = $db->query("SELECT * FROM " . TABLE_PANEL_DATABASES . " WHERE customerid='" . (int)$id . "' ORDER BY `dbserver`");
$db_root = new db($sql_root[0]['host'], $sql_root[0]['user'], $sql_root[0]['password'], '');
$last_dbserver = 0;
/* For each of them */
while($row_database = $db->fetch_array($databases))
{
if($last_dbserver != $row_database['dbserver'])
{
$db_root->query('FLUSH PRIVILEGES;');
$db_root->close();
$db_root = new db($sql_root[$row_database['dbserver']]['host'], $sql_root[$row_database['dbserver']]['user'], $sql_root[$row_database['dbserver']]['password'], '');
$last_dbserver = $row_database['dbserver'];
}
foreach(array_unique(explode(',', $settings['system']['mysql_access_host'])) as $mysql_access_host)
{
$mysql_access_host = trim($mysql_access_host);
/* Prevent access, if deactivated */
if($deactivated)
{
// failsafe if user has been deleted manually (requires MySQL 4.1.2+)
$db_root->query('REVOKE ALL PRIVILEGES, GRANT OPTION FROM \'' . $db_root->escape($row_database['databasename']) .'\'',false,true);
}
else /* Otherwise grant access */
{
$db_root->query('GRANT ALL PRIVILEGES ON `' . $db_root->escape($row_database['databasename']) .'`.* TO `' . $db_root->escape($row_database['databasename']) . '`@`' . $db_root->escape($mysql_access_host) . '`');
$db_root->query('GRANT ALL PRIVILEGES ON `' . str_replace('_', '\_', $db_root->escape($row_database['databasename'])) . '` . * TO `' . $db_root->escape($row_database['databasename']) . '`@`' . $db_root->escape($mysql_access_host) . '`');
}
}
}
/* At last flush the new privileges */
$db_root->query('FLUSH PRIVILEGES;');
$db_root->close();
$log->logAction(ADM_ACTION, LOG_INFO, "deactivated user '" . $result['loginname'] . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "deactivated user '" . $result['loginname'] . "'");
inserttask('1'); inserttask('1');
} }
@@ -1284,13 +980,9 @@ if($page == 'customers'
$db->query("UPDATE `" . TABLE_MAIL_USERS . "` SET `imap`='" . (int)$email_imap . "' WHERE `customerid`='" . (int)$id . "'"); $db->query("UPDATE `" . TABLE_MAIL_USERS . "` SET `imap`='" . (int)$email_imap . "' WHERE `customerid`='" . (int)$id . "'");
} }
// $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `name`='" . $db->escape($name) . "', `firstname`='" . $db->escape($firstname) . "', `company`='" . $db->escape($company) . "', `street`='" . $db->escape($street) . "', `zipcode`='" . $db->escape($zipcode) . "', `city`='" . $db->escape($city) . "', `phone`='" . $db->escape($phone) . "', `fax`='" . $db->escape($fax) . "', `email`='" . $db->escape($email) . "', `customernumber`='" . $db->escape($customernumber) . "', `def_language`='" . $db->escape($def_language) . "', `password` = '" . $password . "', `diskspace`='" . $db->escape($diskspace) . "', `traffic`='" . $db->escape($traffic) . "', `subdomains`='" . $db->escape($subdomains) . "', `emails`='" . $db->escape($emails) . "', `email_accounts` = '" . $db->escape($email_accounts) . "', `email_forwarders`='" . $db->escape($email_forwarders) . "', `ftps`='" . $db->escape($ftps) . "', `tickets`='" . $db->escape($tickets) . "', `mysqls`='" . $db->escape($mysqls) . "', `deactivated`='" . $db->escape($deactivated) . "', `phpenabled`='" . $db->escape($phpenabled) . "', `email_quota`='" . $db->escape($email_quota) . "', `imap`='" . $db->escape($email_imap) . "', `pop3`='" . $db->escape($email_pop3) . "', `aps_packages`='" . (int)$number_of_aps_packages . "', `perlenabled`='" . $db->escape($perlenabled) . "', `email_autoresponder`='" . $db->escape($email_autoresponder) . "' WHERE `customerid`='" . (int)$id . "'"); $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `name`='" . $db->escape($name) . "', `firstname`='" . $db->escape($firstname) . "', `company`='" . $db->escape($company) . "', `street`='" . $db->escape($street) . "', `zipcode`='" . $db->escape($zipcode) . "', `city`='" . $db->escape($city) . "', `phone`='" . $db->escape($phone) . "', `fax`='" . $db->escape($fax) . "', `email`='" . $db->escape($email) . "', `customernumber`='" . $db->escape($customernumber) . "', `def_language`='" . $db->escape($def_language) . "', `password` = '" . $password . "', `diskspace`='" . $db->escape($diskspace) . "', `traffic`='" . $db->escape($traffic) . "', `subdomains`='" . $db->escape($subdomains) . "', `emails`='" . $db->escape($emails) . "', `email_accounts` = '" . $db->escape($email_accounts) . "', `email_forwarders`='" . $db->escape($email_forwarders) . "', `ftps`='" . $db->escape($ftps) . "', `tickets`='" . $db->escape($tickets) . "', `mysqls`='" . $db->escape($mysqls) . "', `deactivated`='" . $db->escape($deactivated) . "', `phpenabled`='" . $db->escape($phpenabled) . "', `email_quota`='" . $db->escape($email_quota) . "', `imap`='" . $db->escape($email_imap) . "', `pop3`='" . $db->escape($email_pop3) . "', `aps_packages`='" . (int)$number_of_aps_packages . "' WHERE `customerid`='" . (int)$id . "'");
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `name`='" . $db->escape($name) . "', `firstname`='" . $db->escape($firstname) . "', `gender`='" . $db->escape($gender) . "', `company`='" . $db->escape($company) . "', `street`='" . $db->escape($street) . "', `zipcode`='" . $db->escape($zipcode) . "', `city`='" . $db->escape($city) . "', `phone`='" . $db->escape($phone) . "', `fax`='" . $db->escape($fax) . "', `email`='" . $db->escape($email) . "', `customernumber`='" . $db->escape($customernumber) . "', `def_language`='" . $db->escape($def_language) . "', `password` = '" . $password . "', `diskspace`='" . $db->escape($diskspace) . "', `traffic`='" . $db->escape($traffic) . "', `subdomains`='" . $db->escape($subdomains) . "', `emails`='" . $db->escape($emails) . "', `email_accounts` = '" . $db->escape($email_accounts) . "', `email_forwarders`='" . $db->escape($email_forwarders) . "', `ftps`='" . $db->escape($ftps) . "', `tickets`='" . $db->escape($tickets) . "', `mysqls`='" . $db->escape($mysqls) . "', `deactivated`='" . $db->escape($deactivated) . "', `phpenabled`='" . $db->escape($phpenabled) . "', `email_quota`='" . $db->escape($email_quota) . "', `imap`='" . $db->escape($email_imap) . "', `pop3`='" . $db->escape($email_pop3) . "', `aps_packages`='" . (int)$number_of_aps_packages . "', `perlenabled`='" . $db->escape($perlenabled) . "', `email_autoresponder`='" . $db->escape($email_autoresponder) . "', `backup_allowed`='" . $db->escape($backup_allowed) . "' WHERE `customerid`='" . (int)$id . "'");
$admin_update_query = "UPDATE `" . TABLE_PANEL_ADMINS . "` SET `customers_used` = `customers_used` "; $admin_update_query = "UPDATE `" . TABLE_PANEL_ADMINS . "` SET `customers_used` = `customers_used` ";
// Using filesystem - quota, insert a task which cleans the filesystem - quota
inserttask('10');
if($mysqls != '-1' if($mysqls != '-1'
|| $result['mysqls'] != '-1') || $result['mysqls'] != '-1')
{ {
@@ -1371,22 +1063,6 @@ if($page == 'customers'
} }
} }
if($email_autoresponder != '-1'
|| $result['email_autoresponder'] != '-1')
{
$admin_update_query.= ", `email_autoresponder_used` = `email_autoresponder_used` ";
if($email_autoresponder != '-1')
{
$admin_update_query.= " + 0" . (int)$email_autoresponder . " ";
}
if($result['email_autoresponder'] != '-1')
{
$admin_update_query.= " - 0" . (int)$result['email_autoresponder'] . " ";
}
}
if($subdomains != '-1' if($subdomains != '-1'
|| $result['subdomains'] != '-1') || $result['subdomains'] != '-1')
{ {
@@ -1539,13 +1215,6 @@ if($page == 'customers'
$result['email_quota'] = ''; $result['email_quota'] = '';
} }
$email_autoresponder_ul = makecheckbox('email_autoresponder_ul', $lng['customer']['unlimited'], '-1', false, $result['email_autoresponder'], true, true);
if($result['email_autoresponder'] == '-1')
{
$result['email_autoresponder'] = '';
}
$ftps_ul = makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, $result['ftps'], true, true); $ftps_ul = makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, $result['ftps'], true, true);
if($result['ftps'] == '-1') if($result['ftps'] == '-1')
@@ -1574,18 +1243,13 @@ if($page == 'customers'
$result['aps_packages'] = ''; $result['aps_packages'] = '';
} }
$createstdsubdomain = makeyesno('createstdsubdomain', '1', '0', (($result['standardsubdomain'] != '0') ? '1' : '0'));
$phpenabled = makeyesno('phpenabled', '1', '0', $result['phpenabled']);
$deactivated = makeyesno('deactivated', '1', '0', $result['deactivated']);
$email_imap = makeyesno('email_imap', '1', '0', $result['imap']);
$email_pop3 = makeyesno('email_pop3', '1', '0', $result['pop3']);
$result = htmlentities_array($result); $result = htmlentities_array($result);
$gender_options = makeoption($lng['gender']['undef'], 0, ($result['gender'] == '0' ? true : false), true, true);
$gender_options .= makeoption($lng['gender']['male'], 1, ($result['gender'] == '1' ? true : false), true, true);
$gender_options .= makeoption($lng['gender']['female'], 2, ($result['gender'] == '2' ? true : false), true, true);
$customer_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/customer/formfield.customer_edit.php';
$customer_edit_form = htmlform::genHTMLForm($customer_edit_data);
$title = $customer_edit_data['customer_edit']['title'];
$image = $customer_edit_data['customer_edit']['image'];
eval("echo \"" . getTemplate("customers/customers_edit") . "\";"); eval("echo \"" . getTemplate("customers/customers_edit") . "\";");
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
@@ -61,7 +61,6 @@ if($page == 'overview')
SUM(`email_accounts_used`) AS `email_accounts_used`, SUM(`email_accounts_used`) AS `email_accounts_used`,
SUM(`email_forwarders_used`) AS `email_forwarders_used`, SUM(`email_forwarders_used`) AS `email_forwarders_used`,
SUM(`email_quota_used`) AS `email_quota_used`, SUM(`email_quota_used`) AS `email_quota_used`,
SUM(`email_autoresponder_used`) AS `email_autoresponder_used`,
SUM(`ftps_used`) AS `ftps_used`, SUM(`ftps_used`) AS `ftps_used`,
SUM(`tickets_used`) AS `tickets_used`, SUM(`tickets_used`) AS `tickets_used`,
SUM(`subdomains_used`) AS `subdomains_used`, SUM(`subdomains_used`) AS `subdomains_used`,
@@ -104,13 +103,11 @@ if($page == 'overview')
$_message = isset($latestversion[1]) ? $latestversion[1] : ''; $_message = isset($latestversion[1]) ? $latestversion[1] : '';
$_link = isset($latestversion[2]) ? $latestversion[2] : htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes'); $_link = isset($latestversion[2]) ? $latestversion[2] : htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes');
// add the branding so debian guys are not gettings confused $lookfornewversion_lable = $_version;
// about their version-number
$lookfornewversion_lable = $_version.$branding;
$lookfornewversion_link = $_link; $lookfornewversion_link = $_link;
$lookfornewversion_addinfo = $_message; $lookfornewversion_addinfo = $_message;
if (version_compare2($version, $_version) == -1) { if (version_compare($version, $_version) == -1) {
$isnewerversion = 1; $isnewerversion = 1;
} else { } else {
$isnewerversion = 0; $isnewerversion = 0;
@@ -143,11 +140,23 @@ if($page == 'overview')
$userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, $settings['panel']['decimal_places']); $userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, $settings['panel']['decimal_places']);
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $settings['panel']['decimal_places']); $userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $settings['panel']['decimal_places']);
$userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), $settings['panel']['decimal_places']); $userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), $settings['panel']['decimal_places']);
$userinfo = str_replace_array('-1', $lng['customer']['unlimited'], $userinfo, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota email_autoresponder ftps tickets subdomains aps_packages'); $userinfo = str_replace_array('-1', $lng['customer']['unlimited'], $userinfo, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps tickets subdomains aps_packages');
$cron_last_runs = getCronjobsLastRun(); $cron_last_runs = getCronjobsLastRun();
$outstanding_tasks = getOutstandingTasks(); $outstanding_tasks = getOutstandingTasks();
$opentickets = 0;
$opentickets = $db->query_first('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
WHERE `answerto` = "0" AND (`status` = "0" OR `status` = "1")
AND `lastreplier`="0" AND `adminid` = "' . $userinfo['adminid'] . '"');
$awaitingtickets = $opentickets['count'];
$awaitingtickets_text = '';
if($opentickets > 0)
{
$awaitingtickets_text = strtr($lng['ticket']['awaitingticketreply'], array('%s' => '<a href="admin_tickets.php?page=tickets&amp;s=' . $s . '">' . $opentickets['count'] . '</a>'));
}
if(function_exists('sys_getloadavg')) if(function_exists('sys_getloadavg'))
{ {
$loadArray = sys_getloadavg(); $loadArray = sys_getloadavg();
@@ -176,7 +185,7 @@ if($page == 'overview')
} }
// Try to get the uptime // Try to get the uptime
// First: With exec (let's hope it's enabled for the Froxlor - vHost) // First: With exec (let's hope it's enabled for the SysCP - vHost)
$uptime_array = explode(" ", @file_get_contents("/proc/uptime")); $uptime_array = explode(" ", @file_get_contents("/proc/uptime"));
@@ -272,47 +281,13 @@ elseif($page == 'change_language')
{ {
$language_options = ''; $language_options = '';
$default_lang = $settings['panel']['standardlanguage'];
if($userinfo['def_language'] != '') {
$default_lang = $userinfo['def_language'];
}
while(list($language_file, $language_name) = each($languages)) while(list($language_file, $language_name) = each($languages))
{ {
$language_options.= makeoption($language_name, $language_file, $default_lang, true); $language_options.= makeoption($language_name, $language_file, $userinfo['def_language'], true);
} }
eval("echo \"" . getTemplate("index/change_language") . "\";"); eval("echo \"" . getTemplate("index/change_language") . "\";");
} }
} }
elseif($page == 'change_theme')
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$theme = validate($_POST['theme'], 'theme');
$db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `theme`='" . $db->escape($theme) . "' WHERE `adminid`='" . (int)$userinfo['adminid'] . "'"); ?>
$db->query("UPDATE `" . TABLE_PANEL_SESSIONS . "` SET `theme`='" . $db->escape($theme) . "' WHERE `hash`='" . $db->escape($s) . "'");
$log->logAction(ADM_ACTION, LOG_NOTICE, "changed his/her theme to '" . $theme . "'");
redirectTo($filename, Array('s' => $s));
}
else
{
$theme_options = '';
$default_theme = $settings['panel']['default_theme'];
if($userinfo['theme'] != '') {
$default_theme = $userinfo['theme'];
}
$themes_avail = getThemes();
foreach($themes_avail as $t)
{
$theme_options.= makeoption($t, $t, $default_theme, true);
}
eval("echo \"" . getTemplate("index/change_theme") . "\";");
}
}

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
@@ -83,7 +83,7 @@ if($page == 'ipsandports'
if(isset($result['id']) if(isset($result['id'])
&& $result['id'] == $id) && $result['id'] == $id)
{ {
$result_checkdomain = $db->query_first("SELECT `id_domain` as `id` FROM `" . TABLE_DOMAINTOIP . "` WHERE `id_ipandports`='" . (int)$id . "'"); $result_checkdomain = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `ipandport`='" . (int)$id . "'");
if($result_checkdomain['id'] == '') if($result_checkdomain['id'] == '')
{ {
@@ -102,16 +102,9 @@ if($page == 'ipsandports'
&& $_POST['send'] == 'send') && $_POST['send'] == 'send')
{ {
$db->query("DELETE FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id`='" . (int)$id . "'"); $db->query("DELETE FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id`='" . (int)$id . "'");
// also, remove connections to domains (multi-stack)
$db->query("DELETE FROM `".TABLE_DOMAINTOIP."` WHERE `id_ipandports`='".(int)$id."'");
$log->logAction(ADM_ACTION, LOG_WARNING, "deleted IP/port '" . $result['ip'] . ":" . $result['port'] . "'"); $log->logAction(ADM_ACTION, LOG_WARNING, "deleted IP/port '" . $result['ip'] . ":" . $result['port'] . "'");
inserttask('1'); inserttask('1');
// Using nameserver, insert a task which rebuilds the server config
inserttask('4'); inserttask('4');
redirectTo($filename, Array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} }
else else
@@ -143,27 +136,16 @@ if($page == 'ipsandports'
{ {
$ip = validate_ip($_POST['ip']); $ip = validate_ip($_POST['ip']);
$port = validate($_POST['port'], 'port', '/^(([1-9])|([1-9][0-9])|([1-9][0-9][0-9])|([1-9][0-9][0-9][0-9])|([1-5][0-9][0-9][0-9][0-9])|(6[0-4][0-9][0-9][0-9])|(65[0-4][0-9][0-9])|(655[0-2][0-9])|(6553[0-5]))$/Di', array('stringisempty', 'myport')); $port = validate($_POST['port'], 'port', '/^(([1-9])|([1-9][0-9])|([1-9][0-9][0-9])|([1-9][0-9][0-9][0-9])|([1-5][0-9][0-9][0-9][0-9])|(6[0-4][0-9][0-9][0-9])|(65[0-4][0-9][0-9])|(655[0-2][0-9])|(6553[0-5]))$/Di', array('stringisempty', 'myport'));
$listen_statement = isset($_POST['listen_statement']) ? 1 : 0; $listen_statement = intval($_POST['listen_statement']);
$namevirtualhost_statement = isset($_POST['namevirtualhost_statement']) ? 1 : 0; $namevirtualhost_statement = intval($_POST['namevirtualhost_statement']);
$vhostcontainer = isset($_POST['vhostcontainer']) ? 1 : 0; $vhostcontainer = intval($_POST['vhostcontainer']);
$specialsettings = validate(str_replace("\r\n", "\n", $_POST['specialsettings']), 'specialsettings', '/^[^\0]*$/'); $specialsettings = validate(str_replace("\r\n", "\n", $_POST['specialsettings']), 'specialsettings', '/^[^\0]*$/');
$vhostcontainer_servername_statement = isset($_POST['vhostcontainer_servername_statement']) ? 1 : 0; $vhostcontainer_servername_statement = intval($_POST['vhostcontainer_servername_statement']);
$ssl = intval($_POST['ssl']);
$ssl_cert_file = validate($_POST['ssl_cert_file'], 'ssl_cert_file');
$ssl_key_file = validate($_POST['ssl_key_file'], 'ssl_key_file');
$ssl_ca_file = validate($_POST['ssl_ca_file'], 'ssl_ca_file');
$default_vhostconf_domain = validate(str_replace("\r\n", "\n", $_POST['default_vhostconf_domain']), 'default_vhostconf_domain', '/^[^\0]*$/'); $default_vhostconf_domain = validate(str_replace("\r\n", "\n", $_POST['default_vhostconf_domain']), 'default_vhostconf_domain', '/^[^\0]*$/');
$docroot = validate($_POST['docroot'], 'docroot');
if((int)$settings['system']['use_ssl'] == 1)
{
$ssl = intval($_POST['ssl']);
$ssl_cert_file = validate($_POST['ssl_cert_file'], 'ssl_cert_file');
$ssl_key_file = validate($_POST['ssl_key_file'], 'ssl_key_file');
$ssl_ca_file = validate($_POST['ssl_ca_file'], 'ssl_ca_file');
$ssl_cert_chainfile = validate($_POST['ssl_cert_chainfile'], 'ssl_cert_chainfile');
} else {
$ssl = 0;
$ssl_cert_file = '';
$ssl_key_file = '';
$ssl_ca_file = '';
$ssl_cert_chainfile = '';
}
if($listen_statement != '1') if($listen_statement != '1')
{ {
@@ -205,20 +187,6 @@ if($page == 'ipsandports'
$ssl_ca_file = makeCorrectFile($ssl_ca_file); $ssl_ca_file = makeCorrectFile($ssl_ca_file);
} }
if($ssl_cert_chainfile != '')
{
$ssl_cert_chainfile = makeCorrectFile($ssl_cert_chainfile);
}
if(strlen(trim($docroot)) > 0)
{
$docroot = makeCorrectDir($docroot);
}
else
{
$docroot = '';
}
$result_checkfordouble = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($ip) . "' AND `port`='" . (int)$port . "'"); $result_checkfordouble = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($ip) . "' AND `port`='" . (int)$port . "'");
if($result_checkfordouble['id'] != '') if($result_checkfordouble['id'] != '')
@@ -227,23 +195,7 @@ if($page == 'ipsandports'
} }
else else
{ {
$db->query("INSERT INTO `" . TABLE_PANEL_IPSANDPORTS . "` $db->query("INSERT INTO `" . TABLE_PANEL_IPSANDPORTS . "` (`ip`, `port`, `listen_statement`, `namevirtualhost_statement`, `vhostcontainer`, `vhostcontainer_servername_statement`, `specialsettings`, `ssl`, `ssl_cert_file`, `ssl_key_file`, `ssl_ca_file`, `default_vhostconf_domain`) VALUES ('" . $db->escape($ip) . "', '" . (int)$port . "', '" . (int)$listen_statement . "', '" . (int)$namevirtualhost_statement . "', '" . (int)$vhostcontainer . "', '" . (int)$vhostcontainer_servername_statement . "', '" . $db->escape($specialsettings) . "', '" . (int)$ssl . "', '" . $db->escape($ssl_cert_file) . "', '" . $db->escape($ssl_key_file) . "', '" . $db->escape($ssl_ca_file) . "', '" . $db->escape($default_vhostconf_domain) . "')");
SET
`ip` = '" . $db->escape($ip) . "',
`port` = '" . (int)$port . "',
`listen_statement` = '" . (int)$listen_statement . "',
`namevirtualhost_statement` = '" . (int)$namevirtualhost_statement . "',
`vhostcontainer` = '" . (int)$vhostcontainer . "',
`vhostcontainer_servername_statement` = '" . (int)$vhostcontainer_servername_statement . "',
`specialsettings` = '" . $db->escape($specialsettings) . "',
`ssl` = '" . (int)$ssl . "',
`ssl_cert_file` = '" . $db->escape($ssl_cert_file) . "',
`ssl_key_file` = '" . $db->escape($ssl_key_file) . "',
`ssl_ca_file` = '" . $db->escape($ssl_ca_file) . "',
`ssl_cert_chainfile` = '" . $db->escape($ssl_cert_chainfile) . "',
`default_vhostconf_domain` = '" . $db->escape($default_vhostconf_domain) . "',
`docroot` = '" . $db->escape($docroot) . "';
");
if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
{ {
@@ -252,29 +204,17 @@ if($page == 'ipsandports'
$log->logAction(ADM_ACTION, LOG_WARNING, "added IP/port '" . $ip . ":" . $port . "'"); $log->logAction(ADM_ACTION, LOG_WARNING, "added IP/port '" . $ip . ":" . $port . "'");
inserttask('1'); inserttask('1');
// Using nameserver, insert a task which rebuilds the server config
inserttask('4'); inserttask('4');
redirectTo($filename, Array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} }
} }
else else
{ {
/*
$enable_ssl = makeyesno('ssl', '1', '0', '0'); $enable_ssl = makeyesno('ssl', '1', '0', '0');
$listen_statement = makeyesno('listen_statement', '1', '0', '1'); $listen_statement = makeyesno('listen_statement', '1', '0', '1');
$namevirtualhost_statement = makeyesno('namevirtualhost_statement', '1', '0', '1'); $namevirtualhost_statement = makeyesno('namevirtualhost_statement', '1', '0', '1');
$vhostcontainer = makeyesno('vhostcontainer', '1', '0', '1'); $vhostcontainer = makeyesno('vhostcontainer', '1', '0', '1');
$vhostcontainer_servername_statement = makeyesno('vhostcontainer_servername_statement', '1', '0', '1'); $vhostcontainer_servername_statement = makeyesno('vhostcontainer_servername_statement', '1', '0', '1');
*/
$ipsandports_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/ipsandports/formfield.ipsandports_add.php';
$ipsandports_add_form = htmlform::genHTMLForm($ipsandports_add_data);
$title = $ipsandports_add_data['ipsandports_add']['title'];
$image = $ipsandports_add_data['ipsandports_add']['image'];
eval("echo \"" . getTemplate("ipsandports/ipsandports_add") . "\";"); eval("echo \"" . getTemplate("ipsandports/ipsandports_add") . "\";");
} }
} }
@@ -292,34 +232,16 @@ if($page == 'ipsandports'
$port = validate($_POST['port'], 'port', '/^(([1-9])|([1-9][0-9])|([1-9][0-9][0-9])|([1-9][0-9][0-9][0-9])|([1-5][0-9][0-9][0-9][0-9])|(6[0-4][0-9][0-9][0-9])|(65[0-4][0-9][0-9])|(655[0-2][0-9])|(6553[0-5]))$/Di', array('stringisempty', 'myport')); $port = validate($_POST['port'], 'port', '/^(([1-9])|([1-9][0-9])|([1-9][0-9][0-9])|([1-9][0-9][0-9][0-9])|([1-5][0-9][0-9][0-9][0-9])|(6[0-4][0-9][0-9][0-9])|(65[0-4][0-9][0-9])|(655[0-2][0-9])|(6553[0-5]))$/Di', array('stringisempty', 'myport'));
$result_checkfordouble = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($ip) . "' AND `port`='" . (int)$port . "'"); $result_checkfordouble = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($ip) . "' AND `port`='" . (int)$port . "'");
$result_sameipotherport = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($result['ip']) . "' AND `id`!='" . (int)$id . "'"); $result_sameipotherport = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($result['ip']) . "' AND `id`!='" . (int)$id . "'");
$listen_statement = isset($_POST['listen_statement']) ? 1 : 0; $listen_statement = intval($_POST['listen_statement']);
$namevirtualhost_statement = isset($_POST['namevirtualhost_statement']) ? 1 : 0; $namevirtualhost_statement = intval($_POST['namevirtualhost_statement']);
$vhostcontainer = isset($_POST['vhostcontainer']) ? 1 : 0; $vhostcontainer = intval($_POST['vhostcontainer']);
$specialsettings = validate(str_replace("\r\n", "\n", $_POST['specialsettings']), 'specialsettings', '/^[^\0]*$/'); $specialsettings = validate(str_replace("\r\n", "\n", $_POST['specialsettings']), 'specialsettings', '/^[^\0]*$/');
$vhostcontainer_servername_statement = isset($_POST['vhostcontainer_servername_statement']) ? 1 : 0; $vhostcontainer_servername_statement = intval($_POST['vhostcontainer_servername_statement']);
$ssl = intval($_POST['ssl']);
$ssl_cert_file = validate($_POST['ssl_cert_file'], 'ssl_cert_file');
$ssl_key_file = validate($_POST['ssl_key_file'], 'ssl_key_file');
$ssl_ca_file = validate($_POST['ssl_ca_file'], 'ssl_ca_file');
$default_vhostconf_domain = validate(str_replace("\r\n", "\n", $_POST['default_vhostconf_domain']), 'default_vhostconf_domain', '/^[^\0]*$/'); $default_vhostconf_domain = validate(str_replace("\r\n", "\n", $_POST['default_vhostconf_domain']), 'default_vhostconf_domain', '/^[^\0]*$/');
$docroot = validate($_POST['docroot'], 'docroot');
if((int)$settings['system']['use_ssl'] == 1
/*
* check here if ssl is even checked, cause if not, we don't need
* to validate and set all the $ssl_*_file vars
*/
&& isset($_POST['ssl'])
&& $_POST['ssl'] != 0
) {
$ssl = 1;
$ssl_cert_file = validate($_POST['ssl_cert_file'], 'ssl_cert_file');
$ssl_key_file = validate($_POST['ssl_key_file'], 'ssl_key_file');
$ssl_ca_file = validate($_POST['ssl_ca_file'], 'ssl_ca_file');
$ssl_cert_chainfile = validate($_POST['ssl_cert_chainfile'], 'ssl_cert_chainfile');
} else {
$ssl = 0;
$ssl_cert_file = '';
$ssl_key_file = '';
$ssl_ca_file = '';
$ssl_cert_chainfile = '';
}
if($listen_statement != '1') if($listen_statement != '1')
{ {
@@ -361,20 +283,6 @@ if($page == 'ipsandports'
$ssl_ca_file = makeCorrectFile($ssl_ca_file); $ssl_ca_file = makeCorrectFile($ssl_ca_file);
} }
if($ssl_cert_chainfile != '')
{
$ssl_cert_chainfile = makeCorrectFile($ssl_cert_chainfile);
}
if(strlen(trim($docroot)) > 0)
{
$docroot = makeCorrectDir($docroot);
}
else
{
$docroot = '';
}
if($result['ip'] != $ip if($result['ip'] != $ip
&& $result['ip'] == $settings['system']['ipaddress'] && $result['ip'] == $settings['system']['ipaddress']
&& $result_sameipotherport['id'] == '') && $result_sameipotherport['id'] == '')
@@ -388,52 +296,21 @@ if($page == 'ipsandports'
} }
else else
{ {
$db->query("UPDATE `" . TABLE_PANEL_IPSANDPORTS . "` SET `ip`='" . $db->escape($ip) . "', `port`='" . (int)$port . "', `listen_statement`='" . (int)$listen_statement . "', `namevirtualhost_statement`='" . (int)$namevirtualhost_statement . "', `vhostcontainer`='" . (int)$vhostcontainer . "', `vhostcontainer_servername_statement`='" . (int)$vhostcontainer_servername_statement . "', `specialsettings`='" . $db->escape($specialsettings) . "', `ssl`='" . (int)$ssl . "', `ssl_cert_file`='" . $db->escape($ssl_cert_file) . "', `ssl_key_file`='" . $db->escape($ssl_key_file) . "', `ssl_ca_file`='" . $db->escape($ssl_ca_file) . "', `default_vhostconf_domain`='" . $db->escape($default_vhostconf_domain) . "' WHERE `id`='" . (int)$id . "'");
$db->query("UPDATE `" . TABLE_PANEL_IPSANDPORTS . "`
SET
`ip` = '" . $db->escape($ip) . "',
`port` = '" . (int)$port . "',
`listen_statement` = '" . (int)$listen_statement . "',
`namevirtualhost_statement` = '" . (int)$namevirtualhost_statement . "',
`vhostcontainer` = '" . (int)$vhostcontainer . "',
`vhostcontainer_servername_statement` = '" . (int)$vhostcontainer_servername_statement . "',
`specialsettings` = '" . $db->escape($specialsettings) . "',
`ssl` = '" . (int)$ssl . "',
`ssl_cert_file` = '" . $db->escape($ssl_cert_file) . "',
`ssl_key_file` = '" . $db->escape($ssl_key_file) . "',
`ssl_ca_file` = '" . $db->escape($ssl_ca_file) . "',
`ssl_cert_chainfile` = '" . $db->escape($ssl_cert_chainfile) . "',
`default_vhostconf_domain` = '" . $db->escape($default_vhostconf_domain) . "',
`docroot` = '" . $db->escape($docroot) . "'
WHERE `id`='" . (int)$id . "'
");
$log->logAction(ADM_ACTION, LOG_WARNING, "changed IP/port from '" . $result['ip'] . ":" . $result['port'] . "' to '" . $ip . ":" . $port . "'"); $log->logAction(ADM_ACTION, LOG_WARNING, "changed IP/port from '" . $result['ip'] . ":" . $result['port'] . "' to '" . $ip . ":" . $port . "'");
inserttask('1'); inserttask('1');
// Using nameserver, insert a task which rebuilds the server config
inserttask('4'); inserttask('4');
redirectTo($filename, Array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} }
} }
else else
{ {
$result = htmlentities_array($result);
/*
$enable_ssl = makeyesno('ssl', '1', '0', $result['ssl']); $enable_ssl = makeyesno('ssl', '1', '0', $result['ssl']);
$result = htmlentities_array($result);
$listen_statement = makeyesno('listen_statement', '1', '0', $result['listen_statement']); $listen_statement = makeyesno('listen_statement', '1', '0', $result['listen_statement']);
$namevirtualhost_statement = makeyesno('namevirtualhost_statement', '1', '0', $result['namevirtualhost_statement']); $namevirtualhost_statement = makeyesno('namevirtualhost_statement', '1', '0', $result['namevirtualhost_statement']);
$vhostcontainer = makeyesno('vhostcontainer', '1', '0', $result['vhostcontainer']); $vhostcontainer = makeyesno('vhostcontainer', '1', '0', $result['vhostcontainer']);
$vhostcontainer_servername_statement = makeyesno('vhostcontainer_servername_statement', '1', '0', $result['vhostcontainer_servername_statement']); $vhostcontainer_servername_statement = makeyesno('vhostcontainer_servername_statement', '1', '0', $result['vhostcontainer_servername_statement']);
*/
$ipsandports_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/ipsandports/formfield.ipsandports_edit.php';
$ipsandports_edit_form = htmlform::genHTMLForm($ipsandports_edit_data);
$title = $ipsandports_edit_data['ipsandports_edit']['title'];
$image = $ipsandports_edit_data['ipsandports_edit']['image'];
eval("echo \"" . getTemplate("ipsandports/ipsandports_edit") . "\";"); eval("echo \"" . getTemplate("ipsandports/ipsandports_edit") . "\";");
} }
} }

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
@@ -22,17 +22,19 @@ define('AREA', 'admin');
/** /**
* Include our init.php, which manages Sessions, Language etc. * Include our init.php, which manages Sessions, Language etc.
*/ */
require('./lib/init.php');
if ($page == 'log' require ("./lib/init.php");
&& $userinfo['change_serversettings'] == '1'
) { if($page == 'log'
if ($action == '') { && $userinfo['change_serversettings'] == '1')
{
if($action == '')
{
$fields = array( $fields = array(
'action' => $lng['logger']['action'],
'date' => $lng['logger']['date'], 'date' => $lng['logger']['date'],
'type' => $lng['logger']['type'], 'type' => $lng['logger']['type'],
'user' => $lng['logger']['user'], 'user' => $lng['logger']['user']
'text' => $lng['logger']['action']
); );
$paging = new paging($userinfo, $db, TABLE_PANEL_LOG, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']); $paging = new paging($userinfo, $db, TABLE_PANEL_LOG, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$paging->sortfield = 'date'; $paging->sortfield = 'date';
@@ -45,21 +47,24 @@ if ($page == 'log'
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s); $pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$clog = array(); $clog = array();
while ($row = $db->fetch_array($result)) { while($row = $db->fetch_array($result))
if (!isset($clog[$row['action']]) {
|| !is_array($clog[$row['action']]) if(!isset($clog[$row['action']])
) { || !is_array($clog[$row['action']]))
{
$clog[$row['action']] = array(); $clog[$row['action']] = array();
} }
$clog[$row['action']][$row['logid']] = $row; $clog[$row['action']][$row['logid']] = $row;
} }
if ($paging->sortfield == 'date' if($paging->sortfield == 'date'
&& $paging->sortorder == 'desc' && $paging->sortorder == 'desc')
) { {
krsort($clog); krsort($clog);
} else { }
else
{
ksort($clog); ksort($clog);
} }
@@ -67,15 +72,20 @@ if ($page == 'log'
$count = 0; $count = 0;
$log_count = 0; $log_count = 0;
$log = ''; $log = '';
foreach ($clog as $action => $logrows) { foreach($clog as $action => $logrows)
{
$_action = 0; $_action = 0;
foreach ($logrows as $row) { foreach($logrows as $row)
if ($paging->checkDisplay($i)) { {
if($paging->checkDisplay($i))
{
$row = htmlentities_array($row); $row = htmlentities_array($row);
$row['date'] = date("d.m.y H:i:s", $row['date']); $row['date'] = date("d.m.y H:i:s", $row['date']);
if ($_action != $action) { if($_action != $action)
switch ($action) { {
switch($action)
{
case USR_ACTION: case USR_ACTION:
$_action = $lng['admin']['customer']; $_action = $lng['admin']['customer'];
break; break;
@@ -97,14 +107,15 @@ if ($page == 'log'
} }
$row['action'] = $_action; $row['action'] = $_action;
eval("\$log.=\"" . getTemplate('logger/logger_action') . "\";"); eval("\$log.=\"" . getTemplate("logger/logger_action") . "\";");
} }
$log_count++; $log_count++;
$type = $row['type']; $type = $row['type'];
$_type = 'unknown'; $_type = 'unknown';
switch ($type) { switch($type)
{
case LOG_INFO: case LOG_INFO:
$_type = 'Information'; $_type = 'Information';
break; break;
@@ -126,28 +137,35 @@ if ($page == 'log'
} }
$row['type'] = $_type; $row['type'] = $_type;
eval("\$log.=\"" . getTemplate('logger/logger_log') . "\";"); eval("\$log.=\"" . getTemplate("logger/logger_log") . "\";");
$count++; $count++;
$_action = $action; $_action = $action;
} }
} }
$i++; $i++;
} }
eval("echo \"" . getTemplate('logger/logger') . "\";"); eval("echo \"" . getTemplate("logger/logger") . "\";");
} elseif ($action == 'truncate') { }
if (isset($_POST['send']) elseif($action == 'truncate')
&& $_POST['send'] == 'send' {
) { if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$yesterday = time() - (60 * 10); $yesterday = time() - (60 * 10);
/* (60*60*24); */ /* (60*60*24); */
$db->query("DELETE FROM `" . TABLE_PANEL_LOG . "` WHERE `date` < '" . $yesterday . "'"); $db->query("DELETE FROM `" . TABLE_PANEL_LOG . "` WHERE `date` < '" . $yesterday . "'");
$log->logAction(ADM_ACTION, LOG_WARNING, 'truncated the system-log (mysql)'); $log->logAction(ADM_ACTION, LOG_WARNING, "truncated the system-log (mysql)");
redirectTo($filename, Array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} else { }
else
{
ask_yesno('logger_reallytruncate', $filename, array('page' => $page, 'action' => $action), TABLE_PANEL_LOG); ask_yesno('logger_reallytruncate', $filename, array('page' => $page, 'action' => $action), TABLE_PANEL_LOG);
} }
} }
} }
?>

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
@@ -22,60 +22,79 @@ define('AREA', 'admin');
/** /**
* Include our init.php, which manages Sessions, Language etc. * Include our init.php, which manages Sessions, Language etc.
*/ */
require('./lib/init.php');
if (isset($_POST['id'])) { require ("./lib/init.php");
if(isset($_POST['id']))
{
$id = intval($_POST['id']); $id = intval($_POST['id']);
} elseif (isset($_GET['id'])) { }
elseif(isset($_GET['id']))
{
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
if ($page == 'message') { if($page == 'message')
if ($action == '') { {
$log->logAction(ADM_ACTION, LOG_NOTICE, 'viewed panel_message'); if($action == '')
{
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed panel_message");
if (isset($_POST['send']) if(isset($_POST['send'])
&& $_POST['send'] == 'send' && $_POST['send'] == 'send')
) { {
if ($_POST['receipient'] == 0 if($_POST['receipient'] == 0
&& $userinfo['customers_see_all'] == '1' && $userinfo['customers_see_all'] == '1')
) { {
$log->logAction(ADM_ACTION, LOG_NOTICE, 'sending messages to admins'); $log->logAction(ADM_ACTION, LOG_NOTICE, "sending messages to admins");
$result = $db->query('SELECT `name`, `email` FROM `' . TABLE_PANEL_ADMINS . "`"); $result = $db->query('SELECT `name`, `email` FROM `' . TABLE_PANEL_ADMINS . "`");
} elseif ($_POST['receipient'] == 1) { }
if ($userinfo['customers_see_all'] == '1') { elseif($_POST['receipient'] == 1)
$log->logAction(ADM_ACTION, LOG_NOTICE, 'sending messages to ALL customers'); {
if($userinfo['customers_see_all'] == "1")
{
$log->logAction(ADM_ACTION, LOG_NOTICE, "sending messages to ALL customers");
$result = $db->query('SELECT `firstname`, `name`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "`"); $result = $db->query('SELECT `firstname`, `name`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "`");
} else { }
$log->logAction(ADM_ACTION, LOG_NOTICE, 'sending messages to customers'); else
{
$log->logAction(ADM_ACTION, LOG_NOTICE, "sending messages to customers");
$result = $db->query('SELECT `firstname`, `name`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "` WHERE `adminid`='" . $userinfo['adminid'] . "'"); $result = $db->query('SELECT `firstname`, `name`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "` WHERE `adminid`='" . $userinfo['adminid'] . "'");
} }
} else { }
else
{
standard_error('noreceipientsgiven'); standard_error('noreceipientsgiven');
} }
$subject = $_POST['subject']; $subject = $_POST['subject'];
$message = wordwrap($_POST['message'], 70); $message = wordwrap($_POST['message'], 70);
if (!empty($message)) { if(!empty($message))
{
$mailcounter = 0; $mailcounter = 0;
$mail->Body = $message; $mail->Body = $message;
$mail->Subject = $subject; $mail->Subject = $subject;
while ($row = $db->fetch_array($result)) { while($row = $db->fetch_array($result))
{
$mail->AddAddress($row['email'], (isset($row['firstname']) ? $row['firstname'] . ' ' : '') . $row['name']); $mail->AddAddress($row['email'], (isset($row['firstname']) ? $row['firstname'] . ' ' : '') . $row['name']);
$mail->From = $userinfo['email']; $mail->From = $userinfo['email'];
$mail->FromName = (isset($userinfo['firstname']) ? $userinfo['firstname'] . ' ' : '') . $userinfo['name']; $mail->FromName = (isset($userinfo['firstname']) ? $userinfo['firstname'] . ' ' : '') . $userinfo['name'];
if (!$mail->Send()) { if(!$mail->Send())
if ($mail->ErrorInfo != '') { {
if($mail->ErrorInfo != '')
{
$mailerr_msg = $mail->ErrorInfo; $mailerr_msg = $mail->ErrorInfo;
} else { }
$mailerr_msg = $row['email']; else
{
$mailerr_msg = $row["email"];
} }
$log->logAction(ADM_ACTION, LOG_ERR, 'Error sending mail: ' . $mailerr_msg); $log->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
standard_error('errorsendingmail', $row['email']); standard_error('errorsendingmail', $row["email"]);
} }
$mailcounter++; $mailcounter++;
@@ -83,34 +102,47 @@ if ($page == 'message') {
} }
redirectTo($filename, Array('page' => $page, 's' => $s, 'action' => 'showsuccess', 'sentitems' => $mailcounter)); redirectTo($filename, Array('page' => $page, 's' => $s, 'action' => 'showsuccess', 'sentitems' => $mailcounter));
} else { }
else
{
standard_error('nomessagetosend'); standard_error('nomessagetosend');
} }
} }
} }
if ($action == 'showsuccess') { if($action == 'showsuccess')
{
$success = 1; $success = 1;
$sentitems = isset($_GET['sentitems']) ? (int)$_GET['sentitems'] : 0; $sentitems = isset($_GET['sentitems']) ? (int)$_GET['sentitems'] : 0;
if ($sentitems == 0) { if($sentitems == 0)
{
$successmessage = $lng['message']['noreceipients']; $successmessage = $lng['message']['noreceipients'];
} else { }
else
{
$successmessage = str_replace('%s', $sentitems, $lng['message']['success']); $successmessage = str_replace('%s', $sentitems, $lng['message']['success']);
} }
} else {
$action = '';
}
else
{
$success = 0; $success = 0;
$sentitems = 0; $sentitems = 0;
$successmessage = ''; $successmessage = '';
$action = '';
} }
$action = '';
$receipients = ''; $receipients = '';
if ($userinfo['customers_see_all'] == '1') { if($userinfo['customers_see_all'] == "1")
{
$receipients.= makeoption($lng['panel']['reseller'], 0); $receipients.= makeoption($lng['panel']['reseller'], 0);
} }
$receipients .= makeoption($lng['panel']['customer'], 1); $receipients.= makeoption($lng['panel']['customer'], 1);
eval("echo \"" . getTemplate('message/message') . "\";"); eval("echo \"" . getTemplate("message/message") . "\";");
} }
?>

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
@@ -25,58 +25,49 @@ define('AREA', 'admin');
require ("./lib/init.php"); require ("./lib/init.php");
if (isset($_POST['id'])) { if(isset($_POST['id']))
{
$id = intval($_POST['id']); $id = intval($_POST['id']);
} elseif (isset($_GET['id'])) { }
elseif(isset($_GET['id']))
{
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
if ($page == 'overview') { if($page == 'overview')
{
if ($action == '') { if($action == '')
{
$tablecontent = ''; $tablecontent = '';
$count = 0;
$result = $db->query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "`"); $result = $db->query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "`");
while ($row = $db->fetch_array($result)) { while($row = $db->fetch_array($result))
{
$domainresult = false; $domainresult = false;
$query = "SELECT * FROM `".TABLE_PANEL_DOMAINS."` if((int)$userinfo['domains_see_all'] == 0)
WHERE `phpsettingid` = '".(int)$row['id']."' {
AND `parentdomainid` = '0'"; $domainresult = $db->query("SELECT * FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `adminid` = " . (int)$userinfo['userid'] . " AND `phpsettingid` = " . (int)$row['id']);
if ((int)$userinfo['domains_see_all'] == 0) {
$query .= " AND `adminid` = '".(int)$userinfo['userid']."'";
} }
else
if ((int)$settings['panel']['phpconfigs_hidestdsubdomain'] == 1) { {
$query2 = "SELECT DISTINCT `standardsubdomain` $domainresult = $db->query("SELECT * FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `phpsettingid` = " . (int)$row['id']);
FROM `".TABLE_PANEL_CUSTOMERS."`
WHERE `standardsubdomain` > 0 ORDER BY `standardsubdomain` ASC;";
$ssdids_res = $db->query($query2);
$ssdids = array();
while ($ssd = $db->fetch_array($ssdids_res)) {
$ssdids[] = $ssd['standardsubdomain'];
}
if (count($ssdids) > 0) {
$query .= " AND `id` NOT IN (".implode(', ', $ssdids).")";
}
} }
$domainresult = $db->query($query);
$domains = ''; $domains = '';
if ($db->num_rows($domainresult) > 0) {
while ($row2 = $db->fetch_array($domainresult)) { if($db->num_rows($domainresult) > 0)
{
while($row2 = $db->fetch_array($domainresult))
{
$domains.= $row2['domain'] . '<br/>'; $domains.= $row2['domain'] . '<br/>';
} }
} else { }
else
{
$domains = $lng['admin']['phpsettings']['notused']; $domains = $lng['admin']['phpsettings']['notused'];
} }
$count ++;
eval("\$tablecontent.=\"" . getTemplate("phpconfig/overview_overview") . "\";"); eval("\$tablecontent.=\"" . getTemplate("phpconfig/overview_overview") . "\";");
} }
@@ -112,13 +103,6 @@ if ($page == 'overview') {
else else
{ {
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = 1"); $result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = 1");
$phpconfig_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php';
$phpconfig_add_form = htmlform::genHTMLForm($phpconfig_add_data);
$title = $phpconfig_add_data['phpconfig_add']['title'];
$image = $phpconfig_add_data['phpconfig_add']['image'];
eval("echo \"" . getTemplate("phpconfig/overview_add") . "\";"); eval("echo \"" . getTemplate("phpconfig/overview_add") . "\";");
} }
} }
@@ -188,12 +172,6 @@ if ($page == 'overview') {
} }
else else
{ {
$phpconfig_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php';
$phpconfig_edit_form = htmlform::genHTMLForm($phpconfig_edit_data);
$title = $phpconfig_edit_data['phpconfig_edit']['title'];
$image = $phpconfig_edit_data['phpconfig_edit']['image'];
eval("echo \"" . getTemplate("phpconfig/overview_edit") . "\";"); eval("echo \"" . getTemplate("phpconfig/overview_edit") . "\";");
} }
} }

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
@@ -65,11 +65,6 @@ if(($page == 'settings' || $page == 'overview')
$only_enabledisable = true; $only_enabledisable = true;
} }
// check if the session timeout is too low #815
if (isset($_POST['session_sessiontimeout']) && $_POST['session_sessiontimeout'] <= 60) {
standard_error($lng['error']['session_timeout'], $lng['error']['session_timeout_desc']);
}
if(processFormEx( if(processFormEx(
$settings_data, $settings_data,
$_POST, $_POST,
@@ -80,11 +75,6 @@ if(($page == 'settings' || $page == 'overview')
$only_enabledisable $only_enabledisable
) )
) { ) {
$log->logAction(ADM_ACTION, LOG_INFO, "rebuild configfiles due to changed setting");
inserttask('1');
// Using nameserver, insert a task which rebuilds the server config
inserttask('4');
standard_success('settingssaved', '', array('filename' => $filename, 'action' => $action, 'page' => $page)); standard_success('settingssaved', '', array('filename' => $filename, 'action' => $action, 'page' => $page));
} }
} }
@@ -115,50 +105,6 @@ if(($page == 'settings' || $page == 'overview')
} }
} }
elseif($page == 'phpinfo'
&& $userinfo['change_serversettings'] == '1'
) {
ob_start();
phpinfo();
$phpinfo = array('phpinfo' => array());
if (preg_match_all(
'#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>)?)?</tr>)#s',
ob_get_clean(), $matches, PREG_SET_ORDER
)
) {
foreach ($matches as $match) {
$end = array_keys($phpinfo);
$end = end($end);
if (strlen($match[1])) {
$phpinfo[$match[1]] = array();
} elseif (isset($match[3])) {
$phpinfo[$end][$match[2]] = isset($match[4]) ? array($match[3], $match[4]) : $match[3];
} else {
$phpinfo[$end][] = $match[2];
}
}
$phpinfohtml = '';
foreach ($phpinfo as $name => $section) {
$phpinfoentries = "";
foreach ($section as $key => $val) {
if (is_array($val)) {
eval("\$phpinfoentries .= \"" . getTemplate("settings/phpinfo/phpinfo_3") . "\";");
} elseif (is_string($key)) {
eval("\$phpinfoentries .= \"" . getTemplate("settings/phpinfo/phpinfo_2") . "\";");
} else {
eval("\$phpinfoentries .= \"" . getTemplate("settings/phpinfo/phpinfo_1") . "\";");
}
}
// first header -> show actual php version
if (strtolower($name) == "phpinfo") {
$name = "PHP ".PHP_VERSION;
}
eval("\$phpinfohtml .= \"" . getTemplate("settings/phpinfo/phpinfo_table") . "\";");
}
$phpinfo = $phpinfohtml;
}
eval("echo \"" . getTemplate("settings/phpinfo") . "\";");
}
elseif($page == 'rebuildconfigs' elseif($page == 'rebuildconfigs'
&& $userinfo['change_serversettings'] == '1') && $userinfo['change_serversettings'] == '1')
{ {
@@ -167,11 +113,9 @@ elseif($page == 'rebuildconfigs'
{ {
$log->logAction(ADM_ACTION, LOG_INFO, "rebuild configfiles"); $log->logAction(ADM_ACTION, LOG_INFO, "rebuild configfiles");
inserttask('1'); inserttask('1');
inserttask('10');
// Using nameserver, insert a task which rebuilds the server config
inserttask('4'); inserttask('4');
inserttask('5');
standard_success('rebuildingconfigs', '', array('filename' => 'admin_index.php')); redirectTo('admin_index.php', array('s' => $s));
} }
else else
{ {
@@ -271,3 +215,5 @@ elseif($page == 'enforcequotas'
ask_yesno('admin_quotas_reallyenforce', $filename, array('page' => $page)); ask_yesno('admin_quotas_reallyenforce', $filename, array('page' => $page));
} }
} }
?>

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
@@ -48,28 +48,13 @@ elseif(isset($_GET['id']))
$available_templates = array( $available_templates = array(
'createcustomer', 'createcustomer',
'pop_success', 'pop_success',
'new_database_by_customer', 'trafficninetypercent',
'new_ftpaccount_by_customer', 'new_ticket_by_customer',
'password_reset' 'new_ticket_for_customer',
'new_ticket_by_staff',
'new_reply_ticket_by_customer',
'new_reply_ticket_by_staff'
); );
// only show templates of features that are enabled #1191
if ((int)$settings['system']['report_enable'] == 1) {
array_push($available_templates,
'trafficmaxpercent',
'diskmaxpercent'
);
}
if ((int)$settings['ticket']['enabled'] == 1) {
array_push($available_templates,
'new_ticket_by_customer',
'new_ticket_for_customer',
'new_ticket_by_staff',
'new_reply_ticket_by_customer',
'new_reply_ticket_by_staff'
);
}
$file_templates = array( $file_templates = array(
'index_html' 'index_html'
); );
@@ -163,7 +148,7 @@ elseif($action == 'delete'
} }
} }
} }
elseif($action == 'deletef' elseif($action == 'delete'
&& $id != 0) && $id != 0)
{ {
//file templates //file templates
@@ -220,12 +205,6 @@ elseif($action == 'add')
$template_options.= makeoption($lng['admin']['templates'][$template], $template, NULL, true); $template_options.= makeoption($lng['admin']['templates'][$template], $template, NULL, true);
} }
$template_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/templates/formfield.template_add.php';
$template_add_form = htmlform::genHTMLForm($template_add_data);
$title = $template_add_data['template_add']['title'];
$image = $template_add_data['template_add']['image'];
eval("echo \"" . getTemplate("templates/templates_add_2") . "\";"); eval("echo \"" . getTemplate("templates/templates_add_2") . "\";");
} }
elseif(isset($_POST['send']) elseif(isset($_POST['send'])
@@ -329,12 +308,6 @@ elseif($action == 'add')
$free_templates.= makeoption($lng['admin']['templates'][$template], $template, '', true); $free_templates.= makeoption($lng['admin']['templates'][$template], $template, '', true);
} }
$filetemplate_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/templates/formfield.filetemplate_add.php';
$filetemplate_add_form = htmlform::genHTMLForm($filetemplate_add_data);
$title = $filetemplate_add_data['filetemplate_add']['title'];
$image = $filetemplate_add_data['filetemplate_add']['image'];
eval("echo \"" . getTemplate("templates/filetemplates_add") . "\";"); eval("echo \"" . getTemplate("templates/filetemplates_add") . "\";");
} }
} }
@@ -367,18 +340,11 @@ elseif($action == 'edit'
$result = $db->query_first("SELECT `language`, `varname`, `value` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `id`='$mailbodyid'"); $result = $db->query_first("SELECT `language`, `varname`, `value` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `id`='$mailbodyid'");
$result = htmlentities_array($result); $result = htmlentities_array($result);
$mailbody = $result['value']; $mailbody = $result['value'];
$template_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/templates/formfield.template_edit.php';
$template_edit_form = htmlform::genHTMLForm($template_edit_data);
$title = $template_edit_data['template_edit']['title'];
$image = $template_edit_data['template_edit']['image'];
eval("echo \"" . getTemplate("templates/templates_edit") . "\";"); eval("echo \"" . getTemplate("templates/templates_edit") . "\";");
} }
} }
} }
elseif($action == 'editf' elseif($action == 'edit'
&& $id != 0) && $id != 0)
{ {
//file templates //file templates
@@ -402,13 +368,6 @@ elseif($action == 'editf'
else else
{ {
$row = htmlentities_array($row); $row = htmlentities_array($row);
$filetemplate_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/templates/formfield.filetemplate_edit.php';
$filetemplate_edit_form = htmlform::genHTMLForm($filetemplate_edit_data);
$title = $filetemplate_edit_data['filetemplate_edit']['title'];
$image = $filetemplate_edit_data['filetemplate_edit']['image'];
eval("echo \"" . getTemplate("templates/filetemplates_edit") . "\";"); eval("echo \"" . getTemplate("templates/filetemplates_edit") . "\";");
} }
} }
@@ -418,3 +377,5 @@ elseif($action == 'editf'
exit; exit;
} }
} }
?>

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
@@ -32,22 +32,6 @@ if(isset($_POST['id']))
elseif(isset($_GET['id'])) elseif(isset($_GET['id']))
{ {
$id = intval($_GET['id']); $id = intval($_GET['id']);
// only check if this is not a category-id
if (!isset($_GET['page']) || (isset($_GET['page']) && $_GET['page'] != 'categories')) {
if (!$userinfo['customers_see_all']) {
/*
* Check if the current user is allowed to see the current ticket.
*/
$sql = "SELECT `id` FROM `panel_tickets` WHERE `id` = '".$id."' AND `adminid` = '".$userinfo['admindid']."'";
$result = $db->query_first($sql);
if ($result == null) {
// no rights to see the requested ticket
standard_error(array('ticketnotaccessible'));
}
}
}
} }
if($page == 'tickets' if($page == 'tickets'
@@ -72,7 +56,7 @@ if($page == 'tickets'
$paging = new paging($userinfo, $db, TABLE_PANEL_TICKETS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']); $paging = new paging($userinfo, $db, TABLE_PANEL_TICKETS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$paging->sortfield = 'lastchange'; $paging->sortfield = 'lastchange';
$paging->sortorder = 'desc'; $paging->sortorder = 'desc';
$result = $db->query('SELECT `main`.`id`, `main`.`customerid`, (SELECT COUNT(`sub`.`id`) FROM `' . TABLE_PANEL_TICKETS . '` `sub` WHERE `sub`.`answerto` = `main`.`id`) as `ticket_answers`, `main`.`lastchange`, `main`.`subject`, `main`.`status`, `main`.`lastreplier`, `main`.`priority` FROM `' . TABLE_PANEL_TICKETS . '` as `main` WHERE `main`.`answerto` = "0" AND `archived` = "0" ' . ($userinfo['customers_see_all'] ? '' : ' AND `adminid` = "' . (int)$userinfo['adminid'] . '"') . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()); $result = $db->query('SELECT `main`.`id`, `main`.`customerid`, (SELECT COUNT(`sub`.`id`) FROM `' . TABLE_PANEL_TICKETS . '` `sub` WHERE `sub`.`answerto` = `main`.`id`) as `ticket_answers`, `main`.`lastchange`, `main`.`subject`, `main`.`status`, `main`.`lastreplier`, `main`.`priority` FROM `' . TABLE_PANEL_TICKETS . '` as `main` WHERE `main`.`answerto` = "0" AND `archived` = "0" AND `adminid` = "' . (int)$userinfo['adminid'] . '" ' . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
$paging->setEntries($db->num_rows($result)); $paging->setEntries($db->num_rows($result));
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
@@ -118,20 +102,16 @@ if($page == 'tickets'
if($_cid != $row['customerid']) if($_cid != $row['customerid'])
{ {
$cid = $row['customerid']; $cid = $row['customerid'];
$usr = $db->query_first('SELECT `customerid`, `firstname`, `name`, `company`, `loginname` FROM `' . TABLE_PANEL_CUSTOMERS . '` $usr = $db->query_first('SELECT `firstname`, `name`, `company`, `loginname` FROM `' . TABLE_PANEL_CUSTOMERS . '`
WHERE `customerid` = "' . (int)$cid . '"'); WHERE `customerid` = "' . (int)$cid . '"');
if(isset($usr['loginname'])) if(isset($usr['loginname'])) {
{ $customer = getCorrectFullUserDetails($usr) . ' (' . $usr['loginname'] . ')';
$customer = getCorrectFullUserDetails($usr); //$customer = $usr['firstname'] . " " . $usr['name'] . " (" . $usr['loginname'] . ")";
$customerloginname = $usr['loginname']; } else {
$customerid = $usr['customerid'];
}
else
{
$customer = $lng['ticket']['nonexistingcustomer']; $customer = $lng['ticket']['nonexistingcustomer'];
} }
eval("\$tickets.=\"" . getTemplate("tickets/tickets_customer") . "\";"); eval("\$tickets.=\"" . getTemplate("ticket/tickets_customer") . "\";");
} }
$tickets_count++; $tickets_count++;
@@ -160,13 +140,12 @@ if($page == 'tickets'
$cananswer = 1; $cananswer = 1;
} }
$row['subject'] = html_entity_decode($row['subject']);
if(strlen($row['subject']) > 20) if(strlen($row['subject']) > 20)
{ {
$row['subject'] = substr($row['subject'], 0, 17) . '...'; $row['subject'] = substr($row['subject'], 0, 17) . '...';
} }
eval("\$tickets.=\"" . getTemplate("tickets/tickets_tickets") . "\";"); eval("\$tickets.=\"" . getTemplate("ticket/tickets_tickets") . "\";");
$count++; $count++;
$_cid = $row['customerid']; $_cid = $row['customerid'];
} }
@@ -175,7 +154,7 @@ if($page == 'tickets'
$i++; $i++;
} }
eval("echo \"" . getTemplate("tickets/tickets") . "\";"); eval("echo \"" . getTemplate("ticket/tickets") . "\";");
} }
elseif($action == 'new') elseif($action == 'new')
{ {
@@ -189,8 +168,8 @@ if($page == 'tickets'
$newticket->Set('subject', validate($_POST['subject'], 'subject'), true, false); $newticket->Set('subject', validate($_POST['subject'], 'subject'), true, false);
$newticket->Set('priority', validate($_POST['priority'], 'priority'), true, false); $newticket->Set('priority', validate($_POST['priority'], 'priority'), true, false);
$newticket->Set('category', validate($_POST['category'], 'category'), true, false); $newticket->Set('category', validate($_POST['category'], 'category'), true, false);
$newticket->Set('customer', (int)$_POST['customer'], true, false); $newticket->Set('customer', validate($_POST['customer'], 'customer'), true, false);
$newticket->Set('message', validate(htmlentities(str_replace("\r\n", "\n", $_POST['message'])), 'message', '/^[^\0]*$/'), true, false); $newticket->Set('message', validate(str_replace("\r\n", "\n", $_POST['message']), 'message', '/^[^\0]*$/'), true, false);
if($newticket->Get('subject') == null) if($newticket->Get('subject') == null)
{ {
@@ -219,16 +198,12 @@ if($page == 'tickets'
else else
{ {
$categories = ''; $categories = '';
$where = ''; $result = $db->query_first('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` WHERE `adminid` = "' . $userinfo['adminid'] . '" ORDER BY `logicalorder`, `name` ASC');
if ($userinfo['tickets_see_all'] != '1') {
$where = 'WHERE `adminid` = "' . $userinfo['adminid'] . '"';
}
$result = $db->query_first('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` '.$where.' ORDER BY `logicalorder`, `name` ASC');
if(isset($result['name']) if(isset($result['name'])
&& $result['name'] != '') && $result['name'] != '')
{ {
$result2 = $db->query('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` '.$where.' ORDER BY `logicalorder`, `name` ASC'); $result2 = $db->query('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` WHERE `adminid` = "' . $userinfo['adminid'] . '" ORDER BY `logicalorder`, `name` ASC');
while($row = $db->fetch_array($result2)) while($row = $db->fetch_array($result2))
{ {
@@ -248,17 +223,10 @@ if($page == 'tickets'
$customers.= makeoption(getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid']); $customers.= makeoption(getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid']);
} }
$priorities = makeoption($lng['ticket']['high'], '1', $settings['ticket']['default_priority']); $priorities = makeoption($lng['ticket']['unf_high'], '1', $settings['ticket']['default_priority']);
$priorities.= makeoption($lng['ticket']['normal'], '2', $settings['ticket']['default_priority']); $priorities.= makeoption($lng['ticket']['unf_normal'], '2', $settings['ticket']['default_priority']);
$priorities.= makeoption($lng['ticket']['low'], '3', $settings['ticket']['default_priority']); $priorities.= makeoption($lng['ticket']['unf_low'], '3', $settings['ticket']['default_priority']);
eval("echo \"" . getTemplate("ticket/tickets_new") . "\";");
$ticket_new_data = include_once dirname(__FILE__).'/lib/formfields/admin/tickets/formfield.ticket_new.php';
$ticket_new_form = htmlform::genHTMLForm($ticket_new_data);
$title = $ticket_new_data['ticket_new']['title'];
$image = $ticket_new_data['ticket_new']['image'];
eval("echo \"" . getTemplate("tickets/tickets_new") . "\";");
} }
} }
else else
@@ -275,7 +243,7 @@ if($page == 'tickets'
$replyticket = ticket::getInstanceOf($userinfo, $db, $settings, -1); $replyticket = ticket::getInstanceOf($userinfo, $db, $settings, -1);
$replyticket->Set('subject', validate($_POST['subject'], 'subject'), true, false); $replyticket->Set('subject', validate($_POST['subject'], 'subject'), true, false);
$replyticket->Set('priority', validate($_POST['priority'], 'priority'), true, false); $replyticket->Set('priority', validate($_POST['priority'], 'priority'), true, false);
$replyticket->Set('message', validate(htmlentities(str_replace("\r\n", "\n", $_POST['message'])), 'message', '/^[^\0]*$/'), true, false); $replyticket->Set('message', validate(str_replace("\r\n", "\n", $_POST['message']), 'message', '/^[^\0]*$/'), true, false);
if($replyticket->Get('message') == null) if($replyticket->Get('message') == null)
{ {
@@ -326,25 +294,18 @@ if($page == 'tickets'
$isclosed = 1; $isclosed = 1;
} }
if ($mainticket->Get('by') == '1') if($mainticket->Get('by') == '1')
{ {
$by = $lng['ticket']['staff']; $by = $lng['ticket']['staff'];
} }
else else
{ {
$cid = $mainticket->Get('customer'); $by = $lng['ticket']['customer'];
$usr = $db->query_first('SELECT `customerid`, `firstname`, `name`, `company`, `loginname`
FROM `' . TABLE_PANEL_CUSTOMERS . '`
WHERE `customerid` = "' . (int)$cid . '"'
);
$by = '<a href="'.$linker->getLink(array('section' => 'customers', 'page' => 'customers', 'action' => 'su', 'id' => $cid)).'" rel="external">';
$by .= getCorrectFullUserDetails($usr).'</a>';
//$by = $lng['ticket']['customer'];
} }
$subject = $mainticket->Get('subject'); $subject = $mainticket->Get('subject');
$message = $mainticket->Get('message'); $message = $mainticket->Get('message');
eval("\$ticket_replies.=\"" . getTemplate("tickets/tickets_tickets_main") . "\";"); eval("\$ticket_replies.=\"" . getTemplate("ticket/tickets_tickets_main") . "\";");
$result = $db->query('SELECT `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` $result = $db->query('SELECT `name` FROM `' . TABLE_PANEL_TICKET_CATS . '`
WHERE `id`="' . (int)$mainticket->Get('category') . '"'); WHERE `id`="' . (int)$mainticket->Get('category') . '"');
$row = $db->fetch_array($result); $row = $db->fetch_array($result);
@@ -361,19 +322,12 @@ if($page == 'tickets'
} }
else else
{ {
$cid = $subticket->Get('customer'); $by = $lng['ticket']['customer'];
$usr = $db->query_first('SELECT `customerid`, `firstname`, `name`, `company`, `loginname`
FROM `' . TABLE_PANEL_CUSTOMERS . '`
WHERE `customerid` = "' . (int)$cid . '"'
);
$by = '<a href="'.$linker->getLink(array('section' => 'customers', 'page' => 'customers', 'action' => 'su', 'id' => $cid)).'" rel="external">';
$by .= getCorrectFullUserDetails($usr).'</a>';
//$by = $lng['ticket']['customer'];
} }
$subject = $subticket->Get('subject'); $subject = $subticket->Get('subject');
$message = $subticket->Get('message'); $message = $subticket->Get('message');
eval("\$ticket_replies.=\"" . getTemplate("tickets/tickets_tickets_list") . "\";"); eval("\$ticket_replies.=\"" . getTemplate("ticket/tickets_tickets_list") . "\";");
} }
$priorities = makeoption($lng['ticket']['high'], '1', $mainticket->Get('priority'), true, true); $priorities = makeoption($lng['ticket']['high'], '1', $mainticket->Get('priority'), true, true);
@@ -383,13 +337,8 @@ if($page == 'tickets'
$ticket_replies_count = $db->num_rows($andere) + 1; $ticket_replies_count = $db->num_rows($andere) + 1;
// don't forget the main-ticket! // don't forget the main-ticket!
$ticket_reply_data = include_once dirname(__FILE__).'/lib/formfields/admin/tickets/formfield.ticket_reply.php';
$ticket_reply_form = htmlform::genHTMLForm($ticket_reply_data);
$title = $ticket_reply_data['ticket_reply']['title']; eval("echo \"" . getTemplate("ticket/tickets_reply") . "\";");
$image = $ticket_reply_data['ticket_reply']['image'];
eval("echo \"" . getTemplate("tickets/tickets_reply") . "\";");
} }
} }
elseif($action == 'close' elseif($action == 'close'
@@ -475,16 +424,11 @@ elseif($page == 'categories'
'name' => $lng['ticket']['category'], 'name' => $lng['ticket']['category'],
'logicalorder' => $lng['ticket']['logicalorder'] 'logicalorder' => $lng['ticket']['logicalorder']
); );
$where = '1'; // WHERE 1 is like no 'where-clause'
if ($userinfo['tickets_see_all'] != '1') {
$where = " `main`.`adminid` = '" . (int)$userinfo['adminid'] . "'";
}
$paging = new paging($userinfo, $db, TABLE_PANEL_TICKET_CATS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']); $paging = new paging($userinfo, $db, TABLE_PANEL_TICKET_CATS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$result = $db->query("SELECT `main`.`id`, `main`.`name`, `main`.`logicalorder`, ( $result = $db->query("SELECT `main`.`id`, `main`.`name`, `main`.`logicalorder`, (
SELECT COUNT(`sub`.`id`) FROM `" . TABLE_PANEL_TICKETS . "` `sub` SELECT COUNT(`sub`.`id`) FROM `" . TABLE_PANEL_TICKETS . "` `sub`
WHERE `sub`.`category` = `main`.`id` WHERE `sub`.`category` = `main`.`id`
AND `sub`.`answerto` = '0' AND `sub`.`adminid` = '" . $userinfo['adminid'] . "') AND `sub`.`answerto` = '0' AND `sub`.`adminid` = '" . $userinfo['adminid'] . "')
as `ticketcount`, ( as `ticketcount`, (
SELECT COUNT(`sub2`.`id`) FROM `" . TABLE_PANEL_TICKETS . "` `sub2` SELECT COUNT(`sub2`.`id`) FROM `" . TABLE_PANEL_TICKETS . "` `sub2`
WHERE `sub2`.`category` = `main`.`id` WHERE `sub2`.`category` = `main`.`id`
@@ -492,7 +436,7 @@ elseif($page == 'categories'
AND (`sub2`.`status` = '0' OR `sub2`.`status` = '1' OR `sub2`.`status` = '2') AND (`sub2`.`status` = '0' OR `sub2`.`status` = '1' OR `sub2`.`status` = '2')
AND `sub2`.`adminid` = '" . $userinfo['adminid'] . "' AND `sub2`.`adminid` = '" . $userinfo['adminid'] . "'
) as `ticketcountnotclosed` ) as `ticketcountnotclosed`
FROM `" . TABLE_PANEL_TICKET_CATS . "` `main` WHERE " . $where . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()); FROM `" . TABLE_PANEL_TICKET_CATS . "` `main` WHERE `main`.`adminid` = '" . (int)$userinfo['adminid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
$paging->setEntries($db->num_rows($result)); $paging->setEntries($db->num_rows($result));
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
@@ -509,14 +453,14 @@ elseif($page == 'categories'
{ {
$row = htmlentities_array($row); $row = htmlentities_array($row);
$closedtickets_count = ($row['ticketcount'] - $row['ticketcountnotclosed']); $closedtickets_count = ($row['ticketcount'] - $row['ticketcountnotclosed']);
eval("\$ticketcategories.=\"" . getTemplate("tickets/tickets_categories") . "\";"); eval("\$ticketcategories.=\"" . getTemplate("ticket/tickets_categories") . "\";");
$count++; $count++;
} }
$i++; $i++;
} }
eval("echo \"" . getTemplate("tickets/categories") . "\";"); eval("echo \"" . getTemplate("ticket/categories") . "\";");
} }
elseif($action == 'addcategory') elseif($action == 'addcategory')
{ {
@@ -528,8 +472,7 @@ elseif($page == 'categories'
if($order < 1 || $order >= 1000) if($order < 1 || $order >= 1000)
{ {
// use the latest available $order = 1;
$order = ticket::getHighestOrderNumber($db, $userinfo['adminid']) + 1;
} }
if($category == '') if($category == '')
@@ -545,15 +488,7 @@ elseif($page == 'categories'
} }
else else
{ {
$order = ticket::getHighestOrderNumber($db, $userinfo['adminid']) + 1; eval("echo \"" . getTemplate("ticket/tickets_newcategory") . "\";");
$category_new_data = include_once dirname(__FILE__).'/lib/formfields/admin/tickets/formfield.category_new.php';
$category_new_form = htmlform::genHTMLForm($category_new_data);
$title = $category_new_data['category_new']['title'];
$image = $category_new_data['category_new']['image'];
eval("echo \"" . getTemplate("tickets/tickets_newcategory") . "\";");
} }
} }
elseif($action == 'editcategory' elseif($action == 'editcategory'
@@ -584,14 +519,7 @@ elseif($page == 'categories'
else else
{ {
$row = $db->query_first('SELECT * FROM `' . TABLE_PANEL_TICKET_CATS . '` WHERE `id` = "' . (int)$id . '"'); $row = $db->query_first('SELECT * FROM `' . TABLE_PANEL_TICKET_CATS . '` WHERE `id` = "' . (int)$id . '"');
eval("echo \"" . getTemplate("ticket/tickets_editcategory") . "\";");
$category_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/tickets/formfield.category_edit.php';
$category_edit_form = htmlform::genHTMLForm($category_edit_data);
$title = $category_edit_data['category_edit']['title'];
$image = $category_edit_data['category_edit']['image'];
eval("echo \"" . getTemplate("tickets/tickets_editcategory") . "\";");
} }
} }
elseif($action == 'deletecategory' elseif($action == 'deletecategory'
@@ -640,7 +568,8 @@ elseif($page == 'archive'
{ {
$categories[$x] = isset($_POST['category' . $x]) ? $_POST['category' . $x] : ''; $categories[$x] = isset($_POST['category' . $x]) ? $_POST['category' . $x] : '';
} }
$query = ticket::getArchiveSearchStatement($db, $subject, $priority, $fromdate, $todate, $message, $customer, $userinfo['adminid'], $categories);
$query = ticket::getArchiveSearchStatement($subject, $priority, $fromdate, $todate, $message, $customer, $userinfo['adminid'], $categories);
$fields = array( $fields = array(
'lastchange' => $lng['ticket']['lastchange'], 'lastchange' => $lng['ticket']['lastchange'],
'ticket_answers' => $lng['ticket']['ticket_answers'], 'ticket_answers' => $lng['ticket']['ticket_answers'],
@@ -698,39 +627,25 @@ elseif($page == 'archive'
{ {
if($paging->checkDisplay($i)) if($paging->checkDisplay($i))
{ {
$ticket = htmlentities_array($ticket);
$ticket['lastchange'] = date("d.m.y H:i", $ticket['lastchange']); $ticket['lastchange'] = date("d.m.y H:i", $ticket['lastchange']);
if($_cid != $ticket['customerid']) if($_cid != $ticket['customerid'])
{ {
$cid = $ticket['customerid']; $cid = $ticket['customerid'];
$usr = $db->query_first('SELECT `customerid`, `firstname`, `name`, `company`, `loginname` FROM `' . TABLE_PANEL_CUSTOMERS . '` $usr = $db->query_first('SELECT `firstname`, `name`, `company`, `loginname` FROM `' . TABLE_PANEL_CUSTOMERS . '`
WHERE `customerid` = "' . (int)$cid . '"'); WHERE `customerid` = "' . (int)$cid . '"');
if(isset($usr['loginname'])) if(isset($usr['loginname'])) {
{ $customer = getCorrectFullUserDetails($usr) . ' (' . $usr['loginname'] . ')';
$customer = getCorrectFullUserDetails($usr); } else {
$customerloginname = $usr['loginname'];
$customerid = $usr['customerid'];
}
else
{
$customer = $lng['ticket']['nonexistingcustomer']; $customer = $lng['ticket']['nonexistingcustomer'];
} }
eval("\$tickets.=\"" . getTemplate("tickets/tickets_customer") . "\";"); eval("\$tickets.=\"" . getTemplate("ticket/tickets_customer") . "\";");
} }
$tickets_count++; $tickets_count++;
switch ($ticket['priority'])
{
case 1: $ticket['display'] = 'high';
break;
case 2: $ticket['display'] = 'normal';
break;
case 3: $ticket['display'] = 'low';
break;
default: $ticket['display'] = 'unknown';
}
$ticket['priority'] = ticket::getPriorityText($lng, $ticket['priority']); $ticket['priority'] = ticket::getPriorityText($lng, $ticket['priority']);
if($ticket['lastreplier'] == '1') if($ticket['lastreplier'] == '1')
@@ -746,8 +661,8 @@ elseif($page == 'archive'
{ {
$ticket['subject'] = substr($ticket['subject'], 0, 17) . '...'; $ticket['subject'] = substr($ticket['subject'], 0, 17) . '...';
} }
$ticket = htmlentities_array($ticket);
eval("\$tickets.=\"" . getTemplate("tickets/archived_tickets") . "\";"); eval("\$tickets.=\"" . getTemplate("ticket/archived_tickets") . "\";");
$count++; $count++;
$_cid = $ticket['customerid']; $_cid = $ticket['customerid'];
} }
@@ -756,7 +671,7 @@ elseif($page == 'archive'
$i++; $i++;
} }
eval("echo \"" . getTemplate("tickets/archivesearch") . "\";"); eval("echo \"" . getTemplate("ticket/archivesearch") . "\";");
} }
else else
{ {
@@ -785,13 +700,13 @@ elseif($page == 'archive'
$ticket['subject'] = substr($ticket['subject'], 0, 17) . '...'; $ticket['subject'] = substr($ticket['subject'], 0, 17) . '...';
} }
eval("\$tickets.=\"" . getTemplate("tickets/archived_tickets") . "\";"); eval("\$tickets.=\"" . getTemplate("ticket/archived_tickets") . "\";");
} }
} }
$priorities_options = makecheckbox('priority1', $lng['ticket']['high'], '1'); $priorities_options = makecheckbox('priority1', $lng['ticket']['unf_high'], '1');
$priorities_options.= makecheckbox('priority2', $lng['ticket']['normal'], '2'); $priorities_options.= makecheckbox('priority2', $lng['ticket']['unf_normal'], '2');
$priorities_options.= makecheckbox('priority3', $lng['ticket']['low'], '3'); $priorities_options.= makecheckbox('priority3', $lng['ticket']['unf_low'], '3');
$category_options = ''; $category_options = '';
$ccount = 0; $ccount = 0;
$result = $db->query('SELECT * FROM `' . TABLE_PANEL_TICKET_CATS . '` ORDER BY `name` ASC'); $result = $db->query('SELECT * FROM `' . TABLE_PANEL_TICKET_CATS . '` ORDER BY `name` ASC');
@@ -810,7 +725,7 @@ elseif($page == 'archive'
$customers.= makeoption(getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid']); $customers.= makeoption(getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid']);
} }
eval("echo \"" . getTemplate("tickets/archive") . "\";"); eval("echo \"" . getTemplate("ticket/archive") . "\";");
} }
} }
elseif($action == 'view' elseif($action == 'view'
@@ -830,19 +745,12 @@ elseif($page == 'archive'
} }
else else
{ {
$cid = $mainticket->Get('customer'); $by = $lng['ticket']['customer'];
$usr = $db->query_first('SELECT `customerid`, `firstname`, `name`, `company`, `loginname`
FROM `' . TABLE_PANEL_CUSTOMERS . '`
WHERE `customerid` = "' . (int)$cid . '"'
);
$by = '<a href="'.$linker->getLink(array('section' => 'customers', 'page' => 'customers', 'action' => 'su', 'id' => $cid)).'" rel="external">';
$by .= getCorrectFullUserDetails($usr).'</a>';
//$by = $lng['ticket']['customer'];
} }
$subject = $mainticket->Get('subject'); $subject = $mainticket->Get('subject');
$message = $mainticket->Get('message'); $message = $mainticket->Get('message');
eval("\$ticket_replies.=\"" . getTemplate("tickets/tickets_tickets_main") . "\";"); eval("\$ticket_replies.=\"" . getTemplate("ticket/tickets_tickets_main") . "\";");
$result = $db->query('SELECT `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` $result = $db->query('SELECT `name` FROM `' . TABLE_PANEL_TICKET_CATS . '`
WHERE `id`="' . (int)$mainticket->Get('category') . '"'); WHERE `id`="' . (int)$mainticket->Get('category') . '"');
$row = $db->fetch_array($result); $row = $db->fetch_array($result);
@@ -859,29 +767,23 @@ elseif($page == 'archive'
} }
else else
{ {
$cid = $subticket->Get('customer'); $by = $lng['ticket']['customer'];
$usr = $db->query_first('SELECT `customerid`, `firstname`, `name`, `company`, `loginname`
FROM `' . TABLE_PANEL_CUSTOMERS . '`
WHERE `customerid` = "' . (int)$cid . '"'
);
$by = '<a href="'.$linker->getLink(array('section' => 'customers', 'page' => 'customers', 'action' => 'su', 'id' => $cid)).'" rel="external">';
$by .= getCorrectFullUserDetails($usr).'</a>';
//$by = $lng['ticket']['customer'];
} }
$subject = $subticket->Get('subject'); $subject = $subticket->Get('subject');
$message = $subticket->Get('message'); $message = $subticket->Get('message');
eval("\$ticket_replies.=\"" . getTemplate("tickets/tickets_tickets_list") . "\";"); eval("\$ticket_replies.=\"" . getTemplate("ticket/tickets_tickets_list") . "\";");
} }
$priorities = makeoption($lng['ticket']['high'], '1', htmlentities($mainticket->Get('priority')), true, true); $priorities = makeoption($lng['ticket']['high'], '1', $mainticket->Get('priority'), true, true);
$priorities.= makeoption($lng['ticket']['normal'], '2', htmlentities($mainticket->Get('priority')), true, true); $priorities.= makeoption($lng['ticket']['normal'], '2', $mainticket->Get('priority'), true, true);
$priorities.= makeoption($lng['ticket']['low'], '3', htmlentities($mainticket->Get('priority')), true, true); $priorities.= makeoption($lng['ticket']['low'], '3', $mainticket->Get('priority'), true, true);
$subject = $mainticket->Get('subject'); $subject = $mainticket->Get('subject');
$ticket_replies_count = $db->num_rows($andere) + 1; $ticket_replies_count = $db->num_rows($andere) + 1;
// don't forget the main-ticket! // don't forget the main-ticket!
eval("echo \"" . getTemplate("tickets/tickets_view") . "\";");
eval("echo \"" . getTemplate("ticket/tickets_view") . "\";");
} }
elseif($action == 'delete' elseif($action == 'delete'
&& $id != 0) && $id != 0)
@@ -900,6 +802,6 @@ elseif($page == 'archive'
ask_yesno('ticket_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject')); ask_yesno('ticket_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject'));
} }
} }
} else {
standard_error('nocustomerforticket');
} }
?>

View File

@@ -1,148 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Morton Jonuschat <m.jonuschat@chrome-it.de>
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
* @package Panel
*
*/
define('AREA', 'admin');
/**
* Include our init.php, which manages Sessions, Language etc.
*/
require ("./lib/init.php");
if($action == 'logout')
{
$db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['adminid'] . "' AND `adminsession` = '1'");
redirectTo('index.php');
exit;
}
if(isset($_POST['id']))
{
$id = intval($_POST['id']);
}
elseif(isset($_GET['id']))
{
$id = intval($_GET['id']);
}
$months = array(
'0' => 'empty',
'1' => 'jan',
'2' => 'feb',
'3' => 'mar',
'4' => 'apr',
'5' => 'may',
'6' => 'jun',
'7' => 'jul',
'8' => 'aug',
'9' => 'sep',
'10' => 'oct',
'11' => 'nov',
'12' => 'dec',
);
if($page == 'overview' || $page == 'customers')
{
if($action == 'su' && $id != 0)
{
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `customerid`='" . (int)$id . "' " . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = '" . (int)$userinfo['adminid'] . "' "));
if($result['loginname'] != '')
{
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid`='" . (int)$userinfo['userid'] . "'");
$s = md5(uniqid(microtime(), 1));
$db->query("INSERT INTO `" . TABLE_PANEL_SESSIONS . "` (`hash`, `userid`, `ipaddress`, `useragent`, `lastactivity`, `language`, `adminsession`) VALUES ('" . $db->escape($s) . "', '" . (int)$id . "', '" . $db->escape($result['ipaddress']) . "', '" . $db->escape($result['useragent']) . "', '" . time() . "', '" . $db->escape($result['language']) . "', '0')");
redirectTo('customer_traffic.php', Array(
's' => $s
));
}
else
{
redirectTo('index.php', Array(
'action' => 'login'
));
}
}
$customerview = 1;
$stats_tables = '';
$minyear = $db->query_first("SELECT `year` FROM `". TABLE_PANEL_TRAFFIC . "` ORDER BY `year` ASC LIMIT 1");
if (!isset($minyear['year']) || $minyear['year'] == 0)
{
$maxyears = 0;
}
else
{
$maxyears = date("Y") - $minyear['year'];
}
for($years = 0; $years<=$maxyears; $years++) {
$overview['year'] = date("Y")-$years;
$overview['type'] = $lng['traffic']['customer'];
$domain_list = '';
$customer_name_list = $db->query("SELECT `customerid`,`company`,`name`,`firstname` FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `deactivated`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = '" . (int)$userinfo['adminid'] . "' ") . " ORDER BY name");
$totals = array(
'jan' => 0,
'feb' => 0,
'mar' => 0,
'apr' => 0,
'may' => 0,
'jun' => 0,
'jul' => 0,
'aug' => 0,
'sep' => 0,
'oct' => 0,
'nov' => 0,
'dec' => 0,
);
while($customer_name = $db->fetch_array($customer_name_list)) {
$virtual_host = array(
'name' => ($customer_name['company'] == '' ? $customer_name['name'] . ", " . $customer_name['firstname'] : $customer_name['company']),
'customerid' => $customer_name['customerid'],
'jan' => '-',
'feb' => '-',
'mar' => '-',
'apr' => '-',
'may' => '-',
'jun' => '-',
'jul' => '-',
'aug' => '-',
'sep' => '-',
'oct' => '-',
'nov' => '-',
'dec' => '-',
);
$traffic_list = $db->query("SELECT month, SUM(http+ftp_up+ftp_down+mail)*1024 AS traffic FROM `" . TABLE_PANEL_TRAFFIC . "` WHERE year = " . (date("Y")-$years) . " AND `customerid` = '" . $customer_name['customerid'] . "' GROUP BY month ORDER BY month");
while($traffic_month = $db->fetch_array($traffic_list)) {
$virtual_host[$months[(int)$traffic_month['month']]] = size_readable($traffic_month['traffic'], 'GiB', 'bi', '%01.'.(int)$settings['panel']['decimal_places'].'f %s');
$totals[$months[(int)$traffic_month['month']]] += $traffic_month['traffic'];
}
eval("\$domain_list .= sprintf(\"%s\", \"" . getTemplate("traffic/index_table_row") . "\");");
}
// sum up totals
$virtual_host = array(
'name' => $lng['traffic']['months']['total'],
);
foreach($totals as $month => $bytes) {
$virtual_host[$month] = ($bytes == 0 ? '-' : size_readable($bytes, 'GiB', 'bi', '%01.'.(int)$settings['panel']['decimal_places'].'f %s'));
}
$customerview = 0;
eval("\$total_list = sprintf(\"%s\", \"" . getTemplate("traffic/index_table_row") . "\");");
eval("\$stats_tables .= sprintf(\"%s\", \"" . getTemplate("traffic/index_table") . "\");");
}
eval("echo \"" . getTemplate("traffic/index") . "\";");
}

View File

@@ -12,13 +12,14 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'admin'); define('AREA', 'admin');
require('./lib/init.php'); require ("./lib/init.php");
if ($page == 'overview') { if($page == 'overview')
{
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_updates"); $log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_updates");
/** /**
@@ -28,13 +29,13 @@ if ($page == 'overview') {
*/ */
if (!isFroxlor()) { if (!isFroxlor()) {
if (!isset($settings['panel']['version']) if (!isset($settings['panel']['version'])
|| $settings['panel']['version'] == '' || $settings['panel']['version'] == ''
) { ) {
$settings['panel']['version'] = '1.4.2.1'; $settings['panel']['version'] = '1.4.2.1';
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('panel','version','".$settings['panel']['version']."')"); $db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('panel','version','".$settings['panel']['version']."')");
} }
if (!isset($settings['system']['dbversion']) if (!isset($settings['system']['dbversion'])
|| $settings['system']['dbversion'] == '' || $settings['system']['dbversion'] == ''
) { ) {
/** /**
* for syscp-stable (1.4.2.1) this value has to be 0 * for syscp-stable (1.4.2.1) this value has to be 0
@@ -42,9 +43,11 @@ if ($page == 'overview') {
* and the svn-version has its value in the database * and the svn-version has its value in the database
* -> bug #54 * -> bug #54
*/ */
$result = $db->query_first("SELECT `value` FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'dbversion'"); $result = $db->query_first("SELECT `value` FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'dbversion'");
if (isset($result['value'])) { if(isset($result['value']))
{
$settings['system']['dbversion'] = (int)$result['value']; $settings['system']['dbversion'] = (int)$result['value'];
} else { } else {
$settings['system']['dbversion'] = 0; $settings['system']['dbversion'] = 0;
@@ -52,36 +55,40 @@ if ($page == 'overview') {
} }
} }
if (hasUpdates($version)) { if(hasUpdates($version))
{
$successful_update = false; $successful_update = false;
$message = ''; $message = '';
if (isset($_POST['send']) if(isset($_POST['send'])
&& $_POST['send'] == 'send' && $_POST['send'] == 'send')
) { {
if ((isset($_POST['update_preconfig']) if((isset($_POST['update_preconfig'])
&& isset($_POST['update_changesagreed']) && isset($_POST['update_changesagreed'])
&& intval($_POST['update_changesagreed']) != 0) && intval($_POST['update_changesagreed']) != 0)
|| !isset($_POST['update_preconfig']) || !isset($_POST['update_preconfig'])
) { ) {
eval("echo \"" . getTemplate('update/update_start') . "\";"); eval("echo \"" . getTemplate("update/update_start") . "\";");
include_once './install/updatesql.php'; include_once './install/updatesql.php';
$redirect_url = 'admin_index.php?s=' . $s; $redirect_url = 'admin_index.php?s=' . $s;
eval("echo \"" . getTemplate('update/update_end') . "\";"); eval("echo \"" . getTemplate("update/update_end") . "\";");
updateCounters(); updateCounters();
inserttask('1'); inserttask('1');
@chmod('./lib/userdata.inc.php', 0440); @chmod('./lib/userdata.inc.php', 0440);
$successful_update = true; $successful_update = true;
} else { }
$message = '<br /><strong style="color: red">You have to agree that you have read the update notifications.</strong>'; else
{
$message = '<br /><strong style="color:#ff0000;">You have to agree that you have read the update notifications.</strong>';
} }
} }
if (!$successful_update) { if(!$successful_update)
{
$current_version = $settings['panel']['version']; $current_version = $settings['panel']['version'];
$new_version = $version; $new_version = $version;
@@ -92,20 +99,26 @@ if ($page == 'overview') {
include_once './install/updates/preconfig.php'; include_once './install/updates/preconfig.php';
$preconfig = getPreConfig($current_version); $preconfig = getPreConfig($current_version);
if ($preconfig != '') { if($preconfig != '')
$update_information .= '<br />' . $preconfig . $message; {
$update_information .= '<br />'.$preconfig.$message;
} }
$update_information .= $lng['update']['update_information']['part_b']; $update_information .= $lng['update']['update_information']['part_b'];
eval("echo \"" . getTemplate('update/index') . "\";"); eval("echo \"" . getTemplate("update/index") . "\";");
} }
} else { }
else
{
/* /*
* @TODO version-webcheck check here * @TODO version-webcheck check here
*/ */
$success_message = $lng['update']['noupdatesavail']; $success_message = $lng['update']['noupdatesavail'];
$redirect_url = 'admin_index.php?s=' . $s; $redirect_url = 'admin_index.php?s=' . $s;
eval("echo \"" . getTemplate('update/noupdatesavail') . "\";"); eval("echo \"" . getTemplate("update/noupdatesavail") . "\";");
} }
} }
?>

1
cache/.gitignore vendored
View File

@@ -1 +0,0 @@
*

0
cache/.keep vendored
View File

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
.jqplot-target{position:relative;color:#666;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:1em}.jqplot-axis{font-size:.75em}.jqplot-xaxis{margin-top:10px}.jqplot-x2axis{margin-bottom:10px}.jqplot-yaxis{margin-right:10px}.jqplot-y2axis,.jqplot-y3axis,.jqplot-y4axis,.jqplot-y5axis,.jqplot-y6axis,.jqplot-y7axis,.jqplot-y8axis,.jqplot-y9axis,.jqplot-yMidAxis{margin-left:10px;margin-right:10px}.jqplot-axis-tick,.jqplot-xaxis-tick,.jqplot-yaxis-tick,.jqplot-x2axis-tick,.jqplot-y2axis-tick,.jqplot-y3axis-tick,.jqplot-y4axis-tick,.jqplot-y5axis-tick,.jqplot-y6axis-tick,.jqplot-y7axis-tick,.jqplot-y8axis-tick,.jqplot-y9axis-tick,.jqplot-yMidAxis-tick{position:absolute;white-space:pre}.jqplot-xaxis-tick{top:0;left:15px;vertical-align:top}.jqplot-x2axis-tick{bottom:0;left:15px;vertical-align:bottom}.jqplot-yaxis-tick{right:0;top:15px;text-align:right}.jqplot-yaxis-tick.jqplot-breakTick{right:-20px;margin-right:0;padding:1px 5px 1px 5px;z-index:2;font-size:1.5em}.jqplot-y2axis-tick,.jqplot-y3axis-tick,.jqplot-y4axis-tick,.jqplot-y5axis-tick,.jqplot-y6axis-tick,.jqplot-y7axis-tick,.jqplot-y8axis-tick,.jqplot-y9axis-tick{left:0;top:15px;text-align:left}.jqplot-yMidAxis-tick{text-align:center;white-space:nowrap}.jqplot-xaxis-label{margin-top:10px;font-size:11pt;position:absolute}.jqplot-x2axis-label{margin-bottom:10px;font-size:11pt;position:absolute}.jqplot-yaxis-label{margin-right:10px;font-size:11pt;position:absolute}.jqplot-yMidAxis-label{font-size:11pt;position:absolute}.jqplot-y2axis-label,.jqplot-y3axis-label,.jqplot-y4axis-label,.jqplot-y5axis-label,.jqplot-y6axis-label,.jqplot-y7axis-label,.jqplot-y8axis-label,.jqplot-y9axis-label{font-size:11pt;margin-left:10px;position:absolute}.jqplot-meterGauge-tick{font-size:.75em;color:#999}.jqplot-meterGauge-label{font-size:1em;color:#999}table.jqplot-table-legend{margin-top:12px;margin-bottom:12px;margin-left:12px;margin-right:12px}table.jqplot-table-legend,table.jqplot-cursor-legend{background-color:rgba(255,255,255,0.6);border:1px solid #ccc;position:absolute;font-size:.75em}td.jqplot-table-legend{vertical-align:middle}td.jqplot-seriesToggle:hover,td.jqplot-seriesToggle:active{cursor:pointer}.jqplot-table-legend .jqplot-series-hidden{text-decoration:line-through}div.jqplot-table-legend-swatch-outline{border:1px solid #ccc;padding:1px}div.jqplot-table-legend-swatch{width:0;height:0;border-top-width:5px;border-bottom-width:5px;border-left-width:6px;border-right-width:6px;border-top-style:solid;border-bottom-style:solid;border-left-style:solid;border-right-style:solid}.jqplot-title{top:0;left:0;padding-bottom:.5em;font-size:1.2em}table.jqplot-cursor-tooltip{border:1px solid #ccc;font-size:.75em}.jqplot-cursor-tooltip{border:1px solid #ccc;font-size:.75em;white-space:nowrap;background:rgba(208,208,208,0.5);padding:1px}.jqplot-highlighter-tooltip,.jqplot-canvasOverlay-tooltip{border:1px solid #ccc;font-size:.75em;white-space:nowrap;background:rgba(208,208,208,0.5);padding:1px}.jqplot-point-label{font-size:.75em;z-index:2}td.jqplot-cursor-legend-swatch{vertical-align:middle;text-align:center}div.jqplot-cursor-legend-swatch{width:1.2em;height:.7em}.jqplot-error{text-align:center}.jqplot-error-message{position:relative;top:46%;display:inline-block}div.jqplot-bubble-label{font-size:.8em;padding-left:2px;padding-right:2px;color:rgb(20%,20%,20%)}div.jqplot-bubble-label.jqplot-bubble-label-highlight{background:rgba(90%,90%,90%,0.7)}div.jqplot-noData-container{text-align:center;background-color:rgba(96%,96%,96%,0.3)}

View File

@@ -14,21 +14,21 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
// Required code
define('AREA', 'customer'); define('AREA', 'customer');
require ('./lib/init.php'); require ("./lib/init.php");
$Id = 0; $Id = 0;
if (isset($_GET['id'])) {
$Id = (int)$_GET['id'];
}
if (isset($_POST['id'])) {
$Id = (int)$_POST['id'];
}
eval("echo \"" . getTemplate('aps/header') . "\";"); if(isset($_GET['id']))$Id = (int)$_GET['id'];
if(isset($_POST['id']))$Id = (int)$_POST['id'];
eval("echo \"" . getTemplate("aps/header") . "\";");
$Aps = new ApsParser($userinfo, $settings, $db); $Aps = new ApsParser($userinfo, $settings, $db);
$Aps->MainHandler($action); $Aps->MainHandler($action);
eval("echo \"" . getTemplate('aps/footer') . "\";"); eval("echo \"" . getTemplate("aps/footer") . "\";");
?>

View File

@@ -14,17 +14,21 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'customer'); // Required code
require('./lib/init.php');
if ($action == 'add') { define('AREA', 'customer');
// Create new autoresponder require ("./lib/init.php");
if (isset($_POST['send'])
&& $_POST['send'] == 'send' // Create new autoresponder
) {
if($action == "add")
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$account = trim($_POST['account']); $account = trim($_POST['account']);
$subject = trim($_POST['subject']); $subject = trim($_POST['subject']);
$message = trim($_POST['message']); $message = trim($_POST['message']);
@@ -38,31 +42,39 @@ if ($action == 'add') {
$ts_from = -1; $ts_from = -1;
$ts_until = -1; $ts_until = -1;
if ($date_from_off > -1) { if($date_from_off > -1)
{
$date_from = $_POST['date_from']; $date_from = $_POST['date_from'];
$ts_from = mktime(0, 0, 0, substr($date_from, 3, 2), substr($date_from, 0, 2), substr($date_from, 6, 4)); $ts_from = mktime(0, 0, 0, substr($date_from, 3, 2), substr($date_from, 0, 2), substr($date_from, 6, 4));
} }
if ($date_until_off > -1) { if($date_until_off > -1)
{
$date_until = $_POST['date_until']; $date_until = $_POST['date_until'];
$ts_until = mktime(0, 0, 0, substr($date_until, 3, 2), substr($date_until, 0, 2), substr($date_until, 6, 4)); $ts_until = mktime(0, 0, 0, substr($date_until, 3, 2), substr($date_until, 0, 2), substr($date_until, 6, 4));
} }
if (empty($account) if(empty($account)
|| empty($subject) || empty($subject)
|| empty($message) || empty($message))
) { {
standard_error('missingfields'); standard_error('missingfields');
} }
// Does account exist? // Does account exist?
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1"); $result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1");
if ($db->num_rows($result) == 0) {
if($db->num_rows($result) == 0)
{
standard_error('accountnotexisting'); standard_error('accountnotexisting');
} }
// Does autoresponder exist? // Does autoresponder exist?
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1"); $result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1");
if ($db->num_rows($result) == 1) {
if($db->num_rows($result) == 1)
{
standard_error('autoresponderalreadyexists'); standard_error('autoresponderalreadyexists');
} }
@@ -75,38 +87,40 @@ if ($action == 'add') {
`subject` = '" . $db->escape($subject) . "', `subject` = '" . $db->escape($subject) . "',
`customerid` = '" . $db->escape((int)$userinfo['customerid']) . "' `customerid` = '" . $db->escape((int)$userinfo['customerid']) . "'
"); ");
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_autoresponder_used` = `email_autoresponder_used` + 1 WHERE `customerid` = '" . $db->escape((int)$userinfo['customerid']). "'");
redirectTo($filename, Array('s' => $s)); redirectTo($filename, Array('s' => $s));
} }
// Get accounts // Get accounts
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` NOT IN (SELECT `email` FROM `" . TABLE_MAIL_AUTORESPONDER . "`) ORDER BY email ASC"); $result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` NOT IN (SELECT `email` FROM `" . TABLE_MAIL_AUTORESPONDER . "`) ORDER BY email ASC");
if ($db->num_rows($result) == 0) {
if($db->num_rows($result) == 0)
{
standard_error('noemailaccount'); standard_error('noemailaccount');
} }
$accounts = ''; $accounts = '';
while ($row = $db->fetch_array($result)) {
$accounts .= '<option value="' . $row['email'] . '">' . $row['email'] . '</option>'; while($row = $db->fetch_array($result))
{
$accounts.= "<option value=\"" . $row['email'] . "\">" . $row['email'] . "</option>";
} }
$date_from_off = makecheckbox('date_from_off', $lng['panel']['not_activated'], '-1', false, '-1', true, true); $date_from_off = makecheckbox('date_from_off', $lng['panel']['not_activated'], '-1', false, '-1', true, true);
$date_until_off = makecheckbox('date_until_off', $lng['panel']['not_activated'], '-1', false, '-1', true, true); $date_until_off = makecheckbox('date_until_off', $lng['panel']['not_activated'], '-1', false, '-1', true, true);
//$isactive = makeyesno('active', '1', '0', '1'); eval("echo \"" . getTemplate("email/autoresponder_add") . "\";");
}
$autoresponder_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/autoresponder/formfield.autoresponder_add.php'; // Edit autoresponder
$autoresponder_add_form = htmlform::genHTMLForm($autoresponder_add_data);
$title = $autoresponder_add_data['autoresponder_add']['title']; else
$image = $autoresponder_add_data['autoresponder_add']['image'];
eval("echo \"" . getTemplate('autoresponder/autoresponder_add') . "\";"); if($action == "edit")
} elseif ($action == 'edit') { {
// Edit autoresponder if(isset($_POST['send'])
if (isset($_POST['send']) && $_POST['send'] == 'send')
&& $_POST['send'] == 'send' {
) {
$account = trim($_POST['account']); $account = trim($_POST['account']);
$subject = trim($_POST['subject']); $subject = trim($_POST['subject']);
$message = trim($_POST['message']); $message = trim($_POST['message']);
@@ -120,36 +134,49 @@ if ($action == 'add') {
$ts_from = -1; $ts_from = -1;
$ts_until = -1; $ts_until = -1;
if ($date_from_off > -1) { if($date_from_off > -1)
{
$date_from = $_POST['date_from']; $date_from = $_POST['date_from'];
$ts_from = mktime(0, 0, 0, substr($date_from, 3, 2), substr($date_from, 0, 2), substr($date_from, 6, 4)); $ts_from = mktime(0, 0, 0, substr($date_from, 3, 2), substr($date_from, 0, 2), substr($date_from, 6, 4));
} }
if ($date_until_off > -1) { if($date_until_off > -1)
{
$date_until = $_POST['date_until']; $date_until = $_POST['date_until'];
$ts_until = mktime(0, 0, 0, substr($date_until, 3, 2), substr($date_until, 0, 2), substr($date_until, 6, 4)); $ts_until = mktime(0, 0, 0, substr($date_until, 3, 2), substr($date_until, 0, 2), substr($date_until, 6, 4));
} }
if (empty($account) if(empty($account)
|| empty($subject) || empty($subject)
|| empty($message) || empty($message))
) { {
standard_error('missingfields'); standard_error('missingfields');
} }
// Does account exist? // Does account exist?
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1"); $result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1");
if ($db->num_rows($result) == 0)
if($db->num_rows($result) == 0)
{ {
standard_error('accountnotexisting'); standard_error('accountnotexisting');
} }
// Does autoresponder exist? // Does autoresponder exist?
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1"); $result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1");
if ($db->num_rows($result) == 0) {
if($db->num_rows($result) == 0)
{
standard_error('invalidautoresponder'); standard_error('invalidautoresponder');
} }
$ResponderActive = (isset($_POST['active']) && $_POST['active'] == '1') ? 1 : 0; $ResponderActive = 0;
if(isset($_POST['active'])
&& $_POST['active'] == '1')
{
$ResponderActive = 1;
}
$db->query("UPDATE `" . TABLE_MAIL_AUTORESPONDER . "` $db->query("UPDATE `" . TABLE_MAIL_AUTORESPONDER . "`
SET `message` = '" . $db->escape($message) . "', SET `message` = '" . $db->escape($message) . "',
@@ -166,8 +193,11 @@ if ($action == 'add') {
$email = trim(htmlspecialchars($_GET['email'])); $email = trim(htmlspecialchars($_GET['email']));
// Get account data // Get account data
$result = $db->query("SELECT * FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($email) . "' LIMIT 0,1"); $result = $db->query("SELECT * FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($email) . "' LIMIT 0,1");
if ($db->num_rows($result) == 0) {
if($db->num_rows($result) == 0)
{
standard_error('invalidautoresponder'); standard_error('invalidautoresponder');
} }
@@ -178,43 +208,56 @@ if ($action == 'add') {
$date_from = (int)$row['date_from']; $date_from = (int)$row['date_from'];
$date_until = (int)$row['date_until']; $date_until = (int)$row['date_until'];
if ($date_from == -1) { if($date_from == -1)
{
$deactivated = '-1'; $deactivated = '-1';
$date_from = ''; }
} else { else
{
$deactivated = '0'; $deactivated = '0';
$date_from = date('d-m-Y', $date_from); $date_from = date('d-m-Y', $date_from);
} }
$date_from_off = makecheckbox('date_from_off', $lng['panel']['not_activated'], '-1', false, $deactivated, true, true); $date_from_off = makecheckbox('date_from_off', $lng['panel']['not_activated'], '-1', false, $deactivated, true, true);
if ($date_until == -1) { if($date_until == -1)
{
$deactivated = '-1'; $deactivated = '-1';
$date_until = ''; $date_until = '-1';
} else { }
else
{
$deactivated = '0'; $deactivated = '0';
$date_until = date('d-m-Y', $date_until); $date_until = date('d-m-Y', $date_until);
} }
$date_until_off = makecheckbox('date_until_off', $lng['panel']['not_activated'], '-1', false, $deactivated, true, true); $date_until_off = makecheckbox('date_until_off', $lng['panel']['not_activated'], '-1', false, $deactivated, true, true);
//$isactive = makeyesno('active', '1', '0', $row['enabled']); $checked = '';
$autoresponder_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/autoresponder/formfield.autoresponder_edit.php'; if($row['enabled'] == 1)
$autoresponder_edit_form = htmlform::genHTMLForm($autoresponder_edit_data); {
$checked = "checked=\"checked\"";
}
$title = $autoresponder_edit_data['autoresponder_edit']['title']; eval("echo \"" . getTemplate("email/autoresponder_edit") . "\";");
$image = $autoresponder_edit_data['autoresponder_edit']['image']; }
eval("echo \"" . getTemplate('autoresponder/autoresponder_edit') . "\";"); // Delete autoresponder
} elseif ($action == 'delete') {
// Delete autoresponder else
if (isset($_POST['send'])
&& $_POST['send'] == 'send' if($action == "delete")
) { {
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$account = trim($_POST['account']); $account = trim($_POST['account']);
// Does autoresponder exist? // Does autoresponder exist?
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1"); $result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1");
if ($db->num_rows($result) == 0) {
if($db->num_rows($result) == 0)
{
standard_error('invalidautoresponder'); standard_error('invalidautoresponder');
} }
@@ -222,31 +265,42 @@ if ($action == 'add') {
WHERE `email` = '" . $db->escape($account) . "' WHERE `email` = '" . $db->escape($account) . "'
AND `customerid` = '" . $db->escape((int)$userinfo['customerid']) . "' AND `customerid` = '" . $db->escape((int)$userinfo['customerid']) . "'
"); ");
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_autoresponder_used` = `email_autoresponder_used` - 1 WHERE `customerid` = '" . $db->escape((int)$userinfo['customerid']). "'");
redirectTo($filename, Array('s' => $s)); redirectTo($filename, Array('s' => $s));
} }
$email = trim(htmlspecialchars($_GET['email'])); $email = trim(htmlspecialchars($_GET['email']));
ask_yesno('autoresponderdelete', $filename, array('action' => $action, 'account' => $email)); ask_yesno('autoresponderdelete', $filename, array('action' => $action, 'account' => $email));
} else { }
// List existing autoresponders
// List existing autoresponders
else
{
$autoresponder = ''; $autoresponder = '';
$count = 0;
$result = $db->query("SELECT * FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' ORDER BY email ASC"); $result = $db->query("SELECT * FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' ORDER BY email ASC");
while ($row = $db->fetch_array($result)) { while($row = $db->fetch_array($result))
if ($row['date_from'] == -1 && $row['date_until'] == -1) { {
if($row['date_from'] == -1 && $row['date_until'] == -1)
{
$activated_date = $lng['panel']['not_activated']; $activated_date = $lng['panel']['not_activated'];
} elseif($row['date_from'] == -1 && $row['date_until'] != -1) { }
elseif($row['date_from'] == -1 && $row['date_until'] != -1)
{
$activated_date = $lng['autoresponder']['date_until'].': '.date('d-m-Y', $row['date_until']); $activated_date = $lng['autoresponder']['date_until'].': '.date('d-m-Y', $row['date_until']);
} elseif($row['date_from'] != -1 && $row['date_until'] == -1) { }
elseif($row['date_from'] != -1 && $row['date_until'] == -1)
{
$activated_date = $lng['autoresponder']['date_from'].': '.date('d-m-Y', $row['date_from']); $activated_date = $lng['autoresponder']['date_from'].': '.date('d-m-Y', $row['date_from']);
} else { }
else
{
$activated_date = date('d-m-Y', $row['date_from']) . ' - ' . date('d-m-Y', $row['date_until']); $activated_date = date('d-m-Y', $row['date_from']) . ' - ' . date('d-m-Y', $row['date_until']);
} }
eval("\$autoresponder.=\"" . getTemplate('autoresponder/autoresponder_autoresponder') . "\";"); eval("\$autoresponder.=\"" . getTemplate("email/autoresponder_autoresponder") . "\";");
$count++;
} }
eval("echo \"" . getTemplate('autoresponder/autoresponder') . "\";"); eval("echo \"" . getTemplate("email/autoresponder") . "\";");
} }
?>

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'customer'); define('AREA', 'customer');
@@ -45,7 +45,9 @@ elseif($page == 'domains')
{ {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_domains::domains"); $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_domains::domains");
$fields = array( $fields = array(
'd.domain' => $lng['domains']['domainname'] 'd.domain' => $lng['domains']['domainname'],
'd.documentroot' => $lng['panel']['path'],
'd.aliasdomain' => $lng['domains']['aliasdomain']
); );
$paging = new paging($userinfo, $db, TABLE_PANEL_DOMAINS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']); $paging = new paging($userinfo, $db, TABLE_PANEL_DOMAINS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$result = $db->query("SELECT `d`.`id`, `d`.`customerid`, `d`.`domain`, `d`.`documentroot`, `d`.`isemaildomain`, `d`.`caneditdomain`, `d`.`iswildcarddomain`, `d`.`parentdomainid`, `ad`.`id` AS `aliasdomainid`, `ad`.`domain` AS `aliasdomain`, `da`.`id` AS `domainaliasid`, `da`.`domain` AS `domainalias` FROM `" . TABLE_PANEL_DOMAINS . "` `d` LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `ad` ON `d`.`aliasdomain`=`ad`.`id` LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `da` ON `da`.`aliasdomain`=`d`.`id` WHERE `d`.`customerid`='" . (int)$userinfo['customerid'] . "' AND `d`.`email_only`='0' AND `d`.`id` <> " . (int)$userinfo['standardsubdomain'] . " " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()); $result = $db->query("SELECT `d`.`id`, `d`.`customerid`, `d`.`domain`, `d`.`documentroot`, `d`.`isemaildomain`, `d`.`caneditdomain`, `d`.`iswildcarddomain`, `d`.`parentdomainid`, `ad`.`id` AS `aliasdomainid`, `ad`.`domain` AS `aliasdomain`, `da`.`id` AS `domainaliasid`, `da`.`domain` AS `domainalias` FROM `" . TABLE_PANEL_DOMAINS . "` `d` LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `ad` ON `d`.`aliasdomain`=`ad`.`id` LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `da` ON `da`.`aliasdomain`=`d`.`id` WHERE `d`.`customerid`='" . (int)$userinfo['customerid'] . "' AND `d`.`email_only`='0' AND `d`.`id` <> " . (int)$userinfo['standardsubdomain'] . " " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
@@ -71,33 +73,17 @@ elseif($page == 'domains')
$parentdomains_count++; $parentdomains_count++;
} }
/**
* check for set ssl-certs to show different state-icons
*/
// nothing (ssl_global)
$row['domain_hascert'] = 0;
$ssl_result = $db->query_first("SELECT * FROM `".TABLE_PANEL_DOMAIN_SSL_SETTINGS."` WHERE `domainid`='".(int)$row['id']."';");
if (is_array($ssl_result)
&& isset($ssl_result['ssl_cert_file'])
&& $ssl_result['ssl_cert_file'] != ''
) {
// own certificate (ssl_customer_green)
$row['domain_hascert'] = 1;
} else {
// check if it's parent has one set (shared)
if ($row['parentdomainid'] != 0) {
$ssl_result = $db->query_first("SELECT * FROM `".TABLE_PANEL_DOMAIN_SSL_SETTINGS."` WHERE `domainid`='".(int)$row['parentdomainid']."';");
if (is_array($ssl_result)
&& isset($ssl_result['ssl_cert_file'])
&& $ssl_result['ssl_cert_file'] != ''
) {
// parent has a certificate (ssl_shared)
$row['domain_hascert'] = 2;
}
}
}
$domains_count++; $domains_count++;
/*
$domainparts = explode('.', $row['domain']);
$domainparts = array_reverse($domainparts);
$sortkey = '';
foreach($domainparts as $key => $part)
{
$sortkey.= $part . '.';
}
$domain_array[$sortkey] = $row;
*/
$domain_array[$row['domain']] = $row; $domain_array[$row['domain']] = $row;
} }
@@ -165,14 +151,6 @@ elseif($page == 'domains')
$row['documentroot'] = makeCorrectDir(substr($row['documentroot'], strlen($userinfo['documentroot']))); $row['documentroot'] = makeCorrectDir(substr($row['documentroot'], strlen($userinfo['documentroot'])));
} }
// get ssl-ips if activated
$show_ssledit = false;
if ($settings['system']['use_ssl'] == '1'
&& domainHasSslIpPort($row['id'])
&& $row['caneditdomain'] == '1'
) {
$show_ssledit = true;
}
$row = htmlentities_array($row); $row = htmlentities_array($row);
eval("\$domains.=\"" . getTemplate("domains/domains_domain") . "\";"); eval("\$domains.=\"" . getTemplate("domains/domains_domain") . "\";");
} }
@@ -218,10 +196,7 @@ elseif($page == 'domains')
$result = $db->query("DELETE FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'"); $result = $db->query("DELETE FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
$result = $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `subdomains_used`=`subdomains_used`-1 WHERE `customerid`='" . (int)$userinfo['customerid'] . "'"); $result = $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `subdomains_used`=`subdomains_used`-1 WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
inserttask('1'); inserttask('1');
// Using nameserver, insert a task which rebuilds the server config
inserttask('4'); inserttask('4');
redirectTo($filename, Array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} }
else else
@@ -256,7 +231,7 @@ elseif($page == 'domains')
if($aliasdomain != 0) if($aliasdomain != 0)
{ {
// also check ip/port combination to be the same, #176 // also check ip/port combination to be the same, #176
$aliasdomain_check = $db->query_first("SELECT `d`.`id` FROM `" . TABLE_PANEL_DOMAINS . "` `d` , `" . TABLE_PANEL_CUSTOMERS . "` `c` , `".TABLE_DOMAINTOIP."` `dip` WHERE `d`.`aliasdomain` IS NULL AND `d`.`id` = '".(int)$aliasdomain."' AND `c`.`standardsubdomain` <> `d`.`id` AND `d`.`customerid` = '" . (int)$userinfo['customerid'] . "' AND `c`.`customerid` = `d`.`customerid` AND `d`.`id` = `dip`.`id_domain` AND `dip`.`id_ipandports` IN (SELECT `id_ipandports` FROM `".TABLE_DOMAINTOIP."` WHERE `id_domain` = '".(int)$aliasdomain."') GROUP BY `d`.`domain` ORDER BY `d`.`domain` ASC;"); $aliasdomain_check = $db->query_first('SELECT `id` FROM `' . TABLE_PANEL_DOMAINS . '` `d`,`' . TABLE_PANEL_CUSTOMERS . '` `c` WHERE `d`.`customerid`=\'' . (int)$userinfo['customerid'] . '\' AND `d`.`aliasdomain` IS NULL AND `d`.`id`<>`c`.`standardsubdomain` AND `c`.`customerid`=\'' . (int)$userinfo['customerid'] . '\' AND `d`.`id`=\'' . (int)$aliasdomain . '\' AND `d`.`ipandport` = \''.(int)$domain_check['ipandport'].'\'');
} }
if(isset($_POST['url']) if(isset($_POST['url'])
@@ -274,17 +249,8 @@ elseif($page == 'domains')
if(!preg_match('/^https?\:\/\//', $path) if(!preg_match('/^https?\:\/\//', $path)
|| !validateUrl($idna_convert->encode($path))) || !validateUrl($idna_convert->encode($path)))
{ {
// If path is empty or '/' and 'Use domain name as default value for DocumentRoot path' is enabled in settings, $path = $userinfo['documentroot'] . '/' . $path;
// set default path to subdomain or domain name $path = makeCorrectDir($path);
if((($path == '') || ($path == '/'))
&& $settings['system']['documentroot_use_default_value'] == 1)
{
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $completedomain);
}
else
{
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path);
}
if (strstr($path, ":") !== FALSE) if (strstr($path, ":") !== FALSE)
{ {
standard_error('pathmaynotcontaincolon'); standard_error('pathmaynotcontaincolon');
@@ -358,18 +324,18 @@ elseif($page == 'domains')
`customerid` = '" . (int)$userinfo['customerid'] . "', `customerid` = '" . (int)$userinfo['customerid'] . "',
`domain` = '" . $db->escape($completedomain) . "', `domain` = '" . $db->escape($completedomain) . "',
`documentroot` = '" . $db->escape($path) . "', `documentroot` = '" . $db->escape($path) . "',
`ipandport` = '" . $db->escape($domain_check['ipandport']) . "',
`aliasdomain` = ".(($aliasdomain != 0) ? "'" . $db->escape($aliasdomain) . "'" : "NULL") .", `aliasdomain` = ".(($aliasdomain != 0) ? "'" . $db->escape($aliasdomain) . "'" : "NULL") .",
`parentdomainid` = '" . (int)$domain_check['id'] . "', `parentdomainid` = '" . (int)$domain_check['id'] . "',
`isemaildomain` = '" . ($domain_check['subcanemaildomain'] == '3' ? '1' : '0') . "', `isemaildomain` = '" . ($domain_check['subcanemaildomain'] == '3' ? '1' : '0') . "',
`openbasedir` = '" . $db->escape($domain_check['openbasedir']) . "', `openbasedir` = '" . $db->escape($domain_check['openbasedir']) . "',
`openbasedir_path` = '" . $db->escape($openbasedir_path) . "', `openbasedir_path` = '" . $db->escape($openbasedir_path) . "',
`safemode` = '" . $db->escape($domain_check['safemode']) . "',
`speciallogfile` = '" . $db->escape($domain_check['speciallogfile']) . "', `speciallogfile` = '" . $db->escape($domain_check['speciallogfile']) . "',
`specialsettings` = '" . $db->escape($domain_check['specialsettings']) . "', `specialsettings` = '" . $db->escape($domain_check['specialsettings']) . "',
`ssl_redirect` = '" . $ssl_redirect . "', `ssl_redirect` = '" . $ssl_redirect . "',
`phpsettingid` = '" . $phpsid_result['phpsettingid'] . "'"); `phpsettingid` = '" . $phpsid_result['phpsettingid'] . "'");
$result = $db->query("INSERT INTO `".TABLE_DOMAINTOIP."` (`id_domain`, `id_ipandports`) SELECT LAST_INSERT_ID(), `id_ipandports` FROM `".TABLE_DOMAINTOIP."` WHERE `id_domain` = '" . (int)$domain_check['id'] . "';");
if($_doredirect) if($_doredirect)
{ {
$did = $db->insert_id(); $did = $db->insert_id();
@@ -380,10 +346,7 @@ elseif($page == 'domains')
$result = $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `subdomains_used`=`subdomains_used`+1 WHERE `customerid`='" . (int)$userinfo['customerid'] . "'"); $result = $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `subdomains_used`=`subdomains_used`+1 WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
$log->logAction(USR_ACTION, LOG_INFO, "added subdomain '" . $completedomain . "'"); $log->logAction(USR_ACTION, LOG_INFO, "added subdomain '" . $completedomain . "'");
inserttask('1'); inserttask('1');
// Using nameserver, insert a task which rebuilds the server config
inserttask('4'); inserttask('4');
redirectTo($filename, Array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} }
} }
@@ -405,32 +368,19 @@ elseif($page == 'domains')
$aliasdomains.= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['id']); $aliasdomains.= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['id']);
} }
$redirectcode = '';
if($settings['customredirect']['enabled'] == '1') if($settings['customredirect']['enabled'] == '1')
{ {
$redirectcode = '';
$codes = getRedirectCodesArray(); $codes = getRedirectCodesArray();
foreach($codes as $rc) foreach($codes as $rc)
{ {
$redirectcode .= makeoption($rc['code']. ' ('.$lng['redirect_desc'][$rc['desc']].')', $rc['id'], $settings['customredirect']['default']); $redirectcode .= makeoption($rc['code'], $rc['id'], $settings['customredirect']['default']);
} }
} }
// check if we at least have one ssl-ip/port, #1179 $ssl_redirect = makeyesno('ssl_redirect', '1', '0', $result['ssl_redirect']);
$ssl_ipsandports = '';
$resultX = $db->query_first("SELECT COUNT(*) as countSSL FROM `panel_ipsandports` WHERE `ssl`='1'");
if (isset($resultX['countSSL']) && (int)$resultX['countSSL'] > 0) {
$ssl_ipsandports = 'notempty';
}
$openbasedir = makeoption($lng['domain']['docroot'], 0, NULL, true) . makeoption($lng['domain']['homedir'], 1, NULL, true); $openbasedir = makeoption($lng['domain']['docroot'], 0, NULL, true) . makeoption($lng['domain']['homedir'], 1, NULL, true);
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']); $pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
$subdomain_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/domains/formfield.domains_add.php';
$subdomain_add_form = htmlform::genHTMLForm($subdomain_add_data);
$title = $subdomain_add_data['domain_add']['title'];
$image = $subdomain_add_data['domain_add']['image'];
eval("echo \"" . getTemplate("domains/domains_add") . "\";"); eval("echo \"" . getTemplate("domains/domains_add") . "\";");
} }
} }
@@ -438,7 +388,7 @@ elseif($page == 'domains')
elseif($action == 'edit' elseif($action == 'edit'
&& $id != 0) && $id != 0)
{ {
$result = $db->query_first("SELECT `d`.`id`, `d`.`customerid`, `d`.`domain`, `d`.`documentroot`, `d`.`isemaildomain`, `d`.`wwwserveralias`, `d`.`iswildcarddomain`, `d`.`parentdomainid`, `d`.`ssl_redirect`, `d`.`aliasdomain`, `d`.`openbasedir`, `d`.`openbasedir_path`, `pd`.`subcanemaildomain` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_DOMAINS . "` `pd` WHERE `d`.`customerid`='" . (int)$userinfo['customerid'] . "' AND `d`.`id`='" . (int)$id . "' AND ((`d`.`parentdomainid`!='0' AND `pd`.`id`=`d`.`parentdomainid`) OR (`d`.`parentdomainid`='0' AND `pd`.`id`=`d`.`id`)) AND `d`.`caneditdomain`='1'"); $result = $db->query_first("SELECT `d`.`id`, `d`.`customerid`, `d`.`domain`, `d`.`documentroot`, `d`.`isemaildomain`, `d`.`iswildcarddomain`, `d`.`parentdomainid`, `d`.`ssl_redirect`, `d`.`aliasdomain`, `d`.`openbasedir_path`, `d`.`ipandport`, `pd`.`subcanemaildomain` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_DOMAINS . "` `pd` WHERE `d`.`customerid`='" . (int)$userinfo['customerid'] . "' AND `d`.`id`='" . (int)$id . "' AND ((`d`.`parentdomainid`!='0' AND `pd`.`id`=`d`.`parentdomainid`) OR (`d`.`parentdomainid`='0' AND `pd`.`id`=`d`.`id`)) AND `d`.`caneditdomain`='1'");
$alias_check = $db->query_first('SELECT COUNT(`id`) AS count FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `aliasdomain`=\'' . (int)$result['id'] . '\''); $alias_check = $db->query_first('SELECT COUNT(`id`) AS count FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `aliasdomain`=\'' . (int)$result['id'] . '\'');
$alias_check = $alias_check['count']; $alias_check = $alias_check['count'];
$_doredirect = false; $_doredirect = false;
@@ -464,17 +414,8 @@ elseif($page == 'domains')
if(!preg_match('/^https?\:\/\//', $path) if(!preg_match('/^https?\:\/\//', $path)
|| !validateUrl($idna_convert->encode($path))) || !validateUrl($idna_convert->encode($path)))
{ {
// If path is empty or '/' and 'Use domain name as default value for DocumentRoot path' is enabled in settings, $path = $userinfo['documentroot'] . '/' . $path;
// set default path to subdomain or domain name $path = makeCorrectDir($path);
if((($path == '') || ($path == '/'))
&& $settings['system']['documentroot_use_default_value'] == 1)
{
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $result['domain']);
}
else
{
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path);
}
if (strstr($path, ":") !== FALSE) if (strstr($path, ":") !== FALSE)
{ {
standard_error('pathmaynotcontaincolon'); standard_error('pathmaynotcontaincolon');
@@ -487,14 +428,15 @@ elseif($page == 'domains')
$aliasdomain = intval($_POST['alias']); $aliasdomain = intval($_POST['alias']);
if(isset($_POST['selectserveralias']) if(isset($_POST['iswildcarddomain'])
&& $_POST['iswildcarddomain'] == '1'
&& $result['parentdomainid'] == '0' && $result['parentdomainid'] == '0'
) { ){
$iswildcarddomain = ($_POST['selectserveralias'] == '0') ? '1' : '0'; $iswildcarddomain = '1';
$wwwserveralias = ($_POST['selectserveralias'] == '1') ? '1' : '0'; }
} else { else
{
$iswildcarddomain = '0'; $iswildcarddomain = '0';
$wwwserveralias = '0';
} }
if($result['parentdomainid'] != '0' if($result['parentdomainid'] != '0'
@@ -564,28 +506,15 @@ elseif($page == 'domains')
if($path != $result['documentroot'] if($path != $result['documentroot']
|| $isemaildomain != $result['isemaildomain'] || $isemaildomain != $result['isemaildomain']
|| $wwwserveralias != $result['wwwserveralias']
|| $iswildcarddomain != $result['iswildcarddomain'] || $iswildcarddomain != $result['iswildcarddomain']
|| $aliasdomain != $result['aliasdomain'] || $aliasdomain != $result['aliasdomain']
|| $openbasedir_path != $result['openbasedir_path'] || $openbasedir_path != $result['openbasedir_path']
|| $ssl_redirect != $result['ssl_redirect']) || $ssl_redirect != $result['ssl_redirect'])
{ {
$log->logAction(USR_ACTION, LOG_INFO, "edited domain '" . $idna_convert->decode($result['domain']) . "'"); $log->logAction(USR_ACTION, LOG_INFO, "edited domain '" . $idna_convert->decode($result['domain']) . "'");
$result = $db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET $result = $db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `documentroot`='" . $db->escape($path) . "', `isemaildomain`='" . (int)$isemaildomain . "', `iswildcarddomain`='" . (int)$iswildcarddomain . "', `aliasdomain`=" . (($aliasdomain != 0 && $alias_check == 0) ? '\'' . $db->escape($aliasdomain) . '\'' : 'NULL') . ",`openbasedir_path`='" . $db->escape($openbasedir_path) . "', `ssl_redirect`='" . $ssl_redirect . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
`documentroot`='" . $db->escape($path) . "',
`isemaildomain`='" . (int)$isemaildomain . "',
`wwwserveralias`='" . (int)$wwwserveralias . "',
`iswildcarddomain`='" . (int)$iswildcarddomain . "',
`aliasdomain`=" . (($aliasdomain != 0 && $alias_check == 0) ? '\'' . $db->escape($aliasdomain) . '\'' : 'NULL') . ",
`openbasedir_path`='" . $db->escape($openbasedir_path) . "',
`ssl_redirect`='" . $ssl_redirect . "'
WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'"
);
inserttask('1'); inserttask('1');
// Using nameserver, insert a task which rebuilds the server config
inserttask('4'); inserttask('4');
} }
redirectTo($filename, Array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
@@ -594,10 +523,9 @@ elseif($page == 'domains')
else else
{ {
$result['domain'] = $idna_convert->decode($result['domain']); $result['domain'] = $idna_convert->decode($result['domain']);
$domains = makeoption($lng['domains']['noaliasdomain'], 0, $result['aliasdomain'], true); $domains = makeoption($lng['domains']['noaliasdomain'], 0, $result['aliasdomain'], true);
// also check ip/port combination to be the same, #176 // also check ip/port combination to be the same, #176
$result_domains = $db->query("SELECT `d`.`id`, `d`.`domain` FROM `" . TABLE_PANEL_DOMAINS . "` `d` , `" . TABLE_PANEL_CUSTOMERS . "` `c` , `".TABLE_DOMAINTOIP."` `dip` WHERE `d`.`aliasdomain` IS NULL AND `d`.`id` <> '".(int)$result['id']."' AND `c`.`standardsubdomain` <> `d`.`id` AND `d`.`customerid` = '" . (int)$userinfo['customerid'] . "' AND `c`.`customerid` = `d`.`customerid` AND `d`.`id` = `dip`.`id_domain` AND `dip`.`id_ipandports` IN (SELECT `id_ipandports` FROM `".TABLE_DOMAINTOIP."` WHERE `id_domain` = '".(int)$result['id']."') GROUP BY `d`.`domain` ORDER BY `d`.`domain` ASC"); $result_domains = $db->query("SELECT `d`.`id`, `d`.`domain` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c` WHERE `d`.`aliasdomain` IS NULL AND `d`.`id`<>'" . (int)$result['id'] . "' AND `c`.`standardsubdomain`<>`d`.`id` AND `d`.`customerid`='" . (int)$userinfo['customerid'] . "' AND `c`.`customerid`=`d`.`customerid` AND `d`.`ipandport` = '".(int)$result['ipandport']."' ORDER BY `d`.`domain` ASC");
while($row_domain = $db->fetch_array($result_domains)) while($row_domain = $db->fetch_array($result_domains))
{ {
@@ -606,17 +534,10 @@ elseif($page == 'domains')
if(preg_match('/^https?\:\/\//', $result['documentroot']) if(preg_match('/^https?\:\/\//', $result['documentroot'])
&& validateUrl($idna_convert->encode($result['documentroot'])) && validateUrl($idna_convert->encode($result['documentroot']))
) { && $settings['panel']['pathedit'] == 'Dropdown')
if($settings['panel']['pathedit'] == 'Dropdown') {
{ $urlvalue = $result['documentroot'];
$urlvalue = $result['documentroot']; $pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
}
else
{
$urlvalue = '';
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit'], $result['documentroot'], true);
}
} }
else else
{ {
@@ -624,53 +545,30 @@ elseif($page == 'domains')
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit'], $result['documentroot']); $pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit'], $result['documentroot']);
} }
$redirectcode = '';
if($settings['customredirect']['enabled'] == '1') if($settings['customredirect']['enabled'] == '1')
{ {
$def_code = getDomainRedirectId($id); $def_code = getDomainRedirectId($id);
$redirectcode = '';
$codes = getRedirectCodesArray(); $codes = getRedirectCodesArray();
foreach($codes as $rc) foreach($codes as $rc)
{ {
$redirectcode .= makeoption($rc['code']. ' ('.$lng['redirect_desc'][$rc['desc']].')', $rc['id'], $def_code); $redirectcode .= makeoption($rc['code'], $rc['id'], $def_code);
} }
} }
// check if we at least have one ssl-ip/port, #1179 $ssl_redirect = makeyesno('ssl_redirect', '1', '0', $result['ssl_redirect']);
$ssl_ipsandports = ''; $iswildcarddomain = makeyesno('iswildcarddomain', '1', '0', $result['iswildcarddomain']);
$resultX = $db->query_first("SELECT COUNT(*) as countSSL FROM `panel_ipsandports` WHERE `ssl`='1'"); $isemaildomain = makeyesno('isemaildomain', '1', '0', $result['isemaildomain']);
if (isset($resultX['countSSL']) && (int)$resultX['countSSL'] > 0) {
$ssl_ipsandports = 'notempty';
}
$openbasedir = makeoption($lng['domain']['docroot'], 0, $result['openbasedir_path'], true) . makeoption($lng['domain']['homedir'], 1, $result['openbasedir_path'], true); $openbasedir = makeoption($lng['domain']['docroot'], 0, $result['openbasedir_path'], true) . makeoption($lng['domain']['homedir'], 1, $result['openbasedir_path'], true);
// create serveralias options $result_ipandport = $db->query_first("SELECT `ip` FROM `".TABLE_PANEL_IPSANDPORTS."` WHERE `id`='".(int)$result['ipandport']."'");
$serveraliasoptions = ""; if(filter_var($result_ipandport['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
$_value = '2'; {
if ($result['iswildcarddomain'] == '1') { $result_ipandport['ip'] = '[' . $result_ipandport['ip'] . ']';
$_value = '0';
} elseif ($result['wwwserveralias'] == '1') {
$_value = '1';
} }
$serveraliasoptions .= makeoption($lng['domains']['serveraliasoption_wildcard'], '0', $_value, true, true);
$serveraliasoptions .= makeoption($lng['domains']['serveraliasoption_www'], '1', $_value, true, true);
$serveraliasoptions .= makeoption($lng['domains']['serveraliasoption_none'], '2', $_value, true, true);
$resultips = $db->query("SELECT `p`.`ip` AS `ip` FROM `".TABLE_PANEL_IPSANDPORTS."` `p` LEFT JOIN `".TABLE_DOMAINTOIP."` `dip` ON ( `dip`.`id_ipandports` = `p`.`id` ) WHERE `dip`.`id_domain` = '".(int)$result['id']."' GROUP BY `p`.`ip`");
$result_ipandport['ip'] = '';
while ($rowip = $db->fetch_array($resultips)) {
$result_ipandport['ip'] .= $rowip['ip'] . "<br />";
}
$domainip = $result_ipandport['ip']; $domainip = $result_ipandport['ip'];
$result = htmlentities_array($result); $result = htmlentities_array($result);
$subdomain_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/domains/formfield.domains_edit.php';
$subdomain_edit_form = htmlform::genHTMLForm($subdomain_edit_data);
$title = $subdomain_edit_data['domain_edit']['title'];
$image = $subdomain_edit_data['domain_edit']['image'];
eval("echo \"" . getTemplate("domains/domains_edit") . "\";"); eval("echo \"" . getTemplate("domains/domains_edit") . "\";");
} }
} }
@@ -680,126 +578,5 @@ elseif($page == 'domains')
} }
} }
} }
elseif ($page == 'domainssleditor') {
if ($action == '' ?>
|| $action == 'view'
) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$ssl_cert_file = isset($_POST['ssl_cert_file']) ? $_POST['ssl_cert_file'] : '';
$ssl_key_file = isset($_POST['ssl_key_file']) ? $_POST['ssl_key_file'] : '';
$ssl_ca_file = isset($_POST['ssl_ca_file']) ? $_POST['ssl_ca_file'] : '';
$ssl_cert_chainfile = isset($_POST['ssl_cert_chainfile']) ? $_POST['ssl_cert_chainfile'] : '';
$do_insert = isset($_POST['do_insert']) ? (($_POST['do_insert'] == 1) ? true : false) : false;
if ($ssl_cert_file != '' && $ssl_key_file == '') {
standard_error('sslcertificateismissingprivatekey');
}
$do_verify = true;
// no cert-file given -> forget everything
if ($ssl_cert_file == '') {
$ssl_key_file = '';
$ssl_ca_file = '';
$ssl_cert_chainfile = '';
$do_verify = false;
}
// verify certificate content
if ($do_verify) {
// array openssl_x509_parse ( mixed $x509cert [, bool $shortnames = true ] )
// openssl_x509_parse() returns information about the supplied x509cert, including fields such as
// subject name, issuer name, purposes, valid from and valid to dates etc.
$cert_content = openssl_x509_parse($ssl_cert_file);
if (is_array($cert_content)
&& isset($cert_content['subject'])
&& isset($cert_content['subject']['CN'])
) {
// TODO self-signed certs might differ and don't need/want this
/*
$domain = $db->query_first("SELECT * FROM `".TABLE_PANEL_DOMAINS."` WHERE `id`='".(int)$id."'");
if (strtolower($cert_content['subject']['CN']) != strtolower($idna_convert->decode($domain['domain']))) {
standard_error('sslcertificatewrongdomain');
}
*/
// bool openssl_x509_check_private_key ( mixed $cert , mixed $key )
// Checks whether the given key is the private key that corresponds to cert.
if (openssl_x509_check_private_key($ssl_cert_file, $ssl_key_file) === false) {
standard_error('sslcertificateinvalidcertkeypair');
}
// check optional stuff
if ($ssl_ca_file != '') {
$ca_content = openssl_x509_parse($ssl_ca_file);
if (!is_array($ca_content)) {
// invalid
standard_error('sslcertificateinvalidca');
}
}
if ($ssl_cert_chainfile != '') {
$chain_content = openssl_x509_parse($ssl_cert_chainfile);
if (!is_array($chain_content)) {
// invalid
standard_error('sslcertificateinvalidchain');
}
}
} else {
standard_error('sslcertificateinvalidcert');
}
}
// Add/Update database entry
$qrystart = "UPDATE ";
$qrywhere = "WHERE ";
if ($do_insert) {
$qrystart = "INSERT INTO ";
$qrywhere = ", ";
}
$db->query($qrystart." `".TABLE_PANEL_DOMAIN_SSL_SETTINGS."` SET
`ssl_cert_file` = '".$db->escape($ssl_cert_file)."',
`ssl_key_file` = '".$db->escape($ssl_key_file)."',
`ssl_ca_file` = '".$db->escape($ssl_ca_file)."',
`ssl_cert_chainfile` = '".$db->escape($ssl_cert_chainfile)."'
".$qrywhere." `domainid`='".(int)$id."';"
);
// insert task to re-generate webserver-configs (#1260)
inserttask('1');
// back to domain overview
redirectTo($filename, array('page' => 'domains', 's' => $s));
}
$result = $db->query_first("SELECT * FROM `".TABLE_PANEL_DOMAIN_SSL_SETTINGS."`
WHERE `domainid`='".(int)$id."';"
);
$do_insert = false;
// if no entry can be found, behave like we have empty values
if (!is_array($result) || !isset($result['ssl_cert_file'])) {
$result = array(
'ssl_cert_file' => '',
'ssl_key_file' => '',
'ssl_ca_file' => '',
'ssl_cert_chainfile' => ''
);
$do_insert = true;
}
$result = htmlentities_array($result);
$ssleditor_data = include_once dirname(__FILE__).'/lib/formfields/customer/domains/formfield.domain_ssleditor.php';
$ssleditor_form = htmlform::genHTMLForm($ssleditor_data);
$title = $ssleditor_data['domain_ssleditor']['title'];
$image = $ssleditor_data['domain_ssleditor']['image'];
eval("echo \"" . getTemplate("domains/domain_ssleditor") . "\";");
}
}

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'customer'); define('AREA', 'customer');
@@ -50,7 +50,7 @@ elseif($page == 'emails')
'm.destination' => $lng['emails']['forwarders'] 'm.destination' => $lng['emails']['forwarders']
); );
$paging = new paging($userinfo, $db, TABLE_MAIL_VIRTUAL, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']); $paging = new paging($userinfo, $db, TABLE_MAIL_VIRTUAL, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$result = $db->query('SELECT `m`.`id`, `m`.`domainid`, `m`.`email`, `m`.`email_full`, `m`.`iscatchall`, `u`.`quota`, `m`.`destination`, `m`.`popaccountid`, `d`.`domain`, `u`.`mboxsize` FROM `' . TABLE_MAIL_VIRTUAL . '` `m` LEFT JOIN `' . TABLE_PANEL_DOMAINS . '` `d` ON (`m`.`domainid` = `d`.`id`) LEFT JOIN `' . TABLE_MAIL_USERS . '` `u` ON (`m`.`popaccountid` = `u`.`id`) WHERE `m`.`customerid`="' . $db->escape($userinfo['customerid']) . '" ' . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()); $result = $db->query('SELECT `m`.`id`, `m`.`domainid`, `m`.`email`, `m`.`email_full`, `m`.`iscatchall`, `u`.`quota`, `m`.`destination`, `m`.`popaccountid`, `d`.`domain` FROM `' . TABLE_MAIL_VIRTUAL . '` `m` LEFT JOIN `' . TABLE_PANEL_DOMAINS . '` `d` ON (`m`.`domainid` = `d`.`id`) LEFT JOIN `' . TABLE_MAIL_USERS . '` `u` ON (`m`.`popaccountid` = `u`.`id`) WHERE `m`.`customerid`="' . $db->escape($userinfo['customerid']) . '" ' . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
$paging->setEntries($db->num_rows($result)); $paging->setEntries($db->num_rows($result));
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
@@ -66,7 +66,6 @@ elseif($page == 'emails')
$emails[$row['domain']] = array(); $emails[$row['domain']] = array();
} }
$row['mboxsize'] = size_readable($row['mboxsize']);
$emails[$row['domain']][$row['email_full']] = $row; $emails[$row['domain']][$row['email_full']] = $row;
} }
@@ -188,7 +187,7 @@ elseif($page == 'emails')
if(isset($_POST['delete_userfiles']) if(isset($_POST['delete_userfiles'])
&& (int)$_POST['delete_userfiles'] == 1) && (int)$_POST['delete_userfiles'] == 1)
{ {
inserttask('7', $userinfo['loginname'], $result['email_full']); inserttask('7', $result['loginname'], $result['email']);
} }
$db->query("DELETE FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'"); $db->query("DELETE FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
@@ -198,12 +197,7 @@ elseif($page == 'emails')
} }
else else
{ {
if(maildirExists($result)) { ask_yesno_withcheckbox('email_reallydelete', 'admin_customer_alsoremovemail', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $idna_convert->decode($result['email_full']));
$show_checkbox = true;
} else {
$show_checkbox = false;
}
ask_yesno_withcheckbox('email_reallydelete', 'admin_customer_alsoremovemail', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $idna_convert->decode($result['email_full']), $show_checkbox);
} }
} }
} }
@@ -238,7 +232,7 @@ elseif($page == 'emails')
standard_error('emailiswrong', $email_full); standard_error('emailiswrong', $email_full);
} }
$email_check = $db->query_first("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid` FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE (`email` = '" . strtolower($db->escape($email)) . "' OR `email_full` = '" . strtolower($db->escape($email_full)) . "') AND `customerid`='" . (int)$userinfo['customerid'] . "'"); $email_check = $db->query_first("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid` FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE ( `email`='" . $db->escape($email) . "' OR `email_full` = '" . $db->escape($email_full) . "' ) AND `customerid`='" . (int)$userinfo['customerid'] . "'");
if($email == '' if($email == ''
|| $email_full == '' || $email_full == ''
@@ -254,7 +248,7 @@ elseif($page == 'emails')
{ {
standard_error('maindomainnonexist', $domain); standard_error('maindomainnonexist', $domain);
} }
elseif(strtolower($email_check['email_full']) == strtolower($email_full)) elseif($email_check['email_full'] == $email_full)
{ {
standard_error('emailexistalready', $email_full); standard_error('emailexistalready', $email_full);
} }
@@ -282,20 +276,7 @@ elseif($page == 'emails')
$domains.= makeoption($idna_convert->decode($row['domain']), $row['domain']); $domains.= makeoption($idna_convert->decode($row['domain']), $row['domain']);
} }
//$iscatchall = makeyesno('iscatchall', '1', '0', '0'); $iscatchall = makeyesno('iscatchall', '1', '0', '0');
$email_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/email/formfield.emails_add.php';
if ( $settings['catchall']['catchall_enabled'] != '1' )
{
unset($email_add_data['emails_add']['sections']['section_a']['fields']['iscatchall']);
}
$email_add_form = htmlform::genHTMLForm($email_add_data);
$title = $email_add_data['emails_add']['title'];
$image = $email_add_data['emails_add']['image'];
eval("echo \"" . getTemplate("email/emails_add") . "\";"); eval("echo \"" . getTemplate("email/emails_add") . "\";");
} }
} }
@@ -335,60 +316,40 @@ elseif($page == 'emails')
$destinations_count = count($result['destination']); $destinations_count = count($result['destination']);
$result = htmlentities_array($result); $result = htmlentities_array($result);
$email_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/email/formfield.emails_edit.php';
if ( $settings['catchall']['catchall_enabled'] != '1' )
{
unset($email_edit_data['emails_edit']['sections']['section_a']['fields']['mail_catchall']);
}
$email_edit_form = htmlform::genHTMLForm($email_edit_data);
$title = $email_edit_data['emails_edit']['title'];
$image = $email_edit_data['emails_edit']['image'];
eval("echo \"" . getTemplate("email/emails_edit") . "\";"); eval("echo \"" . getTemplate("email/emails_edit") . "\";");
} }
} }
elseif($action == 'togglecatchall' elseif($action == 'togglecatchall'
&& $id != 0) && $id != 0)
{ {
if ( $settings['catchall']['catchall_enabled'] == '1' ) $result = $db->query_first("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid`, `popaccountid` FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
{
$result = $db->query_first("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid`, `popaccountid` FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
if(isset($result['email']) if(isset($result['email'])
&& $result['email'] != '') && $result['email'] != '')
{
if($result['iscatchall'] == '1')
{ {
if($result['iscatchall'] == '1') $db->query("UPDATE `" . TABLE_MAIL_VIRTUAL . "` SET `email` = '" . $db->escape($result['email_full']) . "', `iscatchall` = '0' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$result['id'] . "'");
}
else
{
$email_parts = explode('@', $result['email_full']);
$email = '@' . $email_parts[1];
$email_check = $db->query_first("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid` FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE `email`='" . $db->escape($email) . "' AND `customerid`='" . (int)$userinfo['customerid'] . "'");
if($email_check['email'] == $email)
{ {
$db->query("UPDATE `" . TABLE_MAIL_VIRTUAL . "` SET `email` = '" . $db->escape($result['email_full']) . "', `iscatchall` = '0' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$result['id'] . "'"); standard_error('youhavealreadyacatchallforthisdomain');
exit;
} }
else else
{ {
$email_parts = explode('@', $result['email_full']); $db->query("UPDATE `" . TABLE_MAIL_VIRTUAL . "` SET `email` = '$email' , `iscatchall` = '1' WHERE `customerid`='" . $userinfo['customerid'] . "' AND `id`='" . $result['id'] . "'");
$email = '@' . $email_parts[1]; $log->logAction(USR_ACTION, LOG_INFO, "edited email address '" . $email . "'");
$email_check = $db->query_first("SELECT `id`, `email`, `email_full`, `iscatchall`, `destination`, `customerid` FROM `" . TABLE_MAIL_VIRTUAL . "` WHERE `email`='" . $db->escape($email) . "' AND `customerid`='" . (int)$userinfo['customerid'] . "'");
if($email_check['email'] == $email)
{
standard_error('youhavealreadyacatchallforthisdomain');
exit;
}
else
{
$db->query("UPDATE `" . TABLE_MAIL_VIRTUAL . "` SET `email` = '$email' , `iscatchall` = '1' WHERE `customerid`='" . $userinfo['customerid'] . "' AND `id`='" . $result['id'] . "'");
$log->logAction(USR_ACTION, LOG_INFO, "edited email address '" . $email . "'");
}
} }
redirectTo($filename, Array('page' => $page, 'action' => 'edit', 'id' => $id, 's' => $s));
} }
}
else redirectTo($filename, Array('page' => $page, 'action' => 'edit', 'id' => $id, 's' => $s));
{
standard_error(array('operationnotpermitted', 'featureisdisabled'), 'Catchall');
} }
} }
} }
@@ -459,42 +420,11 @@ elseif($page == 'accounts')
$password = substr(md5(uniqid(microtime(), 1)), 12, 6); $password = substr(md5(uniqid(microtime(), 1)), 12, 6);
} }
$cryptPassword = makeCryptPassword($password); $db->query("INSERT INTO `" . TABLE_MAIL_USERS . "` (`customerid`, `email`, `username`, " . ($settings['system']['mailpwcleartext'] == '1' ? '`password`, ' : '') . " `password_enc`, `homedir`, `maildir`, `uid`, `gid`, `domainid`, `postfix`, `quota`, `imap`, `pop3`) VALUES ('" . (int)$userinfo['customerid'] . "', '" . $db->escape($email_full) . "', '" . $db->escape($username) . "', " . ($settings['system']['mailpwcleartext'] == '1' ? "'" . $db->escape($password) . "'," : '') . " ENCRYPT('" . $db->escape($password) . "'), '" . $db->escape($settings['system']['vmail_homedir']) . "', '" . $db->escape($userinfo['loginname'] . '/' . $email_full . '/') . "', '" . (int)$settings['system']['vmail_uid'] . "', '" . (int)$settings['system']['vmail_gid'] . "', '" . (int)$result['domainid'] . "', 'y', '" . (int)$quota . "', '" . (int)$userinfo['imap'] . "', '" . (int)$userinfo['pop3'] . "')");
$email_user=substr($email_full,0,strrpos($email_full,"@"));
$email_domain=substr($email_full,strrpos($email_full,"@")+1);
$maildirname=trim($settings['system']['vmail_maildirname']);
// Add trailing slash to Maildir if needed
$maildirpath=$maildirname;
if (!empty($maildirname) and substr($maildirname,-1) != "/") $maildirpath.="/";
$db->query("INSERT INTO `" . TABLE_MAIL_USERS .
"` (`customerid`, `email`, `username`, " . ($settings['system']['mailpwcleartext'] == '1' ? '`password`, ' : '') . " `password_enc`, `homedir`, `maildir`, `uid`, `gid`, `domainid`, `postfix`, `quota`, `imap`, `pop3`) ".
"VALUES (".
"'" . (int)$userinfo['customerid'] . "', ".
"'" . $db->escape($email_full) . "', ".
"'" . $db->escape($username) . "', " .
($settings['system']['mailpwcleartext'] == '1' ? "'" . $db->escape($password) . "', " : '') .
"'" . $db->escape($cryptPassword) . "', ".
"'" . $db->escape($settings['system']['vmail_homedir']) . "', '" . $db->escape($userinfo['loginname'] . '/' . $email_domain . "/" . $email_user . "/" . $maildirpath) . "', ".
"'" . (int)$settings['system']['vmail_uid'] . "', ".
"'" . (int)$settings['system']['vmail_gid'] . "', ".
"'" . (int)$result['domainid'] . "', ".
"'y', ".
"'" . (int)$quota . "', ".
"'" . (int)$userinfo['imap'] . "', ".
"'" . (int)$userinfo['pop3'] . "')");
$popaccountid = $db->insert_id(); $popaccountid = $db->insert_id();
$result['destination'].= ' ' . $email_full; $result['destination'].= ' ' . $email_full;
$db->query("UPDATE `" . TABLE_MAIL_VIRTUAL . "` SET ". $db->query("UPDATE `" . TABLE_MAIL_VIRTUAL . "` SET `destination` = '" . $db->escape(makeCorrectDestination($result['destination'])) . "', `popaccountid` = '" . (int)$popaccountid . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
"`destination` = '" . $db->escape(makeCorrectDestination($result['destination'])) . "', ". $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_accounts_used`=`email_accounts_used`+1, `email_quota_used`=`email_quota_used`+" . (int)$quota . " WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
"`popaccountid` = '" . (int)$popaccountid . "' ".
"WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET ".
"`email_accounts_used`=`email_accounts_used`+1, ".
"`email_quota_used`=`email_quota_used`+" . (int)$quota . " ".
"WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
$log->logAction(USR_ACTION, LOG_INFO, "added email account for '" . $email_full . "'"); $log->logAction(USR_ACTION, LOG_INFO, "added email account for '" . $email_full . "'");
$replace_arr = array( $replace_arr = array(
'EMAIL' => $email_full, 'EMAIL' => $email_full,
@@ -513,7 +443,7 @@ elseif($page == 'accounts')
$mail->Subject = $mail_subject; $mail->Subject = $mail_subject;
$mail->AltBody = $mail_body; $mail->AltBody = $mail_body;
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body)); $mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
$mail->AddAddress($email_full); $mail->AddAddress($email_full, getCorrectUserSalutation($userinfo));
$mail->Send(); $mail->Send();
} catch(phpmailerException $e) { } catch(phpmailerException $e) {
$mailerr_msg = $e->errorMessage(); $mailerr_msg = $e->errorMessage();
@@ -570,13 +500,6 @@ elseif($page == 'accounts')
$result['email_full'] = $idna_convert->decode($result['email_full']); $result['email_full'] = $idna_convert->decode($result['email_full']);
$result = htmlentities_array($result); $result = htmlentities_array($result);
$quota = $settings['system']['mail_quota']; $quota = $settings['system']['mail_quota'];
$account_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/email/formfield.emails_addaccount.php';
$account_add_form = htmlform::genHTMLForm($account_add_data);
$title = $account_add_data['emails_addaccount']['title'];
$image = $account_add_data['emails_addaccount']['image'];
eval("echo \"" . getTemplate("email/account_add") . "\";"); eval("echo \"" . getTemplate("email/account_add") . "\";");
} }
} }
@@ -608,21 +531,13 @@ elseif($page == 'accounts')
$password = validatePassword($password); $password = validatePassword($password);
$log->logAction(USR_ACTION, LOG_NOTICE, "changed email password for '" . $result['email_full'] . "'"); $log->logAction(USR_ACTION, LOG_NOTICE, "changed email password for '" . $result['email_full'] . "'");
$cryptPassword = makeCryptPassword($password); $result = $db->query("UPDATE `" . TABLE_MAIL_USERS . "` SET " . ($settings['system']['mailpwcleartext'] == '1' ? "`password` = '" . $db->escape($password) . "', " : '') . " `password_enc`=ENCRYPT('" . $db->escape($password) . "') WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$result['popaccountid'] . "'");
$result = $db->query("UPDATE `" . TABLE_MAIL_USERS . "` SET " . ($settings['system']['mailpwcleartext'] == '1' ? "`password` = '" . $db->escape($password) . "', " : '') . " `password_enc`='" . $db->escape($cryptPassword) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$result['popaccountid'] . "'");
redirectTo($filename, Array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s)); redirectTo($filename, Array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
} }
else else
{ {
$result['email_full'] = $idna_convert->decode($result['email_full']); $result['email_full'] = $idna_convert->decode($result['email_full']);
$result = htmlentities_array($result); $result = htmlentities_array($result);
$account_changepw_data = include_once dirname(__FILE__).'/lib/formfields/customer/email/formfield.emails_accountchangepasswd.php';
$account_changepw_form = htmlform::genHTMLForm($account_changepw_data);
$title = $account_changepw_data['emails_accountchangepasswd']['title'];
$image = $account_changepw_data['emails_accountchangepasswd']['image'];
eval("echo \"" . getTemplate("email/account_changepw") . "\";"); eval("echo \"" . getTemplate("email/account_changepw") . "\";");
} }
} }
@@ -664,13 +579,6 @@ elseif($page == 'accounts')
{ {
$result['email_full'] = $idna_convert->decode($result['email_full']); $result['email_full'] = $idna_convert->decode($result['email_full']);
$result = htmlentities_array($result); $result = htmlentities_array($result);
$quota_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/email/formfield.emails_accountchangequota.php';
$quota_edit_form = htmlform::genHTMLForm($quota_edit_data);
$title = $quota_edit_data['emails_accountchangequota']['title'];
$image = $quota_edit_data['emails_accountchangequota']['image'];
eval("echo \"" . getTemplate("email/account_changequota") . "\";"); eval("echo \"" . getTemplate("email/account_changequota") . "\";");
} }
} }
@@ -700,19 +608,13 @@ elseif($page == 'accounts')
$quota = 0; $quota = 0;
} }
if(isset($_POST['delete_userfiles'])
&& (int)$_POST['delete_userfiles'] == 1)
{
inserttask('7', $userinfo['loginname'], $result['email_full']);
}
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_accounts_used` = `email_accounts_used` - 1, `email_quota_used` = `email_quota_used` - " . (int)$quota . " WHERE `customerid`='" . (int)$userinfo['customerid'] . "'"); $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_accounts_used` = `email_accounts_used` - 1, `email_quota_used` = `email_quota_used` - " . (int)$quota . " WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
$log->logAction(USR_ACTION, LOG_INFO, "deleted email account for '" . $result['email_full'] . "'"); $log->logAction(USR_ACTION, LOG_INFO, "deleted email account for '" . $result['email_full'] . "'");
redirectTo($filename, Array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s)); redirectTo($filename, Array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
} }
else else
{ {
ask_yesno_withcheckbox('email_reallydelete_account', 'admin_customer_alsoremovemail', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $idna_convert->decode($result['email_full'])); ask_yesno('email_reallydelete_account', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $idna_convert->decode($result['email_full']));
} }
} }
} }
@@ -765,13 +667,6 @@ elseif($page == 'forwarders')
{ {
$result['email_full'] = $idna_convert->decode($result['email_full']); $result['email_full'] = $idna_convert->decode($result['email_full']);
$result = htmlentities_array($result); $result = htmlentities_array($result);
$forwarder_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/email/formfield.emails_addforwarder.php';
$forwarder_add_form = htmlform::genHTMLForm($forwarder_add_data);
$title = $forwarder_add_data['emails_addforwarder']['title'];
$image = $forwarder_add_data['emails_addforwarder']['image'];
eval("echo \"" . getTemplate("email/forwarder_add") . "\";"); eval("echo \"" . getTemplate("email/forwarder_add") . "\";");
} }
} }

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'customer'); define('AREA', 'customer');
@@ -39,30 +39,6 @@ if($page == 'overview')
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras"); $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras");
eval("echo \"" . getTemplate("extras/extras") . "\";"); eval("echo \"" . getTemplate("extras/extras") . "\";");
} }
elseif($page == 'backup')
{
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras_backup");
$result = $db->query("SELECT `backup_enabled` FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
$row = $db->fetch_array($result);
$backup_enabled = makeyesno('backup_enabled', '1', '0', $row['backup_enabled']);
if(isset($_POST['send']) && $_POST['send'] == 'send'){
$backup_enabled = ($_POST['backup_enabled'] == '1' ? '1' : '0');
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `backup_enabled`='" . $backup_enabled . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
redirectTo($filename, Array('page' => $page, 's' => $s));
}
$backup_data = include_once dirname(__FILE__).'/lib/formfields/customer/extras/formfield.backup.php';
$backup_form = htmlform::genHTMLForm($backup_data);
$title = $backup_data['backup']['title'];
$image = $backup_data['backup']['image'];
eval("echo \"" . getTemplate("extras/backup") . "\";");
}
elseif($page == 'htpasswds') elseif($page == 'htpasswds')
{ {
if($action == '') if($action == '')
@@ -73,7 +49,7 @@ elseif($page == 'htpasswds')
'path' => $lng['panel']['path'] 'path' => $lng['panel']['path']
); );
$paging = new paging($userinfo, $db, TABLE_PANEL_HTPASSWDS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']); $paging = new paging($userinfo, $db, TABLE_PANEL_HTPASSWDS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$result = $db->query("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()); $result = $db->query("SELECT `id`, `username`, `path` FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
$paging->setEntries($db->num_rows($result)); $paging->setEntries($db->num_rows($result));
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
@@ -105,7 +81,7 @@ elseif($page == 'htpasswds')
elseif($action == 'delete' elseif($action == 'delete'
&& $id != 0) && $id != 0)
{ {
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'"); $result = $db->query_first("SELECT `id`, `customerid`, `username`, `path` FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
if(isset($result['username']) if(isset($result['username'])
&& $result['username'] != '') && $result['username'] != '')
@@ -138,7 +114,6 @@ elseif($page == 'htpasswds')
$userpath = $path; $userpath = $path;
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path); $path = makeCorrectDir($userinfo['documentroot'] . '/' . $path);
$username = validate($_POST['username'], 'username', '/^[a-zA-Z0-9][a-zA-Z0-9\-_]+\$?$/'); $username = validate($_POST['username'], 'username', '/^[a-zA-Z0-9][a-zA-Z0-9\-_]+\$?$/');
$authname = validate($_POST['directory_authname'], 'directory_authname', '/^[a-zA-Z0-9][a-zA-Z0-9\-_ ]+\$?$/');
validate($_POST['directory_password'], 'password'); validate($_POST['directory_password'], 'password');
$username_path_check = $db->query_first("SELECT `id`, `username`, `path` FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `username`='" . $db->escape($username) . "' AND `path`='" . $db->escape($path) . "' AND `customerid`='" . (int)$userinfo['customerid'] . "'"); $username_path_check = $db->query_first("SELECT `id`, `username`, `path` FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `username`='" . $db->escape($username) . "' AND `path`='" . $db->escape($path) . "' AND `customerid`='" . (int)$userinfo['customerid'] . "'");
@@ -176,7 +151,7 @@ elseif($page == 'htpasswds')
} }
else else
{ {
$db->query("INSERT INTO `" . TABLE_PANEL_HTPASSWDS . "` (`customerid`, `username`, `password`, `path`, `authname`) VALUES ('" . (int)$userinfo['customerid'] . "', '" . $db->escape($username) . "', '" . $db->escape($password) . "', '" . $db->escape($path) . "', '" . $db->escape($authname) . "')"); $db->query("INSERT INTO `" . TABLE_PANEL_HTPASSWDS . "` (`customerid`, `username`, `password`, `path`) VALUES ('" . (int)$userinfo['customerid'] . "', '" . $db->escape($username) . "', '" . $db->escape($password) . "', '" . $db->escape($path) . "')");
$log->logAction(USR_ACTION, LOG_INFO, "added htpasswd for '" . $username . " (" . $path . ")'"); $log->logAction(USR_ACTION, LOG_INFO, "added htpasswd for '" . $username . " (" . $path . ")'");
inserttask('1'); inserttask('1');
redirectTo($filename, Array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
@@ -185,20 +160,13 @@ elseif($page == 'htpasswds')
else else
{ {
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']); $pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
$htpasswd_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/extras/formfield.htpasswd_add.php';
$htpasswd_add_form = htmlform::genHTMLForm($htpasswd_add_data);
$title = $htpasswd_add_data['htpasswd_add']['title'];
$image = $htpasswd_add_data['htpasswd_add']['image'];
eval("echo \"" . getTemplate("extras/htpasswds_add") . "\";"); eval("echo \"" . getTemplate("extras/htpasswds_add") . "\";");
} }
} }
elseif($action == 'edit' elseif($action == 'edit'
&& $id != 0) && $id != 0)
{ {
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'"); $result = $db->query_first("SELECT `id`, `username`, `path` FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
if(isset($result['username']) if(isset($result['username'])
&& $result['username'] != '') && $result['username'] != '')
@@ -207,7 +175,6 @@ elseif($page == 'htpasswds')
&& $_POST['send'] == 'send') && $_POST['send'] == 'send')
{ {
validate($_POST['directory_password'], 'password'); validate($_POST['directory_password'], 'password');
$authname = validate($_POST['directory_authname'], 'directory_authname', '/^[a-zA-Z0-9][a-zA-Z0-9\-_ ]+\$?$/');
if(CRYPT_STD_DES == 1) if(CRYPT_STD_DES == 1)
{ {
@@ -219,25 +186,13 @@ elseif($page == 'htpasswds')
$password = crypt($_POST['directory_password']); $password = crypt($_POST['directory_password']);
} }
$pwd_sql = ''; if($_POST['directory_password'] == '')
if($_POST['directory_password'] != '')
{ {
$pwd_sql = "`password`='" . $db->escape($password) . "' "; standard_error(array('stringisempty', 'mypassword'));
} }
else
$auth_sql = '';
if($authname != $result['authname'])
{ {
$auth_sql = "`authname`='" . $db->escape($authname) . "' "; $db->query("UPDATE `" . TABLE_PANEL_HTPASSWDS . "` SET `password`='" . $db->escape($password) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
}
if($pwd_sql != '' || $auth_sql != '')
{
if($pwd_sql !='' && $auth_sql != '') {
$pwd_sql.= ', ';
}
$db->query("UPDATE `" . TABLE_PANEL_HTPASSWDS . "` SET ".$pwd_sql.$auth_sql." WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
$log->logAction(USR_ACTION, LOG_INFO, "edited htpasswd for '" . $result['username'] . " (" . $result['path'] . ")'"); $log->logAction(USR_ACTION, LOG_INFO, "edited htpasswd for '" . $result['username'] . " (" . $result['path'] . ")'");
inserttask('1'); inserttask('1');
redirectTo($filename, Array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
@@ -251,13 +206,6 @@ elseif($page == 'htpasswds')
} }
$result = htmlentities_array($result); $result = htmlentities_array($result);
$htpasswd_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/extras/formfield.htpasswd_edit.php';
$htpasswd_edit_form = htmlform::genHTMLForm($htpasswd_edit_data);
$title = $htpasswd_edit_data['htpasswd_edit']['title'];
$image = $htpasswd_edit_data['htpasswd_edit']['image'];
eval("echo \"" . getTemplate("extras/htpasswds_edit") . "\";"); eval("echo \"" . getTemplate("extras/htpasswds_edit") . "\";");
} }
} }
@@ -273,11 +221,10 @@ elseif($page == 'htaccess')
'options_indexes' => $lng['extras']['view_directory'], 'options_indexes' => $lng['extras']['view_directory'],
'error404path' => $lng['extras']['error404path'], 'error404path' => $lng['extras']['error404path'],
'error403path' => $lng['extras']['error403path'], 'error403path' => $lng['extras']['error403path'],
'error500path' => $lng['extras']['error500path'], 'error500path' => $lng['extras']['error500path']
'options_cgi' => $lng['extras']['execute_perl']
); );
$paging = new paging($userinfo, $db, TABLE_PANEL_HTACCESS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']); $paging = new paging($userinfo, $db, TABLE_PANEL_HTACCESS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$result = $db->query("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()); $result = $db->query("SELECT `id`, `path`, `options_indexes`, `error404path`, `error403path`, `error500path` FROM `" . TABLE_PANEL_HTACCESS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
$paging->setEntries($db->num_rows($result)); $paging->setEntries($db->num_rows($result));
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
@@ -287,8 +234,6 @@ elseif($page == 'htaccess')
$count = 0; $count = 0;
$htaccess = ''; $htaccess = '';
$cperlenabled = customerHasPerlEnabled($userinfo['customerid']);
while($row = $db->fetch_array($result)) while($row = $db->fetch_array($result))
{ {
if($paging->checkDisplay($i)) if($paging->checkDisplay($i))
@@ -296,14 +241,10 @@ elseif($page == 'htaccess')
if(strpos($row['path'], $userinfo['documentroot']) === 0) if(strpos($row['path'], $userinfo['documentroot']) === 0)
{ {
$row['path'] = substr($row['path'], strlen($userinfo['documentroot'])); $row['path'] = substr($row['path'], strlen($userinfo['documentroot']));
// don't show nothing wehn it's the docroot, show slash
if ($row['path'] == '') { $row['path'] = '/'; }
} }
$row['options_indexes'] = str_replace('1', $lng['panel']['yes'], $row['options_indexes']); $row['options_indexes'] = str_replace('1', $lng['panel']['yes'], $row['options_indexes']);
$row['options_indexes'] = str_replace('0', $lng['panel']['no'], $row['options_indexes']); $row['options_indexes'] = str_replace('0', $lng['panel']['no'], $row['options_indexes']);
$row['options_cgi'] = str_replace('1', $lng['panel']['yes'], $row['options_cgi']);
$row['options_cgi'] = str_replace('0', $lng['panel']['no'], $row['options_cgi']);
$row = htmlentities_array($row); $row = htmlentities_array($row);
eval("\$htaccess.=\"" . getTemplate("extras/htaccess_htaccess") . "\";"); eval("\$htaccess.=\"" . getTemplate("extras/htaccess_htaccess") . "\";");
$count++; $count++;
@@ -352,27 +293,34 @@ elseif($page == 'htaccess')
standard_error('invalidpath'); standard_error('invalidpath');
} }
if(isset($_POST['options_cgi']) if(($_POST['error404path'] === '')
&& (int)$_POST['options_cgi'] != 0 || (validateUrl($idna_convert->encode($_POST['error404path']))))
) { {
$options_cgi = '1'; $error404path = $_POST['error404path'];
} }
else else
{ {
$options_cgi = '0'; standard_error('mustbeurl');
} }
$error404path = ''; if(($_POST['error403path'] === '')
if (isset($_POST['error404path'])) { || (validateUrl($idna_convert->encode($_POST['error403path']))))
$error404path = correctErrorDocument($_POST['error404path']); {
$error403path = $_POST['error403path'];
} }
$error403path = ''; else
if (isset($_POST['error403path'])) { {
$error403path = correctErrorDocument($_POST['error403path']); standard_error('mustbeurl');
} }
$error500path = '';
if (isset($_POST['error500path'])) { if(($_POST['error500path'] === '')
$error500path = correctErrorDocument($_POST['error500path']); || (validateUrl($idna_convert->encode($_POST['error500path']))))
{
$error500path = $_POST['error500path'];
}
else
{
standard_error('mustbeurl');
} }
if($path_dupe_check['path'] == $path) if($path_dupe_check['path'] == $path)
@@ -385,15 +333,7 @@ elseif($page == 'htaccess')
} }
else else
{ {
$db->query('INSERT INTO `' . TABLE_PANEL_HTACCESS . '` SET $db->query('INSERT INTO `' . TABLE_PANEL_HTACCESS . '` (`customerid`, `path`, `options_indexes`, `error404path`, `error403path`, `error500path` ) VALUES ("' . (int)$userinfo['customerid'] . '", "' . $db->escape($path) . '", "' . $db->escape($_POST['options_indexes'] == '1' ? '1' : '0') . '", "' . $db->escape($error404path) . '", "' . $db->escape($error403path) . '", "' . $db->escape($error500path) . '" )');
`customerid` = "'.(int)$userinfo['customerid'].'",
`path` = "'.$db->escape($path).'",
`options_indexes` = "'.$db->escape($_POST['options_indexes'] == '1' ? '1' : '0').'",
`error404path` = "'.$db->escape($error404path).'",
`error403path` = "'.$db->escape($error403path).'",
`error500path` = "'.$db->escape($error500path).'",
`options_cgi` = "'.$db->escape($options_cgi).'"');
$log->logAction(USR_ACTION, LOG_INFO, "added htaccess for '" . $path . "'"); $log->logAction(USR_ACTION, LOG_INFO, "added htaccess for '" . $path . "'");
inserttask('1'); inserttask('1');
redirectTo($filename, Array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
@@ -402,18 +342,7 @@ elseif($page == 'htaccess')
else else
{ {
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']); $pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
$cperlenabled = customerHasPerlEnabled($userinfo['customerid']); $options_indexes = makeyesno('options_indexes', '1', '0', '1');
/*
$options_indexes = makeyesno('options_indexes', '1', '0', '0');
$options_cgi = makeyesno('options_cgi', '1', '0', '0');
*/
$htaccess_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/extras/formfield.htaccess_add.php';
$htaccess_add_form = htmlform::genHTMLForm($htaccess_add_data);
$title = $htaccess_add_data['htaccess_add']['title'];
$image = $htaccess_add_data['htaccess_add']['image'];
eval("echo \"" . getTemplate("extras/htaccess_add") . "\";"); eval("echo \"" . getTemplate("extras/htaccess_add") . "\";");
} }
} }
@@ -430,30 +359,49 @@ elseif($page == 'htaccess')
&& $_POST['send'] == 'send') && $_POST['send'] == 'send')
{ {
$option_indexes = intval($_POST['options_indexes']); $option_indexes = intval($_POST['options_indexes']);
$options_cgi = isset($_POST['options_cgi']) ? intval($_POST['options_cgi']) : 0;
if($option_indexes != '1') if($option_indexes != '1')
{ {
$option_indexes = '0'; $option_indexes = '0';
} }
if($options_cgi != '1') if(($_POST['error404path'] === '')
|| (validateUrl($idna_convert->encode($_POST['error404path']))))
{ {
$options_cgi = '0'; $error404path = $_POST['error404path'];
}
else
{
standard_error('mustbeurl');
} }
$error404path = correctErrorDocument($_POST['error404path']); if(($_POST['error403path'] === '')
$error403path = correctErrorDocument($_POST['error403path']); || (validateUrl($idna_convert->encode($_POST['error403path']))))
$error500path = correctErrorDocument($_POST['error500path']); {
$error403path = $_POST['error403path'];
}
else
{
standard_error('mustbeurl');
}
if(($_POST['error500path'] === '')
|| (validateUrl($idna_convert->encode($_POST['error500path']))))
{
$error500path = $_POST['error500path'];
}
else
{
standard_error('mustbeurl');
}
if(($option_indexes != $result['options_indexes']) if(($option_indexes != $result['options_indexes'])
|| ($error404path != $result['error404path']) || ($error404path != $result['error404path'])
|| ($error403path != $result['error403path']) || ($error403path != $result['error403path'])
|| ($error500path != $result['error500path']) || ($error500path != $result['error500path']))
|| ($options_cgi != $result['options_cgi']))
{ {
inserttask('1'); inserttask('1');
$db->query('UPDATE `' . TABLE_PANEL_HTACCESS . '` SET `options_indexes` = "' . $db->escape($option_indexes) . '", `error404path` = "' . $db->escape($error404path) . '", `error403path` = "' . $db->escape($error403path) . '", `error500path` = "' . $db->escape($error500path) . '", `options_cgi` = "' . $db->escape($options_cgi) . '" WHERE `customerid` = "' . (int)$userinfo['customerid'] . '" AND `id` = "' . (int)$id . '"'); $db->query('UPDATE `' . TABLE_PANEL_HTACCESS . '` SET `options_indexes` = "' . $db->escape($option_indexes) . '", `error404path` = "' . $db->escape($error404path) . '", `error403path` = "' . $db->escape($error403path) . '", `error500path` = "' . $db->escape($error500path) . '" WHERE `customerid` = "' . (int)$userinfo['customerid'] . '" AND `id` = "' . (int)$id . '"');
$log->logAction(USR_ACTION, LOG_INFO, "edited htaccess for '" . str_replace($userinfo['documentroot'], '', $result['path']) . "'"); $log->logAction(USR_ACTION, LOG_INFO, "edited htaccess for '" . str_replace($userinfo['documentroot'], '', $result['path']) . "'");
} }
@@ -464,26 +412,13 @@ elseif($page == 'htaccess')
if(strpos($result['path'], $userinfo['documentroot']) === 0) if(strpos($result['path'], $userinfo['documentroot']) === 0)
{ {
$result['path'] = substr($result['path'], strlen($userinfo['documentroot'])); $result['path'] = substr($result['path'], strlen($userinfo['documentroot']));
// don't show nothing wehn it's the docroot, show slash
if ($result['path'] == '') { $result['path'] = '/'; }
} }
$result['error404path'] = $result['error404path']; $result['error404path'] = $result['error404path'];
$result['error403path'] = $result['error403path']; $result['error403path'] = $result['error403path'];
$result['error500path'] = $result['error500path']; $result['error500path'] = $result['error500path'];
$cperlenabled = customerHasPerlEnabled($userinfo['customerid']);
/*
$options_indexes = makeyesno('options_indexes', '1', '0', $result['options_indexes']); $options_indexes = makeyesno('options_indexes', '1', '0', $result['options_indexes']);
$options_cgi = makeyesno('options_cgi', '1', '0', $result['options_cgi']);
*/
$result = htmlentities_array($result); $result = htmlentities_array($result);
$htaccess_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/extras/formfield.htaccess_edit.php';
$htaccess_edit_form = htmlform::genHTMLForm($htaccess_edit_data);
$title = $htaccess_edit_data['htaccess_edit']['title'];
$image = $htaccess_edit_data['htaccess_edit']['image'];
eval("echo \"" . getTemplate("extras/htaccess_edit") . "\";"); eval("echo \"" . getTemplate("extras/htaccess_edit") . "\";");
} }
} }

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'customer'); define('AREA', 'customer');
@@ -22,27 +22,34 @@ define('AREA', 'customer');
/** /**
* Include our init.php, which manages Sessions, Language etc. * Include our init.php, which manages Sessions, Language etc.
*/ */
require('./lib/init.php');
$id = 0; require ("./lib/init.php");
if (isset($_POST['id'])) {
if(isset($_POST['id']))
{
$id = intval($_POST['id']); $id = intval($_POST['id']);
} elseif(isset($_GET['id'])) { }
elseif(isset($_GET['id']))
{
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
if ($page == 'overview') { if($page == 'overview')
{
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_ftp"); $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_ftp");
eval("echo \"" . getTemplate('ftp/ftp') . "\";"); eval("echo \"" . getTemplate("ftp/ftp") . "\";");
} elseif ($page == 'accounts') { }
if ($action == '') { elseif($page == 'accounts')
{
if($action == '')
{
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_ftp::accounts"); $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_ftp::accounts");
$fields = array( $fields = array(
'username' => $lng['login']['username'], 'username' => $lng['login']['username'],
'homedir' => $lng['panel']['path'] 'homedir' => $lng['panel']['path']
); );
$paging = new paging($userinfo, $db, TABLE_FTP_USERS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']); $paging = new paging($userinfo, $db, TABLE_FTP_USERS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$result = $db->query("SELECT `id`, `username`, `homedir` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . $userinfo['customerid'] . "' AND `username` NOT LIKE '%_backup'" . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()); $result = $db->query("SELECT `id`, `username`, `homedir` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . $userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
$paging->setEntries($db->num_rows($result)); $paging->setEntries($db->num_rows($result));
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
@@ -52,18 +59,23 @@ if ($page == 'overview') {
$count = 0; $count = 0;
$accounts = ''; $accounts = '';
while ($row = $db->fetch_array($result)) { while($row = $db->fetch_array($result))
if ($paging->checkDisplay($i)) { {
if (strpos($row['homedir'], $userinfo['documentroot']) === 0) { if($paging->checkDisplay($i))
{
if(strpos($row['homedir'], $userinfo['documentroot']) === 0)
{
$row['documentroot'] = substr($row['homedir'], strlen($userinfo['documentroot'])); $row['documentroot'] = substr($row['homedir'], strlen($userinfo['documentroot']));
} else { }
else
{
$row['documentroot'] = $row['homedir']; $row['documentroot'] = $row['homedir'];
} }
$row['documentroot'] = makeCorrectDir($row['documentroot']); $row['documentroot'] = makeCorrectDir($row['documentroot']);
$row = htmlentities_array($row); $row = htmlentities_array($row);
eval("\$accounts.=\"" . getTemplate('ftp/accounts_account') . "\";"); eval("\$accounts.=\"" . getTemplate("ftp/accounts_account") . "\";");
$count++; $count++;
} }
@@ -71,88 +83,114 @@ if ($page == 'overview') {
} }
$ftps_count = $db->num_rows($result); $ftps_count = $db->num_rows($result);
eval("echo \"" . getTemplate('ftp/accounts') . "\";"); eval("echo \"" . getTemplate("ftp/accounts") . "\";");
} elseif ($action == 'delete' && $id != 0) { }
elseif($action == 'delete'
&& $id != 0)
{
$result = $db->query_first("SELECT `id`, `username`, `homedir`, `up_count`, `up_bytes`, `down_count`, `down_bytes` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'"); $result = $db->query_first("SELECT `id`, `username`, `homedir`, `up_count`, `up_bytes`, `down_count`, `down_bytes` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
if (isset($result['username']) if(isset($result['username'])
&& $result['username'] != $userinfo['loginname'] && $result['username'] != $userinfo['loginname'])
) { {
if (isset($_POST['send']) if(isset($_POST['send'])
&& $_POST['send'] == 'send' && $_POST['send'] == 'send')
) { {
$db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `up_count`=`up_count`+'" . (int)$result['up_count'] . "', `up_bytes`=`up_bytes`+'" . (int)$result['up_bytes'] . "', `down_count`=`down_count`+'" . (int)$result['down_count'] . "', `down_bytes`=`down_bytes`+'" . (int)$result['down_bytes'] . "' WHERE `username`='" . $db->escape($userinfo['loginname']) . "'"); $db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `up_count`=`up_count`+'" . (int)$result['up_count'] . "', `up_bytes`=`up_bytes`+'" . (int)$result['up_bytes'] . "', `down_count`=`down_count`+'" . (int)$result['down_count'] . "', `down_bytes`=`down_bytes`+'" . (int)$result['down_bytes'] . "' WHERE `username`='" . $db->escape($userinfo['loginname']) . "'");
$result = $db->query_first("SELECT `username`, `homedir` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'"); $result = $db->query("SELECT `username` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
$db->query("DELETE FROM `" . TABLE_FTP_QUOTATALLIES . "` WHERE `name` = '" . $db->escape($result['username']) . "'"); while($row = $db->fetch_array($result))
{
$db->query("DELETE FROM `" . TABLE_FTP_QUOTATALLIES . "` WHERE `name` = '" . $db->escape($row['username']) . "'");
}
$db->query("DELETE FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'"); $db->query("DELETE FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
$log->logAction(USR_ACTION, LOG_INFO, "deleted ftp-account '" . $result['username'] . "'"); $log->logAction(USR_ACTION, LOG_INFO, "deleted ftp-account '" . $result['username'] . "'");
$db->query("UPDATE `" . TABLE_FTP_GROUPS . "` SET `members`=REPLACE(`members`,'," . $db->escape($result['username']) . "','') WHERE `customerid`='" . (int)$userinfo['customerid'] . "'"); $db->query("UPDATE `" . TABLE_FTP_GROUPS . "` SET `members`=REPLACE(`members`,'," . $db->escape($result['username']) . "','') WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
$resetaccnumber = ($userinfo['ftps_used'] == '1') ? " , `ftp_lastaccountnumber`='0'" : ''; // $db->query("DELETE FROM `".TABLE_FTP_GROUPS."` WHERE `customerid`='".$userinfo['customerid']."' AND `id`='$id'");
// refs #293 if($userinfo['ftps_used'] == '1')
if (isset($_POST['delete_userfiles']) {
&& (int)$_POST['delete_userfiles'] == 1 $resetaccnumber = " , `ftp_lastaccountnumber`='0'";
) { }
inserttask('8', $userinfo['loginname'], $result['homedir']); else
{
$resetaccnumber = '';
} }
$result = $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `ftps_used`=`ftps_used`-1 $resetaccnumber WHERE `customerid`='" . (int)$userinfo['customerid'] . "'"); $result = $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `ftps_used`=`ftps_used`-1 $resetaccnumber WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
redirectTo($filename, Array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} else {
ask_yesno_withcheckbox('ftp_reallydelete', 'admin_customer_alsoremoveftphomedir', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['username']);
} }
} else { else
{
ask_yesno('ftp_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['username']);
}
}
else
{
standard_error('ftp_cantdeletemainaccount'); standard_error('ftp_cantdeletemainaccount');
} }
} elseif ($action == 'add') { }
if ($userinfo['ftps_used'] < $userinfo['ftps'] elseif($action == 'add')
|| $userinfo['ftps'] == '-1' {
) { if($userinfo['ftps_used'] < $userinfo['ftps']
if (isset($_POST['send']) || $userinfo['ftps'] == '-1')
&& $_POST['send'] == 'send' {
) { if(isset($_POST['send'])
// @FIXME use a good path-validating regex here (refs #1231) && $_POST['send'] == 'send')
{
$path = validate($_POST['path'], 'path'); $path = validate($_POST['path'], 'path');
$password = validate($_POST['ftp_password'], 'password'); $password = validate($_POST['ftp_password'], 'password');
$password = validatePassword($password); $password = validatePassword($password);
$sendinfomail = isset($_POST['sendinfomail']) ? 1 : 0; $sendinfomail = intval($_POST['sendinfomail']);
if ($sendinfomail != 1) { if($sendinfomail != 1)
{
$sendinfomail = 0; $sendinfomail = 0;
} }
if ($settings['customer']['ftpatdomain'] == '1') { if($settings['customer']['ftpatdomain'] == '1')
{
$ftpusername = validate($_POST['ftp_username'], 'username', '/^[a-zA-Z0-9][a-zA-Z0-9\-_]+\$?$/'); $ftpusername = validate($_POST['ftp_username'], 'username', '/^[a-zA-Z0-9][a-zA-Z0-9\-_]+\$?$/');
if ($ftpusername == '') { if($ftpusername == '')
{
standard_error(array('stringisempty', 'username')); standard_error(array('stringisempty', 'username'));
} }
$ftpdomain = $idna_convert->encode(validate($_POST['ftp_domain'], 'domain')); $ftpdomain = $idna_convert->encode(validate($_POST['ftp_domain'], 'domain'));
$ftpdomain_check = $db->query_first("SELECT `id`, `domain`, `customerid` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `domain`='" . $db->escape($ftpdomain) . "' AND `customerid`='" . (int)$userinfo['customerid'] . "'"); $ftpdomain_check = $db->query_first("SELECT `id`, `domain`, `customerid` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `domain`='" . $db->escape($ftpdomain) . "' AND `customerid`='" . (int)$userinfo['customerid'] . "'");
if ($ftpdomain_check['domain'] != $ftpdomain) { if($ftpdomain_check['domain'] != $ftpdomain)
{
standard_error('maindomainnonexist', $domain); standard_error('maindomainnonexist', $domain);
} }
$username = $ftpusername . "@" . $ftpdomain; $username = $ftpusername . "@" . $ftpdomain;
} else { }
else
{
$username = $userinfo['loginname'] . $settings['customer']['ftpprefix'] . (intval($userinfo['ftp_lastaccountnumber']) + 1); $username = $userinfo['loginname'] . $settings['customer']['ftpprefix'] . (intval($userinfo['ftp_lastaccountnumber']) + 1);
} }
$username_check = $db->query_first('SELECT * FROM `' . TABLE_FTP_USERS .'` WHERE `username` = \'' . $db->escape($username) . '\''); $username_check = $db->query_first('SELECT * FROM `' . TABLE_FTP_USERS .'` WHERE `username` = \'' . $db->escape($username) . '\'');
if (!empty($username_check) && $username_check['username'] = $username) { if(!empty($username_check) && $username_check['username'] = $username)
{
standard_error('usernamealreadyexists', $username); standard_error('usernamealreadyexists', $username);
} elseif ($password == '') { }
elseif($password == '')
{
standard_error(array('stringisempty', 'mypassword')); standard_error(array('stringisempty', 'mypassword'));
} elseif ($path == '') { }
elseif($path == '')
{
standard_error('patherror'); standard_error('patherror');
} else { }
else
{
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path); $path = makeCorrectDir($userinfo['documentroot'] . '/' . $path);
$cryptPassword = makeCryptPassword($password); $db->query("INSERT INTO `" . TABLE_FTP_USERS . "` (`customerid`, `username`, `password`, `homedir`, `login_enabled`, `uid`, `gid`) VALUES ('" . (int)$userinfo['customerid'] . "', '" . $db->escape($username) . "', ENCRYPT('" . $db->escape($password) . "'), '" . $db->escape($path) . "', 'y', '" . (int)$userinfo['guid'] . "', '" . (int)$userinfo['guid'] . "')");
$db->query("INSERT INTO `" . TABLE_FTP_USERS . "` (`customerid`, `username`, `password`, `homedir`, `login_enabled`, `uid`, `gid`) VALUES ('" . (int)$userinfo['customerid'] . "', '" . $db->escape($username) . "', '" . $db->escape($cryptPassword) . "', '" . $db->escape($path) . "', 'y', '" . (int)$userinfo['guid'] . "', '" . (int)$userinfo['guid'] . "')");
$result = $db->query("SELECT `bytes_in_used` FROM `" . TABLE_FTP_QUOTATALLIES . "` WHERE `name` = '" . $userinfo['loginname'] . "'"); $result = $db->query("SELECT `bytes_in_used` FROM `" . TABLE_FTP_QUOTATALLIES . "` WHERE `name` = '" . $userinfo['loginname'] . "'");
while ($row = $db->fetch_array($result)) { 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_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'] . "'"); $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `ftps_used`=`ftps_used`+1, `ftp_lastaccountnumber`=`ftp_lastaccountnumber`+1 WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
@@ -160,24 +198,20 @@ if ($page == 'overview') {
$log->logAction(USR_ACTION, LOG_INFO, "added ftp-account '" . $username . " (" . $path . ")'"); $log->logAction(USR_ACTION, LOG_INFO, "added ftp-account '" . $username . " (" . $path . ")'");
inserttask(5); inserttask(5);
if ($sendinfomail == 1) { if($sendinfomail == 1)
{
$replace_arr = array( $replace_arr = array(
'SALUTATION' => getCorrectUserSalutation($userinfo), 'CUST_NAME' => getCorrectUserSalutation($userinfo),
'CUST_NAME' => getCorrectUserSalutation($userinfo), // < keep this for compatibility
'USR_NAME' => $username, 'USR_NAME' => $username,
'USR_PASS' => $password, 'USR_PASS' => $password,
'USR_PATH' => makeCorrectDir(substr($path, strlen($userinfo['documentroot']))) 'USR_PATH' => makeCorrectDir(substr($path, strlen($userinfo['documentroot'])))
); );
$def_language = $userinfo['def_language']; $mail_body = replace_variables($lng['customer']['ftp_add']['infomail_body']['main'], $replace_arr);
$result = $db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($def_language) . '\' AND `templategroup`=\'mails\' AND `varname`=\'new_ftpaccount_by_customer_subject\'');
$mail_subject = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['customer']['ftp_add']['infomail_subject']), $replace_arr));
$result = $db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($def_language) . '\' AND `templategroup`=\'mails\' AND `varname`=\'new_ftpaccount_by_customer_mailbody\'');
$mail_body = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['customer']['ftp_add']['infomail_body']['main']), $replace_arr));
$_mailerror = false; $_mailerror = false;
try { try {
$mail->Subject = $mail_subject; $mail->Subject = $lng['customer']['ftp_add']['infomail_subject'];
$mail->AltBody = $mail_body; $mail->AltBody = $mail_body;
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body)); $mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
$mail->AddAddress($userinfo['email'], getCorrectUserSalutation($userinfo)); $mail->AddAddress($userinfo['email'], getCorrectUserSalutation($userinfo));
@@ -200,81 +234,73 @@ if ($page == 'overview') {
redirectTo($filename, Array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} }
} else { }
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit'], '/'); else
{
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
if ($settings['customer']['ftpatdomain'] == '1') { if($settings['customer']['ftpatdomain'] == '1')
$domainlist = array(); {
$domains = ''; $domains = '';
$result_domains = $db->query("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "'"); $result_domains = $db->query("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
while ($row_domain = $db->fetch_array($result_domains)) { while($row_domain = $db->fetch_array($result_domains))
$domainlist[] = $row_domain['domain']; {
} $domains.= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['domain']);
sort($domainlist);
if (isset($domainlist[0]) && $domainlist[0] != '') {
foreach ($domainlist as $dom) {
$domains .= makeoption($idna_convert->decode($dom), $dom);
}
} }
} }
//$sendinfomail = makeyesno('sendinfomail', '1', '0', '0'); $sendinfomail = makeyesno('sendinfomail', '1', '0', '0');
$ftp_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/ftp/formfield.ftp_add.php'; eval("echo \"" . getTemplate("ftp/accounts_add") . "\";");
$ftp_add_form = htmlform::genHTMLForm($ftp_add_data);
$title = $ftp_add_data['ftp_add']['title'];
$image = $ftp_add_data['ftp_add']['image'];
eval("echo \"" . getTemplate('ftp/accounts_add') . "\";");
} }
} }
} elseif ($action == 'edit' && $id != 0) { }
elseif($action == 'edit'
&& $id != 0)
{
$result = $db->query_first("SELECT `id`, `username`, `homedir`, `uid`, `gid` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'"); $result = $db->query_first("SELECT `id`, `username`, `homedir`, `uid`, `gid` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
if (isset($result['username']) if(isset($result['username'])
&& $result['username'] != '' && $result['username'] != '')
) { {
if (isset($_POST['send']) if(isset($_POST['send'])
&& $_POST['send'] == 'send' && $_POST['send'] == 'send')
) { {
// @FIXME use a good path-validating regex here (refs #1231)
$path = validate($_POST['path'], 'path'); $path = validate($_POST['path'], 'path');
$_setnewpass = false; $_setnewpass = false;
if (isset($_POST['ftp_password']) && $_POST['ftp_password'] != '') { if(isset($_POST['ftp_password']) && $_POST['ftp_password'] != '')
{
$password = validate($_POST['ftp_password'], 'password'); $password = validate($_POST['ftp_password'], 'password');
$password = validatePassword($password); $password = validatePassword($password);
$_setnewpass = true; $_setnewpass = true;
} }
if ($_setnewpass) { if($_setnewpass)
if ($password == '') { {
if($password == '')
{
standard_error(array('stringisempty', 'mypassword')); standard_error(array('stringisempty', 'mypassword'));
exit; exit;
} }
$log->logAction(USR_ACTION, LOG_INFO, "updated ftp-account password for '" . $result['username'] . "'"); else
$cryptPassword = makeCryptPassword($password); {
$db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `password`='" . $db->escape($cryptPassword) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'"); $log->logAction(USR_ACTION, LOG_INFO, "updated ftp-account password for '" . $result['username'] . "'");
$db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `password`=ENCRYPT('" . $db->escape($password) . "') WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
// also update customers backup user password if password of main ftp user is changed
if(!preg_match('/' . $settings['customer']['ftpprefix'] . '/', $result['username'])){
$db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `password`='" . $db->escape($cryptPassword) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `username`='" . $result['username'] . "_backup'");
} }
} }
if ($path != '') { if($path != '')
{
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path); $path = makeCorrectDir($userinfo['documentroot'] . '/' . $path);
if ($path != $result['homedir']) { if($path != $result['homedir'])
if (!file_exists($path)) { {
// it's the task for "new ftp" but that will if(!file_exists($path))
// create all directories and correct their permissions {
inserttask(5); mkDirWithCorrectOwnership($userinfo['documentroot'], $path, $result['uid'], $result['gid']);
} }
$log->logAction(USR_ACTION, LOG_INFO, "updated ftp-account homdir for '" . $result['username'] . "'"); $log->logAction(USR_ACTION, LOG_INFO, "updated ftp-account homdir for '" . $result['username'] . "'");
@@ -283,34 +309,37 @@ if ($page == 'overview') {
} }
redirectTo($filename, Array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} else { }
if (strpos($result['homedir'], $userinfo['documentroot']) === 0) { else
{
if(strpos($result['homedir'], $userinfo['documentroot']) === 0)
{
$homedir = substr($result['homedir'], strlen($userinfo['documentroot'])); $homedir = substr($result['homedir'], strlen($userinfo['documentroot']));
} else { }
else
{
$homedir = $result['homedir']; $homedir = $result['homedir'];
} }
$homedir = makeCorrectDir($homedir); $homedir = makeCorrectDir($homedir);
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit'], $homedir); $pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit'], $homedir);
if ($settings['customer']['ftpatdomain'] == '1') { if($settings['customer']['ftpatdomain'] == '1')
{
$domains = ''; $domains = '';
$result_domains = $db->query("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "'"); $result_domains = $db->query("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
while ($row_domain = $db->fetch_array($result_domains)) { while($row_domain = $db->fetch_array($result_domains))
$domains .= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['domain']); {
$domains.= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['domain']);
} }
} }
$ftp_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/ftp/formfield.ftp_edit.php'; eval("echo \"" . getTemplate("ftp/accounts_edit") . "\";");
$ftp_edit_form = htmlform::genHTMLForm($ftp_edit_data);
$title = $ftp_edit_data['ftp_edit']['title'];
$image = $ftp_edit_data['ftp_edit']['image'];
eval("echo \"" . getTemplate('ftp/accounts_edit') . "\";");
} }
} }
} }
} }
?>

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'customer'); define('AREA', 'customer');
@@ -22,32 +22,40 @@ define('AREA', 'customer');
/** /**
* Include our init.php, which manages Sessions, Language etc. * Include our init.php, which manages Sessions, Language etc.
*/ */
require('./lib/init.php');
if ($action == 'logout') { require ("./lib/init.php");
$log->logAction(USR_ACTION, LOG_NOTICE, 'logged out');
$query = "DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['customerid'] . "' AND `adminsession` = '0'"; if($action == 'logout')
if ($settings['session']['allow_multiple_login'] == '1') { {
$query .= " AND `hash` = '" . $s . "'"; $log->logAction(USR_ACTION, LOG_NOTICE, "logged out");
if($settings['session']['allow_multiple_login'] == '1')
{
$db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['customerid'] . "' AND `adminsession` = '0' AND `hash` = '" . $s . "'");
} }
$db->query($query); else
{
$db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['customerid'] . "' AND `adminsession` = '0'");
}
redirectTo('index.php'); redirectTo('index.php');
exit; exit;
} }
if ($page == 'overview') { if($page == 'overview')
{
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_index"); $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_index");
$domains = ''; $domains = '';
$result = $db->query("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `parentdomainid`='0' AND `id` <> '" . (int)$userinfo['standardsubdomain'] . "' "); $result = $db->query("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `parentdomainid`='0' AND `id` <> '" . (int)$userinfo['standardsubdomain'] . "' ");
$domainArray = array(); $domainArray = array();
while ($row = $db->fetch_array($result)) { while($row = $db->fetch_array($result))
{
$domainArray[] = $idna_convert->decode($row['domain']); $domainArray[] = $idna_convert->decode($row['domain']);
} }
natsort($domainArray); natsort($domainArray);
$domains = implode(',<br />', $domainArray); $domains = implode(', ', $domainArray);
$userinfo['email'] = $idna_convert->decode($userinfo['email']); $userinfo['email'] = $idna_convert->decode($userinfo['email']);
$yesterday = time() - (60 * 60 * 24); $yesterday = time() - (60 * 60 * 24);
$month = date('M Y', $yesterday); $month = date('M Y', $yesterday);
@@ -59,47 +67,77 @@ if ($page == 'overview') {
$userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, $settings['panel']['decimal_places']); $userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, $settings['panel']['decimal_places']);
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $settings['panel']['decimal_places']); $userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $settings['panel']['decimal_places']);
$userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), $settings['panel']['decimal_places']); $userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), $settings['panel']['decimal_places']);
$userinfo = str_replace_array('-1', $lng['customer']['unlimited'], $userinfo, 'diskspace traffic mysqls emails email_accounts email_forwarders email_quota email_autoresponder ftps tickets subdomains aps_packages'); $userinfo = str_replace_array('-1', $lng['customer']['unlimited'], $userinfo, 'diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps tickets subdomains aps_packages');
$opentickets = 0;
$opentickets = $db->query_first('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
WHERE `customerid` = "' . $userinfo['customerid'] . '"
AND `answerto` = "0"
AND (`status` = "0" OR `status` = "2")
AND `lastreplier`="1"');
$awaitingtickets = $opentickets['count'];
$awaitingtickets_text = '';
eval("echo \"" . getTemplate('index/index') . "\";"); if($opentickets > 0)
} elseif ($page == 'change_password') { {
if (isset($_POST['send']) && $_POST['send'] == 'send') { $awaitingtickets_text = strtr($lng['ticket']['awaitingticketreply'], array('%s' => '<a href="customer_tickets.php?page=tickets&amp;s=' . $s . '">' . $opentickets['count'] . '</a>'));
}
eval("echo \"" . getTemplate("index/index") . "\";");
}
elseif($page == 'change_password')
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$old_password = validate($_POST['old_password'], 'old password'); $old_password = validate($_POST['old_password'], 'old password');
if (md5($old_password) != $userinfo['password']) {
if(md5($old_password) != $userinfo['password'])
{
standard_error('oldpasswordnotcorrect'); standard_error('oldpasswordnotcorrect');
exit; exit;
} }
$new_password = validatePassword($_POST['new_password'], 'new password'); $new_password = validate($_POST['new_password'], 'new password');
$new_password_confirm = validatePassword($_POST['new_password_confirm'], 'new password confirm'); $new_password_confirm = validate($_POST['new_password_confirm'], 'new password confirm');
if ($old_password == '') { if($old_password == '')
{
standard_error(array('stringisempty', 'oldpassword')); standard_error(array('stringisempty', 'oldpassword'));
} elseif($new_password == '') { }
elseif($new_password == '')
{
standard_error(array('stringisempty', 'newpassword')); standard_error(array('stringisempty', 'newpassword'));
} elseif($new_password_confirm == '') { }
elseif($new_password_confirm == '')
{
standard_error(array('stringisempty', 'newpasswordconfirm')); standard_error(array('stringisempty', 'newpasswordconfirm'));
} elseif($new_password != $new_password_confirm) { }
elseif($new_password != $new_password_confirm)
{
standard_error('newpasswordconfirmerror'); standard_error('newpasswordconfirmerror');
} else { }
else
{
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `password`='" . md5($new_password) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `password`='" . md5($old_password) . "'"); $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `password`='" . md5($new_password) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `password`='" . md5($old_password) . "'");
$log->logAction(USR_ACTION, LOG_NOTICE, 'changed password'); $log->logAction(USR_ACTION, LOG_NOTICE, 'changed password');
if (isset($_POST['change_main_ftp']) if(isset($_POST['change_main_ftp'])
&& $_POST['change_main_ftp'] == 'true' && $_POST['change_main_ftp'] == 'true')
) { {
$cryptPassword = makeCryptPassword($new_password); $db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `password`=ENCRYPT('" . $db->escape($new_password) . "') WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `username`='" . $db->escape($userinfo['loginname']) . "'");
$db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `password`='" . $db->escape($cryptPassword) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `username`='" . $db->escape($userinfo['loginname']) . "'");
$log->logAction(USR_ACTION, LOG_NOTICE, 'changed main ftp password'); $log->logAction(USR_ACTION, LOG_NOTICE, 'changed main ftp password');
} }
if (isset($_POST['change_webalizer']) if(isset($_POST['change_webalizer'])
&& $_POST['change_webalizer'] == 'true' && $_POST['change_webalizer'] == 'true')
) { {
if (CRYPT_STD_DES == 1) { if(CRYPT_STD_DES == 1)
{
$saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2); $saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2);
$new_webalizer_password = crypt($new_password, $saltfordescrypt); $new_webalizer_password = crypt($new_password, $saltfordescrypt);
} else { }
else
{
$new_webalizer_password = crypt($new_password); $new_webalizer_password = crypt($new_password);
} }
@@ -108,52 +146,39 @@ if ($page == 'overview') {
redirectTo($filename, Array('s' => $s)); redirectTo($filename, Array('s' => $s));
} }
} else {
eval("echo \"" . getTemplate('index/change_password') . "\";");
} }
} elseif ($page == 'change_language') { else
if (isset($_POST['send']) && $_POST['send'] == 'send') { {
eval("echo \"" . getTemplate("index/change_password") . "\";");
}
}
elseif($page == 'change_language')
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$def_language = validate($_POST['def_language'], 'default language'); $def_language = validate($_POST['def_language'], 'default language');
if (isset($languages[$def_language])) {
if(isset($languages[$def_language]))
{
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `def_language`='" . $db->escape($def_language) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "'"); $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `def_language`='" . $db->escape($def_language) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
$db->query("UPDATE `" . TABLE_PANEL_SESSIONS . "` SET `language`='" . $db->escape($def_language) . "' WHERE `hash`='" . $db->escape($s) . "'"); $db->query("UPDATE `" . TABLE_PANEL_SESSIONS . "` SET `language`='" . $db->escape($def_language) . "' WHERE `hash`='" . $db->escape($s) . "'");
$log->logAction(USR_ACTION, LOG_NOTICE, "changed default language to '" . $def_language . "'"); $log->logAction(USR_ACTION, LOG_NOTICE, "changed default language to '" . $def_language . "'");
} }
redirectTo($filename, Array('s' => $s)); redirectTo($filename, Array('s' => $s));
} else {
$default_lang = $settings['panel']['standardlanguage'];
if ($userinfo['def_language'] != '') {
$default_lang = $userinfo['def_language'];
}
$language_options = '';
while (list($language_file, $language_name) = each($languages)) {
$language_options .= makeoption($language_name, $language_file, $default_lang, true);
}
eval("echo \"" . getTemplate('index/change_language') . "\";");
} }
} elseif ($page == 'change_theme') { else
if (isset($_POST['send']) && $_POST['send'] == 'send') { {
$theme = validate($_POST['theme'], 'theme'); $language_options = '';
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `theme`='" . $db->escape($theme) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "'"); while(list($language_file, $language_name) = each($languages))
$db->query("UPDATE `" . TABLE_PANEL_SESSIONS . "` SET `theme`='" . $db->escape($theme) . "' WHERE `hash`='" . $db->escape($s) . "'"); {
$log->logAction(USR_ACTION, LOG_NOTICE, "changed default theme to '" . $theme . "'"); $language_options.= makeoption($language_name, $language_file, $userinfo['def_language'], true);
redirectTo($filename, Array('s' => $s));
} else {
$default_theme = $settings['panel']['default_theme'];
if ($userinfo['theme'] != '') {
$default_theme = $userinfo['theme'];
} }
$theme_options = ''; eval("echo \"" . getTemplate("index/change_language") . "\";");
$themes_avail = getThemes();
foreach ($themes_avail as $t) {
$theme_options .= makeoption($t, $t, $default_theme, true);
}
eval("echo \"" . getTemplate('index/change_theme') . "\";");
} }
} }
?>

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'customer'); define('AREA', 'customer');
@@ -22,29 +22,37 @@ define('AREA', 'customer');
/** /**
* Include our init.php, which manages Sessions, Language etc. * Include our init.php, which manages Sessions, Language etc.
*/ */
$need_db_sql_data = true; $need_db_sql_data = true;
$need_root_db_sql_data = true; $need_root_db_sql_data = true;
require('./lib/init.php'); require ("./lib/init.php");
if (isset($_POST['id'])) { if(isset($_POST['id']))
{
$id = intval($_POST['id']); $id = intval($_POST['id']);
} elseif(isset($_GET['id'])) { }
elseif(isset($_GET['id']))
{
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
if ($page == 'overview') { if($page == 'overview')
{
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_mysql"); $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_mysql");
$lng['mysql']['description'] = str_replace('<SQL_HOST>', $sql['host'], $lng['mysql']['description']); $lng['mysql']['description'] = str_replace('<SQL_HOST>', $sql['host'], $lng['mysql']['description']);
eval("echo \"" . getTemplate('mysql/mysql') . "\";"); eval("echo \"" . getTemplate("mysql/mysql") . "\";");
} elseif($page == 'mysqls') { }
if ($action == '') { elseif($page == 'mysqls')
{
if($action == '')
{
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_mysql::mysqls"); $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_mysql::mysqls");
$fields = array( $fields = array(
'databasename' => $lng['mysql']['databasename'], 'databasename' => $lng['mysql']['databasename'],
'description' => $lng['mysql']['databasedescription'] 'description' => $lng['mysql']['databasedescription']
); );
$paging = new paging($userinfo, $db, TABLE_PANEL_DATABASES, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']); $paging = new paging($userinfo, $db, TABLE_PANEL_DATABASES, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$result = $db->query("SELECT * FROM `" . TABLE_PANEL_DATABASES . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()); $result = $db->query("SELECT `id`, `databasename`, `description`, `dbserver` FROM `" . TABLE_PANEL_DATABASES . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
$paging->setEntries($db->num_rows($result)); $paging->setEntries($db->num_rows($result));
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
@@ -54,117 +62,121 @@ if ($page == 'overview') {
$count = 0; $count = 0;
$mysqls = ''; $mysqls = '';
// Begin root-session while($row = $db->fetch_array($result))
$db_root = new db($sql_root[0]['host'], $sql_root[0]['user'], $sql_root[0]['password'], ''); {
while ($row = $db->fetch_array($result)) { if($paging->checkDisplay($i))
if ($paging->checkDisplay($i)) { {
$row = htmlentities_array($row); $row = htmlentities_array($row);
$mbdata = $db_root->query_first("SELECT SUM( data_length + index_length) / 1024 / 1024 'MB' FROM information_schema.TABLES WHERE table_schema = '" . $db_root->escape($row['databasename']) . "' GROUP BY table_schema ;"); eval("\$mysqls.=\"" . getTemplate("mysql/mysqls_database") . "\";");
$row['size'] = number_format($mbdata['MB'], 3, '.', '');
eval("\$mysqls.=\"" . getTemplate('mysql/mysqls_database') . "\";");
$count++; $count++;
} }
$i++; $i++;
} }
$db_root->close();
// End root-session
$mysqls_count = $db->num_rows($result); $mysqls_count = $db->num_rows($result);
eval("echo \"" . getTemplate('mysql/mysqls') . "\";"); eval("echo \"" . getTemplate("mysql/mysqls") . "\";");
} elseif($action == 'delete' && $id != 0) { }
$result = $db->query_first('SELECT `id`, `databasename`, `description`, `dbserver` FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . (int)$userinfo['customerid'] . '" AND `id`="' . (int)$id . '"'); 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 . '"');
if (isset($result['databasename']) if(isset($result['databasename'])
&& $result['databasename'] != '' && $result['databasename'] != '')
) { {
if (!isset($sql_root[$result['dbserver']]) || !is_array($sql_root[$result['dbserver']])) { if(!isset($sql_root[$result['dbserver']]) || !is_array($sql_root[$result['dbserver']]))
{
$result['dbserver'] = 0; $result['dbserver'] = 0;
} }
if (isset($_POST['send']) if(isset($_POST['send'])
&& $_POST['send'] == 'send' && $_POST['send'] == 'send')
) { {
// Begin root-session // Begin root-session
$db_root = new db($sql_root[$result['dbserver']]['host'], $sql_root[$result['dbserver']]['user'], $sql_root[$result['dbserver']]['password'], '');
$log->logAction(USR_ACTION, LOG_INFO, "deleted database '" . $result['databasename'] . "'");
if (mysql_get_server_info() < '5.0.2') {
// Revoke privileges (only required for MySQL 4.1.2 - 5.0.1)
$db_root->query('REVOKE ALL PRIVILEGES, GRANT OPTION FROM \'' . $db_root->escape($result['databasename']) .'\'',false,true);
}
$host_res = $db_root->query("SELECT `Host` FROM `mysql`.`user` WHERE `User`='" . $db_root->escape($result['databasename']) . "'"); $db_root = new db($sql_root[$result['dbserver']]['host'], $sql_root[$result['dbserver']]['user'], $sql_root[$result['dbserver']]['password'], '');
while ($host = $db_root->fetch_array($host_res)) { unset($db_root->password);
// as of MySQL 5.0.2 this also revokes privileges. (requires MySQL 4.1.2+) foreach(array_map('trim', array_unique(explode(',', $settings['system']['mysql_access_host']))) as $mysql_access_host)
$db_root->query('DROP USER \'' . $db_root->escape($result['databasename']). '\'@\'' . $db_root->escape($host['Host']) . '\'', false, true); {
$db_root->query('REVOKE ALL PRIVILEGES ON * . * FROM `' . $db_root->escape($result['databasename']) . '`@`' . $db_root->escape($mysql_access_host) . '`');
$db_root->query('REVOKE ALL PRIVILEGES ON `' . str_replace('_', '\_', $db_root->escape($result['databasename'])) . '` . * FROM `' . $db_root->escape($result['databasename']) . '`@`' . $db_root->escape($mysql_access_host) . '`');
$db_root->query('DELETE FROM `mysql`.`user` WHERE `User` = "' . $db_root->escape($result['databasename']) . '" AND `Host` = "' . $db_root->escape($mysql_access_host) . '"');
} }
$db_root->query('DROP DATABASE IF EXISTS `' . $db_root->escape($result['databasename']) . '`'); $db_root->query('DROP DATABASE IF EXISTS `' . $db_root->escape($result['databasename']) . '`');
$db_root->query('FLUSH PRIVILEGES'); $db_root->query('FLUSH PRIVILEGES');
$db_root->close(); $db_root->close();
// End root-session // End root-session
$db->query('DELETE FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . (int)$userinfo['customerid'] . '" AND `id`="' . (int)$id . '"'); $db->query('DELETE FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . (int)$userinfo['customerid'] . '" AND `id`="' . (int)$id . '"');
$resetaccnumber = ($userinfo['mysqls_used'] == '1') ? " , `mysql_lastaccountnumber`='0' " : ''; if($userinfo['mysqls_used'] == '1')
{
$resetaccnumber = " , `mysql_lastaccountnumber`='0' ";
}
else
{
$resetaccnumber = '';
}
$result = $db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used`=`mysqls_used`-1 ' . $resetaccnumber . 'WHERE `customerid`="' . (int)$userinfo['customerid'] . '"'); $result = $db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used`=`mysqls_used`-1 ' . $resetaccnumber . 'WHERE `customerid`="' . (int)$userinfo['customerid'] . '"');
redirectTo($filename, Array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} else { }
$dbnamedesc = $result['databasename']; else
if (isset($result['description']) && $result['description'] != '') { {
$dbnamedesc .= ' ('.$result['description'].')'; ask_yesno('mysql_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['databasename']);
}
ask_yesno('mysql_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $dbnamedesc);
} }
} }
} elseif ($action == 'add') { }
if ($userinfo['mysqls_used'] < $userinfo['mysqls'] elseif($action == 'add')
|| $userinfo['mysqls'] == '-1' {
) { if($userinfo['mysqls_used'] < $userinfo['mysqls']
if (isset($_POST['send']) || $userinfo['mysqls'] == '-1')
&& $_POST['send'] == 'send' {
) { if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$password = validate($_POST['mysql_password'], 'password'); $password = validate($_POST['mysql_password'], 'password');
$password = validatePassword($password); $password = validatePassword($password);
$sendinfomail = isset($_POST['sendinfomail']) ? 1 : 0; $sendinfomail = intval($_POST['sendinfomail']);
if ($sendinfomail != 1) { if($sendinfomail != 1)
{
$sendinfomail = 0; $sendinfomail = 0;
} }
if ($password == '') { if($password == '')
{
standard_error(array('stringisempty', 'mypassword')); standard_error(array('stringisempty', 'mypassword'));
} else { }
$dbserver = 0; else
if (count($sql_root) > 1) { {
$username = $userinfo['loginname'] . $settings['customer']['mysqlprefix'] . (intval($userinfo['mysql_lastaccountnumber']) + 1);
if(count($sql_root) > 1)
{
$dbserver = validate($_POST['mysql_server'], html_entity_decode($lng['mysql']['mysql_server']), '', '', 0); $dbserver = validate($_POST['mysql_server'], html_entity_decode($lng['mysql']['mysql_server']), '', '', 0);
if (!isset($sql_root[$dbserver]) || !is_array($sql_root[$dbserver])) {
if(!isset($sql_root[$dbserver]) || !is_array($sql_root[$dbserver]))
{
$dbserver = 0; $dbserver = 0;
} }
} }
else
// validate description before actual adding the database, #1052 {
$databasedescription = validate(trim($_POST['description']), 'description'); $dbserver = 0;
// Begin root-session
$db_root = new db($sql_root[$dbserver]['host'], $sql_root[$dbserver]['user'], $sql_root[$dbserver]['password'], '');
if (strtoupper($settings['customer']['mysqlprefix']) == 'RANDOM') {
$result = $db_root->query('SELECT `User` FROM mysql.user');
while ($row = $db_root->fetch_array($result)) {
$allsqlusers[] = $row[User];
}
$username = $userinfo['loginname'] . '-' . substr(md5(uniqid(microtime(), 1)), 20, 3);
while (in_array($username , $allsqlusers)) {
$username = $userinfo['loginname'] . '-' . substr(md5(uniqid(microtime(), 1)), 20, 3);
}
} else {
$username = $userinfo['loginname'] . $settings['customer']['mysqlprefix'] . (intval($userinfo['mysql_lastaccountnumber']) + 1);
} }
// Begin root-session
$db_root = new db($sql_root[$dbserver]['host'], $sql_root[$dbserver]['user'], $sql_root[$dbserver]['password'], '');
unset($db_root->password);
$db_root->query('CREATE DATABASE `' . $db_root->escape($username) . '`'); $db_root->query('CREATE DATABASE `' . $db_root->escape($username) . '`');
$log->logAction(USR_ACTION, LOG_INFO, "created database '" . $username . "'"); $log->logAction(USR_ACTION, LOG_INFO, "created database '" . $username . "'");
foreach (array_map('trim', explode(',', $settings['system']['mysql_access_host'])) as $mysql_access_host) { foreach(array_map('trim', explode(',', $settings['system']['mysql_access_host'])) as $mysql_access_host)
{
$db_root->query('GRANT ALL PRIVILEGES ON `' . str_replace('_', '\_', $db_root->escape($username)) . '`.* TO `' . $db_root->escape($username) . '`@`' . $db_root->escape($mysql_access_host) . '` IDENTIFIED BY \'password\''); $db_root->query('GRANT ALL PRIVILEGES ON `' . str_replace('_', '\_', $db_root->escape($username)) . '`.* TO `' . $db_root->escape($username) . '`@`' . $db_root->escape($mysql_access_host) . '` IDENTIFIED BY \'password\'');
$db_root->query('SET PASSWORD FOR `' . $db_root->escape($username) . '`@`' . $db_root->escape($mysql_access_host) . '` = PASSWORD(\'' . $db_root->escape($password) . '\')'); $db_root->query('SET PASSWORD FOR `' . $db_root->escape($username) . '`@`' . $db_root->escape($mysql_access_host) . '` = PASSWORD(\'' . $db_root->escape($password) . '\')');
$log->logAction(USR_ACTION, LOG_NOTICE, "grant all privileges for '" . $username . "'@'" . $mysql_access_host . "'"); $log->logAction(USR_ACTION, LOG_NOTICE, "grant all privileges for '" . $username . "'@'" . $mysql_access_host . "'");
@@ -172,21 +184,25 @@ if ($page == 'overview') {
$db_root->query('FLUSH PRIVILEGES'); $db_root->query('FLUSH PRIVILEGES');
$db_root->close(); $db_root->close();
// End root-session
// Statement modified for Database description -- PH 2004-11-29 // End root-session
// Statement modifyed for Database description -- PH 2004-11-29
$databasedescription = validate($_POST['description'], 'description');
$result = $db->query('INSERT INTO `' . TABLE_PANEL_DATABASES . '` (`customerid`, `databasename`, `description`, `dbserver`) VALUES ("' . (int)$userinfo['customerid'] . '", "' . $db->escape($username) . '", "' . $db->escape($databasedescription) . '", "' . $db->escape($dbserver) . '")'); $result = $db->query('INSERT INTO `' . TABLE_PANEL_DATABASES . '` (`customerid`, `databasename`, `description`, `dbserver`) VALUES ("' . (int)$userinfo['customerid'] . '", "' . $db->escape($username) . '", "' . $db->escape($databasedescription) . '", "' . $db->escape($dbserver) . '")');
$result = $db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used`=`mysqls_used`+1, `mysql_lastaccountnumber`=`mysql_lastaccountnumber`+1 WHERE `customerid`="' . (int)$userinfo['customerid'] . '"'); $result = $db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used`=`mysqls_used`+1, `mysql_lastaccountnumber`=`mysql_lastaccountnumber`+1 WHERE `customerid`="' . (int)$userinfo['customerid'] . '"');
if ($sendinfomail == 1) { if($sendinfomail == 1)
$pma = $lng['admin']['notgiven']; {
if ($settings['panel']['phpmyadmin_url'] != '') { $pma = '';
$pma = $settings['panel']['phpmyadmin_url']; if($settings['panel']['phpmyadmin_url'] != '')
{
$r_arr = array('URI' => $settings['panel']['phpmyadmin_url']);
$pma = replace_variables($lng['customer']['mysql_add']['infomail_body']['pma'], $r_arr);
} }
$replace_arr = array( $replace_arr = array(
'SALUTATION' => getCorrectUserSalutation($userinfo), 'CUST_NAME' => getCorrectUserSalutation($userinfo),
'CUST_NAME' => getCorrectUserSalutation($userinfo), // < keep this for compatibility
'DB_NAME' => $username, 'DB_NAME' => $username,
'DB_PASS' => $password, 'DB_PASS' => $password,
'DB_DESC' => $databasedescription, 'DB_DESC' => $databasedescription,
@@ -194,15 +210,11 @@ if ($page == 'overview') {
'PMA_URI' => $pma 'PMA_URI' => $pma
); );
$def_language = $userinfo['def_language']; $mail_body = replace_variables($lng['customer']['mysql_add']['infomail_body']['main'], $replace_arr);
$result = $db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($def_language) . '\' AND `templategroup`=\'mails\' AND `varname`=\'new_database_by_customer_subject\'');
$mail_subject = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['customer']['mysql_add']['infomail_subject']), $replace_arr));
$result = $db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($def_language) . '\' AND `templategroup`=\'mails\' AND `varname`=\'new_database_by_customer_mailbody\'');
$mail_body = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['customer']['mysql_add']['infomail_body']['main']), $replace_arr));
$_mailerror = false; $_mailerror = false;
try { try {
$mail->Subject = $mail_subject; $mail->Subject = $lng['customer']['mysql_add']['infomail_subject'];
$mail->AltBody = $mail_body; $mail->AltBody = $mail_body;
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body)); $mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
$mail->AddAddress($userinfo['email'], getCorrectUserSalutation($userinfo)); $mail->AddAddress($userinfo['email'], getCorrectUserSalutation($userinfo));
@@ -225,68 +237,73 @@ if ($page == 'overview') {
redirectTo($filename, Array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} }
} else { }
else
{
$mysql_servers = ''; $mysql_servers = '';
foreach ($sql_root as $mysql_server => $mysql_server_details) { foreach($sql_root as $mysql_server => $mysql_server_details)
{
$mysql_servers .= makeoption($mysql_server_details['caption'], $mysql_server); $mysql_servers .= makeoption($mysql_server_details['caption'], $mysql_server);
} }
//$sendinfomail = makeyesno('sendinfomail', '1', '0', '0'); $sendinfomail = makeyesno('sendinfomail', '1', '0', '0');
$mysql_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/mysql/formfield.mysql_add.php'; eval("echo \"" . getTemplate("mysql/mysqls_add") . "\";");
$mysql_add_form = htmlform::genHTMLForm($mysql_add_data);
$title = $mysql_add_data['mysql_add']['title'];
$image = $mysql_add_data['mysql_add']['image'];
eval("echo \"" . getTemplate('mysql/mysqls_add') . "\";");
} }
} }
} elseif ($action == 'edit' && $id != 0) { }
elseif($action == 'edit'
&& $id != 0)
{
$result = $db->query_first('SELECT `id`, `databasename`, `description`, `dbserver` FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . $userinfo['customerid'] . '" AND `id`="' . $id . '"'); $result = $db->query_first('SELECT `id`, `databasename`, `description`, `dbserver` FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . $userinfo['customerid'] . '" AND `id`="' . $id . '"');
if (isset($result['databasename']) if(isset($result['databasename'])
&& $result['databasename'] != '' && $result['databasename'] != '')
) { {
if (!isset($sql_root[$result['dbserver']]) || !is_array($sql_root[$result['dbserver']])) { if(!isset($sql_root[$result['dbserver']]) || !is_array($sql_root[$result['dbserver']]))
{
$result['dbserver'] = 0; $result['dbserver'] = 0;
} }
if (isset($_POST['send']) if(isset($_POST['send'])
&& $_POST['send'] == 'send' && $_POST['send'] == 'send')
) { {
// Only change Password if it is set, do nothing if it is empty! -- PH 2004-11-29 // Only change Password if it is set, do nothing if it is empty! -- PH 2004-11-29
$password = validate($_POST['mysql_password'], 'password');
if ($password != '') {
// validate password
$password = validatePassword($password);
$password = validate($_POST['mysql_password'], 'password');
$password = validatePassword($password);
if($password != '')
{
// Begin root-session // Begin root-session
$db_root = new db($sql_root[$result['dbserver']]['host'], $sql_root[$result['dbserver']]['user'], $sql_root[$result['dbserver']]['password'], ''); $db_root = new db($sql_root[$result['dbserver']]['host'], $sql_root[$result['dbserver']]['user'], $sql_root[$result['dbserver']]['password'], '');
foreach (array_map('trim', explode(',', $settings['system']['mysql_access_host'])) as $mysql_access_host) { unset($db_root->password);
foreach(array_map('trim', explode(',', $settings['system']['mysql_access_host'])) as $mysql_access_host)
{
$db_root->query('SET PASSWORD FOR `' . $db_root->escape($result['databasename']) . '`@`' . $db_root->escape($mysql_access_host) . '` = PASSWORD(\'' . $db_root->escape($password) . '\')'); $db_root->query('SET PASSWORD FOR `' . $db_root->escape($result['databasename']) . '`@`' . $db_root->escape($mysql_access_host) . '` = PASSWORD(\'' . $db_root->escape($password) . '\')');
} }
$db_root->query('FLUSH PRIVILEGES'); $db_root->query('FLUSH PRIVILEGES');
$db_root->close(); $db_root->close();
// End root-session // End root-session
} }
// Update the Database description -- PH 2004-11-29 // Update the Database description -- PH 2004-11-29
$log->logAction(USR_ACTION, LOG_INFO, "edited database '" . $result['databasename'] . "'"); $log->logAction(USR_ACTION, LOG_INFO, "edited database '" . $result['databasename'] . "'");
$databasedescription = validate($_POST['description'], 'description'); $databasedescription = validate($_POST['description'], 'description');
$result = $db->query('UPDATE `' . TABLE_PANEL_DATABASES . '` SET `description`="' . $db->escape($databasedescription) . '" WHERE `customerid`="' . (int)$userinfo['customerid'] . '" AND `id`="' . (int)$id . '"'); $result = $db->query('UPDATE `' . TABLE_PANEL_DATABASES . '` SET `description`="' . $db->escape($databasedescription) . '" WHERE `customerid`="' . (int)$userinfo['customerid'] . '" AND `id`="' . (int)$id . '"');
redirectTo($filename, Array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} else { }
$mysql_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/mysql/formfield.mysql_edit.php'; else
$mysql_edit_form = htmlform::genHTMLForm($mysql_edit_data); {
eval("echo \"" . getTemplate("mysql/mysqls_edit") . "\";");
$title = $mysql_edit_data['mysql_edit']['title'];
$image = $mysql_edit_data['mysql_edit']['image'];
eval("echo \"" . getTemplate('mysql/mysqls_edit') . "\";");
} }
} }
} }
} }
?>

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'customer'); define('AREA', 'customer');
@@ -28,17 +28,6 @@ require ("./lib/init.php");
if(isset($_POST['id'])) if(isset($_POST['id']))
{ {
$id = intval($_POST['id']); $id = intval($_POST['id']);
/*
* Check if the current user is allowed to see the current ticket.
*/
$sql = "SELECT `id` FROM `panel_tickets` WHERE `id` = '".$id."' AND `customerid` = '".$userinfo['customerid']."'";
$result = $db->query_first($sql);
if ($result == null) {
// no rights to see the requested ticket
standard_error(array('ticketnotaccessible'));
}
} }
elseif(isset($_GET['id'])) elseif(isset($_GET['id']))
{ {
@@ -48,7 +37,7 @@ elseif(isset($_GET['id']))
if($page == 'overview') if($page == 'overview')
{ {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_tickets"); $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_tickets");
eval("echo \"" . getTemplate("tickets/ticket") . "\";"); eval("echo \"" . getTemplate("ticket/ticket") . "\";");
} }
elseif($page == 'tickets') elseif($page == 'tickets')
{ {
@@ -66,7 +55,7 @@ elseif($page == 'tickets')
$paging = new paging($userinfo, $db, TABLE_PANEL_TICKETS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']); $paging = new paging($userinfo, $db, TABLE_PANEL_TICKETS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$paging->sortfield = 'lastchange'; $paging->sortfield = 'lastchange';
$paging->sortorder = 'desc'; $paging->sortorder = 'desc';
$result = $db->query('SELECT `main`.`id`, (SELECT COUNT(`sub`.`id`) FROM `' . TABLE_PANEL_TICKETS . '` `sub` WHERE `sub`.`answerto` = `main`.`id`) as `ticket_answers`, `main`.`lastchange`, `main`.`subject`, `main`.`status`, `main`.`lastreplier`, `main`.`priority` FROM `' . TABLE_PANEL_TICKETS . '` as `main` WHERE `main`.`answerto` = "0" AND `archived` = "0" AND `customerid`="' . (int)$userinfo['customerid'] . '" ' . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()); $result = $db->query('SELECT `main`.`id`, (SELECT COUNT(`sub`.`id`) FROM `' . TABLE_PANEL_TICKETS . '` `sub` WHERE `sub`.`answerto` = `main`.`id`) as `ticket_answers`, `main`.`lastchange`, `main`.`subject`, `main`.`status`, `main`.`lastreplier`, `main`.`priority` FROM `' . TABLE_PANEL_TICKETS . '` as `main` WHERE `main`.`answerto` = "0" AND `archived` = "0" AND `customerid`="' . (int)$userinfo['customerid'] . '" AND `adminid`="' . (int)$userinfo['adminid'] . '" ' . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
$paging->setEntries($db->num_rows($result)); $paging->setEntries($db->num_rows($result));
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
@@ -109,13 +98,12 @@ elseif($page == 'tickets')
$cananswer = 0; $cananswer = 0;
} }
$row['subject'] = html_entity_decode($row['subject']);
if(strlen($row['subject']) > 20) if(strlen($row['subject']) > 20)
{ {
$row['subject'] = substr($row['subject'], 0, 17) . '...'; $row['subject'] = substr($row['subject'], 0, 17) . '...';
} }
eval("\$tickets.=\"" . getTemplate("tickets/tickets_tickets") . "\";"); eval("\$tickets.=\"" . getTemplate("ticket/tickets_tickets") . "\";");
$count++; $count++;
} }
@@ -168,7 +156,7 @@ elseif($page == 'tickets')
} }
$ticketsopen = (int)$opentickets['count']; $ticketsopen = (int)$opentickets['count'];
eval("echo \"" . getTemplate("tickets/tickets") . "\";"); eval("echo \"" . getTemplate("ticket/tickets") . "\";");
} }
elseif($action == 'new') elseif($action == 'new')
{ {
@@ -221,12 +209,12 @@ elseif($page == 'tickets')
else else
{ {
$categories = ''; $categories = '';
$result = $db->query_first('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` WHERE `adminid` = "' . $userinfo['adminid'] . '" ORDER BY `logicalorder`, `name` ASC'); $result = $db->query_first('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` ORDER BY `logicalorder`, `name` ASC');
if(isset($result['name']) if(isset($result['name'])
&& $result['name'] != '') && $result['name'] != '')
{ {
$result2 = $db->query('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` WHERE `adminid` = "' . $userinfo['adminid'] . '" ORDER BY `logicalorder`, `name` ASC'); $result2 = $db->query('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` ORDER BY `logicalorder`, `name` ASC');
while($row = $db->fetch_array($result2)) while($row = $db->fetch_array($result2))
{ {
@@ -238,9 +226,9 @@ elseif($page == 'tickets')
$categories = makeoption($lng['ticket']['no_cat'], '0'); $categories = makeoption($lng['ticket']['no_cat'], '0');
} }
$priorities = makeoption($lng['ticket']['high'], '1', $settings['ticket']['default_priority']); $priorities = makeoption($lng['ticket']['unf_high'], '1', $settings['ticket']['default_priority']);
$priorities.= makeoption($lng['ticket']['normal'], '2', $settings['ticket']['default_priority']); $priorities.= makeoption($lng['ticket']['unf_normal'], '2', $settings['ticket']['default_priority']);
$priorities.= makeoption($lng['ticket']['low'], '3', $settings['ticket']['default_priority']); $priorities.= makeoption($lng['ticket']['unf_low'], '3', $settings['ticket']['default_priority']);
$ticketsopen = 0; $ticketsopen = 0;
$opentickets = $db->query_first('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '` $opentickets = $db->query_first('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
WHERE `customerid` = "' . $userinfo['customerid'] . '" WHERE `customerid` = "' . $userinfo['customerid'] . '"
@@ -258,14 +246,7 @@ elseif($page == 'tickets')
} }
$ticketsopen = (int)$opentickets['count']; $ticketsopen = (int)$opentickets['count'];
eval("echo \"" . getTemplate("ticket/tickets_new") . "\";");
$ticket_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/tickets/formfield.ticket_add.php';
$ticket_add_form = htmlform::genHTMLForm($ticket_add_data);
$title = $ticket_add_data['ticket_add']['title'];
$image = $ticket_add_data['ticket_add']['image'];
eval("echo \"" . getTemplate("tickets/tickets_new") . "\";");
} }
} }
else else
@@ -340,18 +321,12 @@ elseif($page == 'tickets')
} }
else else
{ {
$cid = $mainticket->Get('customer'); $by = $lng['ticket']['customer'];
$usr = $db->query_first('SELECT `customerid`, `firstname`, `name`, `company`, `loginname`
FROM `' . TABLE_PANEL_CUSTOMERS . '`
WHERE `customerid` = "' . (int)$cid . '"'
);
$by = getCorrectFullUserDetails($usr);
//$by = $lng['ticket']['customer'];
} }
$subject = $mainticket->Get('subject'); $subject = $mainticket->Get('subject');
$message = $mainticket->Get('message'); $message = $mainticket->Get('message');
eval("\$ticket_replies.=\"" . getTemplate("tickets/tickets_tickets_main") . "\";"); eval("\$ticket_replies.=\"" . getTemplate("ticket/tickets_tickets_main") . "\";");
$result = $db->query('SELECT `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` $result = $db->query('SELECT `name` FROM `' . TABLE_PANEL_TICKET_CATS . '`
WHERE `id`="' . (int)$mainticket->Get('category') . '"'); WHERE `id`="' . (int)$mainticket->Get('category') . '"');
$row = $db->fetch_array($result); $row = $db->fetch_array($result);
@@ -368,13 +343,12 @@ elseif($page == 'tickets')
} }
else else
{ {
$by = getCorrectFullUserDetails($usr); $by = $lng['ticket']['customer'];
//$by = $lng['ticket']['customer'];
} }
$subject = $subticket->Get('subject'); $subject = $subticket->Get('subject');
$message = $subticket->Get('message'); $message = $subticket->Get('message');
eval("\$ticket_replies.=\"" . getTemplate("tickets/tickets_tickets_list") . "\";"); eval("\$ticket_replies.=\"" . getTemplate("ticket/tickets_tickets_list") . "\";");
} }
$priorities = makeoption($lng['ticket']['high'], '1', $mainticket->Get('priority'), true, true); $priorities = makeoption($lng['ticket']['high'], '1', $mainticket->Get('priority'), true, true);
@@ -385,13 +359,7 @@ elseif($page == 'tickets')
// don't forget the main-ticket! // don't forget the main-ticket!
$ticket_reply_data = include_once dirname(__FILE__).'/lib/formfields/customer/tickets/formfield.ticket_reply.php'; eval("echo \"" . getTemplate("ticket/tickets_reply") . "\";");
$ticket_reply_form = htmlform::genHTMLForm($ticket_reply_data);
$title = $ticket_reply_data['ticket_reply']['title'];
$image = $ticket_reply_data['ticket_reply']['image'];
eval("echo \"" . getTemplate("tickets/tickets_reply") . "\";");
} }
} }
elseif($action == 'close' elseif($action == 'close'

View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'customer'); define('AREA', 'customer');
@@ -22,20 +22,21 @@ define('AREA', 'customer');
/** /**
* Include our init.php, which manages Sessions, Language etc. * Include our init.php, which manages Sessions, Language etc.
*/ */
$intrafficpage = 1;
require('./lib/init.php'); require ("./lib/init.php");
$traffic = ''; $traffic = '';
$month = null; $month = null;
$year = null; $year = null;
if (isset($_POST['month']) if(isset($_POST['month'])
&& isset($_POST['year']) && isset($_POST['year']))
) { {
$month = intval($_POST['month']); $month = intval($_POST['month']);
$year = intval($_POST['year']); $year = intval($_POST['year']);
} elseif (isset($_GET['month']) }
&& isset($_GET['year']) elseif(isset($_GET['month'])
) { && isset($_GET['year']))
{
$month = intval($_GET['month']); $month = intval($_GET['month']);
$year = intval($_GET['year']); $year = intval($_GET['year']);
} }
@@ -43,25 +44,40 @@ if (isset($_POST['month'])
//BAM! $_GET??? //BAM! $_GET???
elseif (isset($_GET['page']) elseif (isset($_GET['page'])
&& $_GET['page'] == 'current' && $_GET['page'] == "current")
) { {
if (date('d') != '01') { if(date('d') != '01')
{
$month = date('m'); $month = date('m');
$year = date('Y'); $year = date('Y');
} else { }
if (date('m') == '01') { else
{
if(date('m') == '01')
{
$month = 12; $month = 12;
$year = date('Y') - 1; $year = date('Y') - 1;
} else { }
else
{
$month = date('m') - 1; $month = date('m') - 1;
$year = date('Y'); $year = date('Y');
} }
} }
} }
if (!is_null($month) if(!is_null($month)
&& !is_null($year)) { && !is_null($year))
{
$traf['byte'] = 0; $traf['byte'] = 0;
$result = $db->query("SELECT MAX(`http`), MAX(`ftp_up`+`ftp_down`), MAX(`mail`)
FROM `" . TABLE_PANEL_TRAFFIC . "`
WHERE `customerid`='" . $userinfo['customerid'] . "'
AND `month` = '" . $month . "'
AND `year` = '" . $year . "'");
$row = mysql_fetch_row($result);
rsort($row);
$traf['max'] = ($row[0] > $row[1] ? ($row[0] > $row[2] ? $row[0] : $row[2]) : ($row[1] > $row[2] ? $row[1] : $row[2]));;
$result = $db->query("SELECT $result = $db->query("SELECT
SUM(`http`) as 'http', SUM(`ftp_up`) AS 'ftp_up', SUM(`ftp_down`) as 'ftp_down', SUM(`mail`) as 'mail', SUM(`http`) as 'http', SUM(`ftp_up`) AS 'ftp_up', SUM(`ftp_down`) as 'ftp_down', SUM(`mail`) as 'mail',
`day`, `month`, `year` `day`, `month`, `year`
@@ -74,50 +90,106 @@ if (!is_null($month)
$traffic_complete['mail'] = 0; $traffic_complete['mail'] = 0;
$show = ''; $show = '';
while ($row = $db->fetch_array($result)) { while($row = $db->fetch_array($result))
{
$http = $row['http']; $http = $row['http'];
$ftp = $row['ftp_up'] + $row['ftp_down']; $ftp = $row['ftp_up'] + $row['ftp_down'];
$mail = $row['mail']; $mail = $row['mail'];
$traf['byte'] = $http + $ftp + $mail; $traf['byte'] = $http + $ftp + $mail;
$traffic_complete['http'] += $http; $traffic_complete['http']+= $http;
$traffic_complete['ftp'] += $ftp; $traffic_complete['ftp']+= $ftp;
$traffic_complete['mail'] += $mail; $traffic_complete['mail']+= $mail;
$traf['day'] = $row['day'] . '.'; $traf['day'] = $row['day'];
if (extension_loaded('bcmath')) { if(extension_loaded('bcmath'))
{
$traf['ftptext'] = bcdiv($row['ftp_up'], 1024, $settings['panel']['decimal_places']) . " MB up/ " . bcdiv($row['ftp_down'], 1024, $settings['panel']['decimal_places']) . " MB down (FTP)"; $traf['ftptext'] = bcdiv($row['ftp_up'], 1024, $settings['panel']['decimal_places']) . " MB up/ " . bcdiv($row['ftp_down'], 1024, $settings['panel']['decimal_places']) . " MB down (FTP)";
$traf['httptext'] = bcdiv($http, 1024, $settings['panel']['decimal_places']) . " MB (HTTP)"; $traf['httptext'] = bcdiv($http, 1024, $settings['panel']['decimal_places']) . " MB (HTTP)";
$traf['mailtext'] = bcdiv($mail, 1024, $settings['panel']['decimal_places']) . " MB (Mail)"; $traf['mailtext'] = bcdiv($mail, 1024, $settings['panel']['decimal_places']) . " MB (Mail)";
$traf['ftp'] = bcdiv($ftp, 1024, $settings['panel']['decimal_places']); }
$traf['http'] = bcdiv($http, 1024, $settings['panel']['decimal_places']); else
$traf['mail'] = bcdiv($mail, 1024, $settings['panel']['decimal_places']); {
$traf['byte'] = bcdiv($traf['byte'], 1024, $settings['panel']['decimal_places']);
} else {
$traf['ftptext'] = round($row['ftp_up'] / 1024, $settings['panel']['decimal_places']) . " MB up/ " . round($row['ftp_down'] / 1024, $settings['panel']['decimal_places']) . " MB down (FTP)"; $traf['ftptext'] = round($row['ftp_up'] / 1024, $settings['panel']['decimal_places']) . " MB up/ " . round($row['ftp_down'] / 1024, $settings['panel']['decimal_places']) . " MB down (FTP)";
$traf['httptext'] = round($http / 1024, $settings['panel']['decimal_places']) . " MB (HTTP)"; $traf['httptext'] = round($http / 1024, $settings['panel']['decimal_places']) . " MB (HTTP)";
$traf['mailtext'] = round($mail / 1024, $settings['panel']['decimal_places']) . " MB (Mail)"; $traf['mailtext'] = round($mail / 1024, $settings['panel']['decimal_places']) . " MB (Mail)";
$traf['http'] = round($http, $settings['panel']['decimal_places']); }
$traf['ftp'] = round($ftp, $settings['panel']['decimal_places']);
$traf['mail'] = round($mail, $settings['panel']['decimal_places']); if($traf['byte'] != 0
&& $traf['max'] != 0)
{
$proz = $traf['max'] / 100;
$traf['http'] = round($http / $proz, 0);
$traf['ftp'] = round($ftp / $proz, 0);
$traf['mail'] = round($mail / $proz, 0);
if($traf['http'] == 0)
{
$traf['http'] = 1;
}
if($traf['ftp'] == 0)
{
$traf['ftp'] = 1;
}
if($traf['mail'] == 0)
{
$traf['mail'] = 1;
}
}
else
{
$traf['http'] = 0;
$traf['ftp'] = 0;
$traf['mail'] = 0;
}
if(extension_loaded('bcmath'))
{
$traf['byte'] = bcdiv($traf['byte'], 1024, $settings['panel']['decimal_places']);
}
else
{
$traf['byte'] = round($traf['byte'] / 1024, $settings['panel']['decimal_places']); $traf['byte'] = round($traf['byte'] / 1024, $settings['panel']['decimal_places']);
} }
eval("\$traffic.=\"" . getTemplate('traffic/traffic_month') . "\";"); eval("\$traffic.=\"" . getTemplate("traffic/traffic_month") . "\";");
$show = $lng['traffic']['months'][intval($row['month'])] . ' ' . $row['year']; $show = $lng['traffic']['months'][intval($row['month'])] . " " . $row['year'];
} }
if (extension_loaded('bcmath')) { if(extension_loaded('bcmath'))
{
$traffic_complete['http'] = bcdiv($traffic_complete['http'], 1024, $settings['panel']['decimal_places']); $traffic_complete['http'] = bcdiv($traffic_complete['http'], 1024, $settings['panel']['decimal_places']);
$traffic_complete['ftp'] = bcdiv($traffic_complete['ftp'], 1024, $settings['panel']['decimal_places']); $traffic_complete['ftp'] = bcdiv($traffic_complete['ftp'], 1024, $settings['panel']['decimal_places']);
$traffic_complete['mail'] = bcdiv($traffic_complete['mail'], 1024, $settings['panel']['decimal_places']); $traffic_complete['mail'] = bcdiv($traffic_complete['mail'], 1024, $settings['panel']['decimal_places']);
} else { }
else
{
$traffic_complete['http'] = round($traffic_complete['http'] / 1024, $settings['panel']['decimal_places']); $traffic_complete['http'] = round($traffic_complete['http'] / 1024, $settings['panel']['decimal_places']);
$traffic_complete['ftp'] = round($traffic_complete['ftp'] / 1024, $settings['panel']['decimal_places']); $traffic_complete['ftp'] = round($traffic_complete['ftp'] / 1024, $settings['panel']['decimal_places']);
$traffic_complete['mail'] = round($traffic_complete['mail'] / 1024, $settings['panel']['decimal_places']); $traffic_complete['mail'] = round($traffic_complete['mail'] / 1024, $settings['panel']['decimal_places']);
} }
eval("echo \"" . getTemplate('traffic/traffic_details') . "\";"); eval("echo \"" . getTemplate("traffic/traffic_details") . "\";");
} else { }
else
{
$result = $db->query("SELECT MAX(`http`), MAX(`ftp_up`+`ftp_down`), MAX(`mail`)
FROM `" . TABLE_PANEL_TRAFFIC . "`
WHERE `customerid`='" . $userinfo['customerid'] . "'
GROUP BY CONCAT(`year`,`month`) ORDER BY CONCAT(`year`,`month`) DESC LIMIT 12");
$nums = mysql_num_rows($result);
if($nums > 0)
{
$row = mysql_fetch_row($result);
rsort($row);
$traf['max'] = ($row[0] > $row[1] ? ($row[0] > $row[2] ? $row[0] : $row[2]) : ($row[1] > $row[2] ? $row[1] : $row[2]));
} else {
// no records yet
$traf['max'] = 0;
}
$result = $db->query("SELECT `month`, `year`, SUM(`http`) AS http, SUM(`ftp_up`) AS ftp_up, SUM(`ftp_down`) AS ftp_down, SUM(`mail`) AS mail $result = $db->query("SELECT `month`, `year`, SUM(`http`) AS http, SUM(`ftp_up`) AS ftp_up, SUM(`ftp_down`) AS ftp_down, SUM(`mail`) AS mail
FROM `" . TABLE_PANEL_TRAFFIC . "` WHERE `customerid` = '" . $userinfo['customerid'] . "' FROM `" . TABLE_PANEL_TRAFFIC . "` WHERE `customerid` = '" . $userinfo['customerid'] . "'
GROUP BY CONCAT(`year`,`month`) ORDER BY CONCAT(`year`,`month`) DESC LIMIT 12"); GROUP BY CONCAT(`year`,`month`) ORDER BY CONCAT(`year`,`month`) DESC LIMIT 12");
@@ -125,49 +197,88 @@ if (!is_null($month)
$traffic_complete['ftp'] = 0; $traffic_complete['ftp'] = 0;
$traffic_complete['mail'] = 0; $traffic_complete['mail'] = 0;
while ($row = $db->fetch_array($result)) { while($row = $db->fetch_array($result))
{
$http = $row['http']; $http = $row['http'];
$ftp_up = $row['ftp_up']; $ftp_up = $row['ftp_up'];
$ftp_down = $row['ftp_down']; $ftp_down = $row['ftp_down'];
$mail = $row['mail']; $mail = $row['mail'];
$traffic_complete['http'] += $http; $traffic_complete['http']+= $http;
$traffic_complete['ftp'] += $ftp_up + $ftp_down; $traffic_complete['ftp']+= $ftp_up + $ftp_down;
$traffic_complete['mail'] += $mail; $traffic_complete['mail']+= $mail;
$traf['month'] = $row['month']; $traf['month'] = $row['month'];
$traf['year'] = $row['year']; $traf['year'] = $row['year'];
$traf['monthname'] = $lng['traffic']['months'][intval($row['month'])] . " " . $row['year']; $traf['monthname'] = $lng['traffic']['months'][intval($row['month'])] . " " . $row['year'];
$traf['byte'] = $http + $ftp_up + $ftp_down + $mail; $traf['byte'] = $http + $ftp_up + $ftp_down + $mail;
if (extension_loaded('bcmath')) { if(extension_loaded('bcmath'))
$traf['ftptext'] = bcdiv($ftp_up, 1024, $settings['panel']['decimal_places']) . " MB up/ " . bcdiv($ftp_down, 1024, $settings['panel']['decimal_places']) . " MB down (FTP)"; {
$traf['httptext'] = bcdiv($http, 1024, $settings['panel']['decimal_places']) . " MB (HTTP)"; $traf['ftptext'] = bcdiv($ftp_up, 1024 * 1024, $settings['panel']['decimal_places']) . " GB up/ " . bcdiv($ftp_down, 1024 * 1024, $settings['panel']['decimal_places']) . " GB down (FTP)";
$traf['mailtext'] = bcdiv($mail, 1024, $settings['panel']['decimal_places']) . " MB (Mail)"; $traf['httptext'] = bcdiv($http, 1024 * 1024, $settings['panel']['decimal_places']) . " GB (HTTP)";
$traf['ftp'] = bcdiv(($ftp_up + $ftp_down), 1024, $settings['panel']['decimal_places']); $traf['mailtext'] = bcdiv($mail, 1024 * 1024, $settings['panel']['decimal_places']) . " GB (Mail)";
$traf['http'] = bcdiv($http, 1024, $settings['panel']['decimal_places']); }
$traf['mail'] = bcdiv($mail, 1024, $settings['panel']['decimal_places']); else
$traf['byte'] = bcdiv($traf['byte'], 1024 * 1024, $settings['panel']['decimal_places']); {
} else { $traf['ftptext'] = round($ftp_up / 1024 * 1024, $settings['panel']['decimal_places']) . " GB up/ " . round($ftp_down / 1024 * 1024, $settings['panel']['decimal_places']) . " GB down (FTP)";
$traf['ftptext'] = round($ftp_up / 1024, $settings['panel']['decimal_places']) . " MB up/ " . round($ftp_down / 1024, $settings['panel']['decimal_places']) . " MB down (FTP)"; $traf['httptext'] = round($http / 1024 * 1024, $settings['panel']['decimal_places']) . " GB (HTTP)";
$traf['httptext'] = round($http / 1024, $settings['panel']['decimal_places']) . " MB (HTTP)"; $traf['mailtext'] = round($mail / 1024 * 1024, $settings['panel']['decimal_places']) . " GB (Mail)";
$traf['mailtext'] = round($mail / 1024, $settings['panel']['decimal_places']) . " MB (Mail)";
$traf['ftp'] = round(($ftp_up + $ftp_down) / 1024, $settings['panel']['decimal_places']);
$traf['http'] = round($http / 1024, $settings['panel']['decimal_places']);
$traf['mail'] = round($mail / 1024, $settings['panel']['decimal_places']);
$traf['byte'] = round($traf['byte'] / (1024 * 1024), $settings['panel']['decimal_places']);
} }
eval("\$traffic.=\"" . getTemplate('traffic/traffic_traffic') . "\";"); if($traf['max'] != 0)
{
$proz = $traf['max'] / 100;
$traf['ftp'] = round(($ftp_up + $ftp_down) / $proz, 0);
$traf['http'] = round($http / $proz, 0);
$traf['mail'] = round($mail / $proz, 0);
if($traf['http'] == 0)
{
$traf['http'] = 1;
}
if($traf['ftp'] == 0)
{
$traf['ftp'] = 1;
}
if($traf['mail'] == 0)
{
$traf['mail'] = 1;
}
}
else
{
$traf['ftp'] = 0;
$traf['http'] = 0;
$traf['mail'] = 0;
}
if(extension_loaded('bcmath'))
{
$traf['byte'] = bcadd($traf['byte'] / (1024 * 1024), 0.0000, 4);
}
else
{
$traf['byte'] = round($traf['byte'] + (1024 * 1024), 4);
}
eval("\$traffic.=\"" . getTemplate("traffic/traffic_traffic") . "\";");
} }
if (extension_loaded('bcmath')) { if(extension_loaded('bcmath'))
{
$traffic_complete['http'] = bcdiv($traffic_complete['http'], 1024 * 1024, $settings['panel']['decimal_places']); $traffic_complete['http'] = bcdiv($traffic_complete['http'], 1024 * 1024, $settings['panel']['decimal_places']);
$traffic_complete['ftp'] = bcdiv($traffic_complete['ftp'], 1024 * 1024, $settings['panel']['decimal_places']); $traffic_complete['ftp'] = bcdiv($traffic_complete['ftp'], 1024 * 1024, $settings['panel']['decimal_places']);
$traffic_complete['mail'] = bcdiv($traffic_complete['mail'], 1024 * 1024, $settings['panel']['decimal_places']); $traffic_complete['mail'] = bcdiv($traffic_complete['mail'], 1024 * 1024, $settings['panel']['decimal_places']);
} else { }
$traffic_complete['http'] = round($traffic_complete['http'] / (1024 * 1024), $settings['panel']['decimal_places']); else
$traffic_complete['ftp'] = round($traffic_complete['ftp'] / (1024 * 1024), $settings['panel']['decimal_places']); {
$traffic_complete['mail'] = round($traffic_complete['mail'] / (1024 * 1024), $settings['panel']['decimal_places']); $traffic_complete['http'] = round($traffic_complete['http'] / 1024 * 1024, $settings['panel']['decimal_places']);
$traffic_complete['ftp'] = round($traffic_complete['ftp'] / 1024 * 1024, $settings['panel']['decimal_places']);
$traffic_complete['mail'] = round($traffic_complete['mail'] / 1024 * 1024, $settings['panel']['decimal_places']);
} }
eval("echo \"" . getTemplate('traffic/traffic') . "\";"); eval("echo \"" . getTemplate("traffic/traffic") . "\";");
} }
?>

BIN
images/ball.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 B

BIN
images/changelanguage.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
images/default.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
images/endsection.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
images/error.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
images/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
images/footer.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
images/header.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
images/header_r.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
images/info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
images/login.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
images/logininternal.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
images/order_asc.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 B

BIN
images/order_desc.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 B

BIN
images/section.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
images/shadow.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 B

BIN
images/subsection.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
images/title.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 B

View File

Before

Width:  |  Height:  |  Size: 66 B

After

Width:  |  Height:  |  Size: 66 B

View File

Before

Width:  |  Height:  |  Size: 82 B

After

Width:  |  Height:  |  Size: 82 B

View File

Before

Width:  |  Height:  |  Size: 105 B

After

Width:  |  Height:  |  Size: 105 B

View File

Before

Width:  |  Height:  |  Size: 827 B

After

Width:  |  Height:  |  Size: 827 B

293
index.php
View File

@@ -14,7 +14,7 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel * @package Panel
* * @version $Id$
*/ */
define('AREA', 'login'); define('AREA', 'login');
@@ -22,74 +22,69 @@ define('AREA', 'login');
/** /**
* Include our init.php, which manages Sessions, Language etc. * Include our init.php, which manages Sessions, Language etc.
*/ */
require ('./lib/init.php');
if ($action == '') { require ("./lib/init.php");
if($action == '')
{
$action = 'login'; $action = 'login';
} }
if ($action == 'login') { if($action == 'login')
if (isset($_POST['send']) {
&& $_POST['send'] == 'send' if(isset($_POST['send'])
) { && $_POST['send'] == 'send')
{
$loginname = validate($_POST['loginname'], 'loginname'); $loginname = validate($_POST['loginname'], 'loginname');
$password = validate($_POST['password'], 'password'); $password = validate($_POST['password'], 'password');
$row = $db->query_first("SELECT `loginname` AS `customer` FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `loginname`='" . $db->escape($loginname) . "'"); $row = $db->query_first("SELECT `loginname` AS `customer` FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `loginname`='" . $db->escape($loginname) . "'");
if ($row['customer'] == $loginname) { if($row['customer'] == $loginname)
{
$table = "`" . TABLE_PANEL_CUSTOMERS . "`"; $table = "`" . TABLE_PANEL_CUSTOMERS . "`";
$uid = 'customerid'; $uid = 'customerid';
$adminsession = '0'; $adminsession = '0';
$is_admin = false; $is_admin = false;
} else { }
else
{
$is_admin = true; $is_admin = true;
if ((int)$settings['login']['domain_login'] == 1) {
/**
* check if the customer tries to login with a domain, #374
*/
$domainname = $idna_convert->encode(preg_replace(Array('/\:(\d)+$/', '/^https?\:\/\//'), '', $loginname));
$row2 = $db->query_first("SELECT `customerid` FROM `".TABLE_PANEL_DOMAINS."` WHERE `domain` = '".$db->escape($domainname)."'");
if (isset($row2['customerid']) && $row2['customerid'] > 0) {
$loginname = getCustomerDetail($row2['customerid'], 'loginname');
if ($loginname !== false) {
$row3 = $db->query_first("SELECT `loginname` AS `customer` FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `loginname`='" . $db->escape($loginname) . "'");
if ($row3['customer'] == $loginname) {
$table = "`" . TABLE_PANEL_CUSTOMERS . "`";
$uid = 'customerid';
$adminsession = '0';
$is_admin = false;
}
}
}
}
} }
if (hasUpdates($version) && $is_admin == false) { if(hasUpdates($version) && $is_admin == false)
{
redirectTo('index.php'); redirectTo('index.php');
exit; exit;
} }
if ($is_admin) { if($is_admin)
if (hasUpdates($version)) { {
if(hasUpdates($version))
{
$row = $db->query_first("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `loginname`='" . $db->escape($loginname) . "' AND `change_serversettings` = '1'"); $row = $db->query_first("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `loginname`='" . $db->escape($loginname) . "' AND `change_serversettings` = '1'");
/* /*
* not an admin who can see updates * not an admin who can see updates
*/ */
if (!isset($row['admin'])) { if(!isset($row['admin']))
{
redirectTo('index.php'); redirectTo('index.php');
exit; exit;
} }
} else { }
else
{
$row = $db->query_first("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `loginname`='" . $db->escape($loginname) . "'"); $row = $db->query_first("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `loginname`='" . $db->escape($loginname) . "'");
} }
if ($row['admin'] == $loginname) { if($row['admin'] == $loginname)
{
$table = "`" . TABLE_PANEL_ADMINS . "`"; $table = "`" . TABLE_PANEL_ADMINS . "`";
$uid = 'adminid'; $uid = 'adminid';
$adminsession = '1'; $adminsession = '1';
} else { }
else
{
redirectTo('index.php', Array('showmessage' => '2'), true); redirectTo('index.php', Array('showmessage' => '2'), true);
exit; exit;
} }
@@ -97,197 +92,201 @@ if ($action == 'login') {
$userinfo = $db->query_first("SELECT * FROM $table WHERE `loginname`='" . $db->escape($loginname) . "'"); $userinfo = $db->query_first("SELECT * FROM $table WHERE `loginname`='" . $db->escape($loginname) . "'");
if ($userinfo['loginfail_count'] >= $settings['login']['maxloginattempts'] if($userinfo['loginfail_count'] >= $settings['login']['maxloginattempts']
&& $userinfo['lastlogin_fail'] > (time() - $settings['login']['deactivatetime']) && $userinfo['lastlogin_fail'] > (time() - $settings['login']['deactivatetime']))
) { {
redirectTo('index.php', Array('showmessage' => '3'), true); redirectTo('index.php', Array('showmessage' => '3'), true);
exit; exit;
} elseif($userinfo['password'] == md5($password)) { }
elseif($userinfo['password'] == md5($password))
{
// login correct // login correct
// reset loginfail_counter, set lastlogin_succ // reset loginfail_counter, set lastlogin_succ
$db->query("UPDATE $table SET `lastlogin_succ`='" . time() . "', `loginfail_count`='0' WHERE `$uid`='" . (int)$userinfo[$uid] . "'"); $db->query("UPDATE $table SET `lastlogin_succ`='" . time() . "', `loginfail_count`='0' WHERE `$uid`='" . (int)$userinfo[$uid] . "'");
$userinfo['userid'] = $userinfo[$uid]; $userinfo['userid'] = $userinfo[$uid];
$userinfo['adminsession'] = $adminsession; $userinfo['adminsession'] = $adminsession;
} else { }
else
{
// login incorrect // login incorrect
$db->query("UPDATE $table SET `lastlogin_fail`='" . time() . "', `loginfail_count`=`loginfail_count`+1 WHERE `$uid`='" . (int)$userinfo[$uid] . "'"); $db->query("UPDATE $table SET `lastlogin_fail`='" . time() . "', `loginfail_count`=`loginfail_count`+1 WHERE `$uid`='" . (int)$userinfo[$uid] . "'");
unset($userinfo); unset($userinfo);
redirectTo('index.php', Array('showmessage' => '2'), true); redirectTo('index.php', Array('showmessage' => '2'), true);
exit; exit;
} }
if (isset($userinfo['userid']) if(isset($userinfo['userid'])
&& $userinfo['userid'] != '' && $userinfo['userid'] != '')
) { {
$s = md5(uniqid(microtime(), 1)); $s = md5(uniqid(microtime(), 1));
if (isset($_POST['language'])) { if(isset($_POST['language']))
{
$language = validate($_POST['language'], 'language'); $language = validate($_POST['language'], 'language');
if ($language == 'profile') {
if($language == 'profile')
{
$language = $userinfo['def_language']; $language = $userinfo['def_language'];
} elseif(!isset($languages[$language])) { }
elseif(!isset($languages[$language]))
{
$language = $settings['panel']['standardlanguage']; $language = $settings['panel']['standardlanguage'];
} }
} else { }
else
{
$language = $settings['panel']['standardlanguage']; $language = $settings['panel']['standardlanguage'];
} }
if (isset($userinfo['theme']) && $userinfo['theme'] != '') { if($settings['session']['allow_multiple_login'] != '1')
$theme = $userinfo['theme']; {
} else {
$theme = $settings['panel']['default_theme'];
}
if ($settings['session']['allow_multiple_login'] != '1') {
$db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['userid'] . "' AND `adminsession` = '" . $db->escape($userinfo['adminsession']) . "'"); $db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['userid'] . "' AND `adminsession` = '" . $db->escape($userinfo['adminsession']) . "'");
} }
// check for field 'theme' in session-table, refs #607 $db->query("INSERT INTO `" . TABLE_PANEL_SESSIONS . "` (`hash`, `userid`, `ipaddress`, `useragent`, `lastactivity`, `language`, `adminsession`) VALUES ('" . $db->escape($s) . "', '" . (int)$userinfo['userid'] . "', '" . $db->escape($remote_addr) . "', '" . $db->escape($http_user_agent) . "', '" . time() . "', '" . $db->escape($language) . "', '" . $db->escape($userinfo['adminsession']) . "')");
$fields = mysql_list_fields($db->getDbName(), TABLE_PANEL_SESSIONS);
$columns = mysql_num_fields($fields);
$field_array = array();
for ($i = 0; $i < $columns; $i++) {
$field_array[] = mysql_field_name($fields, $i);
}
if (!in_array('theme', $field_array)) { if($userinfo['adminsession'] == '1')
$db->query("INSERT INTO `" . TABLE_PANEL_SESSIONS . "` (`hash`, `userid`, `ipaddress`, `useragent`, `lastactivity`, `language`, `adminsession`) VALUES ('" . $db->escape($s) . "', '" . (int)$userinfo['userid'] . "', '" . $db->escape($remote_addr) . "', '" . $db->escape($http_user_agent) . "', '" . time() . "', '" . $db->escape($language) . "', '" . $db->escape($userinfo['adminsession']) . "')"); {
} else { if(hasUpdates($version))
$db->query("INSERT INTO `" . TABLE_PANEL_SESSIONS . "` (`hash`, `userid`, `ipaddress`, `useragent`, `lastactivity`, `language`, `adminsession`, `theme`) VALUES ('" . $db->escape($s) . "', '" . (int)$userinfo['userid'] . "', '" . $db->escape($remote_addr) . "', '" . $db->escape($http_user_agent) . "', '" . time() . "', '" . $db->escape($language) . "', '" . $db->escape($userinfo['adminsession']) . "', '" . $db->escape($theme) . "')"); {
}
if ($userinfo['adminsession'] == '1') {
if (hasUpdates($version)) {
redirectTo('admin_updates.php', Array('s' => $s), true); redirectTo('admin_updates.php', Array('s' => $s), true);
} else { exit;
redirectTo('admin_index.php', Array('s' => $s), true); }
else
{
redirectTo('admin_index.php', Array('s' => $s), true);
exit;
} }
} else {
redirectTo('customer_index.php', Array('s' => $s), true);
} }
} else { else
redirectTo('index.php', Array('showmessage' => '2'), true); {
redirectTo('customer_index.php', Array('s' => $s), true);
exit;
}
} }
exit; else
} else { {
redirectTo('index.php', Array('showmessage' => '2'), true);
exit;
}
}
else
{
$language_options = ''; $language_options = '';
$language_options .= makeoption($lng['login']['profile_lng'], 'profile', 'profile', true, true); $language_options.= makeoption($lng['login']['profile_lng'], 'profile', 'profile', true, true);
while (list($language_file, $language_name) = each($languages)) { while(list($language_file, $language_name) = each($languages))
$language_options .= makeoption($language_name, $language_file, 'profile', true); {
$language_options.= makeoption($language_name, $language_file, 'profile', true);
} }
$smessage = isset($_GET['showmessage']) ? (int)$_GET['showmessage'] : 0; $smessage = isset($_GET['showmessage']) ? (int)$_GET['showmessage'] : 0;
$message = ''; $message = '';
$successmessage = '';
switch ($smessage) { switch($smessage)
{
case 1: case 1:
$successmessage = $lng['pwdreminder']['success']; $message = $lng['pwdreminder']['success'];
break; break;
case 2: case 2:
$message = $lng['error']['login']; $message = $lng['error']['login'];
break; break;
case 3: case 3:
$message = sprintf($lng['error']['login_blocked'],$settings['login']['deactivatetime']); $message = $lng['error']['login_blocked'];
break; break;
case 4: case 4:
$cmail = isset($_GET['customermail']) ? $_GET['customermail'] : 'unknown'; $message = $lng['error']['errorsendingmail'];
$message = str_replace('%s', $cmail, $lng['error']['errorsendingmail']);
break;
case 5:
$message = $lng['error']['user_banned'];
break; break;
} }
$update_in_progress = ''; $update_in_progress = '';
if (hasUpdates($version)) { if(hasUpdates($version))
{
$update_in_progress = $lng['update']['updateinprogress_onlyadmincanlogin']; $update_in_progress = $lng['update']['updateinprogress_onlyadmincanlogin'];
} }
eval("echo \"" . getTemplate('login') . "\";"); eval("echo \"" . getTemplate("login") . "\";");
} }
} }
if ($action == 'forgotpwd') { if($action == 'forgotpwd')
{
$adminchecked = false; $adminchecked = false;
$message = ''; $message = '';
if (isset($_POST['send']) if(isset($_POST['send'])
&& $_POST['send'] == 'send' && $_POST['send'] == 'send')
) { {
$loginname = validate($_POST['loginname'], 'loginname'); $loginname = validate($_POST['loginname'], 'loginname');
$email = validateEmail($_POST['loginemail'], 'email'); $email = validateEmail($_POST['loginemail'], 'email');
$sql = "SELECT `adminid`, `customerid`, `firstname`, `name`, `company`, `email`, `loginname`, `def_language`, `deactivated` FROM `" . TABLE_PANEL_CUSTOMERS . "` $sql = "SELECT `customerid`, `firstname`, `name`, `email`, `loginname` FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE `loginname`='" . $db->escape($loginname) . "' WHERE `loginname`='" . $db->escape($loginname) . "'
AND `email`='" . $db->escape($email) . "'"; AND `email`='" . $db->escape($email) . "'";
$result = $db->query($sql); $result = $db->query($sql);
if ($db->num_rows() == 0) { if($db->num_rows() == 0)
$sql = "SELECT `adminid`, `name`, `email`, `loginname`, `def_language` FROM `" . TABLE_PANEL_ADMINS . "` {
$sql = "SELECT `adminid`, `name`, `email`, `loginname` FROM `" . TABLE_PANEL_ADMINS . "`
WHERE `loginname`='" . $db->escape($loginname) . "' WHERE `loginname`='" . $db->escape($loginname) . "'
AND `email`='" . $db->escape($email) . "'"; AND `email`='" . $db->escape($email) . "'";
$result = $db->query($sql); $result = $db->query($sql);
if ($db->num_rows() > 0) { if($db->num_rows() > 0)
{
$adminchecked = true; $adminchecked = true;
} else { }
else
{
$result = null; $result = null;
} }
} }
if ($result !== null) { if($result !== null)
{
$user = $db->fetch_array($result); $user = $db->fetch_array($result);
/* Check whether user is banned */ if(($adminchecked && $settings['panel']['allow_preset_admin'] == '1')
if ($user['deactivated']) { || $adminchecked == false)
$message = $lng['pwdreminder']['notallowed']; {
redirectTo('index.php', Array('showmessage' => '5'), true); if($user !== false)
} {
if (($adminchecked && $settings['panel']['allow_preset_admin'] == '1')
|| $adminchecked == false
) {
if ($user !== false) {
if ($settings['panel']['password_min_length'] <= 6) { if ($settings['panel']['password_min_length'] <= 6) {
$password = substr(md5(uniqid(microtime(), 1)), 12, 6); $password = substr(md5(uniqid(microtime(), 1)), 12, 6);
} else { } else {
// make it two times larger than password_min_length // make it two times larger than password_min_length
$rnd = ''; $rnd = '';
$minlength = $settings['panel']['password_min_length']; $minlength = $settings['panel']['password_min_length'];
while (strlen($rnd) < ($minlength * 2)) { while (strlen($rnd) < ($minlength * 2))
{
$rnd .= md5(uniqid(microtime(), 1)); $rnd .= md5(uniqid(microtime(), 1));
} }
$password = substr($rnd, (int)($minlength / 2), $minlength); $password = substr($rnd, (int)($minlength / 2), $minlength);
} }
$passwordTable = $adminchecked ? TABLE_PANEL_ADMINS : TABLE_PANEL_CUSTOMERS; if($adminchecked)
$db->query("UPDATE `" . $passwordTable . "` SET `password`='" . md5($password) . "' {
WHERE `loginname`='" . $user['loginname'] . "' $db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `password`='" . md5($password) . "'
AND `email`='" . $user['email'] . "'"); WHERE `loginname`='" . $user['loginname'] . "'
AND `email`='" . $user['email'] . "'");
}
else
{
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `password`='" . md5($password) . "'
WHERE `loginname`='" . $user['loginname'] . "'
AND `email`='" . $user['email'] . "'");
}
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'), $db, $settings); $rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'), $db, $settings);
$rstlog->logAction(USR_ACTION, LOG_WARNING, "Password for user '" . $user['loginname'] . "' has been reset!"); $rstlog->logAction(USR_ACTION, LOG_WARNING, "Password for user '" . $user['loginname'] . "' has been reset!");
$replace_arr = array(
'SALUTATION' => getCorrectUserSalutation($user),
'USERNAME' => $user['loginname'],
'PASSWORD' => $password
);
$body = strtr($lng['pwdreminder']['body'], array('%s' => $user['firstname'] . ' ' . $user['name'], '%p' => $password)); $body = strtr($lng['pwdreminder']['body'], array('%s' => $user['firstname'] . ' ' . $user['name'], '%p' => $password));
$def_language = ($user['def_language'] != '') ? $user['def_language'] : $settings['panel']['standardlanguage'];
$result = $db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$user['adminid'] . '\' AND `language`=\'' . $db->escape($def_language) . '\' AND `templategroup`=\'mails\' AND `varname`=\'password_reset_subject\'');
$mail_subject = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['pwdreminder']['subject']), $replace_arr));
$result = $db->query_first('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$user['adminid'] . '\' AND `language`=\'' . $db->escape($def_language) . '\' AND `templategroup`=\'mails\' AND `varname`=\'password_reset_mailbody\'');
$mail_body = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $body), $replace_arr));
$_mailerror = false; $_mailerror = false;
try { try {
$mail->Subject = $mail_subject; $mail->Subject = $lng['pwdreminder']['subject'];
$mail->AltBody = $mail_body; $mail->AltBody = $body;
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body)); $mail->MsgHTML(str_replace("\\n", "<br />", $body));
$mail->AddAddress($user['email'], $user['firstname'] . ' ' . $user['name']); $mail->AddAddress($user['email'], $user['firstname'] . ' ' . $user['name']);
$mail->Send(); $mail->Send();
} catch(phpmailerException $e) { } catch(phpmailerException $e) {
@@ -301,36 +300,44 @@ if ($action == 'forgotpwd') {
if ($_mailerror) { if ($_mailerror) {
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'), $db, $settings); $rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'), $db, $settings);
$rstlog->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg); $rstlog->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
redirectTo('index.php', Array('showmessage' => '4', 'customermail' => $user['email']), true); redirectTo('index.php', Array('showmessage' => '4'), true);
exit; exit;
} }
$mail->ClearAddresses(); $mail->ClearAddresses();
redirectTo('index.php', Array('showmessage' => '1'), true); redirectTo('index.php', Array('showmessage' => '1'), true);
exit; exit;
} else { }
else
{
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'), $db, $settings); $rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'), $db, $settings);
$rstlog->logAction(USR_ACTION, LOG_WARNING, "User '" . $loginname . "' tried to reset pwd but wasn't found in database!"); $rstlog->logAction(USR_ACTION, LOG_WARNING, "User '" . $loginname . "' tried to reset pwd but wasn't found in database!");
$message = $lng['login']['combination_not_found']; $message = $lng['login']['usernotfound'];
} }
unset($user); unset($user);
} }
} else {
$message = $lng['login']['usernotfound'];
} }
} }
if ($adminchecked) {
if ($settings['panel']['allow_preset_admin'] != '1') { if($adminchecked)
{
if($settings['panel']['allow_preset_admin'] != '1')
{
$message = $lng['pwdreminder']['notallowed']; $message = $lng['pwdreminder']['notallowed'];
unset ($adminchecked); unset ($adminchecked);
} }
} else { }
if ($settings['panel']['allow_preset'] != '1') { else
{
if($settings['panel']['allow_preset'] != '1')
{
$message = $lng['pwdreminder']['notallowed']; $message = $lng['pwdreminder']['notallowed'];
} }
} }
eval("echo \"" . getTemplate('fpwd') . "\";"); eval("echo \"" . getTemplate("fpwd") . "\";");
} }
?>

File diff suppressed because it is too large Load Diff

View File

@@ -2,6 +2,7 @@
/** /**
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * For the full copyright and license information, please view the COPYING
@@ -9,14 +10,889 @@
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * COPYING file online at http://files.froxlor.org/misc/COPYING.txt
* *
* @copyright (c) the authors * @copyright (c) the authors
* @author Michael Kaufmann <mkaufmann@nutime.de> * @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Install * @package Install
* * @version $Id$
*/ */
require 'lib/class.FroxlorInstall.php'; /**
* Most elements are taken from the phpBB (www.phpbb.com)
* installer, (c) 1999 - 2004 phpBB Group.
*/
$frxinstall = new FroxlorInstall(); if(file_exists('../lib/userdata.inc.php'))
$frxinstall->run(); {
/**
* Includes the Usersettings eg. MySQL-Username/Passwort etc. to test if Froxlor is already installed
*/
require ('../lib/userdata.inc.php');
if(isset($sql)
&& is_array($sql))
{
die('Sorry, Froxlor is already configured...');
}
}
/**
* Include the functions
*/
require ('../lib/functions.php');
/**
* Include the MySQL-Table-Definitions
*/
require ('../lib/tables.inc.php');
/**
* Language Managament
*/
$languages = Array(
'german' => 'Deutsch',
'english' => 'English',
'french' => 'Francais'
);
$standardlanguage = 'english';
if(isset($_GET['language'])
&& isset($languages[$_GET['language']]))
{
$language = $_GET['language'];
}
elseif(isset($_POST['language'])
&& isset($languages[$_POST['language']]))
{
$language = $_POST['language'];
}
else
{
$language = $standardlanguage;
}
if(file_exists('./lng/' . $language . '.lng.php'))
{
/**
* Includes file /lng/$language.lng.php if it exists
*/
require ('./lng/' . $language . '.lng.php');
}
/**
* BEGIN FUNCTIONS -----------------------------------------------
*/
function page_header()
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
<link rel="stylesheet" href="../templates/main.css" type="text/css" />
<title>Froxlor</title>
</head>
<body style="margin: 0; padding: 0;" onload="document.loginform.loginname.focus()">
<!--
We request you retain the full copyright notice below including the link to www.froxlor.org.
This not only gives respect to the large amount of time given freely by the developers
but also helps build interest, traffic and use of Froxlor. If you refuse
to include even this then support on our forums may be affected.
The Froxlor Team : 2009-2010
// -->
<!--
Templates based on work by Luca Piona (info@havanastudio.ch) and Luca Longinotti (chtekk@gentoo.org)
// -->
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td width="800"><img src="../images/header.gif" width="800" height="90" alt="" /></td>
<td class="header">&nbsp;</td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td valign="top" bgcolor="#FFFFFF">
<br />
<br />
<?php
}
function page_footer()
{
?>
</td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td width="100%" class="footer">
<br />Froxlor &copy; 2009-2010 by <a href="http://www.froxlor.org/" target="_blank">the Froxlor Team</a>
<br /><br/>
</td>
</tr>
</table>
</body>
</html>
<?php
}
function status_message($case, $text)
{
if($case == 'begin')
{
echo "\t\t<tr>\n\t\t\t<td class=\"main_field_name\">$text";
}
else
{
echo " <span style=\"color:$case;\">$text</span></td>\n\t\t</tr>\n";
}
}
function requirement_checks()
{
global $lng;
page_header();
?>
<table cellpadding="5" cellspacing="4" border="0" align="center" class="maintable">
<tr>
<td class="maintitle"><b><img src="../images/title.gif" alt="" />&nbsp;Froxlor Installation</b></td>
</tr>
<?php
$_die = false;
// check for correct php version
status_message('begin', $lng['install']['phpversion']);
if(version_compare("5.2.0", PHP_VERSION, ">="))
{
status_message('red', $lng['install']['notinstalled']);
$_die = true;
}
else
{
status_message('green', 'OK');
}
status_message('begin', $lng['install']['phpmysql']);
if(!extension_loaded('mysql'))
{
status_message('red', $lng['install']['notinstalled']);
$_die = true;
}
else
{
status_message('green', 'OK');
}
status_message('begin', $lng['install']['phpfilter']);
if(!extension_loaded('filter'))
{
status_message('red', $lng['install']['notinstalled']);
$_die = true;
}
else
{
status_message('green', 'OK');
}
status_message('begin', $lng['install']['phpposix']);
if(!extension_loaded('posix'))
{
status_message('red', $lng['install']['notinstalled']);
$_die = true;
}
else
{
status_message('green', 'OK');
}
status_message('begin', $lng['install']['phpbcmath']);
if(!extension_loaded('bcmath'))
{
status_message('orange', $lng['install']['notinstalled'] . '<br />' . $lng['install']['bcmathdescription']);
}
else
{
status_message('green', 'OK');
}
status_message('begin', $lng['install']['openbasedir']);
$php_ob = @ini_get("open_basedir");
if(!empty($php_ob)
&& $php_ob != '')
{
status_message('orange', $lng['install']['openbasedirenabled']);
}
else
{
status_message('green', 'OK');
}
if($_die)
{
?>
<tr>
<td class="main_field_display" align="center">
<?php echo $lng['install']['diedbecauseofrequirements']; ?><br />
<a href="install.php"><?php echo $lng['install']['click_here_to_refresh']; ?></a>
</td>
</tr>
<?php
} else {
?>
<tr>
<td class="main_field_display" align="center">
<?php echo $lng['install']['froxlor_succ_checks']; ?><br />
<a href="install.php?check=1"><?php echo $lng['install']['click_here_to_continue']; ?></a>
</td>
</tr>
<?php
}
?>
</table>
<br />
<br />
<?php
page_footer();
}
/**
* END FUNCTIONS ---------------------------------------------------
*/
/**
* BEGIN VARIABLES ---------------------------------------------------
*/
//guess Servername
if(!empty($_POST['servername']))
{
$servername = $_POST['servername'];
}
else
{
if(!empty($_SERVER['SERVER_NAME']))
{
if(preg_match('/^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$/', $_SERVER['SERVER_NAME']) == false)
{
$servername = $_SERVER['SERVER_NAME'];
}
else
{
$servername = '';
}
}
else
{
$servername = '';
}
}
//guess serverip
if(!empty($_POST['serverip']))
{
$serverip = $_POST['serverip'];
}
else
{
if(!empty($_SERVER['SERVER_ADDR']))
{
$serverip = $_SERVER['SERVER_ADDR'];
}
else
{
$serverip = '';
}
}
if(!empty($_POST['mysql_host']))
{
$mysql_host = $_POST['mysql_host'];
}
else
{
$mysql_host = '127.0.0.1';
}
if(!empty($_POST['mysql_database']))
{
$mysql_database = $_POST['mysql_database'];
}
else
{
$mysql_database = 'froxlor';
}
if(!empty($_POST['mysql_unpriv_user']))
{
$mysql_unpriv_user = $_POST['mysql_unpriv_user'];
}
else
{
$mysql_unpriv_user = 'froxlor';
}
if(!empty($_POST['mysql_unpriv_pass']))
{
$mysql_unpriv_pass = $_POST['mysql_unpriv_pass'];
}
else
{
$mysql_unpriv_pass = '';
}
if(!empty($_POST['mysql_root_user']))
{
$mysql_root_user = $_POST['mysql_root_user'];
}
else
{
$mysql_root_user = 'root';
}
if(!empty($_POST['mysql_root_pass']))
{
$mysql_root_pass = $_POST['mysql_root_pass'];
}
else
{
$mysql_root_pass = '';
}
if(!empty($_POST['admin_user']))
{
$admin_user = $_POST['admin_user'];
}
else
{
$admin_user = 'admin';
}
if(!empty($_POST['admin_pass1']))
{
$admin_pass1 = $_POST['admin_pass1'];
}
else
{
$admin_pass1 = '';
}
if(!empty($_POST['admin_pass2']))
{
$admin_pass2 = $_POST['admin_pass2'];
}
else
{
$admin_pass2 = '';
}
if($mysql_host == 'localhost'
|| $mysql_host == '127.0.0.1')
{
$mysql_access_host = $mysql_host;
}
else
{
$mysql_access_host = $serverip;
}
// gues http software
if(!empty($_POST['webserver']))
{
$webserver = $_POST['webserver'];
}
else
{
if(strtoupper(@php_sapi_name()) == "APACHE2HANDLER"
|| stristr($_SERVER['SERVER_SOFTWARE'], "apache/2"))
{
$webserver = 'apache2';
}
elseif(substr(strtoupper(@php_sapi_name()), 0, 8) == "LIGHTTPD"
|| stristr($_SERVER['SERVER_SOFTWARE'], "lighttpd"))
{
$webserver = 'lighttpd';
}
else
{
// we don't need to bail out, since unknown does not affect any critical installation routines
$webserver = 'unknown';
}
}
if(!empty($_POST['httpuser']))
{
$httpuser = $_POST['httpuser'];
}
else
{
$httpuser = '';
}
if(!empty($_POST['httpgroup']))
{
$httpgroup = $_POST['httpgroup'];
}
else
{
$httpgroup = '';
}
/**
* END VARIABLES ---------------------------------------------------
*/
/**
* BEGIN INSTALL ---------------------------------------------------
*/
if(isset($_POST['installstep'])
&& $_POST['installstep'] == '1'
&& $admin_pass1 == $admin_pass2
&& $admin_pass1 != ''
&& $admin_pass2 != ''
&& $mysql_unpriv_pass != ''
&& $mysql_root_pass != ''
&& $servername != ''
&& $serverip != ''
&& $httpuser != ''
&& $httpgroup != ''
&& $mysql_unpriv_user != $mysql_root_user)
{
page_header();
?>
<table cellpadding="5" cellspacing="4" border="0" align="center" class="maintable">
<tr>
<td class="maintitle"><b><img src="../images/title.gif" alt="" />&nbsp;Froxlor Installation</b></td>
</tr>
<?php
//first test if we can access the database server with the given root user and password
status_message('begin', $lng['install']['testing_mysql']);
$db_root = new db($mysql_host, $mysql_root_user, $mysql_root_pass, '');
//ok, if we are here, the database class is build up (otherwise it would have already die'd this script)
status_message('green', 'OK');
//first we make a backup of the old DB if it exists
status_message('begin', $lng['install']['backup_old_db']);
$result = mysql_list_tables($mysql_database);
if($result)
{
$filename = "/tmp/froxlor_backup_" . date('YmdHi') . ".sql";
if(is_file("/usr/bin/mysqldump"))
{
$do_backup = true;
$mysql_dump = '/usr/bin/mysqldump';
}
elseif(is_file("/usr/local/bin/mysqldump"))
{
$do_backup = true;
$mysql_dump = '/usr/local/bin/mysqldump';
}
else
{
$do_backup = false;
status_message('red', $lng['install']['backing_up_binary_missing']);
}
if($do_backup) {
$command = $mysql_dump . " " . $mysql_database . " -u " . $mysql_root_user . " --password='" . $mysql_root_pass . "' --result-file=" . $filename;
$output = exec($command);
if(stristr($output, "error"))
{
status_message('red', $lng['install']['backing_up_failed']);
}
else
{
status_message('green', 'OK');
}
}
}
//so first we have to delete the database and the user given for the unpriv-user if they exit
status_message('begin', $lng['install']['erasing_old_db']);
$db_root->query("DELETE FROM `mysql`.`user` WHERE `User` = '" . $db_root->escape($mysql_unpriv_user) . "' AND `Host` = '" . $db_root->escape($mysql_access_host) . "'");
$db_root->query("DELETE FROM `mysql`.`db` WHERE `User` = '" . $db_root->escape($mysql_unpriv_user) . "' AND `Host` = '" . $db_root->escape($mysql_access_host) . "'");
$db_root->query("DELETE FROM `mysql`.`tables_priv` WHERE `User` = '" . $db_root->escape($mysql_unpriv_user) . "' AND `Host` = '" . $db_root->escape($mysql_access_host) . "'");
$db_root->query("DELETE FROM `mysql`.`columns_priv` WHERE `User` = '" . $db_root->escape($mysql_unpriv_user) . "' AND `Host` = '" . $db_root->escape($mysql_access_host) . "'");
$db_root->query("DROP DATABASE IF EXISTS `" . $db_root->escape(str_replace('`', '', $mysql_database)) . "` ;");
$db_root->query("FLUSH PRIVILEGES;");
status_message('green', 'OK');
//then we have to create a new user and database for the froxlor unprivileged mysql access
status_message('begin', $lng['install']['create_mysqluser_and_db']);
$db_root->query("CREATE DATABASE `" . $db_root->escape(str_replace('`', '', $mysql_database)) . "`");
$mysql_access_host_array = array_map('trim', explode(',', $mysql_access_host));
if(in_array('127.0.0.1', $mysql_access_host_array)
&& !in_array('localhost', $mysql_access_host_array))
{
$mysql_access_host_array[] = 'localhost';
}
if(!in_array('127.0.0.1', $mysql_access_host_array)
&& in_array('localhost', $mysql_access_host_array))
{
$mysql_access_host_array[] = '127.0.0.1';
}
$mysql_access_host_array[] = $serverip;
foreach($mysql_access_host_array as $mysql_access_host)
{
$db_root->query("GRANT ALL PRIVILEGES ON `" . $db_root->escape(str_replace('`', '', $mysql_database)) . "`.* TO '" . $db_root->escape($mysql_unpriv_user) . "'@'" . $db_root->escape($mysql_access_host) . "' IDENTIFIED BY 'password'");
$db_root->query("SET PASSWORD FOR '" . $db_root->escape($mysql_unpriv_user) . "'@'" . $db_root->escape($mysql_access_host) . "' = PASSWORD('" . $db_root->escape($mysql_unpriv_pass) . "')");
}
$db_root->query("FLUSH PRIVILEGES;");
$mysql_access_host = implode(',', $mysql_access_host_array);
status_message('green', 'OK');
//now a new database and the new froxlor-unprivileged-mysql-account have been created and we can fill it now with the data.
status_message('begin', $lng['install']['testing_new_db']);
$db = new db($mysql_host, $mysql_unpriv_user, $mysql_unpriv_pass, $mysql_database);
status_message('green', 'OK');
status_message('begin', $lng['install']['importing_data']);
$db_schema = './froxlor.sql';
$sql_query = @file_get_contents($db_schema, 'r');
$sql_query = remove_remarks($sql_query);
$sql_query = split_sql_file($sql_query, ';');
for ($i = 0;$i < sizeof($sql_query);$i++)
{
if(trim($sql_query[$i]) != '')
{
$result = $db->query($sql_query[$i]);
}
}
status_message('green', 'OK');
status_message('begin', 'System Servername...');
if(validate_ip($_SERVER['SERVER_NAME'], true) !== false)
{
status_message('red', $lng['install']['servername_should_be_fqdn']);
}
else
{
status_message('green', 'OK');
}
//now let's change the settings in our settings-table
status_message('begin', $lng['install']['changing_data']);
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = 'admin@" . $db->escape($servername) . "' WHERE `settinggroup` = 'panel' AND `varname` = 'adminmail'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($serverip) . "' WHERE `settinggroup` = 'system' AND `varname` = 'ipaddress'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($servername) . "' WHERE `settinggroup` = 'system' AND `varname` = 'hostname'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($version) . "' WHERE `settinggroup` = 'panel' AND `varname` = 'version'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($languages[$language]) . "' WHERE `settinggroup` = 'panel' AND `varname` = 'standardlanguage'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($mysql_access_host) . "' WHERE `settinggroup` = 'system' AND `varname` = 'mysql_access_host'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($webserver) . "' WHERE `settinggroup` = 'system' AND `varname` = 'webserver'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($webserver) . "' WHERE `settinggroup` = 'system' AND `varname` = 'webserver'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($httpuser) . "' WHERE `settinggroup` = 'system' AND `varname` = 'httpuser'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '" . $db->escape($httpgroup) . "' WHERE `settinggroup` = 'system' AND `varname` = 'httpgroup'");
if($webserver == "apache2")
{
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/apache2/sites-enabled/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_vhost'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/apache2/sites-enabled/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_diroptions'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/apache2/froxlor-htpasswd/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_htpasswddir'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/init.d/apache2 reload' WHERE `settinggroup` = 'system' AND `varname` = 'apachereload_command'");
}
elseif($webserver == "lighttpd")
{
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/conf-enabled/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_vhost'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/froxlor-diroptions/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_diroptions'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/froxlor-htpasswd/' WHERE `settinggroup` = 'system' AND `varname` = 'apacheconf_htpasswddir'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/init.d/lighttpd reload' WHERE `settinggroup` = 'system' AND `varname` = 'apachereload_command'");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/etc/lighttpd/lighttpd.pem' WHERE `settinggroup` = 'system' AND `varname` = 'ssl_cert_file'");
$ssettings = '';
}
// insert the lastcronrun to be the installation date
$query = 'UPDATE `%s` SET `value` = UNIX_TIMESTAMP() WHERE `settinggroup` = \'system\' AND `varname` = \'lastcronrun\'';
$query = sprintf($query, TABLE_PANEL_SETTINGS);
$db->query($query);
// set specific times for some crons (traffic only at night, etc.)
$ts = mktime(0, 0, 0, date('m', time()), date('d', time()), date('Y', time()));
$db->query("UPDATE `".TABLE_PANEL_CRONRUNS."` SET `lastrun` = '".$ts."' WHERE `cronfile` ='cron_traffic.php';");
$ts = mktime(1, 0, 0, date('m', time()), date('d', time()), date('Y', time()));
$db->query("UPDATE `".TABLE_PANEL_CRONRUNS."` SET `lastrun` = '".$ts."' WHERE `cronfile` ='cron_used_tickets_reset.php';");
$db->query("UPDATE `".TABLE_PANEL_CRONRUNS."` SET `lastrun` = '".$ts."' WHERE `cronfile` ='cron_ticketarchive.php';");
// and lets insert the default ip and port
$query = "INSERT INTO `".TABLE_PANEL_IPSANDPORTS."`
SET `ip`= '".$db->escape($serverip)."',
`port` = '80',
`namevirtualhost_statement` = '1',
`vhostcontainer` = '1',
`vhostcontainer_servername_statement` = '1'";
$db->query($query);
$defaultip = $db->insert_id();
// insert the defaultip
$query = 'UPDATE `%s` SET `value` = \'%s\' WHERE `settinggroup` = \'system\' AND `varname` = \'defaultip\'';
$query = sprintf($query, TABLE_PANEL_SETTINGS, $db->escape($defaultip));
$db->query($query);
status_message('green', 'OK');
//last but not least create the main admin
status_message('begin', $lng['install']['adding_admin_user']);
$db->query("INSERT INTO `" . TABLE_PANEL_ADMINS . "` SET
`loginname` = '" . $db->escape($admin_user) . "',
`password` = '" . md5($admin_pass1) . "',
`name` = 'Siteadmin',
`email` = 'admin@" . $db->escape($servername) . "',
`customers` = -1,
`customers_used` = 0,
`customers_see_all` = 1,
`caneditphpsettings` = 1,
`domains` = -1,
`domains_used` = 0,
`domains_see_all` = 1,
`change_serversettings` = 1,
`diskspace` = -1024,
`diskspace_used` = 0,
`mysqls` = -1,
`mysqls_used` = 0,
`emails` = -1,
`emails_used` = 0,
`email_accounts` = -1,
`email_accounts_used` = 0,
`email_forwarders` = -1,
`email_forwarders_used` = 0,
`email_quota` = -1,
`email_quota_used` = 0,
`ftps` = -1,
`ftps_used` = 0,
`tickets` = -1,
`tickets_used` = 0,
`subdomains` = -1,
`subdomains_used` = 0,
`traffic` = -1048576,
`traffic_used` = 0,
`deactivated` = 0,
`aps_packages` = -1");
status_message('green', 'OK');
//now we create the userdata.inc.php with the mysql-accounts
status_message('begin', $lng['install']['creating_configfile']);
$userdata = "<?php\n";
$userdata.= "//automatically generated userdata.inc.php for Froxlor\n";
$userdata.= "\$sql['host']='" . addcslashes($mysql_host, "'\\") . "';\n";
$userdata.= "\$sql['user']='" . addcslashes($mysql_unpriv_user, "'\\") . "';\n";
$userdata.= "\$sql['password']='" . addcslashes($mysql_unpriv_pass, "'\\") . "';\n";
$userdata.= "\$sql['db']='" . addcslashes($mysql_database, "'\\") . "';\n";
$userdata.= "\$sql_root[0]['caption']='Default';\n";
$userdata.= "\$sql_root[0]['host']='" . addcslashes($mysql_host, "'\\") . "';\n";
$userdata.= "\$sql_root[0]['user']='" . addcslashes($mysql_root_user, "'\\") . "';\n";
$userdata.= "\$sql_root[0]['password']='" . addcslashes($mysql_root_pass, "'\\") . "';\n";
$userdata.= "?>";
//we test now if we can store the userdata.inc.php in ../lib
if($fp = @fopen('../lib/userdata.inc.php', 'w'))
{
$result = @fputs($fp, $userdata, strlen($userdata));
@fclose($fp);
status_message('green', $lng['install']['creating_configfile_succ']);
chmod('../lib/userdata.inc.php', 0440);
}
elseif($fp = @fopen('/tmp/userdata.inc.php', 'w'))
{
$result = @fputs($fp, $userdata, strlen($userdata));
@fclose($fp);
status_message('orange', $lng['install']['creating_configfile_temp']);
chmod('/tmp/userdata.inc.php', 0440);
}
else
{
status_message('red', $lng['install']['creating_configfile_failed']);
echo "\t\t<tr>\n\t\t\t<td class=\"main_field_name\"><p>" . nl2br(htmlspecialchars($userdata)) . "</p></td>\n\t\t</tr>\n";
}
?>
<tr>
<td class="main_field_display" align="center">
<?php echo $lng['install']['froxlor_succ_installed']; ?><br />
<a href="../index.php"><?php echo $lng['install']['click_here_to_login']; ?></a>
</td>
</tr>
</table>
<br />
<br />
<?php
page_footer();
}
else
{
if((isset($_GET['check'])
&& $_GET['check'] == '1')
|| (isset($_POST['installstep'])
&& $_POST['installstep'] == '1')
) {
page_header();
?>
<form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="get">
<input type="hidden" name="check" value="1" />
<table cellpadding="5" cellspacing="4" border="0" align="center" class="maintable_40">
<tr>
<td class="maintitle" colspan="2"><b><img src="../images/title.gif" alt="" />&nbsp;<?php echo $lng['install']['welcome']; ?></b></td>
</tr>
<tr>
<td class="main_field_name" colspan="2"><?php echo $lng['install']['welcometext']; ?></td>
</tr>
<tr>
<td class="main_field_name"><?php echo $lng['install']['language']; ?>: </td>
<td class="main_field_display" nowrap="nowrap">
<select name="language" class="dropdown_noborder"><?php
$language_options = '';
while(list($language_file, $language_name) = each($languages))
{
$language_options.= "\n\t\t\t\t\t\t" . makeoption($language_name, $language_file, $language, true, true);
}
echo $language_options;
?>
</select>
</td>
</tr>
<tr>
<td class="main_field_confirm" colspan="2">
<input class="bottom" type="submit" name="chooselang" value="Go" />
</td>
</tr>
</table>
</form>
<br />
<form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="post">
<input type="hidden" name="check" value="1" />
<table cellpadding="5" cellspacing="4" border="0" align="center" class="maintable_40">
<tr>
<td class="maintitle" colspan="2"><b><img src="../images/title.gif" alt="" />&nbsp;<?php echo $lng['install']['database']; ?></b></td>
</tr>
<tr>
<td class="main_field_name"><?php echo $lng['install']['mysql_hostname']; ?>:</td>
<td class="main_field_display"><input type="text" name="mysql_host" value="<?php echo htmlspecialchars($mysql_host); ?>"/></td>
</tr>
<tr>
<td class="main_field_name"><?php echo $lng['install']['mysql_database']; ?>:</td>
<td class="main_field_display"><input type="text" name="mysql_database" value="<?php echo htmlspecialchars($mysql_database); ?>"/></td>
</tr>
<tr>
<td class="main_field_name"<?php echo (($mysql_unpriv_user == $mysql_root_user) ? ' style="color:blue;"' : ''); ?>><?php echo $lng['install']['mysql_unpriv_user']; ?>:</td>
<td class="main_field_display"><input type="text" name="mysql_unpriv_user" value="<?php echo htmlspecialchars($mysql_unpriv_user); ?>"/></td>
</tr>
<tr>
<td class="main_field_name"<?php echo ((!empty($_POST['installstep']) && $mysql_unpriv_pass == '') ? ' style="color:red;"' : ''); ?>><?php echo $lng['install']['mysql_unpriv_pass']; ?>:</td>
<td class="main_field_display"><input type="password" name="mysql_unpriv_pass" value="<?php echo htmlspecialchars($mysql_unpriv_pass); ?>"/></td>
</tr>
<tr>
<td class="main_field_name"<?php echo (($mysql_unpriv_user == $mysql_root_user) ? ' style="color:blue;"' : ''); ?>><?php echo $lng['install']['mysql_root_user']; ?>:</td>
<td class="main_field_display"><input type="text" name="mysql_root_user" value="<?php echo htmlspecialchars($mysql_root_user); ?>"/></td>
</tr>
<tr>
<td class="main_field_name"<?php echo ((!empty($_POST['installstep']) && $mysql_root_pass == '') ? ' style="color:red;"' : ''); ?>><?php echo $lng['install']['mysql_root_pass']; ?>:</td>
<td class="main_field_display"><input type="password" name="mysql_root_pass" value="<?php echo htmlspecialchars($mysql_root_pass); ?>"/></td>
</tr>
<tr>
<td class="maintitle" colspan="2"><b><img src="../images/title.gif" alt="" />&nbsp;<?php echo $lng['install']['admin_account']; ?></b></td>
</tr>
<tr>
<td class="main_field_name"><?php echo $lng['install']['admin_user']; ?>:</td>
<td class="main_field_display"><input type="text" name="admin_user" value="<?php echo htmlspecialchars($admin_user); ?>"/></td>
</tr>
<tr>
<td class="main_field_name"<?php echo ((!empty($_POST['installstep']) && ($admin_pass1 == '' || $admin_pass1 != $admin_pass2)) ? ' style="color:red;"' : ''); ?>><?php echo $lng['install']['admin_pass']; ?>:</td>
<td class="main_field_display"><input type="password" name="admin_pass1" value="<?php echo htmlspecialchars($admin_pass1); ?>"/></td>
</tr>
<tr>
<td class="main_field_name"<?php echo ((!empty($_POST['installstep']) && ($admin_pass2 == '' || $admin_pass1 != $admin_pass2)) ? ' style="color:red;"' : ''); ?>><?php echo $lng['install']['admin_pass_confirm']; ?>:</td>
<td class="main_field_display"><input type="password" name="admin_pass2" value="<?php echo htmlspecialchars($admin_pass2); ?>"/></td>
</tr>
<tr>
<td class="maintitle" colspan="2"><b><img src="../images/title.gif" alt="" />&nbsp;<?php echo $lng['install']['serversettings']; ?></b></td>
</tr>
<tr>
<td class="main_field_name"<?php echo ((!empty($_POST['installstep']) && $servername == '') ? ' style="color:red;"' : ''); ?>><?php echo $lng['install']['servername']; ?>:</td>
<td class="main_field_display"><input type="text" name="servername" value="<?php echo htmlspecialchars($servername); ?>"/></td>
</tr>
<tr>
<td class="main_field_name"<?php echo ((!empty($_POST['installstep']) && $serverip == '') ? ' style="color:red;"' : ''); ?>><?php echo $lng['install']['serverip']; ?>:</td>
<td class="main_field_display"><input type="text" name="serverip" value="<?php echo htmlspecialchars($serverip); ?>"/></td>
</tr>
<tr>
<td class="main_field_name"<?php echo ((!empty($_POST['installstep']) && $webserver == '') ? ' style="color:red;"' : ''); ?>><?php echo $lng['install']['webserver']; ?>:</td>
<td class="main_field_display"><input type="radio" name="webserver" value="apache2" <?php echo $webserver == "apache2" ? 'checked="checked"' : "" ?>/>Apache2&nbsp;<br /><input type="radio" name="webserver" value="lighttpd" <?php echo $webserver == "lighttpd" ? 'checked="checked"' : "" ?>/>Lighttpd</td>
</tr>
<tr>
<td class="main_field_name"<?php echo ((!empty($_POST['installstep']) && $serverip == '') ? ' style="color:red;"' : ''); ?>><?php echo $lng['install']['httpuser']; ?>:</td>
<td class="main_field_display"><input type="text" name="httpuser" value="<?php $posixusername = posix_getpwuid(posix_getuid()); echo $posixusername['name']; ?>"/></td>
</tr>
<tr>
<td class="main_field_name"<?php echo ((!empty($_POST['installstep']) && $serverip == '') ? ' style="color:red;"' : ''); ?>><?php echo $lng['install']['httpgroup']; ?>:</td>
<td class="main_field_display"><input type="text" name="httpgroup" value="<?php $posixgroup = posix_getgrgid(posix_getgid()); echo $posixgroup['name']; ?>"/></td>
</tr>
<tr>
<td class="main_field_confirm" colspan="2"><input type="hidden" name="language" value="<?php echo htmlspecialchars($language); ?>"/><input type="hidden" name="installstep" value="1"/><input class="bottom" type="submit" name="submitbutton" value="<?php echo $lng['install']['next']; ?>"/></td>
</tr>
</table>
</form>
<br />
<br />
<?php
page_footer();
}
else
{
requirement_checks();
}
}
/**
* END INSTALL ---------------------------------------------------
*/
?>

File diff suppressed because it is too large Load Diff

View File

@@ -14,71 +14,81 @@
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Language * @package Language
* * @version $Id$
*/ */
$lng['requirements']['title'] = 'Checking system requirements...'; /**
$lng['requirements']['installed'] = 'installed'; * Begin
$lng['requirements']['not_true'] = 'no'; */
$lng['requirements']['notfound'] = 'not found';
$lng['requirements']['notinstalled'] = 'not installed';
$lng['requirements']['activated'] = 'enabled';
$lng['requirements']['phpversion'] = 'PHP version >= 5.2';
$lng['requirements']['phpmagic_quotes_runtime'] = 'magic_quotes_runtime...';
$lng['requirements']['phpmagic_quotes_runtime_description'] = 'PHP setting "magic_quotes_runtime" must be set to "Off". We have disabled it temporary for now please fix the coresponding php.ini.';
$lng['requirements']['phpmysql'] = 'MySQL-extension...';
$lng['requirements']['phpxml'] = 'PHP XML-extension...';
$lng['requirements']['phpfilter'] = 'PHP filter-extension...';
$lng['requirements']['phpposix'] = 'PHP posix-extension...';
$lng['requirements']['phpbcmath'] = 'PHP bcmath-extension...';
$lng['requirements']['bcmathdescription'] = 'Traffic-calculation related functions will not work correctly!';
$lng['requirements']['openbasedir'] = 'open_basedir...';
$lng['requirements']['openbasedirenabled'] = 'Froxlor will not work properly with open_basedir enabled. Please disable open_basedir for Froxlor in the coresponding php.ini';
$lng['requirements']['diedbecauseofrequirements'] = 'Cannot install Froxlor without these requirements! Try to fix them and retry.';
$lng['requirements']['froxlor_succ_checks'] = 'All requirements are satisfied';
$lng['install']['title'] = 'Froxlor install - chose language'; $lng['install']['language'] = 'Installation - Language';
$lng['install']['language'] = 'Installation language'; $lng['install']['welcome'] = 'Welcome to Froxlor Installation';
$lng['install']['lngbtn_go'] = 'Change language';
$lng['install']['title'] = 'Froxlor install - setup';
$lng['install']['welcometext'] = 'Thank you for choosing Froxlor. Please fill out the following fields with the required information to start the installation.<br /><b>Attention:</b> If the database you chose for Froxlor already exists on your System, it will be erased with all containing data!'; $lng['install']['welcometext'] = 'Thank you for choosing Froxlor. Please fill out the following fields with the required information to start the installation.<br /><b>Attention:</b> If the database you chose for Froxlor already exists on your System, it will be erased with all containing data!';
$lng['install']['database'] = 'Database connection'; $lng['install']['database'] = 'Database';
$lng['install']['mysql_host'] = 'MySQL-Hostname'; $lng['install']['mysql_hostname'] = 'MySQL-Hostname';
$lng['install']['mysql_database'] = 'Database name'; $lng['install']['mysql_database'] = 'MySQL-Database';
$lng['install']['mysql_unpriv_user'] = 'Username for the unprivileged MySQL-account'; $lng['install']['mysql_unpriv_user'] = 'Username for the unprivileged MySQL-account';
$lng['install']['mysql_unpriv_pass'] = 'Password for the unprivileged MySQL-account'; $lng['install']['mysql_unpriv_pass'] = 'Password for the unprivileged MySQL-account';
$lng['install']['mysql_root_user'] = 'Username for the MySQL-root-account'; $lng['install']['mysql_root_user'] = 'Username for the MySQL-root-account';
$lng['install']['mysql_root_pass'] = 'Password for the MySQL-root-account'; $lng['install']['mysql_root_pass'] = 'Password for the MySQL-root-account';
$lng['install']['admin_account'] = 'Administrator Account'; $lng['install']['admin_account'] = 'Administrator Account';
$lng['install']['admin_user'] = 'Administrator Username'; $lng['install']['admin_user'] = 'Administrator Username';
$lng['install']['admin_pass1'] = 'Administrator Password'; $lng['install']['admin_pass'] = 'Administrator Password';
$lng['install']['admin_pass2'] = 'Administrator-Password (confirm)'; $lng['install']['admin_pass_confirm'] = 'Administrator-Password (confirm)';
$lng['install']['serversettings'] = 'Server settings'; $lng['install']['serversettings'] = 'Server settings';
$lng['install']['servername'] = 'Server name (FQDN, no ip-address)'; $lng['install']['servername'] = 'Server name (FQDN)';
$lng['install']['serverip'] = 'Server IP'; $lng['install']['serverip'] = 'Server IP';
$lng['install']['webserver'] = 'Webserver';
$lng['install']['apache2'] = 'Apache 2';
$lng['install']['lighttpd'] = 'LigHTTPd';
$lng['install']['nginx'] = 'NGINX';
$lng['install']['httpuser'] = 'HTTP username'; $lng['install']['httpuser'] = 'HTTP username';
$lng['install']['httpgroup'] = 'HTTP groupname'; $lng['install']['httpgroup'] = 'HTTP groupname';
$lng['install']['apacheversion'] = 'Apacheversion';
$lng['install']['next'] = 'Next';
$lng['install']['testing_mysql'] = 'Checking MySQL-root access...'; /**
$lng['install']['backup_old_db'] = 'Creating backup of old database...'; * Progress
$lng['install']['backup_binary_missing'] = 'Could not find mysqldump'; */
$lng['install']['backup_failed'] = 'Could not backup database';
$lng['install']['prepare_db'] = 'Preparing database...'; $lng['install']['testing_mysql'] = 'Testing if MySQL-root-username and password are correct...';
$lng['install']['create_mysqluser_and_db'] = 'Creating database and username...'; $lng['install']['erasing_old_db'] = 'Erasing old Database...';
$lng['install']['testing_new_db'] = 'Testing if database and user have been created correctly...'; $lng['install']['backup_old_db'] = 'Create backup of the old Database...';
$lng['install']['importing_data'] = 'Importing data...'; $lng['install']['backing_up'] = 'Backing up';
$lng['install']['changing_data'] = 'Adjusting settings...'; $lng['install']['backing_up_binary_missing'] = '/usr/bin/mysqldump is missing';
$lng['install']['creating_entries'] = 'Inserting new values...'; $lng['install']['create_mysqluser_and_db'] = 'Creating MySQL-database and username...';
$lng['install']['adding_admin_user'] = 'Creating admin-account...'; $lng['install']['testing_new_db'] = 'Testing if MySQL-database and username have been created correctly...';
$lng['install']['importing_data'] = 'Importing data into MySQL-database...';
$lng['install']['changing_data'] = 'Changing imported data...';
$lng['install']['adding_admin_user'] = 'Adding Administrator Account...';
$lng['install']['creating_configfile'] = 'Creating configfile...'; $lng['install']['creating_configfile'] = 'Creating configfile...';
$lng['install']['creating_configfile_succ'] = 'OK, userdata.inc.php was saved in lib/.';
$lng['install']['creating_configfile_temp'] = 'File was saved in /tmp/userdata.inc.php, please move to lib/.'; $lng['install']['creating_configfile_temp'] = 'File was saved in /tmp/userdata.inc.php, please move to lib/.';
$lng['install']['creating_configfile_failed'] = 'Could not create lib/userdata.inc.php, please create it manually with the following content:'; $lng['install']['creating_configfile_failed'] = 'Cannot create lib/userdata.inc.php, please create it manually with the following data:';
$lng['install']['froxlor_succ_installed'] = 'Froxlor was installed successfully.'; $lng['install']['froxlor_succ_installed'] = 'Froxlor was installed successfully.';
$lng['install']['click_here_to_login'] = 'Click here to login.';
$lng['install']['phpmysql'] = 'Testing if PHP MySQL-extension is installed...';
$lng['install']['phpfilter'] = 'Testing if PHP filter-extension is installed...';
$lng['install']['diedbecauseofrequirements'] = 'Cannot install Froxlor without these requirements! Aborting...';
$lng['install']['notinstalled'] = 'not installed!';
$lng['install']['phpbcmath'] = 'Testing if PHP bcmath-extension is installed...';
$lng['install']['bcmathdescription'] = 'Traffic-calculation related functions will not work correctly!';
$lng['install']['openbasedir'] = 'Testing if open_basedir is enabled...';
$lng['install']['openbasedirenabled'] = 'enabled. Froxlor will not work properly with open_basedir enabled. Please disable open_basedir for Froxlor';
$lng['click_here_to_refresh'] = 'Click here to check again'; /**
$lng['click_here_to_continue'] = 'Click here to continue'; * Renamed in 1.2.19-svn40
$lng['click_here_to_login'] = 'Click here to login.'; */
$lng['install']['webserver'] = 'Webserver';
/*
* Added in Froxlor 0.9
*/
$lng['install']['phpversion'] = 'Checking for PHP version >= 5.2';
$lng['install']['phpposix'] = 'Testing if PHP posix-extension is installed...';
/*
* Added in Froxlor 0.9.4
*/
$lng['install']['click_here_to_refresh'] = 'Re-check';
$lng['install']['click_here_to_continue'] = 'Continue installation';
$lng['install']['froxlor_succ_checks'] = 'All requirements are satisfied';
?>

View File

@@ -0,0 +1,71 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Tim Zielosko <mail@zielosko.net>
* @author Romain MARIADASSOU <roms2000@free.fr>
* @author Froxlor Team <team@froxlor.org>
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Language
* @version $Id$
*/
/**
* Begin
*/
$lng['install']['language'] = 'Langue d\'installation';
$lng['install']['welcome'] = 'Bienvenue <20> l\'installation de Froxlor';
$lng['install']['welcometext'] = 'Merci beaucoup d\'avoir choisi Froxlor. Pour installer Froxlor remplissez les cases ci-dessous avec les informations demand<6E>es.<br /><b>Attention :</b> Si vous entrez le nom d\'une base de donn<6E>es existante, celle-ci sera effac<61>e !';
$lng['install']['database'] = 'Base de donn<6E>es';
$lng['install']['mysql_hostname'] = 'Nom d\'h<>te du serveur MySQL';
$lng['install']['mysql_database'] = 'Base de donn<6E>es MySQL';
$lng['install']['mysql_unpriv_user'] = 'Utilisateur pour l\'acc<63>s non privil<69>gi<67> <20> MySQL';
$lng['install']['mysql_unpriv_pass'] = 'Mot de passe pour l\'acc<63>s non privil<69>gi<67> <20> MySQL';
$lng['install']['mysql_root_user'] = 'Utilisateur pour l\'acc<63>s root <20> MySQL';
$lng['install']['mysql_root_pass'] = 'Mot de passe pour l\'acc<63>s root <20> MySQL';
$lng['install']['admin_account'] = 'Acc<63>s administratif';
$lng['install']['admin_user'] = 'Login de l\'administrateur';
$lng['install']['admin_pass'] = 'Mot de passe de l\'administrateur';
$lng['install']['admin_pass_confirm'] = 'Mot de passe de l\'administrateur (confirmation)';
$lng['install']['serversettings'] = 'Configuration du serveur';
$lng['install']['servername'] = 'Nom du serveur (FQDN)';
$lng['install']['serverip'] = 'Adresse IP du serveur';
$lng['install']['apacheversion'] = 'Version du serveur Apache';
$lng['install']['next'] = 'Continuer';
/**
* Progress
*/
$lng['install']['testing_mysql'] = 'V<>rification du login root de MySQL ...';
$lng['install']['erasing_old_db'] = 'Effacement de l\'ancienne base de donn<6E>es ...';
$lng['install']['create_mysqluser_and_db'] = 'Cr<43>ation de la base de donn<6E>es puis des utilisateurs ...';
$lng['install']['testing_new_db'] = 'V<>rification de la base de donn<6E>es et des utilisateurs ...';
$lng['install']['importing_data'] = 'Importation des informations dans la base de donn<6E>es ...';
$lng['install']['changing_data'] = 'Modification des donn<6E>es import<72>s ...';
$lng['install']['adding_admin_user'] = 'Ajout de l\'utilisateur administrateur ...';
$lng['install']['creating_configfile'] = 'Cr<43>ation du fichier de configuration ...';
$lng['install']['creating_configfile_succ'] = 'OK, userdata.inc.php a <20>t<EFBFBD> sauvegard<72> dans le dossier lib/ de Froxlor.';
$lng['install']['creating_configfile_temp'] = 'Le fichier a <20>t<EFBFBD> sauvegard<72> dans /tmp/userdata.inc.php, veuillez le d<>placer / copier dans le dossier lib/ de Froxlor.';
$lng['install']['creating_configfile_failed'] = 'Erreur en cr<63>ant le fichier lib/userdata.inc.php, veuillez le cr<63>er avec le contenu ci-dessous :';
$lng['install']['froxlor_succ_installed'] = 'Froxlor a <20>t<EFBFBD> install<6C> correctement.';
$lng['install']['click_here_to_login'] = 'Cliquez ici pour vous rendre <20> l\'invite de connexion.';
$lng['install']['httpuser'] = 'Nom du utilisateur du HTTP';
$lng['install']['httpgroup'] = 'Nom du la group du HTTP';
/**
* Renamed in 1.2.19-svn40
*/
$lng['install']['webserver'] = 'Version du serveur';
?>

View File

@@ -2,83 +2,93 @@
/** /**
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors). * Copyright (c) 2003-2007 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors).
* *
* For the full copyright and license information, please view the COPYING * For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the * file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt * COPYING file online at http://files.syscp.org/misc/COPYING.txt
* *
* @copyright (c) the authors * @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org> (2003-2009) * @author Florian Lippert <flo@syscp.org> (2003-2007)
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor Team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Language * @package Language
* * @version $Id$
*/ */
$lng['requirements']['title'] = 'Prüfe Systemvoraussetzungen...'; /**
$lng['requirements']['installed'] = 'installiert'; * Begin
$lng['requirements']['not_true'] = 'nein'; */
$lng['requirements']['notfound'] = 'nicht gefunden';
$lng['requirements']['notinstalled'] = 'nicht installiert';
$lng['requirements']['activated'] = 'ist aktiviert.';
$lng['requirements']['phpversion'] = 'PHP Version >= 5.2';
$lng['requirements']['phpmagic_quotes_runtime'] = 'magic_quotes_runtime';
$lng['requirements']['phpmagic_quotes_runtime_description'] = 'Die PHP Einstellung "magic_quotes_runtime" muss deaktiviert sein ("Off"). Die Einstellung wurde temporär deaktiviert, bitte ändern Sie diese in der entsprechenden php.ini.';
$lng['requirements']['phpmysql'] = 'PHP MySQL-Erweiterung...';
$lng['requirements']['phpxml'] = 'PHP XML-Erweiterung...';
$lng['requirements']['phpfilter'] = 'PHP filter-Erweiterung...';
$lng['requirements']['phpposix'] = 'PHP posix-Erweiterung...';
$lng['requirements']['phpbcmath'] = 'PHP bcmath-Erweiterung...';
$lng['requirements']['bcmathdescription'] = 'Traffic-Berechnungs bezogene Funktionen stehen nicht vollständig zur Verfügung!';
$lng['requirements']['openbasedir'] = 'open_basedir genutzt wird...';
$lng['requirements']['openbasedirenabled'] = 'Froxlor wird mit aktiviertem open_basedir nicht vollständig funktionieren. Bitte deaktivieren Sie open_basedir für Froxlor in der entsprechenden php.ini';
$lng['requirements']['diedbecauseofrequirements'] = 'Kann Froxlor ohne diese Voraussetzungen nicht installieren! Versuchen Sie die angezeigten Problem zu beheben und versuchen Sie es erneut.';
$lng['requirements']['froxlor_succ_checks'] = 'Alle Vorraussetzungen sind erfüllt';
$lng['install']['lngtitle'] = 'Froxlor Installation - Sprache auswählen'; $lng['install']['language'] = 'Installations - Sprache';
$lng['install']['language'] = 'Sprache für die Installation'; $lng['install']['welcome'] = 'Willkommen zur Froxlor Installation';
$lng['install']['lngbtn_go'] = 'Sprache ändern'; $lng['install']['welcometext'] = 'Vielen Dank dass Sie sich f&uuml;r Froxlor entschieden haben. Um Ihre Installation von Froxlor zu starten, f&uuml;llen Sie bitte alle Felder unten mit den geforderten Angaben.<br /><b>Achtung:</b> Eine eventuell bereits existierende Datenbank, die den selben Namen hat wie den, den Sie unten eingeben werden, wird mit allen enthaltenen Daten gel&ouml;scht!';
$lng['install']['title'] = 'Froxlor Installation - Einrichtung'; $lng['install']['database'] = 'Datenbank';
$lng['install']['welcometext'] = 'Vielen Dank dass Sie sich für Froxlor entschieden haben. Um die Installation von Froxlor zu starten, füllen Sie bitte alle Felder mit den geforderten Angaben aus.<br /><b>Achtung:</b> Eine eventuell existierende Datenbank, die den selben Namen hat wie den Gewählten, wird mit allen enthaltenen Daten gelöscht!'; $lng['install']['mysql_hostname'] = 'MySQL-Hostname';
$lng['install']['database'] = 'Datenbankverbindung'; $lng['install']['mysql_database'] = 'MySQL-Datenbank';
$lng['install']['mysql_host'] = 'MySQL-Hostname'; $lng['install']['mysql_unpriv_user'] = 'Benutzername f&uuml;r den unprivilegierten MySQL-Account';
$lng['install']['mysql_database'] = 'Datenbank Name'; $lng['install']['mysql_unpriv_pass'] = 'Passwort f&uuml;r den unprivilegierten MySQL-Account';
$lng['install']['mysql_unpriv_user'] = 'Benutzername für den unprivilegierten MySQL-Account'; $lng['install']['mysql_root_user'] = 'Benutzername f&uuml;r den MySQL-Root-Account';
$lng['install']['mysql_unpriv_pass'] = 'Passwort für den unprivilegierten MySQL-Account'; $lng['install']['mysql_root_pass'] = 'Passwort f&uuml;r den MySQL-Root-Account';
$lng['install']['mysql_root_user'] = 'Benutzername für den MySQL-Root-Account';
$lng['install']['mysql_root_pass'] = 'Passwort für den MySQL-Root-Account';
$lng['install']['admin_account'] = 'Admin-Zugang'; $lng['install']['admin_account'] = 'Admin-Zugang';
$lng['install']['admin_user'] = 'Administrator-Benutzername'; $lng['install']['admin_user'] = 'Administrator-Benutzername';
$lng['install']['admin_pass1'] = 'Administrator-Passwort'; $lng['install']['admin_pass'] = 'Administrator-Passwort';
$lng['install']['admin_pass2'] = 'Administrator-Passwort (Bestätigung)'; $lng['install']['admin_pass_confirm'] = 'Administrator-Passwort (Best&auml;tigung)';
$lng['install']['serversettings'] = 'Servereinstellungen'; $lng['install']['serversettings'] = 'Servereinstellungen';
$lng['install']['servername'] = 'Servername (FQDN, keine IP-Adresse)'; $lng['install']['servername'] = 'Servername (FQDN)';
$lng['install']['serverip'] = 'Server-IP'; $lng['install']['serverip'] = 'Server-IP';
$lng['install']['webserver'] = 'Webserver'; $lng['install']['apacheversion'] = 'Apacheversion';
$lng['install']['apache2'] = 'Apache 2'; $lng['install']['next'] = 'Fortfahren';
$lng['install']['lighttpd'] = 'LigHTTPd';
$lng['install']['nginx'] = 'NGINX';
$lng['install']['httpuser'] = 'HTTP Username';
$lng['install']['httpgroup'] = 'HTTP Gruppenname';
$lng['install']['testing_mysql'] = 'Teste MySQL-Root Zugang...'; /**
$lng['install']['backup_old_db'] = 'Sicherung vorheriger Datenbank...'; * Progress
$lng['install']['backup_binary_missing'] = 'Konnte mysqldump nicht finden'; */
$lng['install']['backup_failed'] = 'Sicherung fehlgeschlagen';
$lng['install']['prepare_db'] = 'Datenbank wird vorbereitet...'; $lng['install']['testing_mysql'] = 'Teste, ob die MySQL-Root-Benutzerdaten richtig sind...';
$lng['install']['erasing_old_db'] = 'Entferne alte Datenbank...';
$lng['install']['backup_old_db'] = 'Sichere bisherige Datenbank...';
$lng['install']['backing_up'] = 'Sicherung l&auml;ft';
$lng['install']['backing_up_binary_missing'] = '/usr/bin/mysqldump nicht vorhanden';
$lng['install']['create_mysqluser_and_db'] = 'Erstelle Datenbank und Benutzer...'; $lng['install']['create_mysqluser_and_db'] = 'Erstelle Datenbank und Benutzer...';
$lng['install']['testing_new_db'] = 'Teste, ob Datenbank und Benutzer korrekt angelegt wurden...'; $lng['install']['testing_new_db'] = 'Teste, ob die Datenbank und Passwort korrekt angelegt wurden...';
$lng['install']['importing_data'] = 'Importiere Daten...'; $lng['install']['importing_data'] = 'Importiere Daten in die MySQL-Datenbank...';
$lng['install']['changing_data'] = 'Einstellungen anpassen...'; $lng['install']['changing_data'] = 'Passe die importierten Daten an...';
$lng['install']['creating_entries'] = 'Trage neue Werte ein...'; $lng['install']['adding_admin_user'] = 'F&uuml;ge den Admin-Benutzer hinzu...';
$lng['install']['adding_admin_user'] = 'Erstelle Admin-Benutzer...';
$lng['install']['creating_configfile'] = 'Erstelle Konfigurationsdatei...'; $lng['install']['creating_configfile'] = 'Erstelle Konfigurationsdatei...';
$lng['install']['creating_configfile_succ'] = 'OK, userdata.inc.php wurde in lib/ gespeichert.';
$lng['install']['creating_configfile_temp'] = 'Datei wurde in /tmp/userdata.inc.php gespeichert, bitte nach lib/ verschieben.'; $lng['install']['creating_configfile_temp'] = 'Datei wurde in /tmp/userdata.inc.php gespeichert, bitte nach lib/ verschieben.';
$lng['install']['creating_configfile_failed'] = 'Konnte lib/userdata.inc.php nicht erstellen, bitte manuell mit folgendem Inhalt anlegen:'; $lng['install']['creating_configfile_failed'] = 'Konnte lib/userdata.inc.php nicht erstellen, bitte manuell mit folgendem Inhalt anlegen:';
$lng['install']['froxlor_succ_installed'] = 'Froxlor wurde erfolgreich installiert.'; $lng['install']['froxlor_succ_installed'] = 'Froxlor wurde erfolgreich installiert.';
$lng['install']['click_here_to_login'] = 'Hier geht es weiter zum Login-Fenster.';
$lng['install']['phpmysql'] = 'Teste, ob die PHP MySQL-Erweiterung installiert ist...';
$lng['install']['phpfilter'] = 'Teste, ob die PHP Filter-Erweiterung installiert ist...';
$lng['install']['diedbecauseofrequirements'] = 'Kann Froxlor ohne diese Voraussetzungen nicht installieren! Breche ab...';
$lng['install']['notinstalled'] = 'nicht installiert!';
$lng['install']['phpbcmath'] = 'Teste, ob die PHP bcmath-Erweiterung installiert ist...';
$lng['install']['bcmathdescription'] = 'Traffic-Berechnungs bezogene Funktionen stehen nicht vollst&auml;ndig zur Verf&uuml;gung!';
$lng['install']['openbasedir'] = 'Teste, ob open_basedir genutzt wird...';
$lng['install']['openbasedirenabled'] = 'aktiviert. Froxlor wird mit aktiviertem open_basedir nicht vollst&auml;ndig funktionieren. Bitte deaktivieren Sie open_basedir f&uuml;r Froxlor';
$lng['install']['httpuser'] = 'HTTP Username';
$lng['install']['httpgroup'] = 'HTTP Gruppenname';
$lng['click_here_to_refresh'] = 'Hier klicken, um erneut zu prüfen'; /**
$lng['click_here_to_continue'] = 'Installation fortführen'; * Renamed in 1.2.19-svn40
$lng['click_here_to_login'] = 'Hier geht es weiter zum Login-Fenster.'; */
$lng['install']['webserver'] = 'Webserver';
/*
* Added in Froxlor 0.9
*/
$lng['install']['phpversion'] = 'Pr&uuml;fe PHP Version >= 5.2';
$lng['install']['phpposix'] = 'Teste, ob die PHP Posix-Erweiterung installiert ist...';
/*
* Added in Froxlor 0.9.4
*/
$lng['install']['click_here_to_refresh'] = 'Erneut pr&uuml;fen';
$lng['install']['click_here_to_continue'] = 'Installation fortf&uuml;hren';
$lng['install']['froxlor_succ_checks'] = 'Alle Vorraussetzungen sind erf&uuml;llt';
?>

View File

@@ -12,7 +12,7 @@
* @author Michael Duergner <michael@duergner.com> * @author Michael Duergner <michael@duergner.com>
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt * @license GPLv2 http://files.syscp.org/misc/COPYING.txt
* @package System * @package System
* * @version $Id$
*/ */
if(@php_sapi_name() != 'cli' if(@php_sapi_name() != 'cli'

View File

@@ -12,7 +12,7 @@
* @author Martin Burchert <eremit@syscp.org> * @author Martin Burchert <eremit@syscp.org>
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt * @license GPLv2 http://files.syscp.org/misc/COPYING.txt
* @package System * @package System
* * @version $Id$
*/ */
// some configs // some configs

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

View File

@@ -1,10 +0,0 @@
<p style="margin: 20px 20px 0 !important">{$this->_lng['install']['title']}</p>
<form action="{$formaction}" method="get">
<fieldset>
{$formdata}
<p class="submit">
<input type="hidden" name="check" value="1" />
<input type="submit" name="chooselang" value="{$this->_lng['install']['btn_go']}" />
</p>
</fieldset>
</form>

View File

@@ -1,13 +0,0 @@
<p style="margin: 20px 20px 0 !important">{$this->_lng['install']['welcometext']}</p>
<form action="{$formaction}" method="post">
<hr class="line">
<fieldset>
{$formdata}
</fieldset>
<aside>
<input type="hidden" name="check" value="1" />
<input type="hidden" name="language" value="{$language}" />
<input type="hidden" name="installstep" value="1" />
<input class="bottom" type="submit" name="submitbutton" value="{$this->_lng['click_here_to_continue']}" />
</aside>
</form>

View File

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

View File

@@ -1,4 +0,0 @@
<p>
<label for="{$fieldname}" style="width:65%;{$style}">{$this->_lng['install']['webserver']} {$fieldlabel}:</label>
<input type="radio" name="webserver" id="{$fieldname}" value="{$fieldname}" {$checked} /><span>{$fieldlabel}<span>
</p>

View File

@@ -1,2 +0,0 @@
<br />
<h3>{$section}</h3>

View File

@@ -1,7 +0,0 @@
</div>
<footer>
<span> Froxlor &copy; 2009-{$current_year} by <a href="http://www.froxlor.org/" rel="external">the Froxlor Team</a>
</span>
</footer>
</body>
</html>

View File

@@ -1,18 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="Default-Style" content="text/css" />
<!--[if lt IE 9]><script src="../js/html5shiv.js"></script><![endif]-->
<link href="templates/assets/css/install.css" rel="stylesheet" type="text/css" />
<!--[if IE]><link rel="stylesheet" href="../templates/{$theme}/css/main_ie.css" type="text/css" /><![endif]-->
<link href="templates/assets/img/favicon.ico" rel="icon" type="image/x-icon" />
<title>Froxlor Server Management Panel - Installation</title>
<style type="text/css">
body {
font-family: Verdana, Geneva, sans-serif;
}
</style>
</head>
<body>
<div class="installsec">

View File

@@ -1,20 +0,0 @@
<form action="{$formaction}" method="get">
<fieldset>
<legend>{$this->_lng['install']['lngtitle']}</legend>
<table class="noborder">
<tr>
<td>
<label for="language">{$this->_lng['install']['language']}:</label>
</td>
<td align="right">
<select name="language" id="language" class="dropdown">
{$language_options}
</select>
<input type="hidden" name="check" value="1" />
<input type="submit" name="chooselang" value="{$this->_lng['install']['lngbtn_go']}" />
</td>
</tr>
</table>
</fieldset>
</form>
<hr class="line">

View File

@@ -1,11 +0,0 @@
<article class="install bradius">
<header class="dark">
<img src="../templates/{$theme}/assets/img/logo.png" alt="Froxlor Server Management Panel" />
</header>
<section class="installsec">
<h2>{$pagetitle}</h2>
{$pagecontent}
{$pagenavigation}
</section>
</article>

View File

@@ -1,4 +0,0 @@
<h3 style="color:{$msgcolor};text-align: center">{$message}</h3>
<aside>
<a href="{$link}">{$linktext}</a>
</aside>

View File

@@ -1,5 +0,0 @@
<tr>
<td class="main_field_name">
<p>{$escpduserdata}</p>
</td>
</tr>

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