Compare commits

..

1 Commits

Author SHA1 Message Date
Florian Aders (EleRas)
91e42015b5 Tagging 0.9.13.1 2010-10-01 06:30:16 +00:00
1374 changed files with 43291 additions and 90331 deletions

9
.gitignore vendored
View File

@@ -1,9 +0,0 @@
lib/classes/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer/*/
templates/*
logs/*
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

@@ -1,60 +0,0 @@
# Froxlor
The server administration software for your needs.
Developed by experienced server administrators, this panel simplifies the effort of managing your hosting platform.
## Installation
### Fast install
1. Ensure that your webserver serves /var/www
2. Extract froxlor into /var/www
3. Point your browser to http://[ip-of-webserver]/froxlor
4. Follow the installer
5. Login as administrator
6. Adjust "Server > Settings" according to your needs
7. Choose your distribution under "Server > Configuration"
8. Follow the steps for your services
9. Have fun!
### Detailed installation
http://redmine.froxlor.org/projects/froxlor/wiki/Installationtarball
## Help
You may find help in the following places:
### IRC
froxlor may be found on freenode.net, channel #froxlor:
irc://chat.freenode.net/froxlor
### Forum
The community is located on http://forum.froxlor.org
### Wiki
More documentation may be found in the froxlor - wiki:
http://redmine.froxlor.org/projects/froxlor/wiki
## License
May be found in COPYING
## Downloads
### Tarball
http://files.froxlor.org/releases/froxlor-latest.tar.gz [MD5](http://files.froxlor.org/releases/froxlor-latest.tar.gz.md5) [SHA1](http://files.froxlor.org/releases/froxlor-latest.tar.gz.sha1)
### Debian repository
[HowTo](http://redmine.froxlor.org/projects/froxlor/wiki/Installationdebian)
/etc/apt/sources.list.d/froxlor.list
> deb http://debian.froxlor.org [squeeze|wheezy] main
### Gentoo repository
[HowTo](http://redmine.froxlor.org/projects/froxlor/wiki/Installationgentoo)
http://files.froxlor.org/gentoo/repositories.xml

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,12 +151,12 @@ return array(
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'admin_show_news_feed' => array( 'admin_froxlor_graphic' => array(
'label' => $lng['admin']['show_news_feed'], 'label' => $lng['admin']['froxlor_graphic'],
'settinggroup' => 'admin', 'settinggroup' => 'admin',
'varname' => 'show_news_feed', 'varname' => 'froxlor_graphic',
'type' => 'bool', 'type' => 'string',
'default' => true, 'default' => '',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'panel_allow_domain_change_admin' => array( 'panel_allow_domain_change_admin' => array(
@@ -218,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',

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,7 +57,6 @@ return array(
'type' => 'string', 'type' => 'string',
'default' => '', 'default' => '',
'save_method' => 'storeSettingHostname', 'save_method' => 'storeSettingHostname',
'plausibility_check_method' => 'checkHostname',
), ),
'system_froxlordirectlyviahostname' => array( 'system_froxlordirectlyviahostname' => array(
'label' => $lng['serversettings']['froxlordirectlyviahostname'], 'label' => $lng['serversettings']['froxlordirectlyviahostname'],
@@ -77,14 +66,6 @@ return array(
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', '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'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -102,6 +83,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',
@@ -119,48 +109,17 @@ return array(
'default' => true, 'default' => true,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_httpuser' => array( 'system_debug_cron' => array(
'label' => $lng['serversettings']['cron']['debug'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'httpuser', 'varname' => 'debug_cron',
'type' => 'hidden',
'default' => 'www-data',
),
'system_httpgroup' => array(
'settinggroup' => 'system',
'varname' => 'httpgroup',
'type' => 'hidden',
'default' => 'www-data',
),
'system_report_enable' => array(
'label' => $lng['serversettings']['report']['report'],
'settinggroup' => 'system',
'varname' => 'report_enable',
'type' => 'bool', 'type' => 'bool',
'default' => true, 'default' => false,
'cronmodule' => 'froxlor/reports',
'save_method' => 'storeSettingField', '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',
),
), ),
), ),
), ),
); );
?>

View File

@@ -1,51 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2014 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings
*
*/
return array(
'groups' => array(
'crond' => array(
'title' => $lng['admin']['cronsettings'],
'fields' => array(
'system_cronconfig' => array(
'label' => $lng['serversettings']['system_cronconfig'],
'settinggroup' => 'system',
'varname' => 'cronconfig',
'type' => 'string',
'string_type' => 'file',
'default' => '/etc/cron.d/froxlor',
'save_method' => 'storeSettingField',
),
'system_crondreload' => array(
'label' => $lng['serversettings']['system_crondreload'],
'settinggroup' => 'system',
'varname' => 'crondreload',
'type' => 'string',
'default' => '/etc/init.d/cron reload',
'save_method' => 'storeSettingField',
),
'system_debug_cron' => array(
'label' => $lng['serversettings']['cron']['debug'],
'settinggroup' => 'system',
'varname' => 'debug_cron',
'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(
@@ -27,22 +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',
'plausibility_check_method' => 'checkPhpInterfaceSetting',
'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( 'system_httpuser' => array(
'label' => $lng['admin']['webserver_user'], 'label' => $lng['admin']['webserver_user'],
'settinggroup' => 'system', 'settinggroup' => 'system',
@@ -82,10 +72,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',
@@ -95,15 +101,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',
@@ -131,42 +128,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',
@@ -182,7 +143,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'],
@@ -191,7 +151,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'],
@@ -208,7 +167,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'],
@@ -217,7 +175,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'],
@@ -228,9 +185,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

@@ -12,14 +12,13 @@
* @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(
'groups' => array( 'groups' => array(
'fcgid' => array( 'fcgid' => array(
'title' => $lng['admin']['fcgid_settings'], 'title' => $lng['admin']['fcgid_settings'],
'websrv_avail' => array('apache2', 'lighttpd'),
'fields' => array( 'fields' => array(
'system_mod_fcgid_enabled' => array( 'system_mod_fcgid_enabled' => array(
'label' => $lng['serversettings']['mod_fcgid'], 'label' => $lng['serversettings']['mod_fcgid'],
@@ -28,17 +27,15 @@ return array(
'type' => 'bool', 'type' => 'bool',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'plausibility_check_method' => 'checkFcgidPhpFpm',
'overview_option' => true 'overview_option' => true
), ),
'system_mod_fcgid_configdir' => array( 'system_mod_fcgid_configdir' => array(
'label' => $lng['serversettings']['mod_fcgid']['configdir'], 'label' => $lng['serversettings']['mod_fcgid']['configdir'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mod_fcgid_configdir', 'varname' => 'mod_fcgid_configdir',
'type' => 'string', 'type' => 'string',
'string_type' => 'confdir', 'string_type' => 'dir',
'default' => '/var/www/php-fcgi-scripts/', 'default' => '/var/www/php-fcgi-scripts/',
'plausibility_check_method' => 'checkPathConflicts',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_mod_fcgid_tmpdir' => array( 'system_mod_fcgid_tmpdir' => array(
@@ -66,10 +63,9 @@ return array(
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mod_fcgid_wrapper', 'varname' => 'mod_fcgid_wrapper',
'type' => 'option', 'type' => 'option',
'option_options' => array(0 => 'ScriptAlias', 1=> 'FcgidWrapper'), 'option_options' => array(0 => 'ScriptAlias', 1=> 'FCGIWrapper'),
'default' => 1, 'default' => 1,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
), ),
'system_mod_fcgid_starter' => array( 'system_mod_fcgid_starter' => array(
'label' => $lng['serversettings']['mod_fcgid']['starter'], 'label' => $lng['serversettings']['mod_fcgid']['starter'],
@@ -104,7 +100,6 @@ return array(
'type' => 'bool', 'type' => 'bool',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
), ),
'system_mod_fcgid_httpuser' => array( 'system_mod_fcgid_httpuser' => array(
'label' => $lng['admin']['mod_fcgid_user'], 'label' => $lng['admin']['mod_fcgid_user'],
@@ -113,7 +108,6 @@ return array(
'type' => 'string', 'type' => 'string',
'default' => 'froxlorlocal', 'default' => 'froxlorlocal',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
), ),
'system_mod_fcgid_httpgroup' => array( 'system_mod_fcgid_httpgroup' => array(
'label' => $lng['admin']['mod_fcgid_group'], 'label' => $lng['admin']['mod_fcgid_group'],
@@ -122,26 +116,16 @@ return array(
'type' => 'string', 'type' => 'string',
'default' => 'froxlorlocal', 'default' => 'froxlorlocal',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
), ),
'system_mod_fcgid_defaultini_ownvhost' => array( 'system_mod_fcgid_defaultini_ownvhost' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'], 'label' => $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'],
'settinggroup' => 'system', 'settinggroup' => 'system',
'varname' => 'mod_fcgid_defaultini_ownvhost', 'varname' => 'mod_fcgid_defaultini_ownvhost',
'type' => 'option', 'type' => 'option',
'default' => '2', 'default' => '1',
'option_mode' => 'one', 'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs', 'option_options_method' => 'getPhpConfigs',
'save_method' => 'storeSettingField', '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,193 +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' => '2',
'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs',
'save_method' => 'storeSettingField'
),
'system_phpfpm_configdir' => array(
'label' => $lng['serversettings']['phpfpm_settings']['configdir'],
'settinggroup' => 'phpfpm',
'varname' => 'configdir',
'type' => 'string',
'string_type' => 'confdir',
'default' => '/etc/php-fpm.d/',
'save_method' => 'storeSettingField'
),
'system_phpfpm_aliasconfigdir' => array(
'label' => $lng['serversettings']['phpfpm_settings']['aliasconfigdir'],
'settinggroup' => 'phpfpm',
'varname' => 'aliasconfigdir',
'type' => 'string',
'string_type' => 'confdir',
'default' => '/var/www/php-fpm/',
'save_method' => 'storeSettingField'
),
'system_phpfpm_tmpdir' => array(
'label' => $lng['serversettings']['mod_fcgid']['tmpdir'],
'settinggroup' => 'phpfpm',
'varname' => 'tmpdir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/customers/tmp/',
'save_method' => 'storeSettingField'
),
'system_phpfpm_peardir' => array(
'label' => $lng['serversettings']['mod_fcgid']['peardir'],
'settinggroup' => 'phpfpm',
'varname' => 'peardir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/usr/share/php/:/usr/share/php5/',
'save_method' => 'storeSettingField'
),
'system_phpfpm_fastcgi_ipcdir' => array(
'label' => $lng['serversettings']['phpfpm_settings']['ipcdir'],
'settinggroup' => 'phpfpm',
'varname' => 'fastcgi_ipcdir',
'type' => 'string',
'string_type' => 'dir',
'default' => '/var/lib/apache2/fastcgi/',
'save_method' => 'storeSettingField'
),
'system_phpfpm_reload' => array(
'label' => $lng['serversettings']['phpfpm_settings']['reload'],
'settinggroup' => 'phpfpm',
'varname' => 'reload',
'type' => 'string',
'default' => '/etc/init.d/php-fpm restart',
'save_method' => 'storeSettingField'
),
'system_phpfpm_pm' => array(
'label' => $lng['serversettings']['phpfpm_settings']['pm'],
'settinggroup' => 'phpfpm',
'varname' => 'pm',
'type' => 'option',
'default' => 'static',
'option_mode' => 'one',
'option_options' => array('static' => 'static', 'dynamic' => 'dynamic', 'ondemand' => 'ondemand'),
'save_method' => 'storeSettingField'
),
'system_phpfpm_max_children' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_children'],
'settinggroup' => 'phpfpm',
'varname' => 'max_children',
'type' => 'int',
'default' => 1,
'save_method' => 'storeSettingField'
),
'system_phpfpm_start_servers' => array(
'label' => $lng['serversettings']['phpfpm_settings']['start_servers'],
'settinggroup' => 'phpfpm',
'varname' => 'start_servers',
'type' => 'int',
'default' => 20,
'save_method' => 'storeSettingField'
),
'system_phpfpm_min_spare_servers' => array(
'label' => $lng['serversettings']['phpfpm_settings']['min_spare_servers'],
'settinggroup' => 'phpfpm',
'varname' => 'min_spare_servers',
'type' => 'int',
'default' => 5,
'save_method' => 'storeSettingField'
),
'system_phpfpm_max_spare_servers' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_spare_servers'],
'settinggroup' => 'phpfpm',
'varname' => 'max_spare_servers',
'type' => 'int',
'default' => 35,
'save_method' => 'storeSettingField'
),
'system_phpfpm_max_requests' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_requests'],
'settinggroup' => 'phpfpm',
'varname' => 'max_requests',
'type' => 'int',
'default' => 0,
'save_method' => 'storeSettingField'
),
'system_phpfpm_idle_timeout' => array(
'label' => $lng['serversettings']['phpfpm_settings']['idle_timeout'],
'settinggroup' => 'phpfpm',
'varname' => 'idle_timeout',
'type' => 'int',
'default' => 30,
'save_method' => 'storeSettingField'
),
),
),
),
);
?>

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(
@@ -27,7 +27,6 @@ return array(
'type' => 'string', 'type' => 'string',
'default' => '/usr/bin/perl', 'default' => '/usr/bin/perl',
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('lighttpd')
), ),
'system_perl_suexecworkaround' => array( 'system_perl_suexecworkaround' => array(
'label' => $lng['serversettings']['perl']['suexecworkaround'], 'label' => $lng['serversettings']['perl']['suexecworkaround'],
@@ -36,26 +35,14 @@ return array(
'type' => 'bool', 'type' => 'bool',
'default' => false, 'default' => false,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
'websrv_avail' => array('apache2')
), ),
'system_perl_suexeccgipath' => array( 'system_perl_suexeccgipath' => array(
'label' => $lng['serversettings']['perl']['suexeccgipath'], 'label' => $lng['serversettings']['perl']['suexeccgipath'],
'settinggroup' => 'perl', 'settinggroup' => 'perl',
'varname' => 'suexecpath', 'varname' => 'suexecpath',
'type' => 'string', 'type' => 'string',
'string_type' => 'dir',
'default' => '/var/www/cgi-bin/', 'default' => '/var/www/cgi-bin/',
'save_method' => 'storeSettingField', '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(
@@ -66,15 +66,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',
@@ -85,65 +75,24 @@ return array(
'default' => 100, 'default' => 100,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_catchall_enabled' => array( 'system_autoresponder_enabled' => array(
'label' => $lng['serversettings']['catchall_enabled'], 'label' => $lng['serversettings']['autoresponder_active'],
'settinggroup' => 'catchall', 'settinggroup' => 'autoresponder',
'varname' => 'catchall_enabled', 'varname' => 'autoresponder_active',
'type' => 'bool', 'type' => 'bool',
'default' => true, 'default' => false,
'save_method' => 'storeSettingResetCatchall', 'cronmodule' => 'froxlor/autoresponder',
),
'system_mailtraffic_enabled' => array(
'label' => $lng['serversettings']['mailtraffic_enabled'],
'settinggroup' => 'system',
'varname' => 'mailtraffic_enabled',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_mdaserver' => array( 'system_last_autoresponder_run' => array(
'label' => $lng['serversettings']['mdaserver'], 'settinggroup' => 'autoresponder',
'settinggroup' => 'system', 'varname' => 'last_autoresponder_run',
'varname' => 'mdaserver', 'type' => 'hidden',
'type' => 'option', 'default' => 0,
'option_mode' => 'one',
'default' => 'dovecot',
'option_options' => array('courier' => 'Courier', 'dovecot' => 'Dovecot'),
'save_method' => 'storeSettingField',
),
'system_mdalog' => array(
'label' => $lng['serversettings']['mdalog'],
'settinggroup' => 'system',
'varname' => 'mdalog',
'type' => 'string',
'string_type' => 'file',
'default' => '/var/log/mail.log',
'string_emptyallowed' => true,
'save_method' => 'storeSettingField',
),
'system_mtaserver' => array(
'label' => $lng['serversettings']['mtaserver'],
'settinggroup' => 'system',
'varname' => 'mtaserver',
'type' => 'option',
'option_mode' => 'one',
'default' => 'postfix',
'option_options' => array('exim4' => 'Exim4', 'postfix' => 'Postfix'),
'save_method' => 'storeSettingField',
),
'system_mtalog' => array(
'label' => $lng['serversettings']['mtalog'],
'settinggroup' => 'system',
'varname' => 'mtalog',
'type' => 'string',
'string_type' => 'file',
'default' => '/var/log/mail.log',
'string_emptyallowed' => true,
'save_method' => 'storeSettingField',
), ),
), ),
), ),
), ),
); );
?> ?>

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,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(
@@ -36,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',
), ),
@@ -79,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::Get('dkim.dkim_prefix'))
),
'settinggroup' => 'dkim', 'settinggroup' => 'dkim',
'varname' => 'dkim_keylength', 'varname' => 'dkim_keylength',
'type' => 'option', 'type' => 'option',
@@ -131,4 +127,4 @@ return array(
), ),
); );
?> ?>

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',
), ),
), ),
@@ -141,4 +140,4 @@ return array(
) )
); );
?> ?>

View File

@@ -0,0 +1,102 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Settings
* @version $Id$
*/
return array(
'groups' => array(
'aps' => array(
'title' => $lng['admin']['aps'],
'fields' => array(
'aps_enable' => array(
'label' => $lng['aps']['activate_aps'],
'settinggroup' => 'aps',
'varname' => 'aps_active',
'type' => 'bool',
'default' => false,
'cronmodule' => 'froxlor/aps',
'save_method' => 'storeSettingField',
'overview_option' => true
),
'aps_items_per_page' => array(
'label' => $lng['aps']['packages_per_page'],
'settinggroup' => 'aps',
'varname' => 'items_per_page',
'type' => 'int',
'default' => 20,
'save_method' => 'storeSettingField',
),
'aps_upload_fields' => array(
'label' => $lng['aps']['upload_fields'],
'settinggroup' => 'aps',
'varname' => 'upload_fields',
'type' => 'int',
'default' => 5,
'save_method' => 'storeSettingField',
),
'aps_exceptions' => array(
'label' => $lng['aps']['exceptions'],
'type' => 'label',
),
'aps_php-extension' => array(
'label' => $lng['aps']['settings_php_extensions'],
'settinggroup' => 'aps',
'varname' => 'php-extension',
'type' => 'option',
'default' => '',
'option_mode' => 'multiple',
'option_options' => array('gd' => 'GD Library', 'pcre' => 'PCRE', 'ioncube' => 'ionCube', 'ioncube loader' => 'ionCube Loader', 'curl' => 'curl', 'mcrypt' => 'mcrypt', 'imap' => 'imap', 'json' => 'json', 'ldap' => 'LDAP', 'hash' => 'hash', 'mbstring' => 'mbstring'),
'save_method' => 'storeSettingApsPhpExtensions',
),
'aps_php-function' => array(
'settinggroup' => 'aps',
'varname' => 'php-function',
'type' => 'hidden',
'default' => '',
),
'aps_php-configuration' => array(
'label' => $lng['aps']['settings_php_configuration'],
'settinggroup' => 'aps',
'varname' => 'php-configuration',
'type' => 'option',
'default' => '',
'option_mode' => 'multiple',
'option_options' => array('short_open_tag' => 'short_open_tag', 'file_uploads' => 'file_uploads', 'magic_quotes_gpc' => 'magic_quotes_gpc', 'register_globals' => 'register_globals', 'allow_url_fopen' => 'allow_url_fopen', 'safe_mode' => 'safe_mode', 'post_max_size' => 'post_max_size', 'memory_limit' => 'memory_limit', 'max_execution_time' => 'max_execution_time'),
'save_method' => 'storeSettingField',
),
'aps_webserver-module' => array(
'label' => $lng['aps']['settings_webserver_modules'],
'settinggroup' => 'aps',
'varname' => 'webserver-module',
'type' => 'option',
'default' => '',
'option_mode' => 'multiple',
'option_options' => array('mod_perl' => 'mod_perl', 'mod_rewrite' => 'mod_rewrite', 'mod_access' => 'mod_access', 'fcgid-any' => 'FastCGI/mod_fcgid', 'htaccess' => '.htaccess'),
'save_method' => 'storeSettingApsWebserverModules',
),
'aps_webserver-htaccess' => array(
'settinggroup' => 'aps',
'varname' => 'webserver-htaccess',
'type' => 'hidden',
'default' => '',
),
),
),
),
);
?>

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,33 +38,9 @@ return array(
'default' => true, 'default' => true,
'save_method' => 'storeSettingField', 'save_method' => 'storeSettingField',
), ),
'system_passwordcryptfunc' => array( ),
'label' => $lng['serversettings']['passwordcryptfunc'], ),
'settinggroup' => 'system', ),
'varname' => 'passwordcryptfunc',
'type' => 'option',
'default' => 0,
'option_mode' => 'one',
'option_options' => array(0 => $lng['serversettings']['systemdefault'], 1 => 'MD5', 2 => 'BLOWFISH', 3 => 'SHA-256', 4 => 'SHA-512'),
'save_method' => 'storeSettingField',
),
'system_allow_error_report_admin' => array(
'label' => $lng['serversettings']['allow_error_report_admin'],
'settinggroup' => 'system',
'varname' => 'allow_error_report_admin',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'system_allow_error_report_customer' => array(
'label' => $lng['serversettings']['allow_error_report_customer'],
'settinggroup' => 'system',
'varname' => 'allow_error_report_customer',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
)
)
)
)
); );
?>

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',
),
),
),
),
);
?>

File diff suppressed because it is too large Load Diff

34
admin_aps.php Normal file
View File

@@ -0,0 +1,34 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
* @version $Id$
*/
// Required code
define('AREA', 'admin');
require ("./lib/init.php");
$Id = 0;
if(isset($_GET['id']))$Id = (int)$_GET['id'];
if(isset($_POST['id']))$Id = (int)$_POST['id'];
eval("echo \"" . getTemplate("aps/header") . "\";");
$Aps = new ApsParser($userinfo, $settings, $db);
$Aps->MainHandler($action);
eval("echo \"" . getTemplate("aps/footer") . "\";");
?>

View File

@@ -14,14 +14,18 @@
* @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');
$need_db_sql_data = true;
require './lib/init.php';
require './lib/configfiles_index.inc.php';
/**
* Include our init.php, which manages Sessions, Language etc.
*/
$need_db_sql_data = true;
require ("./lib/init.php");
require ("./lib/configfiles_index.inc.php");
$distribution = ''; $distribution = '';
$distributions_select = ''; $distributions_select = '';
$service = ''; $service = '';
@@ -85,20 +89,15 @@ if($userinfo['change_serversettings'] == '1')
'<SQL_UNPRIVILEGED_PASSWORD>' => 'MYSQL_PASSWORD', '<SQL_UNPRIVILEGED_PASSWORD>' => 'MYSQL_PASSWORD',
'<SQL_DB>' => $sql['db'], '<SQL_DB>' => $sql['db'],
'<SQL_HOST>' => $sql['host'], '<SQL_HOST>' => $sql['host'],
'<SERVERNAME>' => Settings::Get('system.hostname'), '<SERVERNAME>' => $settings['system']['hostname'],
'<SERVERIP>' => Settings::Get('system.ipaddress'), '<SERVERIP>' => $settings['system']['ipaddress'],
'<NAMESERVERS>' => Settings::Get('system.nameservers'), '<NAMESERVERS>' => $settings['system']['nameservers'],
'<VIRTUAL_MAILBOX_BASE>' => Settings::Get('system.vmail_homedir'), '<VIRTUAL_MAILBOX_BASE>' => $settings['system']['vmail_homedir'],
'<VIRTUAL_UID_MAPS>' => Settings::Get('system.vmail_uid'), '<VIRTUAL_UID_MAPS>' => $settings['system']['vmail_uid'],
'<VIRTUAL_GID_MAPS>' => Settings::Get('system.vmail_gid'), '<VIRTUAL_GID_MAPS>' => $settings['system']['vmail_gid'],
'<SSLPROTOCOLS>' => (Settings::Get('system.use_ssl') == '1') ? 'imaps pop3s' : '', '<SSLPROTOCOLS>' => ($settings['system']['use_ssl'] == '1') ? 'imaps pop3s' : '',
'<CUSTOMER_TMP>' => (Settings::Get('system.mod_fcgid_tmpdir') != '') ? makeCorrectDir(Settings::Get('system.mod_fcgid_tmpdir')) : '/tmp/', '<REALTIME_PORT>' => $settings['system']['realtime_port'],
'<BASE_PATH>' => makeCorrectDir(FROXLOR_INSTALL_DIR), '<CUSTOMER_TMP>' => ($settings['system']['mod_fcgid_tmpdir'] != '') ? makeCorrectDir($settings['system']['mod_fcgid_tmpdir']) : '/tmp/'
'<BIND_CONFIG_PATH>' => makeCorrectDir(Settings::Get('system.bindconf_directory')),
'<WEBSERVER_RELOAD_CMD>' => Settings::Get('system.apachereload_command'),
'<CUSTOMER_LOGS>' => makeCorrectDir(Settings::Get('system.logfiles_directory')),
'<FPM_IPCDIR>' => makeCorrectDir(Settings::Get('phpfpm.fastcgi_ipcdir')),
'<WEBSERVER_GROUP>' => Settings::Get('system.httpgroup')
); );
$files = ''; $files = '';
$configpage = ''; $configpage = '';

View File

@@ -12,33 +12,42 @@
* @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';
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'],
'c.interval' => $lng['cron']['interval'], 'c.interval' => $lng['cron']['interval'],
'c.isactive' => $lng['cron']['isactive'] 'c.isactive' => $lng['cron']['isactive']
); );
$paging = new paging($userinfo, TABLE_PANEL_CRONRUNS, $fields); $paging = new paging($userinfo, $db, TABLE_PANEL_CRONRUNS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
/*
* @TODO Fix sorting
*/
$crons = ''; $crons = '';
$result_stmt = Database::prepare("SELECT `c`.* FROM `" . TABLE_PANEL_CRONRUNS . "` `c` ORDER BY `module` ASC, `cronfile` ASC"); $result = $db->query("SELECT `c`.* FROM `" . TABLE_PANEL_CRONRUNS . "` `c` ORDER BY `cronfile` ASC");
Database::pexecute($result_stmt); $paging->setEntries($db->num_rows($result));
$paging->setEntries(Database::num_rows());
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
@@ -46,95 +55,103 @@ if ($page == 'cronjobs' || $page == 'overview') {
$i = 0; $i = 0;
$count = 0; $count = 0;
$cmod = '';
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))
if ($cmod != $row['module']) { {
$_mod = explode("/", $row['module']); if($paging->checkDisplay($i))
$module = ucfirst($_mod[1]); {
eval("\$crons.=\"" . getTemplate('cronjobs/cronjobs_cronjobmodule') . "\";");
$cmod = $row['module'];
}
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) { }
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_CRONRUNS . "` WHERE `id`= :id"); elseif($action == 'edit'
Database::pexecute($result_stmt, array('id' => $id)); && $id != 0)
$result = $result_stmt->fetch(PDO::FETCH_ASSOC); {
if ($result['cronfile'] != '') { $result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_CRONRUNS . "` WHERE `id`='" . (int)$id . "'");
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$isactive = isset($_POST['isactive']) ? 1 : 0; if ($result['cronfile'] != '')
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$isactive = intval($_POST['isactive']);
$interval_value = validate($_POST['interval_value'], 'interval_value', '/^([0-9]+)$/Di', 'stringisempty'); $interval_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);
$db->query("UPDATE `" . TABLE_PANEL_CRONRUNS . "`
SET `isactive` = '".(int)$isactive."',
`interval` = '".$interval."'
WHERE `id` = '" . (int)$id . "'");
$interval = $interval_value . ' ' . strtoupper($interval_interval); redirectTo($filename, Array('page' => $page, 's' => $s));
}
$upd = Database::prepare(" else
UPDATE `" . TABLE_PANEL_CRONRUNS . "` {
SET `isactive` = :isactive, `interval` = :int $isactive = makeyesno('isactive', '1', '0', $result['isactive']);
WHERE `id` = :id"
);
Database::pexecute($upd, array('isactive' => $isactive, 'int' => $interval, 'id' => $id));
// insert task to re-generate the cron.d-file
inserttask('99');
redirectTo($filename, array('page' => $page, 's' => $s));
} else {
// 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']['minutes'], 'MINUTE', $interval_nfo[1]); $interval_interval.= makeoption($lng['cronmgmt']['seconds'], 'SECOND', $interval_nfo[1]);
$interval_interval .= makeoption($lng['cronmgmt']['hours'], 'HOUR', $interval_nfo[1]); $interval_interval.= makeoption($lng['cronmgmt']['minutes'], 'MINUTE', $interval_nfo[1]);
$interval_interval .= makeoption($lng['cronmgmt']['days'], 'DAY', $interval_nfo[1]); $interval_interval.= makeoption($lng['cronmgmt']['hours'], 'HOUR', $interval_nfo[1]);
$interval_interval .= makeoption($lng['cronmgmt']['weeks'], 'WEEK', $interval_nfo[1]); $interval_interval.= makeoption($lng['cronmgmt']['days'], 'DAY', $interval_nfo[1]);
$interval_interval .= makeoption($lng['cronmgmt']['months'], 'MONTH', $interval_nfo[1]); $interval_interval.= makeoption($lng['cronmgmt']['weeks'], 'WEEK', $interval_nfo[1]);
$interval_interval.= makeoption($lng['cronmgmt']['months'], 'MONTH', $interval_nfo[1]);
// end of interval // 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
*/ */
} }
} }
?>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -14,164 +14,188 @@
* @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';
if ($action == 'logout') { /**
* Include our init.php, which manages Sessions, Language etc.
*/
require ("./lib/init.php");
if($action == 'logout')
{
$log->logAction(ADM_ACTION, LOG_NOTICE, "logged out"); $log->logAction(ADM_ACTION, LOG_NOTICE, "logged out");
$params = array('adminid' => (int)$userinfo['adminid']); if($settings['session']['allow_multiple_login'] == '1')
{
if (Settings::Get('session.allow_multiple_login') == '1') { $db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['adminid'] . "' AND `adminsession` = '1' AND `hash` = '" . $s . "'");
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` }
WHERE `userid` = :adminid else
AND `adminsession` = '1' {
AND `hash` = :hash" $db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['adminid'] . "' AND `adminsession` = '1'");
);
$params['hash'] = $s;
} else {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :adminid
AND `adminsession` = '1'"
);
} }
Database::pexecute($stmt, $params);
redirectTo('index.php'); redirectTo('index.php');
exit; exit;
} }
if (isset($_POST['id'])) { if(isset($_POST['id']))
{
$id = intval($_POST['id']); $id = intval($_POST['id']);
} elseif(isset($_GET['id'])) { }
elseif(isset($_GET['id']))
{
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
if ($page == 'overview') { if($page == 'overview')
{
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_index"); $log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_index");
$overview_stmt = Database::prepare("SELECT COUNT(*) AS `number_customers`, $overview = $db->query_first("SELECT COUNT(*) AS `number_customers`,
SUM(`diskspace_used`) AS `diskspace_used`, SUM(`diskspace_used`) AS `diskspace_used`,
SUM(`mysqls_used`) AS `mysqls_used`, SUM(`mysqls_used`) AS `mysqls_used`,
SUM(`emails_used`) AS `emails_used`, SUM(`emails_used`) AS `emails_used`,
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`,
SUM(`traffic_used`) AS `traffic_used` SUM(`traffic_used`) AS `traffic_used`,
FROM `" . TABLE_PANEL_CUSTOMERS . "`" . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = :adminid ")); SUM(`aps_packages_used`) AS `aps_packages_used`
$overview = Database::pexecute_first($overview_stmt, array('adminid' => $userinfo['adminid'])); FROM `" . TABLE_PANEL_CUSTOMERS . "`" . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = '" . (int)$userinfo['adminid'] . "' "));
$overview['traffic_used'] = round($overview['traffic_used'] / (1024 * 1024), $settings['panel']['decimal_places']);
$dec_places = Settings::Get('panel.decimal_places'); $overview['diskspace_used'] = round($overview['diskspace_used'] / 1024, $settings['panel']['decimal_places']);
$overview['traffic_used'] = round($overview['traffic_used'] / (1024 * 1024), $dec_places); $number_domains = $db->query_first("SELECT COUNT(*) AS `number_domains` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `parentdomainid`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = '" . (int)$userinfo['adminid'] . "' "));
$overview['diskspace_used'] = round($overview['diskspace_used'] / 1024, $dec_places);
$number_domains_stmt = Database::prepare("
SELECT COUNT(*) AS `number_domains` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `parentdomainid`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :adminid")
);
$number_domains = Database::pexecute_first($number_domains_stmt, array('adminid' => $userinfo['adminid']));
$overview['number_domains'] = $number_domains['number_domains']; $overview['number_domains'] = $number_domains['number_domains'];
$phpversion = phpversion(); $phpversion = phpversion();
$mysqlserverversion = Database::getAttribute(PDO::ATTR_SERVER_VERSION); $phpmemorylimit = @ini_get("memory_limit");
if($phpmemorylimit == "")
{
$phpmemorylimit = $lng['admin']['memorylimitdisabled'];
}
$mysqlserverversion = mysql_get_server_info();
$mysqlclientversion = mysql_get_client_info();
$webserverinterface = strtoupper(@php_sapi_name()); $webserverinterface = strtoupper(@php_sapi_name());
if ((isset($_GET['lookfornewversion']) && $_GET['lookfornewversion'] == 'yes') if((isset($_GET['lookfornewversion']) && $_GET['lookfornewversion'] == 'yes')
|| (isset($lookfornewversion) && $lookfornewversion == 'yes') || (isset($lookfornewversion) && $lookfornewversion == 'yes'))
) { {
$update_check_uri = 'http://version.froxlor.org/Froxlor/legacy/' . $version; $update_check_uri = 'http://version.froxlor.org/Froxlor/legacy/' . $version;
if (ini_get('allow_url_fopen')) { if(ini_get('allow_url_fopen'))
{
$latestversion = @file($update_check_uri); $latestversion = @file($update_check_uri);
if (isset($latestversion[0])) { if (isset($latestversion[0]))
{
$latestversion = explode('|', $latestversion[0]); $latestversion = explode('|', $latestversion[0]);
if (is_array($latestversion) if(is_array($latestversion)
&& count($latestversion) >= 1 && count($latestversion) >= 1)
) { {
$_version = $latestversion[0]; $_version = $latestversion[0];
$_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;
// not numeric -> error-message if (version_compare($version, $_version) == -1) {
if (!preg_match('/^((\d+\\.)(\d+\\.)(\d+\\.)?(\d+)?(\-(svn|dev|rc)(\d+))?)$/', $_version)) {
// check for customized version to not output
// "There is a newer version of froxlor" besides the error-message
$isnewerversion = 2;
} elseif (version_compare2($version, $_version) == -1) {
$isnewerversion = 1; $isnewerversion = 1;
} else { } else {
$isnewerversion = 0; $isnewerversion = 0;
} }
} else { }
else
{
redirectTo($update_check_uri.'/pretty', NULL); redirectTo($update_check_uri.'/pretty', NULL);
} }
} else { }
else
{
redirectTo($update_check_uri.'/pretty', NULL); redirectTo($update_check_uri.'/pretty', NULL);
} }
} else { }
else
{
redirectTo($update_check_uri.'/pretty', NULL); redirectTo($update_check_uri.'/pretty', NULL);
} }
} else { }
else
{
$lookfornewversion_lable = $lng['admin']['lookfornewversion']['clickhere']; $lookfornewversion_lable = $lng['admin']['lookfornewversion']['clickhere'];
$lookfornewversion_link = htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes'); $lookfornewversion_link = htmlspecialchars($filename . '?s=' . urlencode($s) . '&page=' . urlencode($page) . '&lookfornewversion=yes');
$lookfornewversion_addinfo = ''; $lookfornewversion_addinfo = '';
$isnewerversion = 0; $isnewerversion = 0;
} }
$dec_places = Settings::Get('panel.decimal_places'); $userinfo['diskspace'] = round($userinfo['diskspace'] / 1024, $settings['panel']['decimal_places']);
$userinfo['diskspace'] = round($userinfo['diskspace'] / 1024, $dec_places); $userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, $settings['panel']['decimal_places']);
$userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, $dec_places); $userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $settings['panel']['decimal_places']);
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $dec_places); $userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), $settings['panel']['decimal_places']);
$userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), $dec_places); $userinfo = str_replace_array('-1', $lng['customer']['unlimited'], $userinfo, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota 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');
$cron_last_runs = getCronjobsLastRun(); $cron_last_runs = getCronjobsLastRun();
$outstanding_tasks = getOutstandingTasks(); $outstanding_tasks = getOutstandingTasks();
if (function_exists('sys_getloadavg')) { $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'))
{
$loadArray = sys_getloadavg(); $loadArray = sys_getloadavg();
$load = number_format($loadArray[0], 2, '.', '') . " / " . number_format($loadArray[1], 2, '.', '') . " / " . number_format($loadArray[2], 2, '.', ''); $load = number_format($loadArray[0], 2, '.', '') . " / " . number_format($loadArray[1], 2, '.', '') . " / " . number_format($loadArray[2], 2, '.', '');
} else { }
else
{
$load = @file_get_contents('/proc/loadavg'); $load = @file_get_contents('/proc/loadavg');
if (!$load) { if(!$load)
{
$load = $lng['admin']['noloadavailable']; $load = $lng['admin']['noloadavailable'];
} }
} }
if (function_exists('posix_uname')) { if(function_exists('posix_uname'))
{
$showkernel = 1; $showkernel = 1;
$kernel_nfo = posix_uname(); $kernel_nfo = posix_uname();
$kernel = $kernel_nfo['release'] . ' (' . $kernel_nfo['machine'] . ')'; $kernel = $kernel_nfo['release'] . ' (' . $kernel_nfo['machine'] . ')';
} else { }
else
{
$showkernel = 0; $showkernel = 0;
$kernel = ''; $kernel = '';
} }
// 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 Froxlor - vHost)
$uptime_array = explode(" ", @file_get_contents("/proc/uptime")); $uptime_array = explode(" ", @file_get_contents("/proc/uptime"));
if (is_array($uptime_array) if(is_array($uptime_array)
&& isset($uptime_array[0]) && isset($uptime_array[0])
&& is_numeric($uptime_array[0]) && is_numeric($uptime_array[0]))
) { {
// Some calculatioon to get a nicly formatted display // Some calculatioon to get a nicly formatted display
$seconds = round($uptime_array[0], 0); $seconds = round($uptime_array[0], 0);
$minutes = $seconds / 60; $minutes = $seconds / 60;
$hours = $minutes / 60; $hours = $minutes / 60;
@@ -182,22 +206,27 @@ if ($page == 'overview') {
$uptime = "{$days}d, {$hours}h, {$minutes}m, {$seconds}s"; $uptime = "{$days}d, {$hours}h, {$minutes}m, {$seconds}s";
// Just cleanup // Just cleanup
unset($uptime_array, $seconds, $minutes, $hours, $days); unset($uptime_array, $seconds, $minutes, $hours, $days);
} else { }
else
{
// Nothing of the above worked, show an error :/ // Nothing of the above worked, show an error :/
$uptime = ''; $uptime = '';
} }
eval("echo \"" . getTemplate("index/index") . "\";"); eval("echo \"" . getTemplate("index/index") . "\";");
}
} elseif($page == 'change_password') { elseif($page == 'change_password')
{
if (isset($_POST['send']) if(isset($_POST['send'])
&& $_POST['send'] == '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;
} }
@@ -205,204 +234,66 @@ if ($page == 'overview') {
$new_password = validate($_POST['new_password'], 'new password'); $new_password = validate($_POST['new_password'], 'new password');
$new_password_confirm = validate($_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 { }
$chgpwd_stmt = Database::prepare(" else
UPDATE `" . TABLE_PANEL_ADMINS . "` {
SET `password`= :newpasswd $db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `password`='" . md5($new_password) . "' WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `password`='" . md5($old_password) . "'");
WHERE `adminid`= :adminid
AND `password`= :oldpasswd"
);
Database::pexecute($chgpwd_stmt, array(
'newpasswd' => md5($new_password),
'adminid' => (int)$userinfo['adminid'],
'oldpasswd' => md5($old_password)
));
$log->logAction(ADM_ACTION, LOG_NOTICE, 'changed password'); $log->logAction(ADM_ACTION, LOG_NOTICE, 'changed password');
redirectTo($filename, Array('s' => $s)); redirectTo($filename, Array('s' => $s));
} }
} else { }
else
{
eval("echo \"" . getTemplate("index/change_password") . "\";"); eval("echo \"" . getTemplate("index/change_password") . "\";");
} }
}
} elseif($page == 'change_language') { elseif($page == 'change_language')
{
if (isset($_POST['send']) if(isset($_POST['send'])
&& $_POST['send'] == '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]))
$lng_stmt = Database::prepare(" {
UPDATE `" . TABLE_PANEL_ADMINS . "` $db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `def_language`='" . $db->escape($def_language) . "' WHERE `adminid`='" . (int)$userinfo['adminid'] . "'");
SET `def_language`= :deflng $db->query("UPDATE `" . TABLE_PANEL_SESSIONS . "` SET `language`='" . $db->escape($def_language) . "' WHERE `hash`='" . $db->escape($s) . "'");
WHERE `adminid`= :adminid"
);
Database::pexecute($lng_stmt, array(
'deflng' => $def_language,
'adminid' => (int)$userinfo['adminid']
));
$lng_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_SESSIONS . "`
SET `language`= :lng
WHERE `hash`= :hash"
);
Database::pexecute($lng_stmt, array(
'lng' => $def_language,
'hash' => $s
));
} }
$log->logAction(ADM_ACTION, LOG_NOTICE, "changed his/her default language to '" . $def_language . "'"); $log->logAction(ADM_ACTION, LOG_NOTICE, "changed his/her default language to '" . $def_language . "'");
redirectTo($filename, array('s' => $s)); redirectTo($filename, Array('s' => $s));
}
} else { else
{
$language_options = ''; $language_options = '';
$default_lang = Settings::Get('panel.standardlanguage'); $default_lang = $settings['panel']['standardlanguage'];
if ($userinfo['def_language'] != '') { if($userinfo['def_language'] != '') {
$default_lang = $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, $default_lang, 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');
$theme_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_ADMINS . "`
SET `theme`= :theme
WHERE `adminid`= :adminid"
);
Database::pexecute($theme_stmt, array(
'theme' => $theme,
'adminid' => (int)$userinfo['adminid']
));
$theme_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_SESSIONS . "`
SET `theme`= :theme
WHERE `hash`= :hash"
);
Database::pexecute($theme_stmt, array(
'theme' => $theme,
'hash' => $s
));
$log->logAction(ADM_ACTION, LOG_NOTICE, "changed his/her theme to '" . $theme . "'");
redirectTo($filename, array('s' => $s));
} else {
$theme_options = '';
$default_theme = Settings::Get('panel.default_theme');
if ($userinfo['theme'] != '') {
$default_theme = $userinfo['theme'];
}
$themes_avail = getThemes();
foreach ($themes_avail as $t => $d) {
$theme_options.= makeoption($d, $t, $default_theme, true);
}
eval("echo \"" . getTemplate("index/change_theme") . "\";");
}
} elseif ($page == 'send_error_report'
&& Settings::Get('system.allow_error_report_admin') == '1'
) {
// only show this if we really have an exception to report
if (isset($_GET['errorid'])
&& $_GET['errorid'] != ''
) {
$errid = $_GET['errorid'];
// read error file
$err_dir = makeCorrectDir(FROXLOR_INSTALL_DIR."/logs/");
$err_file = makeCorrectFile($err_dir."/".$errid."_sql-error.log");
if (file_exists($err_file)) {
$error_content = file_get_contents($err_file);
$error = explode("|", $error_content);
$_error = array(
'code' => str_replace("\n", "", substr($error[1], 5)),
'message' => str_replace("\n", "", substr($error[2], 4)),
'file' => str_replace("\n", "", substr($error[3], 5 + strlen(FROXLOR_INSTALL_DIR))),
'line' => str_replace("\n", "", substr($error[4], 5)),
'trace' => str_replace(FROXLOR_INSTALL_DIR, "", substr($error[5], 6))
);
// build mail-content
$mail_body = "Dear froxlor-team,\n\n";
$mail_body .= "the following error has been reported by a user:\n\n";
$mail_body .= "-------------------------------------------------------------\n";
$mail_body .= $_error['code'].' '.$_error['message']."\n\n";
$mail_body .= "File: ".$_error['file'].':'.$_error['line']."\n\n";
$mail_body .= "Trace:\n".trim($_error['trace'])."\n\n";
$mail_body .= "-------------------------------------------------------------\n\n";
$mail_body .= "Froxlor-version: ".$version."\n\n";
$mail_body .= "End of report";
$mail_html = nl2br($mail_body);
// send actual report to dev-team
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
// send mail and say thanks
$_mailerror = false;
try {
$mail->Subject = '[Froxlor] Error report by user';
$mail->AltBody = $mail_body;
$mail->MsgHTML($mail_html);
$mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team');
$mail->Send();
} catch(phpmailerException $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
$mailerr_msg = $e->getMessage();
$_mailerror = true;
}
if ($_mailerror) {
// error when reporting an error...LOLFUQ
standard_error('send_report_error', $mailerr_msg);
}
// finally remove error from fs
@unlink($err_file);
redirectTo($filename, array('s' => $s));
}
// show a nice summary of the error-report
// before actually sending anything
eval("echo \"" . getTemplate("index/send_error_report") . "\";");
} else {
redirectTo($filename, array('s' => $s));
}
} else {
redirectTo($filename, array('s' => $s));
}
} }
?>

View File

@@ -14,34 +14,40 @@
* @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';
if (isset($_POST['id'])) { /**
* Include our init.php, which manages Sessions, Language etc.
*/
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 == 'ipsandports' if($page == 'ipsandports'
|| $page == 'overview' || $page == 'overview')
) { {
if($action == '')
if ($action == '') { {
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_ipsandports"); $log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_ipsandports");
$fields = array( $fields = array(
'ip' => $lng['admin']['ipsandports']['ip'], 'ip' => $lng['admin']['ipsandports']['ip'],
'port' => $lng['admin']['ipsandports']['port'] 'port' => $lng['admin']['ipsandports']['port']
); );
$paging = new paging($userinfo, TABLE_PANEL_IPSANDPORTS, $fields); $paging = new paging($userinfo, $db, TABLE_PANEL_IPSANDPORTS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$ipsandports = ''; $ipsandports = '';
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` " . $paging->getSqlWhere(false) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()); $result = $db->query("SELECT `id`, `ip`, `port`, `listen_statement`, `namevirtualhost_statement`, `vhostcontainer`, `vhostcontainer_servername_statement`, `specialsettings`, `ssl` FROM `" . TABLE_PANEL_IPSANDPORTS . "` " . $paging->getSqlWhere(false) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
Database::pexecute($result_stmt); $paging->setEntries($db->num_rows($result));
$paging->setEntries(Database::num_rows());
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
@@ -49,385 +55,266 @@ if ($page == 'ipsandports'
$i = 0; $i = 0;
$count = 0; $count = 0;
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))
{
if ($paging->checkDisplay($i)) { if($paging->checkDisplay($i))
{
$row = htmlentities_array($row); $row = htmlentities_array($row);
if (filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
if(filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
{
$row['ip'] = '[' . $row['ip'] . ']'; $row['ip'] = '[' . $row['ip'] . ']';
} }
eval("\$ipsandports.=\"" . getTemplate("ipsandports/ipsandports_ipandport") . "\";"); eval("\$ipsandports.=\"" . getTemplate("ipsandports/ipsandports_ipandport") . "\";");
$count++; $count++;
} }
$i++; $i++;
} }
eval("echo \"" . getTemplate("ipsandports/ipsandports") . "\";"); eval("echo \"" . getTemplate("ipsandports/ipsandports") . "\";");
}
elseif($action == 'delete'
&& $id != 0)
{
$result = $db->query_first("SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id`='" . (int)$id . "'");
} elseif($action == 'delete' if(isset($result['id'])
&& $id != 0 && $result['id'] == $id)
) { {
$result_stmt = Database::prepare("SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = :id"); $result_checkdomain = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `ipandport`='" . (int)$id . "'");
$result = Database::pexecute_first($result_stmt, array('id' => $id));
if (isset($result['id']) if($result_checkdomain['id'] == '')
&& $result['id'] == $id {
) { if($result['id'] != $settings['system']['defaultip'])
$result_checkdomain_stmt = Database::prepare(" {
SELECT `id_domain` as `id` FROM `" . TABLE_DOMAINTOIP . "` WHERE `id_ipandports` = :id" $result_sameipotherport = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($result['ip']) . "' AND `id`!='" . (int)$id . "'");
);
$result_checkdomain = Database::pexecute_first($result_checkdomain_stmt, array('id' => $id));
if ($result_checkdomain['id'] == '') { if(($result['ip'] != $settings['system']['ipaddress'])
if ($result['id'] != Settings::Get('system.defaultip')) { || ($result['ip'] == $settings['system']['ipaddress'] && $result_sameipotherport['id'] != ''))
{
$result_sameipotherport_stmt = Database::prepare(" $result = $db->query_first("SELECT `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id`='" . (int)$id . "'");
SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
WHERE `ip` = :ip AND `id` <> :id"
);
$result_sameipotherport = Database::pexecute_first($result_sameipotherport_stmt, array('id' => $id, 'ip' => $result['ip']));
if (($result['ip'] != Settings::Get('system.ipaddress'))
|| ($result['ip'] == Settings::Get('system.ipaddress')
&& $result_sameipotherport['id'] != '')
) {
$result_stmt = Database::prepare("
SELECT `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
WHERE `id` = :id"
);
$result = Database::pexecute_first($result_stmt, array('id' => $id));
if ($result['ip'] != '') {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$del_stmt = Database::prepare("
DELETE FROM `" . TABLE_PANEL_IPSANDPORTS . "`
WHERE `id` = :id"
);
Database::pexecute($del_stmt, array('id' => $id));
// also, remove connections to domains (multi-stack)
$del_stmt = Database::prepare("
DELETE FROM `".TABLE_DOMAINTOIP."` WHERE `id_ipandports` = :id"
);
Database::pexecute($del_stmt, array('id' => $id));
if($result['ip'] != '')
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$db->query("DELETE FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id`='" . (int)$id . "'");
$log->logAction(ADM_ACTION, LOG_WARNING, "deleted IP/port '" . $result['ip'] . ":" . $result['port'] . "'"); $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 { {
ask_yesno('admin_ip_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['ip'] . ':' . $result['port']); ask_yesno('admin_ip_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['ip'] . ':' . $result['port']);
} }
} }
} else { }
else
{
standard_error('cantdeletesystemip'); standard_error('cantdeletesystemip');
} }
} else { }
else
{
standard_error('cantdeletedefaultip'); standard_error('cantdeletedefaultip');
} }
} else { }
else
{
standard_error('ipstillhasdomains'); standard_error('ipstillhasdomains');
} }
} }
}
} elseif($action == 'add') { elseif($action == 'add')
{
if (isset($_POST['send']) if(isset($_POST['send'])
&& $_POST['send'] == 'send' && $_POST['send'] == 'send')
) { {
$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($listen_statement != '1')
if ((int)Settings::Get('system.use_ssl') == 1) { {
$ssl = isset($_POST['ssl']) ? intval($_POST['ssl']) : 0;
$ssl_cert_file = validate($_POST['ssl_cert_file'], 'ssl_cert_file');
$ssl_key_file = validate($_POST['ssl_key_file'], 'ssl_key_file');
$ssl_ca_file = validate($_POST['ssl_ca_file'], 'ssl_ca_file');
$ssl_cert_chainfile = validate($_POST['ssl_cert_chainfile'], 'ssl_cert_chainfile');
} else {
$ssl = 0;
$ssl_cert_file = '';
$ssl_key_file = '';
$ssl_ca_file = '';
$ssl_cert_chainfile = '';
}
if ($listen_statement != '1') {
$listen_statement = '0'; $listen_statement = '0';
} }
if ($namevirtualhost_statement != '1') { if($namevirtualhost_statement != '1')
{
$namevirtualhost_statement = '0'; $namevirtualhost_statement = '0';
} }
if ($vhostcontainer != '1') { if($vhostcontainer != '1')
{
$vhostcontainer = '0'; $vhostcontainer = '0';
} }
if ($vhostcontainer_servername_statement != '1') { if($vhostcontainer_servername_statement != '1')
{
$vhostcontainer_servername_statement = '0'; $vhostcontainer_servername_statement = '0';
} }
if ($ssl != '1') { if($ssl != '1')
{
$ssl = '0'; $ssl = '0';
} }
if ($ssl_cert_file != '') { if($ssl_cert_file != '')
{
$ssl_cert_file = makeCorrectFile($ssl_cert_file); $ssl_cert_file = makeCorrectFile($ssl_cert_file);
} }
if ($ssl_key_file != '') { if($ssl_key_file != '')
{
$ssl_key_file = makeCorrectFile($ssl_key_file); $ssl_key_file = makeCorrectFile($ssl_key_file);
} }
if ($ssl_ca_file != '') { if($ssl_ca_file != '')
{
$ssl_ca_file = makeCorrectFile($ssl_ca_file); $ssl_ca_file = makeCorrectFile($ssl_ca_file);
} }
if ($ssl_cert_chainfile != '') { $result_checkfordouble = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($ip) . "' AND `port`='" . (int)$port . "'");
$ssl_cert_chainfile = makeCorrectFile($ssl_cert_chainfile);
}
if (strlen(trim($docroot)) > 0) { if($result_checkfordouble['id'] != '')
$docroot = makeCorrectDir($docroot); {
} else {
$docroot = '';
}
$result_checkfordouble_stmt = Database::prepare("
SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
WHERE `ip` = :ip AND `port` = :port"
);
$result_checkfordouble = Database::pexecute_first($result_checkfordouble_stmt, array('ip' => $ip, 'port' => $port));
if ($result_checkfordouble['id'] != '') {
standard_error('myipnotdouble'); standard_error('myipnotdouble');
} else { }
$ins_stmt = Database::prepare(" else
INSERT INTO `" . TABLE_PANEL_IPSANDPORTS . "` {
SET $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) . "')");
`ip` = :ip, `port` = :port, `listen_statement` = :ls,
`namevirtualhost_statement` = :nvhs, `vhostcontainer` = :vhc,
`vhostcontainer_servername_statement` = :vhcss,
`specialsettings` = :ss, `ssl` = :ssl,
`ssl_cert_file` = :ssl_cert, `ssl_key_file` = :ssl_key,
`ssl_ca_file` = :ssl_ca, `ssl_cert_chainfile` = :ssl_chain,
`default_vhostconf_domain` = :dvhd, `docroot` = :docroot;
");
$ins_data = array(
'ip' => $ip,
'port' => $port,
'ls' => $listen_statement,
'nvhs' => $namevirtualhost_statement,
'vhc' => $vhostcontainer,
'vhcss' => $vhostcontainer_servername_statement,
'ss' => $specialsettings,
'ssl' => $ssl,
'ssl_cert' => $ssl_cert_file,
'ssl_key' => $ssl_key_file,
'ssl_ca' => $ssl_ca_file,
'ssl_chain' => $ssl_cert_chainfile,
'dvhd' => $default_vhostconf_domain,
'docroot' => $docroot
);
Database::pexecute($ins_stmt, $ins_data);
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
{
$ip = '[' . $ip . ']'; $ip = '[' . $ip . ']';
} }
$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
{
$ipsandports_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/ipsandports/formfield.ipsandports_add.php'; $enable_ssl = makeyesno('ssl', '1', '0', '0');
$ipsandports_add_form = htmlform::genHTMLForm($ipsandports_add_data); $listen_statement = makeyesno('listen_statement', '1', '0', '1');
$namevirtualhost_statement = makeyesno('namevirtualhost_statement', '1', '0', '1');
$title = $ipsandports_add_data['ipsandports_add']['title']; $vhostcontainer = makeyesno('vhostcontainer', '1', '0', '1');
$image = $ipsandports_add_data['ipsandports_add']['image']; $vhostcontainer_servername_statement = makeyesno('vhostcontainer_servername_statement', '1', '0', '1');
eval("echo \"" . getTemplate("ipsandports/ipsandports_add") . "\";"); eval("echo \"" . getTemplate("ipsandports/ipsandports_add") . "\";");
} }
}
elseif($action == 'edit'
&& $id != 0)
{
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id`='" . (int)$id . "'");
} elseif($action == 'edit' if($result['ip'] != '')
&& $id != 0 {
) { if(isset($_POST['send'])
$result_stmt = Database::prepare(" && $_POST['send'] == 'send')
SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = :id" {
);
$result = Database::pexecute_first($result_stmt, array('id' => $id));
if ($result['ip'] != '') {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$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; $result_checkfordouble = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($ip) . "' AND `port`='" . (int)$port . "'");
$namevirtualhost_statement = isset($_POST['namevirtualhost_statement']) ? 1 : 0; $result_sameipotherport = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($result['ip']) . "' AND `id`!='" . (int)$id . "'");
$vhostcontainer = isset($_POST['vhostcontainer']) ? 1 : 0; $listen_statement = intval($_POST['listen_statement']);
$namevirtualhost_statement = intval($_POST['namevirtualhost_statement']);
$vhostcontainer = intval($_POST['vhostcontainer']);
$specialsettings = validate(str_replace("\r\n", "\n", $_POST['specialsettings']), 'specialsettings', '/^[^\0]*$/'); $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');
$result_checkfordouble_stmt = Database::prepare("
SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
WHERE `ip` = :ip AND `port` = :port"
);
$result_checkfordouble = Database::pexecute_first($result_checkfordouble_stmt, array('ip' => $ip, 'port' => $port));
$result_sameipotherport_stmt = Database::prepare("
SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
WHERE `ip` = :ip AND `id` <> :id"
);
$result_sameipotherport = Database::pexecute_first($result_sameipotherport_stmt, array('ip' => $ip, 'id' => $id));
if ((int)Settings::Get('system.use_ssl') == 1
&& isset($_POST['ssl'])
&& $_POST['ssl'] != 0
) {
$ssl = 1;
$ssl_cert_file = validate($_POST['ssl_cert_file'], 'ssl_cert_file');
$ssl_key_file = validate($_POST['ssl_key_file'], 'ssl_key_file');
$ssl_ca_file = validate($_POST['ssl_ca_file'], 'ssl_ca_file');
$ssl_cert_chainfile = validate($_POST['ssl_cert_chainfile'], 'ssl_cert_chainfile');
} else {
$ssl = 0;
$ssl_cert_file = '';
$ssl_key_file = '';
$ssl_ca_file = '';
$ssl_cert_chainfile = '';
}
if ($listen_statement != '1') { if($listen_statement != '1')
{
$listen_statement = '0'; $listen_statement = '0';
} }
if ($namevirtualhost_statement != '1') { if($namevirtualhost_statement != '1')
{
$namevirtualhost_statement = '0'; $namevirtualhost_statement = '0';
} }
if ($vhostcontainer != '1') { if($vhostcontainer != '1')
{
$vhostcontainer = '0'; $vhostcontainer = '0';
} }
if ($vhostcontainer_servername_statement != '1') { if($vhostcontainer_servername_statement != '1')
{
$vhostcontainer_servername_statement = '0'; $vhostcontainer_servername_statement = '0';
} }
if ($ssl != '1') { if($ssl != '1')
{
$ssl = '0'; $ssl = '0';
} }
if ($ssl_cert_file != '') { if($ssl_cert_file != '')
{
$ssl_cert_file = makeCorrectFile($ssl_cert_file); $ssl_cert_file = makeCorrectFile($ssl_cert_file);
} }
if ($ssl_key_file != '') { if($ssl_key_file != '')
{
$ssl_key_file = makeCorrectFile($ssl_key_file); $ssl_key_file = makeCorrectFile($ssl_key_file);
} }
if ($ssl_ca_file != '') { if($ssl_ca_file != '')
{
$ssl_ca_file = makeCorrectFile($ssl_ca_file); $ssl_ca_file = makeCorrectFile($ssl_ca_file);
} }
if ($ssl_cert_chainfile != '') { if($result['ip'] != $ip
$ssl_cert_chainfile = makeCorrectFile($ssl_cert_chainfile); && $result['ip'] == $settings['system']['ipaddress']
} && $result_sameipotherport['id'] == '')
{
if (strlen(trim($docroot)) > 0) {
$docroot = makeCorrectDir($docroot);
} else {
$docroot = '';
}
if ($result['ip'] != $ip
&& $result['ip'] == Settings::Get('system.ipaddress')
&& $result_sameipotherport['id'] == ''
) {
standard_error('cantchangesystemip'); standard_error('cantchangesystemip');
}
} elseif($result_checkfordouble['id'] != '' elseif($result_checkfordouble['id'] != ''
&& $result_checkfordouble['id'] != $id && $result_checkfordouble['id'] != $id)
) { {
standard_error('myipnotdouble'); standard_error('myipnotdouble');
}
} else { else
{
$upd_stmt = Database::prepare(" $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 . "'");
UPDATE `" . TABLE_PANEL_IPSANDPORTS . "`
SET
`ip` = :ip, `port` = :port, `listen_statement` = :ls,
`namevirtualhost_statement` = :nvhs, `vhostcontainer` = :vhc,
`vhostcontainer_servername_statement` = :vhcss,
`specialsettings` = :ss, `ssl` = :ssl,
`ssl_cert_file` = :ssl_cert, `ssl_key_file` = :ssl_key,
`ssl_ca_file` = :ssl_ca, `ssl_cert_chainfile` = :ssl_chain,
`default_vhostconf_domain` = :dvhd, `docroot` = :docroot
WHERE `id` = :id;
");
$upd_data = array(
'ip' => $ip,
'port' => $port,
'ls' => $listen_statement,
'nvhs' => $namevirtualhost_statement,
'vhc' => $vhostcontainer,
'vhcss' => $vhostcontainer_servername_statement,
'ss' => $specialsettings,
'ssl' => $ssl,
'ssl_cert' => $ssl_cert_file,
'ssl_key' => $ssl_key_file,
'ssl_ca' => $ssl_ca_file,
'ssl_chain' => $ssl_cert_chainfile,
'dvhd' => $default_vhostconf_domain,
'docroot' => $docroot,
'id' => $id
);
Database::pexecute($upd_stmt, $upd_data);
$log->logAction(ADM_ACTION, LOG_WARNING, "changed IP/port from '" . $result['ip'] . ":" . $result['port'] . "' to '" . $ip . ":" . $port . "'"); $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
{
$enable_ssl = makeyesno('ssl', '1', '0', $result['ssl']);
$result = htmlentities_array($result); $result = htmlentities_array($result);
$listen_statement = makeyesno('listen_statement', '1', '0', $result['listen_statement']);
$ipsandports_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/ipsandports/formfield.ipsandports_edit.php'; $namevirtualhost_statement = makeyesno('namevirtualhost_statement', '1', '0', $result['namevirtualhost_statement']);
$ipsandports_edit_form = htmlform::genHTMLForm($ipsandports_edit_data); $vhostcontainer = makeyesno('vhostcontainer', '1', '0', $result['vhostcontainer']);
$vhostcontainer_servername_statement = makeyesno('vhostcontainer_servername_statement', '1', '0', $result['vhostcontainer_servername_statement']);
$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,48 +14,57 @@
* @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';
if ($page == 'log' /**
&& $userinfo['change_serversettings'] == '1' * Include our init.php, which manages Sessions, Language etc.
) { */
if ($action == '') {
require ("./lib/init.php");
if($page == 'log'
&& $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, TABLE_PANEL_LOG, $fields, null, null, 0, 'desc'); $paging = new paging($userinfo, $db, TABLE_PANEL_LOG, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$result_stmt = Database::query(' $paging->sortfield = 'date';
SELECT * FROM `' . TABLE_PANEL_LOG . '` ' . $paging->getSqlWhere(false) . ' ' . $paging->getSqlOrderBy() . ' ' . $paging->getSqlLimit() $paging->sortorder = 'desc';
); $result = $db->query('SELECT * FROM `' . TABLE_PANEL_LOG . '` ' . $paging->getSqlWhere(false) . ' ' . $paging->getSqlOrderBy() . ' ' . $paging->getSqlLimit());
$paging->setEntries(Database::num_rows()); $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);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
$pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s); $pagingcode = $paging->getHtmlPagingCode($filename . '?page=' . $page . '&s=' . $s);
$clog = array(); $clog = array();
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))
{
if (!isset($clog[$row['action']]) if(!isset($clog[$row['action']])
|| !is_array($clog[$row['action']]) || !is_array($clog[$row['action']]))
) { {
$clog[$row['action']] = array(); $clog[$row['action']] = array();
} }
$clog[$row['action']][$row['logid']] = $row; $clog[$row['action']][$row['logid']] = $row;
} }
if ($paging->sortfield == 'date' if($paging->sortfield == 'date'
&& $paging->sortorder == 'desc' && $paging->sortorder == 'desc')
) { {
krsort($clog); krsort($clog);
} else { }
else
{
ksort($clog); ksort($clog);
} }
@@ -63,47 +72,50 @@ 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;
case RES_ACTION: case RES_ACTION:
$_action = $lng['logger']['reseller']; $_action = 'Reseller';
break; break;
case ADM_ACTION: case ADM_ACTION:
$_action = $lng['logger']['admin']; $_action = 'Administrator';
break; break;
case CRON_ACTION: case CRON_ACTION:
$_action = $lng['logger']['cron']; $_action = 'Cronjob';
break;
case LOGIN_ACTION:
$_action = $lng['logger']['login'];
break; break;
case LOG_ERROR: case LOG_ERROR:
$_action = $lng['logger']['intern']; $_action = 'Internal';
break; break;
default: default:
$_action = $lng['logger']['unknown']; $_action = 'Unknown';
break; break;
} }
$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;
@@ -125,30 +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'])
&& $_POST['send'] == 'send')
{
$yesterday = time() - (60 * 10);
} elseif ($action == 'truncate') { /* (60*60*24); */
if (isset($_POST['send']) $db->query("DELETE FROM `" . TABLE_PANEL_LOG . "` WHERE `date` < '" . $yesterday . "'");
&& $_POST['send'] == 'send' $log->logAction(ADM_ACTION, LOG_WARNING, "truncated the system-log (mysql)");
) { redirectTo($filename, Array('page' => $page, 's' => $s));
$truncatedate = time() - (60 * 10); }
$trunc_stmt = Database::prepare(" else
DELETE FROM `" . TABLE_PANEL_LOG . "` WHERE `date` < :trunc" {
);
Database::pexecute($trunc_stmt, array('trunc' => $truncatedate));
$log->logAction(ADM_ACTION, LOG_WARNING, 'truncated the system-log (mysql)');
redirectTo($filename, array('page' => $page, 's' => $s));
} 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,108 +14,135 @@
* @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';
if (isset($_POST['id'])) { /**
* Include our init.php, which manages Sessions, Language etc.
*/
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 = Database::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'); {
$result = Database::query('SELECT `firstname`, `name`, `company`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "`"); if($userinfo['customers_see_all'] == "1")
} else { {
$log->logAction(ADM_ACTION, LOG_NOTICE, 'sending messages to customers'); $log->logAction(ADM_ACTION, LOG_NOTICE, "sending messages to ALL customers");
$result = Database::prepare(' $result = $db->query('SELECT `firstname`, `name`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "`");
SELECT `firstname`, `name`, `company`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "`
WHERE `adminid` = :adminid"
);
Database::pexecute($result, array('adminid' => $userinfo['adminid']));
} }
} else { else
{
$log->logAction(ADM_ACTION, LOG_NOTICE, "sending messages to customers");
$result = $db->query('SELECT `firstname`, `name`, `email` FROM `' . TABLE_PANEL_CUSTOMERS . "` WHERE `adminid`='" . $userinfo['adminid'] . "'");
}
}
else
{
standard_error('noreceipientsgiven'); 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 = $result->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))
{
$row['firstname'] = isset($row['firstname']) ? $row['firstname'] : ''; $mail->AddAddress($row['email'], (isset($row['firstname']) ? $row['firstname'] . ' ' : '') . $row['name']);
$row['company'] = isset($row['company']) ? $row['company'] : '';
$mail->AddAddress($row['email'], getCorrectUserSalutation(array('firstname' => $row['firstname'], 'name' => $row['name'], 'company' => $row['company'])));
$mail->From = $userinfo['email']; $mail->From = $userinfo['email'];
$mail->FromName = (isset($userinfo['firstname']) ? $userinfo['firstname'] . ' ' : '') . $userinfo['name']; $mail->FromName = (isset($userinfo['firstname']) ? $userinfo['firstname'] . ' ' : '') . $userinfo['name'];
if (!$mail->Send()) { if(!$mail->Send())
if ($mail->ErrorInfo != '') { {
if($mail->ErrorInfo != '')
{
$mailerr_msg = $mail->ErrorInfo; $mailerr_msg = $mail->ErrorInfo;
} else { }
$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++;
$mail->ClearAddresses(); $mail->ClearAddresses();
} }
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,66 +14,60 @@
* @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';
if (isset($_POST['id'])) { /**
* Include our init.php, which manages Sessions, Language etc.
*/
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 == 'overview') { if($page == 'overview')
{
if ($action == '') { if($action == '')
{
$tablecontent = ''; $tablecontent = '';
$count = 0; $result = $db->query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "`");
$result = Database::query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "`");
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
while($row = $db->fetch_array($result))
{
$domainresult = false; $domainresult = false;
$query_params = array('id' => $row['id']);
$query = "SELECT * FROM `".TABLE_PANEL_DOMAINS."` if((int)$userinfo['domains_see_all'] == 0)
WHERE `phpsettingid` = :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` = :adminid";
$query_params['adminid'] = $userinfo['adminid'];
} }
else
if ((int)Settings::Get('panel.phpconfigs_hidestdsubdomain') == 1) { {
$ssdids_res = Database::query(" $domainresult = $db->query("SELECT * FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `phpsettingid` = " . (int)$row['id']);
SELECT DISTINCT `standardsubdomain` FROM `".TABLE_PANEL_CUSTOMERS."`
WHERE `standardsubdomain` > 0 ORDER BY `standardsubdomain` ASC;"
);
$ssdids = array();
while ($ssd = $ssdids_res->fetch(PDO::FETCH_ASSOC)) {
$ssdids[] = $ssd['standardsubdomain'];
}
if (count($ssdids) > 0) {
$query .= " AND `id` NOT IN (".implode(', ', $ssdids).")";
}
} }
$domainresult_stmt = Database::prepare($query);
Database::pexecute($domainresult_stmt, $query_params);
$domains = ''; $domains = '';
if (Database::num_rows() > 0) {
while ($row2 = $domainresult_stmt->fetch(PDO::FETCH_ASSOC)) { 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") . "\";");
} }
@@ -81,221 +75,111 @@ if ($page == 'overview') {
eval("echo \"" . getTemplate("phpconfig/overview") . "\";"); eval("echo \"" . getTemplate("phpconfig/overview") . "\";");
} }
if ($action == 'add') { if($action == 'add')
{
if ((int)$userinfo['change_serversettings'] == 1) { if((int)$userinfo['change_serversettings'] == 1)
{
if (isset($_POST['send']) if(isset($_POST['send'])
&& $_POST['send'] == 'send' && $_POST['send'] == 'send')
) { {
$description = validate($_POST['description'], 'description'); $description = validate($_POST['description'], 'description');
$binary = makeCorrectFile(validate($_POST['binary'], 'binary'));
$file_extensions = validate($_POST['file_extensions'], 'file_extensions', '/^[a-zA-Z0-9\s]*$/');
$phpsettings = validate(str_replace("\r\n", "\n", $_POST['phpsettings']), 'phpsettings', '/^[^\0]*$/'); $phpsettings = validate(str_replace("\r\n", "\n", $_POST['phpsettings']), 'phpsettings', '/^[^\0]*$/');
$mod_fcgid_starter = validate($_POST['mod_fcgid_starter'], 'mod_fcgid_starter', '/^[0-9]*$/', '', array('-1', ''));
$mod_fcgid_maxrequests = validate($_POST['mod_fcgid_maxrequests'], 'mod_fcgid_maxrequests', '/^[0-9]*$/', '', array('-1', ''));
if (Settings::Get('system.mod_fcgid') == 1) { if(strlen($description) == 0
$binary = makeCorrectFile(validate($_POST['binary'], 'binary')); || strlen($description) > 50)
$file_extensions = validate($_POST['file_extensions'], 'file_extensions', '/^[a-zA-Z0-9\s]*$/'); {
$mod_fcgid_starter = validate($_POST['mod_fcgid_starter'], 'mod_fcgid_starter', '/^[0-9]*$/', '', array('-1', ''));
$mod_fcgid_maxrequests = validate($_POST['mod_fcgid_maxrequests'], 'mod_fcgid_maxrequests', '/^[0-9]*$/', '', array('-1', ''));
// disable fpm stuff
$fpm_enableslowlog = 0;
$fpm_reqtermtimeout = 0;
$fpm_reqslowtimeout = 0;
}
elseif (Settings::Get('phpfpm.enabled') == 1) {
$fpm_enableslowlog = isset($_POST['phpfpm_enable_slowlog']) ? (int)$_POST['phpfpm_enable_slowlog'] : 0;
$fpm_reqtermtimeout = validate($_POST['phpfpm_reqtermtimeout'], 'phpfpm_reqtermtimeout', '/^([0-9]+)(|s|m|h|d)$/');
$fpm_reqslowtimeout = validate($_POST['phpfpm_reqslowtimeout'], 'phpfpm_reqslowtimeout', '/^([0-9]+)(|s|m|h|d)$/');
// disable fcgid stuff
$binary = '/usr/bin/php-cgi';
$file_extensions = 'php';
$mod_fcgid_starter = 0;
$mod_fcgid_maxrequests = 0;
}
if (strlen($description) == 0
|| strlen($description) > 50
) {
standard_error('descriptioninvalid'); standard_error('descriptioninvalid');
} }
$ins_stmt = Database::prepare(" $db->query("INSERT INTO `" . TABLE_PANEL_PHPCONFIGS . "` SET `description` = '" . $db->escape($description) . "', `binary` = '" . $db->escape($binary) . "', `file_extensions` = '" . $db->escape($file_extensions) . "', `mod_fcgid_starter` = '" . $db->escape($mod_fcgid_starter) . "', `mod_fcgid_maxrequests` = '" . $db->escape($mod_fcgid_maxrequests) . "', `phpsettings` = '" . $db->escape($phpsettings) . "'");
INSERT INTO `" . TABLE_PANEL_PHPCONFIGS . "` SET
`description` = :desc,
`binary` = :binary,
`file_extensions` = :fext,
`mod_fcgid_starter` = :starter,
`mod_fcgid_maxrequests` = :mreq,
`fpm_slowlog` = :fpmslow,
`fpm_reqterm` = :fpmreqterm,
`fpm_reqslow` = :fpmreqslow,
`phpsettings` = :phpsettings"
);
$ins_data = array(
'desc' => $description,
'binary' => $binary,
'fext' => $file_extensions,
'starter' => $mod_fcgid_starter,
'mreq' => $mod_fcgid_maxrequests,
'fpmslow' => $fpm_enableslowlog,
'fpmreqterm' => $fpm_reqtermtimeout,
'fpmreqslow' => $fpm_reqslowtimeout,
'phpsettings' => $phpsettings
);
Database::pexecute($ins_stmt, $ins_data);
inserttask('1'); inserttask('1');
$log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with description '" . $description . "' has been created by '" . $userinfo['loginname'] . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with description '" . $description . "' has been created by '" . $userinfo['loginname'] . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
}
} else { else
{
$result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = 1"); $result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = 1");
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$phpconfig_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php';
$phpconfig_add_form = htmlform::genHTMLForm($phpconfig_add_data);
$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") . "\";");
} }
}
} else { else
{
standard_error('nopermissionsorinvalidid'); standard_error('nopermissionsorinvalidid');
} }
} }
if ($action == 'delete') { if($action == 'delete')
{
$result_stmt = Database::prepare(" $result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = " . (int)$id);
SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :id"
);
$result = Database::pexecute_first($result_stmt, array('id' => $id));
if ($result['id'] != 0
&& $result['id'] == $id
&& (int)$userinfo['change_serversettings'] == 1
&& $id != 1 // cannot delete the default php.config
) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
// set php-config to default for all domains using the
// config that is to be deleted
$upd_stmt = Database::prepare("
UPDATE `" . TABLE_PANEL_DOMAINS . "` SET
`phpsettingid` = 1 WHERE `phpsettingid` = :id"
);
Database::pexecute($upd_stmt, array('id' => $id));
$del_stmt = Database::prepare("
DELETE FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :id"
);
Database::pexecute($del_stmt, array('id' => $id));
if($result['id'] != 0
&& $result['id'] == $id
&& (int)$userinfo['change_serversettings'] == 1
&& $id != 1)
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$db->query("UPDATE `" . TABLE_PANEL_DOMAINS . "` SET `phpsettingid` = 1 WHERE `phpsettingid` = " . (int)$id);
$db->query("DELETE FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = " . (int)$id);
inserttask('1'); inserttask('1');
$log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with id #" . (int)$id . " has been deleted by '" . $userinfo['loginname'] . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with id #" . (int)$id . " has been deleted by '" . $userinfo['loginname'] . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
}
} else { else
{
ask_yesno('phpsetting_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['description']); ask_yesno('phpsetting_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['description']);
} }
} else { }
else
{
standard_error('nopermissionsorinvalidid'); standard_error('nopermissionsorinvalidid');
} }
} }
if ($action == 'edit') { if($action == 'edit')
{
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = " . (int)$id);
$result_stmt = Database::prepare(" if($result['id'] != 0
SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = :id" && $result['id'] == $id
); && (int)$userinfo['change_serversettings'] == 1)
$result = Database::pexecute_first($result_stmt, array('id' => $id)); {
if(isset($_POST['send'])
if ($result['id'] != 0 && $_POST['send'] == 'send')
&& $result['id'] == $id {
&& (int)$userinfo['change_serversettings'] == 1
) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$description = validate($_POST['description'], 'description'); $description = validate($_POST['description'], 'description');
$binary = makeCorrectFile(validate($_POST['binary'], 'binary'));
$file_extensions = validate($_POST['file_extensions'], 'file_extensions', '/^[a-zA-Z0-9\s]*$/');
$phpsettings = validate(str_replace("\r\n", "\n", $_POST['phpsettings']), 'phpsettings', '/^[^\0]*$/'); $phpsettings = validate(str_replace("\r\n", "\n", $_POST['phpsettings']), 'phpsettings', '/^[^\0]*$/');
$mod_fcgid_starter = validate($_POST['mod_fcgid_starter'], 'mod_fcgid_starter', '/^[0-9]*$/', '', array('-1', ''));
$mod_fcgid_maxrequests = validate($_POST['mod_fcgid_maxrequests'], 'mod_fcgid_maxrequests', '/^[0-9]*$/', '', array('-1', ''));
if (Settings::Get('system.mod_fcgid') == 1) { if(strlen($description) == 0
$binary = makeCorrectFile(validate($_POST['binary'], 'binary')); || strlen($description) > 50)
$file_extensions = validate($_POST['file_extensions'], 'file_extensions', '/^[a-zA-Z0-9\s]*$/'); {
$mod_fcgid_starter = validate($_POST['mod_fcgid_starter'], 'mod_fcgid_starter', '/^[0-9]*$/', '', array('-1', ''));
$mod_fcgid_maxrequests = validate($_POST['mod_fcgid_maxrequests'], 'mod_fcgid_maxrequests', '/^[0-9]*$/', '', array('-1', ''));
// disable fpm stuff
$fpm_enableslowlog = 0;
$fpm_reqtermtimeout = 0;
$fpm_reqslowtimeout = 0;
}
elseif (Settings::Get('phpfpm.enabled') == 1) {
$fpm_enableslowlog = isset($_POST['phpfpm_enable_slowlog']) ? (int)$_POST['phpfpm_enable_slowlog'] : 0;
$fpm_reqtermtimeout = validate($_POST['phpfpm_reqtermtimeout'], 'phpfpm_reqtermtimeout', '/^([0-9]+)(|s|m|h|d)$/');
$fpm_reqslowtimeout = validate($_POST['phpfpm_reqslowtimeout'], 'phpfpm_reqslowtimeout', '/^([0-9]+)(|s|m|h|d)$/');
// disable fcgid stuff
$binary = '/usr/bin/php-cgi';
$file_extensions = 'php';
$mod_fcgid_starter = 0;
$mod_fcgid_maxrequests = 0;
}
if (strlen($description) == 0
|| strlen($description) > 50
) {
standard_error('descriptioninvalid'); standard_error('descriptioninvalid');
} }
$upd_stmt = Database::prepare(" $db->query("UPDATE `" . TABLE_PANEL_PHPCONFIGS . "` SET `description` = '" . $db->escape($description) . "', `binary` = '" . $db->escape($binary) . "', `file_extensions` = '" . $db->escape($file_extensions) . "', `mod_fcgid_starter` = '" . $db->escape($mod_fcgid_starter) . "', `mod_fcgid_maxrequests` = '" . $db->escape($mod_fcgid_maxrequests) . "', `phpsettings` = '" . $db->escape($phpsettings) . "' WHERE `id` = " . (int)$id);
UPDATE `" . TABLE_PANEL_PHPCONFIGS . "` SET
`description` = :desc,
`binary` = :binary,
`file_extensions` = :fext,
`mod_fcgid_starter` = :starter,
`mod_fcgid_maxrequests` = :mreq,
`fpm_slowlog` = :fpmslow,
`fpm_reqterm` = :fpmreqterm,
`fpm_reqslow` = :fpmreqslow,
`phpsettings` = :phpsettings
WHERE `id` = :id"
);
$upd_data = array(
'desc' => $description,
'binary' => $binary,
'fext' => $file_extensions,
'starter' => $mod_fcgid_starter,
'mreq' => $mod_fcgid_maxrequests,
'fpmslow' => $fpm_enableslowlog,
'fpmreqterm' => $fpm_reqtermtimeout,
'fpmreqslow' => $fpm_reqslowtimeout,
'phpsettings' => $phpsettings,
'id' => $id
);
Database::pexecute($upd_stmt, $upd_data);
inserttask('1'); inserttask('1');
$log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with description '" . $description . "' has been changed by '" . $userinfo['loginname'] . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "php.ini setting with description '" . $description . "' has been changed by '" . $userinfo['loginname'] . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
}
} 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") . "\";");
} }
}
} else { else
{
standard_error('nopermissionsorinvalidid'); standard_error('nopermissionsorinvalidid');
} }
} }
} }
?>

View File

@@ -14,57 +14,60 @@
* @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';
// get sql-root access data /**
Database::needRoot(true); * Include our init.php, which manages Sessions, Language etc.
Database::needSqlData(); */
$sql_root = Database::getSqlData();
Database::needRoot(false);
if ($page == 'overview' && $userinfo['change_serversettings'] == '1') { $need_db_sql_data = true;
$need_root_db_sql_data = true;
require ("./lib/init.php");
if(($page == 'settings' || $page == 'overview')
&& $userinfo['change_serversettings'] == '1')
{
$settings_data = loadConfigArrayDir('./actions/admin/settings/'); $settings_data = loadConfigArrayDir('./actions/admin/settings/');
$settings = loadSettings($settings_data); $settings = loadSettings($settings_data, $db);
if (isset($_POST['send']) if(isset($_POST['send'])
&& $_POST['send'] == 'send' && $_POST['send'] == 'send')
) { {
$_part = isset($_GET['part']) ? $_GET['part'] : ''; $_part = isset($_GET['part']) ? $_GET['part'] : '';
if ($_part == '') {
if($_part == '')
{
$_part = isset($_POST['part']) ? $_POST['part'] : ''; $_part = isset($_POST['part']) ? $_POST['part'] : '';
} }
if ($_part != '') { if($_part != '')
if ($_part == 'all') { {
if($_part == 'all')
{
$settings_all = true; $settings_all = true;
$settings_part = false; $settings_part = false;
} else { }
else
{
$settings_all = false; $settings_all = false;
$settings_part = true; $settings_part = true;
} }
$only_enabledisable = false;
} else { $only_enabledisable = false;
}
else
{
$settings_all = false; $settings_all = false;
$settings_part = false; $settings_part = false;
$only_enabledisable = true; $only_enabledisable = true;
} }
// check if the session timeout is too low #815 if(processFormEx(
if (isset($_POST['session_sessiontimeout']) $settings_data,
&& $_POST['session_sessiontimeout'] < 60 $_POST,
) {
standard_error($lng['error']['session_timeout'], $lng['error']['session_timeout_desc']);
}
if (processFormEx(
$settings_data,
$_POST,
array('filename' => $filename, 'action' => $action, 'page' => $page), array('filename' => $filename, 'action' => $action, 'page' => $page),
$_part, $_part,
$settings_all, $settings_all,
@@ -72,216 +75,143 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$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));
} }
}
} else { else
{
$_part = isset($_GET['part']) ? $_GET['part'] : ''; $_part = isset($_GET['part']) ? $_GET['part'] : '';
if ($_part == '') {
if($_part == '')
{
$_part = isset($_POST['part']) ? $_POST['part'] : ''; $_part = isset($_POST['part']) ? $_POST['part'] : '';
} }
$fields = buildFormEx($settings_data, $_part); $fields = buildFormEx($settings_data, $_part);
$settings_page = ''; $settings_page = '';
if ($_part == '') { if($_part == '')
{
eval("\$settings_page .= \"" . getTemplate("settings/settings_overview") . "\";"); eval("\$settings_page .= \"" . getTemplate("settings/settings_overview") . "\";");
} else { }
else
{
eval("\$settings_page .= \"" . getTemplate("settings/settings") . "\";"); eval("\$settings_page .= \"" . getTemplate("settings/settings") . "\";");
} }
eval("echo \"" . getTemplate("settings/settings_form_begin") . "\";"); eval("echo \"" . getTemplate("settings/settings_form_begin") . "\";");
eval("echo \$settings_page;"); eval("echo \$settings_page;");
eval("echo \"" . getTemplate("settings/settings_form_end") . "\";"); eval("echo \"" . getTemplate("settings/settings_form_end") . "\";");
} }
}
} elseif($page == 'phpinfo' elseif($page == 'rebuildconfigs'
&& $userinfo['change_serversettings'] == '1' && $userinfo['change_serversettings'] == '1')
) { {
ob_start(); if(isset($_POST['send'])
phpinfo(); && $_POST['send'] == 'send')
$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'
&& $userinfo['change_serversettings'] == '1'
) {
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$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
{
ask_yesno('admin_configs_reallyrebuild', $filename, array('page' => $page)); ask_yesno('admin_configs_reallyrebuild', $filename, array('page' => $page));
} }
}
} elseif($page == 'updatecounters' elseif($page == 'updatecounters'
&& $userinfo['change_serversettings'] == '1' && $userinfo['change_serversettings'] == '1')
) { {
if(isset($_POST['send'])
if (isset($_POST['send']) && $_POST['send'] == 'send')
&& $_POST['send'] == 'send' {
) {
$log->logAction(ADM_ACTION, LOG_INFO, "updated resource-counters"); $log->logAction(ADM_ACTION, LOG_INFO, "updated resource-counters");
$updatecounters = updateCounters(true); $updatecounters = updateCounters(true);
$customers = ''; $customers = '';
foreach ($updatecounters['customers'] as $customerid => $customer) { foreach($updatecounters['customers'] as $customerid => $customer)
{
eval("\$customers.=\"" . getTemplate("settings/updatecounters_row_customer") . "\";"); eval("\$customers.=\"" . getTemplate("settings/updatecounters_row_customer") . "\";");
} }
$admins = ''; $admins = '';
foreach ($updatecounters['admins'] as $adminid => $admin) { foreach($updatecounters['admins'] as $adminid => $admin)
{
eval("\$admins.=\"" . getTemplate("settings/updatecounters_row_admin") . "\";"); eval("\$admins.=\"" . getTemplate("settings/updatecounters_row_admin") . "\";");
} }
eval("echo \"" . getTemplate("settings/updatecounters") . "\";"); eval("echo \"" . getTemplate("settings/updatecounters") . "\";");
}
} else { else
{
ask_yesno('admin_counters_reallyupdate', $filename, array('page' => $page)); ask_yesno('admin_counters_reallyupdate', $filename, array('page' => $page));
} }
}
} elseif ($page == 'wipecleartextmailpws' elseif($page == 'wipecleartextmailpws'
&& $userinfo['change_serversettings'] == '1' && $userinfo['change_serversettings'] == '1')
) { {
if(isset($_POST['send'])
if (isset($_POST['send']) && $_POST['send'] == 'send')
&& $_POST['send'] == 'send' {
) {
$log->logAction(ADM_ACTION, LOG_WARNING, "wiped all cleartext mail passwords"); $log->logAction(ADM_ACTION, LOG_WARNING, "wiped all cleartext mail passwords");
Database::query("UPDATE `" . TABLE_MAIL_USERS . "` SET `password` = '';"); $db->query("UPDATE `" . TABLE_MAIL_USERS . "` SET `password`='' ");
Database::query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '0' WHERE `settinggroup` = 'system' AND `varname` = 'mailpwcleartext'"); $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value`='0' WHERE `settinggroup`='system' AND `varname`='mailpwcleartext'");
redirectTo('admin_settings.php', array('s' => $s)); redirectTo('admin_settings.php', array('s' => $s));
}
} else { else
{
ask_yesno('admin_cleartextmailpws_reallywipe', $filename, array('page' => $page)); ask_yesno('admin_cleartextmailpws_reallywipe', $filename, array('page' => $page));
} }
}
} elseif($page == 'wipequotas' elseif($page == 'wipequotas'
&& $userinfo['change_serversettings'] == '1' && $userinfo['change_serversettings'] == '1')
) { {
if(isset($_POST['send'])
if (isset($_POST['send']) && $_POST['send'] == 'send')
&& $_POST['send'] == 'send' {
) {
$log->logAction(ADM_ACTION, LOG_WARNING, "wiped all mailquotas"); $log->logAction(ADM_ACTION, LOG_WARNING, "wiped all mailquotas");
// Set the quota to 0 which means unlimited // Set the quota to 0 which means unlimited
Database::query("UPDATE `" . TABLE_MAIL_USERS . "` SET `quota` = '0';");
Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_quota_used` = '0'");
redirectTo('admin_settings.php', array('s' => $s));
} else { $db->query("UPDATE `" . TABLE_MAIL_USERS . "` SET `quota`='0' ");
$db->query("UPDATE " . TABLE_PANEL_CUSTOMERS . " SET `email_quota_used` = 0");
redirectTo('admin_settings.php', array('s' => $s));
}
else
{
ask_yesno('admin_quotas_reallywipe', $filename, array('page' => $page)); ask_yesno('admin_quotas_reallywipe', $filename, array('page' => $page));
} }
}
} elseif ($page == 'enforcequotas' elseif($page == 'enforcequotas'
&& $userinfo['change_serversettings'] == '1' && $userinfo['change_serversettings'] == '1')
) { {
if (isset($_POST['send']) if(isset($_POST['send'])
&& $_POST['send'] == 'send' && $_POST['send'] == 'send')
) { {
// Fetch all accounts // Fetch all accounts
$result_stmt = Database::query("SELECT `quota`, `customerid` FROM `" . TABLE_MAIL_USERS . "`");
if (Database::num_rows() > 0) { $result = $db->query("SELECT `quota`, `customerid` FROM " . TABLE_MAIL_USERS);
$upd_stmt = Database::prepare(" while($array = $db->fetch_array($result))
UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET {
`email_quota_used` = `email_quota_used` + :diff $difference = $settings['system']['mail_quota'] - $array['quota'];
WHERE `customerid` = :customerid $db->query("UPDATE " . TABLE_PANEL_CUSTOMERS . " SET `email_quota_used` = `email_quota_used` + " . (int)$difference . " WHERE `customerid` = '" . $array['customerid'] . "'");
");
while ($array = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$difference = Settings::Get('system.mail_quota') - $array['quota'];
Database::pexecute($upd_stmt, array('diff' => $difference, 'customerid' => $customerid));
}
} }
// Set the new quota // Set the new quota
$upd_stmt = Database::prepare("
UPDATE `" . TABLE_MAIL_USERS . "` SET `quota` = :quota $db->query("UPDATE `" . TABLE_MAIL_USERS . "` SET `quota`='" . $settings['system']['mail_quota'] . "'");
");
Database::pexecute($upd_stmt, array('quota' => Settings::Get('system.mail_quota')));
// Update the Customer, if the used quota is bigger than the allowed quota // Update the Customer, if the used quota is bigger than the allowed quota
Database::query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `email_quota` = `email_quota_used` WHERE `email_quota` < `email_quota_used`");
$log->logAction(ADM_ACTION, LOG_WARNING, 'enforcing mailquota to all customers: ' . Settings::Get('system.mail_quota') . ' MB');
redirectTo('admin_settings.php', array('s' => $s));
} else { $db->query("UPDATE " . TABLE_PANEL_CUSTOMERS . " SET `email_quota` = `email_quota_used` WHERE `email_quota` < `email_quota_used`");
$log->logAction(ADM_ACTION, LOG_WARNING, 'enforcing mailquota to all customers: ' . $settings['system']['mail_quota'] . ' MB');
redirectTo('admin_settings.php', array('s' => $s));
}
else
{
ask_yesno('admin_quotas_reallyenforce', $filename, array('page' => $page)); ask_yesno('admin_quotas_reallyenforce', $filename, array('page' => $page));
} }
} elseif ($page == 'integritycheck' }
&& $userinfo['change_serversettings'] == '1'
) {
$integrity = new IntegrityCheck();
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
$integrity->fixAll();
} elseif(isset($_GET['action'])
&& $_GET['action'] == "fix") {
ask_yesno('admin_integritycheck_reallyfix', $filename, array('page' => $page));
}
$integritycheck = '';
foreach ($integrity->available as $id => $check) {
$displayid = $id + 1;
$result = $integrity->$check();
eval("\$integritycheck.=\"" . getTemplate("settings/integritycheck_row") . "\";");
}
eval("echo \"" . getTemplate("settings/integritycheck") . "\";");
}

View File

@@ -14,83 +14,80 @@
* @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';
if (isset($_POST['subjectid'])) { /**
* Include our init.php, which manages Sessions, Language etc.
*/
require ("./lib/init.php");
if(isset($_POST['subjectid']))
{
$subjectid = intval($_POST['subjectid']); $subjectid = intval($_POST['subjectid']);
$mailbodyid = intval($_POST['mailbodyid']); $mailbodyid = intval($_POST['mailbodyid']);
}
} elseif(isset($_GET['subjectid'])) { elseif(isset($_GET['subjectid']))
{
$subjectid = intval($_GET['subjectid']); $subjectid = intval($_GET['subjectid']);
$mailbodyid = intval($_GET['mailbodyid']); $mailbodyid = intval($_GET['mailbodyid']);
} }
if (isset($_POST['id'])) { if(isset($_POST['id']))
{
$id = intval($_POST['id']); $id = intval($_POST['id']);
}
} elseif(isset($_GET['id'])) { elseif(isset($_GET['id']))
{
$id = intval($_GET['id']); $id = intval($_GET['id']);
} }
$available_templates = array( $available_templates = array(
'createcustomer', 'createcustomer',
'pop_success', 'pop_success',
'trafficninetypercent',
'new_ticket_by_customer',
'new_ticket_for_customer',
'new_ticket_by_staff',
'new_reply_ticket_by_customer',
'new_reply_ticket_by_staff',
'new_database_by_customer', 'new_database_by_customer',
'new_ftpaccount_by_customer', 'new_ftpaccount_by_customer',
'password_reset' 'password_reset'
); );
// only show templates of features that are enabled #1191
if ((int)Settings::Get('system.report_enable') == 1) {
array_push($available_templates,
'trafficmaxpercent',
'diskmaxpercent'
);
}
if ((int)Settings::Get('ticket.enabled') == 1) {
array_push($available_templates,
'new_ticket_by_customer',
'new_ticket_for_customer',
'new_ticket_by_staff',
'new_reply_ticket_by_customer',
'new_reply_ticket_by_staff'
);
}
$file_templates = array( $file_templates = array(
'index_html' 'index_html'
); );
if ($action == '') { if($action == '')
{
//email templates //email templates
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_templates"); $log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_templates");
if (Settings::Get('panel.sendalternativemail') == 1) { if($settings['panel']['sendalternativemail'] == 1)
{
$available_templates[] = 'pop_success_alternative'; $available_templates[] = 'pop_success_alternative';
} }
$templates_array = array(); $templates_array = array();
$result_stmt = Database::prepare(" $result = $db->query("SELECT `id`, `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `templategroup`='mails' ORDER BY `language`, `varname`");
SELECT `id`, `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `templategroup`='mails'
ORDER BY `language`, `varname`"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid']));
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))
{
$parts = array(); $parts = array();
preg_match('/^([a-z]([a-z_]+[a-z])*)_(mailbody|subject)$/', $row['varname'], $parts); preg_match('/^([a-z]([a-z_]+[a-z])*)_(mailbody|subject)$/', $row['varname'], $parts);
$templates_array[$row['language']][$parts[1]][$parts[3]] = $row['id']; $templates_array[$row['language']][$parts[1]][$parts[3]] = $row['id'];
} }
$templates = ''; $templates = '';
foreach ($templates_array as $language => $template_defs) { foreach($templates_array as $language => $template_defs)
foreach ($template_defs as $action => $email) { {
foreach($template_defs as $action => $email)
{
$subjectid = $email['subject']; $subjectid = $email['subject'];
$mailbodyid = $email['mailbody']; $mailbodyid = $email['mailbody'];
$template = $lng['admin']['templates'][$action]; $template = $lng['admin']['templates'][$action];
@@ -99,411 +96,289 @@ if ($action == '') {
} }
$add = false; $add = false;
while (list($language_file, $language_name) = each($languages)) {
while(list($language_file, $language_name) = each($languages))
{
$templates_done = array(); $templates_done = array();
$result_stmt = Database::prepare(" $result = $db->query('SELECT `varname` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($language_name) . '\' AND `templategroup`=\'mails\' AND `varname` LIKE \'%_subject\'');
SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `language`= :lang
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'lang' => $language_name));
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while(($row = $db->fetch_array($result)) != false)
{
$templates_done[] = str_replace('_subject', '', $row['varname']); $templates_done[] = str_replace('_subject', '', $row['varname']);
} }
if (count(array_diff($available_templates, $templates_done)) > 0) { if(count(array_diff($available_templates, $templates_done)) > 0)
{
$add = true; $add = true;
} }
} }
//filetemplates //filetemplates
$filetemplates = ''; $filetemplates = '';
$filetemplateadd = false; $filetemplateadd = false;
$result_stmt = Database::prepare(" $result = $db->query("SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `templategroup`='files'");
SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `templategroup`='files'"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid']));
if (Database::num_rows() != count($file_templates)) { if($db->num_rows($result) != count($file_templates))$filetemplateadd = true;
$filetemplateadd = true;
}
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))
{
eval("\$filetemplates.=\"" . getTemplate("templates/templates_filetemplate") . "\";"); eval("\$filetemplates.=\"" . getTemplate("templates/templates_filetemplate") . "\";");
} }
eval("echo \"" . getTemplate("templates/templates") . "\";"); eval("echo \"" . getTemplate("templates/templates") . "\";");
}
} elseif($action == 'delete' elseif($action == 'delete'
&& $subjectid != 0 && $subjectid != 0
&& $mailbodyid != 0 && $mailbodyid != 0)
) { {
//email templates //email templates
$result_stmt = Database::prepare("
SELECT `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :id"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'id' => $subjectid));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if ($result['varname'] != '') { $result = $db->query_first("SELECT `language`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$subjectid . "'");
if (isset($_POST['send'])
&& $_POST['send'] == 'send' if($result['varname'] != '')
) { {
$del_stmt = Database::prepare(" if(isset($_POST['send'])
DELETE FROM `" . TABLE_PANEL_TEMPLATES . "` && $_POST['send'] == 'send')
WHERE `adminid` = :adminid {
AND (`id` = :ida OR `id` = :idb)" $db->query("DELETE FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND (`id`='" . (int)$subjectid . "' OR `id`='" . (int)$mailbodyid . "')");
);
Database::pexecute($del_stmt, array(
'adminid' => $userinfo['adminid'],
'ida' => $subjectid,
'idb' => $mailbodyid
));
$log->logAction(ADM_ACTION, LOG_INFO, "deleted template '" . $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])] . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "deleted template '" . $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])] . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
}
} else { else
{
ask_yesno('admin_template_reallydelete', $filename, array('subjectid' => $subjectid, 'mailbodyid' => $mailbodyid, 'page' => $page, 'action' => $action), $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])]); ask_yesno('admin_template_reallydelete', $filename, array('subjectid' => $subjectid, 'mailbodyid' => $mailbodyid, 'page' => $page, 'action' => $action), $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])]);
} }
} }
}
} elseif($action == 'deletef' elseif($action == 'delete'
&& $id != 0 && $id != 0)
) { {
//file templates //file templates
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :id"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'id' => $id));
if (Database::num_rows() > 0) { $result = $db->query("SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$id . "'");
$row = $result_stmt->fetch(PDO::FETCH_ASSOC); if($db->num_rows($result) > 0)
{
$row = $db->fetch_array($result);
if (isset($_POST['send']) if(isset($_POST['send'])
&& $_POST['send'] == 'send' && $_POST['send'] == 'send')
) { {
$del_stmt = Database::prepare(" $db->query("DELETE FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`=" . (int)$userinfo['adminid'] . " AND `id`=" . (int)$id . "");
DELETE FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :id"
);
Database::pexecute($del_stmt, array('adminid' => $userinfo['adminid'], 'id' => $id));
$log->logAction(ADM_ACTION, LOG_INFO, "deleted template '" . $lng['admin']['templates'][$row['varname']] . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "deleted template '" . $lng['admin']['templates'][$row['varname']] . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
}
} else { else
{
ask_yesno('admin_template_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $lng['admin']['templates'][$row['varname']]); ask_yesno('admin_template_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $lng['admin']['templates'][$row['varname']]);
} }
}
} else { else
{
standard_error('templatenotfound'); standard_error('templatenotfound');
exit; exit;
} }
}
} elseif($action == 'add') { elseif($action == 'add')
{
if (Settings::Get('panel.sendalternativemail') == 1) { if($settings['panel']['sendalternativemail'] == 1)
{
$available_templates[] = 'pop_success_alternative'; $available_templates[] = 'pop_success_alternative';
} }
if (isset($_POST['prepare']) if(isset($_POST['prepare'])
&& $_POST['prepare'] == 'prepare' && $_POST['prepare'] == 'prepare')
) { {
//email templates //email templates
$language = validate($_POST['language'], 'language'); $language = validate($_POST['language'], 'language');
$templates = array(); $templates = array();
$result_stmt = Database::prepare(" $result = $db->query('SELECT `varname` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($language) . '\' AND `templategroup`=\'mails\' AND `varname` LIKE \'%_subject\'');
SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid`= :adminid AND `language`= :lang
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'lang' => $language));
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while(($row = $db->fetch_array($result)) != false)
{
$templates[] = str_replace('_subject', '', $row['varname']); $templates[] = str_replace('_subject', '', $row['varname']);
} }
$templates = array_diff($available_templates, $templates); $templates = array_diff($available_templates, $templates);
$template_options = ''; $template_options = '';
foreach ($templates as $template) { foreach($templates as $template)
{
$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'])
&& $_POST['send'] == 'send' && $_POST['send'] == 'send')
) { {
//email templates //email templates
$language = validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect'); $language = validate($_POST['language'], 'language', '/^[^\r\n\0"\']+$/', 'nolanguageselect');
$template = validate($_POST['template'], 'template'); $template = validate($_POST['template'], 'template');
$subject = validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate'); $subject = validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate');
$mailbody = validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate'); $mailbody = validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate');
$templates = array(); $templates = array();
$result_stmt = Database::prepare(" $result = $db->query('SELECT `varname` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($language) . '\' AND `templategroup`=\'mails\' AND `varname` LIKE \'%_subject\'');
SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `language` = :lang
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'lang' => $language));
while($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while(($row = $db->fetch_array($result)) != false)
{
$templates[] = str_replace('_subject', '', $row['varname']); $templates[] = str_replace('_subject', '', $row['varname']);
} }
$templates = array_diff($available_templates, $templates); $templates = array_diff($available_templates, $templates);
if (array_search($template, $templates) === false) {
if(array_search($template, $templates) === false)
{
standard_error('templatenotfound'); standard_error('templatenotfound');
} else {
$ins_stmt = Database::prepare("
INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` SET
`adminid` = :adminid,
`language` = :lang,
`templategroup` = 'mails',
`varname` = :var,
`value` = :value"
);
// mail-subject
$ins_data = array(
'adminid' => $userinfo['adminid'],
'lang' => $language,
'var' => $template.'_subject',
'value' => $subject
);
Database::pexecute($ins_stmt, $ins_data);
// mail-body
$ins_data = array(
'adminid' => $userinfo['adminid'],
'lang' => $language,
'var' => $template.'_mailbody',
'value' => $mailbody
);
Database::pexecute($ins_stmt, $ins_data);
$log->logAction(ADM_ACTION, LOG_INFO, "added template '" . $language . ' - ' . $template . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
} }
else
} elseif(isset($_POST['filesend']) {
&& $_POST['filesend'] == 'filesend' $result = $db->query("INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` (`adminid`, `language`, `templategroup`, `varname`, `value`)
) { VALUES ('" . (int)$userinfo['adminid'] . "', '" . $db->escape($language) . "', 'mails', '" . $db->escape($template) . "_subject','" . $db->escape($subject) . "')");
$result = $db->query("INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` (`adminid`, `language`, `templategroup`, `varname`, `value`)
VALUES ('" . (int)$userinfo['adminid'] . "', '" . $db->escape($language) . "', 'mails', '" . $db->escape($template) . "_mailbody','" . $db->escape($mailbody) . "')");
$log->logAction(ADM_ACTION, LOG_INFO, "added template '" . $language . ' - ' . $template . "'");
redirectTo($filename, Array('page' => $page, 's' => $s));
}
}
elseif(isset($_POST['filesend'])
&& $_POST['filesend'] == 'filesend')
{
//file templates //file templates
$template = validate($_POST['template'], 'template'); $template = validate($_POST['template'], 'template');
$filecontent = validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset'); $filecontent = validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset');
$db->query("INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` (`adminid`, `language`, `templategroup`, `varname`, `value`)
$ins_stmt = Database::prepare(" VALUES ('" . (int)$userinfo['adminid'] . "', '', 'files', '" . $db->escape($template) . "','" . $db->escape($filecontent) . "')");
INSERT INTO `" . TABLE_PANEL_TEMPLATES . "` SET
`adminid` = :adminid,
`language` = '',
`templategroup` = 'files',
`varname` = :var,
`value` = :value"
);
$ins_data = array(
'adminid' => $userinfo['adminid'],
'var' => $template,
'value' => $filecontent
);
Database::pexecute($ins_stmt, $ins_data);
$log->logAction(ADM_ACTION, LOG_INFO, "added template '" . $template . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "added template '" . $template . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
}
} elseif(!isset($_GET['files'])) { elseif(!isset($_GET['files']))
{
//email templates //email templates
$add = false; $add = false;
$language_options = ''; $language_options = '';
while (list($language_file, $language_name) = each($languages)) { while(list($language_file, $language_name) = each($languages))
{
$templates = array(); $templates = array();
$result_stmt = Database::prepare(" $result = $db->query('SELECT `varname` FROM `' . TABLE_PANEL_TEMPLATES . '` WHERE `adminid`=\'' . (int)$userinfo['adminid'] . '\' AND `language`=\'' . $db->escape($language_name) . '\' AND `templategroup`=\'mails\' AND `varname` LIKE \'%_subject\'');
SELECT `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `language` = :lang
AND `templategroup` = 'mails' AND `varname` LIKE '%_subject'"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'lang' => $language_name));
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while(($row = $db->fetch_array($result)) != false)
{
$templates[] = str_replace('_subject', '', $row['varname']); $templates[] = str_replace('_subject', '', $row['varname']);
} }
if (count(array_diff($available_templates, $templates)) > 0) { if(count(array_diff($available_templates, $templates)) > 0)
{
$add = true; $add = true;
$language_options.= makeoption($language_name, $language_file, $userinfo['language'], true); $language_options.= makeoption($language_name, $language_file, $userinfo['language'], true);
} }
} }
if ($add) { if($add)
{
eval("echo \"" . getTemplate("templates/templates_add_1") . "\";"); eval("echo \"" . getTemplate("templates/templates_add_1") . "\";");
} else { }
else
{
standard_error('alltemplatesdefined'); standard_error('alltemplatesdefined');
exit; exit;
} }
}
} else { else
{
//filetemplates //filetemplates
$result_stmt = Database::prepare("
SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `templategroup`='files'"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid']));
if (Database::num_rows() == count($file_templates)) { $result = $db->query("SELECT `id`, `varname` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `templategroup`='files'");
if($db->num_rows($result) == count($file_templates))
{
standard_error('alltemplatesdefined'); standard_error('alltemplatesdefined');
exit; exit;
}
} else { else
{
$templatesdefined = array(); $templatesdefined = array();
$free_templates = ''; $free_templates = '';
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))$templatesdefined[] = $row['varname'];
$templatesdefined[] = $row['varname']; foreach(array_diff($file_templates, $templatesdefined) as $template)
} {
foreach (array_diff($file_templates, $templatesdefined) as $template) {
$free_templates.= makeoption($lng['admin']['templates'][$template], $template, '', true); $free_templates.= 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") . "\";");
} }
} }
}
} elseif($action == 'edit' elseif($action == 'edit'
&& $subjectid != 0 && $subjectid != 0
&& $mailbodyid != 0 && $mailbodyid != 0)
) { {
//email templates //email templates
$result_stmt = Database::prepare("
SELECT `language`, `varname`, `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :subjectid"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'subjectid' => $subjectid));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if ($result['varname'] != '') { $result = $db->query_first("SELECT `language`, `varname`, `value` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$subjectid . "'");
if (isset($_POST['send']) if($result['varname'] != '')
&& $_POST['send'] == 'send' {
) { if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$subject = validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate'); $subject = validate($_POST['subject'], 'subject', '/^[^\r\n\0]+$/', 'nosubjectcreate');
$mailbody = validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate'); $mailbody = validate($_POST['mailbody'], 'mailbody', '/^[^\0]+$/', 'nomailbodycreate');
$db->query("UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET `value`='" . $db->escape($subject) . "' WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$subjectid . "'");
$upd_stmt = Database::prepare(" $db->query("UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET `value`='" . $db->escape($mailbody) . "' WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$mailbodyid . "'");
UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET
`value` = :value
WHERE `adminid` = :adminid AND `id` = :id"
);
// subject
Database::pexecute($upd_stmt, array(
'value' => $subject,
'adminid' => $userinfo['adminid'],
'id' => $subjectid
));
// same query but mailbody
Database::pexecute($upd_stmt, array(
'value' => $mailbody,
'adminid' => $userinfo['adminid'],
'id' => $mailbodyid
));
$log->logAction(ADM_ACTION, LOG_INFO, "edited template '" . $result['varname'] . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "edited template '" . $result['varname'] . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
}
} else { else
{
$result = htmlentities_array($result); $result = htmlentities_array($result);
$template = $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])]; $template = $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])];
$subject = $result['value']; $subject = $result['value'];
$result_stmt = Database::prepare(" $result = $db->query_first("SELECT `language`, `varname`, `value` FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `id`='$mailbodyid'");
SELECT `language`, `varname`, `value`
FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `id` = :id"
);
Database::pexecute($result_stmt, array('id' => $mailbodyid));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$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
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid AND `id` = :id"
);
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'id' => $id));
if(Database::num_rows() > 0) { $result = $db->query("SELECT * FROM `" . TABLE_PANEL_TEMPLATES . "` WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$id . "'");
$row = $result_stmt->fetch(PDO::FETCH_ASSOC); if($db->num_rows($result) > 0)
{
$row = $db->fetch_array($result);
//filetemplates //filetemplates
if (isset($_POST['filesend'])
&& $_POST['filesend'] == 'filesend' if(isset($_POST['filesend'])
) { && $_POST['filesend'] == 'filesend')
{
$filecontent = validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset'); $filecontent = validate($_POST['filecontent'], 'filecontent', '/^[^\0]+$/', 'filecontentnotset');
$upd_stmt = Database::prepare(" $db->query("UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET `value`='" . $db->escape($filecontent) . "' WHERE `adminid`='" . (int)$userinfo['adminid'] . "' AND `id`='" . (int)$id . "'");
UPDATE `" . TABLE_PANEL_TEMPLATES . "` SET
`value` = :value
WHERE `adminid` = :adminid AND `id` = :id"
);
Database::pexecute($upd_stmt, array(
'value' => $filecontent,
'adminid' => $userinfo['adminid'],
'id' => $id
));
$log->logAction(ADM_ACTION, LOG_INFO, "edited template '" . $row['varname'] . "'"); $log->logAction(ADM_ACTION, LOG_INFO, "edited template '" . $row['varname'] . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
}
} 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") . "\";");
} }
}
} else { else
{
standard_error('templatenotfound'); standard_error('templatenotfound');
exit; exit;
} }
} }
?>

File diff suppressed because it is too large Load Diff

View File

@@ -1,142 +0,0 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Morton Jonuschat <m.jonuschat@chrome-it.de>
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
* @package Panel
*
*/
define('AREA', 'admin');
require './lib/init.php';
if ($action == 'logout') {
$logout_stmt = Database::prepare("
DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :adminid
AND `adminsession` = '1'"
);
Database::pexecute($logout_stmt, array('adminid' => $userinfo['adminid']));
redirectTo('index.php');
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') {
$customerview = 1;
$stats_tables = '';
$minyear_stmt = Database::query("SELECT `year` FROM `". TABLE_PANEL_TRAFFIC . "` ORDER BY `year` ASC LIMIT 1");
$minyear = $minyear_stmt->fetch(PDO::FETCH_ASSOC);
if (!isset($minyear['year']) || $minyear['year'] == 0) {
$maxyears = 0;
} else {
$maxyears = date("Y") - $minyear['year'];
}
for ($years = 0; $years<=$maxyears; $years++) {
$overview['year'] = date("Y")-$years;
$overview['type'] = $lng['traffic']['customer'];
$domain_list = '';
$totals = array(
'jan' => 0,
'feb' => 0,
'mar' => 0,
'apr' => 0,
'may' => 0,
'jun' => 0,
'jul' => 0,
'aug' => 0,
'sep' => 0,
'oct' => 0,
'nov' => 0,
'dec' => 0,
);
$customer_name_list_stmt = Database::prepare("
SELECT `customerid`,`company`,`name`,`firstname`
FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE `deactivated`='0'" .
($userinfo['customers_see_all'] ? '' : " AND `adminid` = :id") . "
ORDER BY name"
);
Database::pexecute($customer_name_list_stmt, array('id' => $userinfo['adminid']));
while($customer_name = $customer_name_list_stmt->fetch(PDO::FETCH_ASSOC)) {
$virtual_host = array(
'name' => ($customer_name['company'] == '' ? $customer_name['name'] . ", " . $customer_name['firstname'] : $customer_name['company']),
'customerid' => $customer_name['customerid'],
'jan' => '-',
'feb' => '-',
'mar' => '-',
'apr' => '-',
'may' => '-',
'jun' => '-',
'jul' => '-',
'aug' => '-',
'sep' => '-',
'oct' => '-',
'nov' => '-',
'dec' => '-',
);
$traffic_list_stmt = Database::prepare("
SELECT month, SUM(http+ftp_up+ftp_down+mail)*1024 AS traffic
FROM `" . TABLE_PANEL_TRAFFIC . "`
WHERE year = :year AND `customerid` = :id
GROUP BY month ORDER BY month"
);
Database::pexecute($traffic_list_stmt, array('year' => (date("Y")-$years), 'id' => $customer_name['customerid']));
while ($traffic_month = $traffic_list_stmt->fetch(PDO::FETCH_ASSOC)) {
$virtual_host[$months[(int)$traffic_month['month']]] = size_readable($traffic_month['traffic'], 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s');
$totals[$months[(int)$traffic_month['month']]] += $traffic_month['traffic'];
}
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::Get('panel.decimal_places').'f %s'));
}
$customerview = 0;
eval("\$total_list = sprintf(\"%s\", \"" . getTemplate("traffic/index_table_row") . "\");");
eval("\$stats_tables .= sprintf(\"%s\", \"" . getTemplate("traffic/index_table") . "\");");
}
eval("echo \"" . getTemplate("traffic/index") . "\";");
}

View File

@@ -12,28 +12,30 @@
* @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");
/** /**
* this is a dirty hack but syscp 1.4.2.1 does not * this is a dirty hack but syscp 1.4.2.1 does not
* have any version/dbversion in the database (don't know why) * has any version/dbversion in the database (don't know why)
* so we have to set them both to run a correct upgrade * so we have to set them both to run a correct upgrade
*/ */
if (!isFroxlor()) { if (!isFroxlor()) {
if (Settings::Get('panel.version') == null if (!isset($settings['panel']['version'])
|| Settings::Get('panel.version') == '' || $settings['panel']['version'] == ''
) { ) {
Settings::Set('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']."')");
} }
if (Settings::Get('system.dbversion') == null if (!isset($settings['system']['dbversion'])
|| Settings::Get('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
@@ -41,70 +43,82 @@ 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_stmt = Database::query("
SELECT `value` FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'dbversion'" $result = $db->query_first("SELECT `value` FROM `" . TABLE_PANEL_SETTINGS . "` WHERE `varname` = 'dbversion'");
);
$result = $result_stmt->fetch(PDO::FETCH_ASSOC); if(isset($result['value']))
{
if (isset($result['value'])) { $settings['system']['dbversion'] = (int)$result['value'];
Settings::Set('system.dbversion', (int)$result['value'], false);
} else { } else {
Settings::Set('system.dbversion', 0, false); $settings['system']['dbversion'] = 0;
} }
} }
} }
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::Get('panel.version'); {
$current_version = $settings['panel']['version'];
$new_version = $version; $new_version = $version;
$ui_text = $lng['update']['update_information']['part_a']; $ui_text = $lng['update']['update_information']['part_a'];
$ui_text = str_replace('%curversion', $current_version, $ui_text); $ui_text = str_replace('%curversion', $current_version, $ui_text);
$ui_text = str_replace('%newversion', $new_version, $ui_text); $ui_text = str_replace('%newversion', $new_version, $ui_text);
$update_information = $ui_text; $update_information = $ui_text;
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
*/
$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 @@
*

File diff suppressed because one or more lines are too long

34
customer_aps.php Normal file
View File

@@ -0,0 +1,34 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
* @version $Id$
*/
// Required code
define('AREA', 'customer');
require ("./lib/init.php");
$Id = 0;
if(isset($_GET['id']))$Id = (int)$_GET['id'];
if(isset($_POST['id']))$Id = (int)$_POST['id'];
eval("echo \"" . getTemplate("aps/header") . "\";");
$Aps = new ApsParser($userinfo, $settings, $db);
$Aps->MainHandler($action);
eval("echo \"" . getTemplate("aps/footer") . "\";");
?>

308
customer_autoresponder.php Normal file
View File

@@ -0,0 +1,308 @@
<?php
/**
* This file is part of the Froxlor project.
* Copyright (c) 2003-2009 the SysCP Team (see authors).
* Copyright (c) 2010 the Froxlor Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
* @version $Id$
*/
// Required code
define('AREA', 'customer');
require ("./lib/init.php");
// Create new autoresponder
if($action == "add")
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$account = trim($_POST['account']);
$subject = trim($_POST['subject']);
$message = trim($_POST['message']);
$date_from_off = isset($_POST['date_from_off']) ? -1 : 0;
$date_until_off = isset($_POST['date_until_off']) ? -1 : 0;
/*
* @TODO validate date (DD-MM-YYYY)
*/
$ts_from = -1;
$ts_until = -1;
if($date_from_off > -1)
{
$date_from = $_POST['date_from'];
$ts_from = mktime(0, 0, 0, substr($date_from, 3, 2), substr($date_from, 0, 2), substr($date_from, 6, 4));
}
if($date_until_off > -1)
{
$date_until = $_POST['date_until'];
$ts_until = mktime(0, 0, 0, substr($date_until, 3, 2), substr($date_until, 0, 2), substr($date_until, 6, 4));
}
if(empty($account)
|| empty($subject)
|| empty($message))
{
standard_error('missingfields');
}
// Does account exist?
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1");
if($db->num_rows($result) == 0)
{
standard_error('accountnotexisting');
}
// Does autoresponder exist?
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1");
if($db->num_rows($result) == 1)
{
standard_error('autoresponderalreadyexists');
}
$db->query("INSERT INTO `" . TABLE_MAIL_AUTORESPONDER . "`
SET `email` = '" . $db->escape($account) . "',
`message` = '" . $db->escape($message) . "',
`enabled` = '" . (int)$_POST['active'] . "',
`date_from` = '" . (int)$ts_from . "',
`date_until` = '" . (int)$ts_until . "',
`subject` = '" . $db->escape($subject) . "',
`customerid` = '" . $db->escape((int)$userinfo['customerid']) . "'
");
$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));
}
// Get accounts
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` NOT IN (SELECT `email` FROM `" . TABLE_MAIL_AUTORESPONDER . "`) ORDER BY email ASC");
if($db->num_rows($result) == 0)
{
standard_error('noemailaccount');
}
$accounts = '';
while($row = $db->fetch_array($result))
{
$accounts.= "<option value=\"" . $row['email'] . "\">" . $row['email'] . "</option>";
}
$date_from_off = makecheckbox('date_from_off', $lng['panel']['not_activated'], '-1', false, '-1', true, true);
$date_until_off = makecheckbox('date_until_off', $lng['panel']['not_activated'], '-1', false, '-1', true, true);
eval("echo \"" . getTemplate("email/autoresponder_add") . "\";");
}
// Edit autoresponder
else
if($action == "edit")
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$account = trim($_POST['account']);
$subject = trim($_POST['subject']);
$message = trim($_POST['message']);
$date_from_off = isset($_POST['date_from_off']) ? -1 : 0;
$date_until_off = isset($_POST['date_until_off']) ? -1 : 0;
/*
* @TODO validate date (DD-MM-YYYY)
*/
$ts_from = -1;
$ts_until = -1;
if($date_from_off > -1)
{
$date_from = $_POST['date_from'];
$ts_from = mktime(0, 0, 0, substr($date_from, 3, 2), substr($date_from, 0, 2), substr($date_from, 6, 4));
}
if($date_until_off > -1)
{
$date_until = $_POST['date_until'];
$ts_until = mktime(0, 0, 0, substr($date_until, 3, 2), substr($date_until, 0, 2), substr($date_until, 6, 4));
}
if(empty($account)
|| empty($subject)
|| empty($message))
{
standard_error('missingfields');
}
// Does account exist?
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_USERS . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1");
if($db->num_rows($result) == 0)
{
standard_error('accountnotexisting');
}
// Does autoresponder exist?
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1");
if($db->num_rows($result) == 0)
{
standard_error('invalidautoresponder');
}
$ResponderActive = 0;
if(isset($_POST['active'])
&& $_POST['active'] == '1')
{
$ResponderActive = 1;
}
$db->query("UPDATE `" . TABLE_MAIL_AUTORESPONDER . "`
SET `message` = '" . $db->escape($message) . "',
`enabled` = '" . (int)$ResponderActive . "',
`date_from` = '" . (int)$ts_from . "',
`date_until` = '" . (int)$ts_until . "',
`subject` = '" . $db->escape($subject) . "'
WHERE `email` = '" . $db->escape($account) . "'
AND `customerid` = '" . $db->escape((int)$userinfo['customerid']) . "'
");
redirectTo($filename, Array('s' => $s));
}
$email = trim(htmlspecialchars($_GET['email']));
// Get account data
$result = $db->query("SELECT * FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($email) . "' LIMIT 0,1");
if($db->num_rows($result) == 0)
{
standard_error('invalidautoresponder');
}
$row = $db->fetch_array($result);
$subject = htmlspecialchars($row['subject']);
$message = htmlspecialchars($row['message']);
$date_from = (int)$row['date_from'];
$date_until = (int)$row['date_until'];
if($date_from == -1)
{
$deactivated = '-1';
}
else
{
$deactivated = '0';
$date_from = date('d-m-Y', $date_from);
}
$date_from_off = makecheckbox('date_from_off', $lng['panel']['not_activated'], '-1', false, $deactivated, true, true);
if($date_until == -1)
{
$deactivated = '-1';
$date_until = '-1';
}
else
{
$deactivated = '0';
$date_until = date('d-m-Y', $date_until);
}
$date_until_off = makecheckbox('date_until_off', $lng['panel']['not_activated'], '-1', false, $deactivated, true, true);
$checked = '';
if($row['enabled'] == 1)
{
$checked = "checked=\"checked\"";
}
eval("echo \"" . getTemplate("email/autoresponder_edit") . "\";");
}
// Delete autoresponder
else
if($action == "delete")
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$account = trim($_POST['account']);
// Does autoresponder exist?
$result = $db->query("SELECT `email` FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' AND `email` = '" . $db->escape($account) . "' LIMIT 0,1");
if($db->num_rows($result) == 0)
{
standard_error('invalidautoresponder');
}
$db->query("DELETE FROM `" . TABLE_MAIL_AUTORESPONDER . "`
WHERE `email` = '" . $db->escape($account) . "'
AND `customerid` = '" . $db->escape((int)$userinfo['customerid']) . "'
");
$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));
}
$email = trim(htmlspecialchars($_GET['email']));
ask_yesno('autoresponderdelete', $filename, array('action' => $action, 'account' => $email));
}
// List existing autoresponders
else
{
$autoresponder = '';
$result = $db->query("SELECT * FROM `" . TABLE_MAIL_AUTORESPONDER . "` WHERE `customerid` = '" . (int)$userinfo['customerid'] . "' ORDER BY email ASC");
while($row = $db->fetch_array($result))
{
if($row['date_from'] == -1 && $row['date_until'] == -1)
{
$activated_date = $lng['panel']['not_activated'];
}
elseif($row['date_from'] == -1 && $row['date_until'] != -1)
{
$activated_date = $lng['autoresponder']['date_until'].': '.date('d-m-Y', $row['date_until']);
}
elseif($row['date_from'] != -1 && $row['date_until'] == -1)
{
$activated_date = $lng['autoresponder']['date_from'].': '.date('d-m-Y', $row['date_from']);
}
else
{
$activated_date = date('d-m-Y', $row['date_from']) . ' - ' . date('d-m-Y', $row['date_until']);
}
eval("\$autoresponder.=\"" . getTemplate("email/autoresponder_autoresponder") . "\";");
}
eval("echo \"" . getTemplate("email/autoresponder") . "\";");
}
?>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -14,34 +14,43 @@
* @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');
require './lib/init.php';
if (isset($_POST['id'])) { /**
* Include our init.php, which manages Sessions, Language etc.
*/
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 == 'overview') { 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 == 'htpasswds') { }
if ($action == '') { elseif($page == 'htpasswds')
{
if($action == '')
{
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras::htpasswds"); $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras::htpasswds");
$fields = array( $fields = array(
'username' => $lng['login']['username'], 'username' => $lng['login']['username'],
'path' => $lng['panel']['path'] 'path' => $lng['panel']['path']
); );
$paging = new paging($userinfo, TABLE_PANEL_HTPASSWDS, $fields); $paging = new paging($userinfo, $db, TABLE_PANEL_HTPASSWDS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "` $result = $db->query("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit() $paging->setEntries($db->num_rows($result));
);
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid']));
$paging->setEntries(Database::num_rows());
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
@@ -50,9 +59,12 @@ if ($page == 'overview') {
$count = 0; $count = 0;
$htpasswds = ''; $htpasswds = '';
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))
if ($paging->checkDisplay($i)) { {
if (strpos($row['path'], $userinfo['documentroot']) === 0) { if($paging->checkDisplay($i))
{
if(strpos($row['path'], $userinfo['documentroot']) === 0)
{
$row['path'] = substr($row['path'], strlen($userinfo['documentroot'])); $row['path'] = substr($row['path'], strlen($userinfo['documentroot']));
} }
@@ -65,176 +77,158 @@ if ($page == 'overview') {
} }
eval("echo \"" . getTemplate("extras/htpasswds") . "\";"); eval("echo \"" . getTemplate("extras/htpasswds") . "\";");
} elseif ($action == 'delete' && $id != 0) { }
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "` elseif($action == 'delete'
WHERE `customerid`= :customerid && $id != 0)
AND `id`= :id" {
); $result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if (isset($result['username']) && $result['username'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_HTPASSWDS . "`
WHERE `customerid`= :customerid
AND `id`= :id"
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
if(isset($result['username'])
&& $result['username'] != '')
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$db->query("DELETE FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='$id'");
$log->logAction(USR_ACTION, LOG_INFO, "deleted htpasswd for '" . $result['username'] . " (" . $result['path'] . ")'"); $log->logAction(USR_ACTION, LOG_INFO, "deleted htpasswd for '" . $result['username'] . " (" . $result['path'] . ")'");
inserttask('1'); inserttask('1');
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} else { }
if (strpos($result['path'], $userinfo['documentroot']) === 0) { else
{
if(strpos($result['path'], $userinfo['documentroot']) === 0)
{
$result['path'] = substr($result['path'], strlen($userinfo['documentroot'])); $result['path'] = substr($result['path'], strlen($userinfo['documentroot']));
} }
ask_yesno('extras_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['username'] . ' (' . $result['path'] . ')'); ask_yesno('extras_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['username'] . ' (' . $result['path'] . ')');
} }
} }
} elseif ($action == 'add') { }
if (isset($_POST['send']) && $_POST['send'] == 'send') { elseif($action == 'add')
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$path = makeCorrectDir(validate($_POST['path'], 'path')); $path = makeCorrectDir(validate($_POST['path'], 'path'));
$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\-_ ]+\$?$/'); $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_stmt = Database::prepare("SELECT `id`, `username`, `path` FROM `" . TABLE_PANEL_HTPASSWDS . "` if(CRYPT_STD_DES == 1)
WHERE `username`= :username {
AND `path`= :path
AND `customerid`= :customerid"
);
$params = array(
"username" => $username,
"path" => $path,
"customerid" => $userinfo['customerid']
);
Database::pexecute($username_path_check_stmt, $params);
$username_path_check = $username_path_check_stmt->fetch(PDO::FETCH_ASSOC);
if (CRYPT_STD_DES == 1) {
$saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2); $saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2);
$password = crypt($_POST['directory_password'], $saltfordescrypt); $password = crypt($_POST['directory_password'], $saltfordescrypt);
} else { }
else
{
$password = crypt($_POST['directory_password']); $password = crypt($_POST['directory_password']);
} }
if (!$_POST['path']) { if(!$_POST['path'])
{
standard_error('invalidpath'); standard_error('invalidpath');
} }
if ($username == '') { if($username == '')
{
standard_error(array('stringisempty', 'myloginname')); standard_error(array('stringisempty', 'myloginname'));
} elseif ($username_path_check['username'] == $username && $username_path_check['path'] == $path) { }
elseif($username_path_check['username'] == $username
&& $username_path_check['path'] == $path)
{
standard_error('userpathcombinationdupe'); standard_error('userpathcombinationdupe');
} elseif ($_POST['directory_password'] == '') { }
elseif($_POST['directory_password'] == '')
{
standard_error(array('stringisempty', 'mypassword')); standard_error(array('stringisempty', 'mypassword'));
} elseif ($path == '') { }
elseif($path == '')
{
standard_error('patherror'); standard_error('patherror');
} else { }
$stmt = Database::prepare("INSERT INTO `" . TABLE_PANEL_HTPASSWDS . "` SET else
`customerid` = :customerid, {
`username` = :username, $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) . "')");
`password` = :password,
`path` = :path,
`authname` = :authname"
);
$params = array(
"customerid" => $userinfo['customerid'],
"username" => $username,
"password" => $password,
"path" => $path,
"authname" => $authname
);
Database::pexecute($stmt, $params);
$log->logAction(USR_ACTION, LOG_INFO, "added htpasswd for '" . $username . " (" . $path . ")'"); $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));
} }
} else { }
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']); else
{
$htpasswd_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/extras/formfield.htpasswd_add.php'; $pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
$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' && $id != 0) { }
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "` elseif($action == 'edit'
WHERE `customerid`= :customerid && $id != 0)
AND `id`= :id" {
); $result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if (isset($result['username']) && $result['username'] != '') { if(isset($result['username'])
if (isset($_POST['send']) && $_POST['send'] == 'send') { && $result['username'] != '')
{
if(isset($_POST['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\-_ ]+\$?$/'); $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)
{
$saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2); $saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2);
$password = crypt($_POST['directory_password'], $saltfordescrypt); $password = crypt($_POST['directory_password'], $saltfordescrypt);
} else { }
else
{
$password = crypt($_POST['directory_password']); $password = crypt($_POST['directory_password']);
} }
$params = array(
"customerid" => $userinfo['customerid'],
"id" => $id
);
$pwd_sql = ''; $pwd_sql = '';
if ($_POST['directory_password'] != '') { if($_POST['directory_password'] != '')
$pwd_sql = "`password`= :password "; {
$params["password"] = $password; $pwd_sql = "`password`='" . $db->escape($password) . "' ";
} }
$auth_sql = ''; $auth_sql = '';
if ($authname != $result['authname']) { if($authname != $result['authname'])
$auth_sql = "`authname`= :authname "; {
$params["authname"] = $authname; $auth_sql = "`authname`='" . $db->escape($authname) . "' ";
} }
if ($pwd_sql != '' || $auth_sql != '') { if($pwd_sql != '' || $auth_sql != '')
if ($pwd_sql !='' && $auth_sql != '') { {
if($pwd_sql !='' && $auth_sql != '') {
$pwd_sql.= ', '; $pwd_sql.= ', ';
} }
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_HTPASSWDS . "` $db->query("UPDATE `" . TABLE_PANEL_HTPASSWDS . "` SET ".$pwd_sql.$auth_sql." WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
SET ".$pwd_sql.$auth_sql."
WHERE `customerid`= :customerid
AND `id`= :id"
);
Database::pexecute($stmt, $params);
$log->logAction(USR_ACTION, LOG_INFO, "edited htpasswd for '" . $result['username'] . " (" . $result['path'] . ")'"); $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));
} }
} else { }
if (strpos($result['path'], $userinfo['documentroot']) === 0) { else
{
if(strpos($result['path'], $userinfo['documentroot']) === 0)
{
$result['path'] = substr($result['path'], strlen($userinfo['documentroot'])); $result['path'] = substr($result['path'], strlen($userinfo['documentroot']));
} }
$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") . "\";");
} }
} }
} }
} elseif ($page == 'htaccess') { }
if ($action == '') { elseif($page == 'htaccess')
{
if($action == '')
{
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras::htaccess"); $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras::htaccess");
$fields = array( $fields = array(
'path' => $lng['panel']['path'], 'path' => $lng['panel']['path'],
@@ -244,12 +238,9 @@ if ($page == 'overview') {
'error500path' => $lng['extras']['error500path'], 'error500path' => $lng['extras']['error500path'],
'options_cgi' => $lng['extras']['execute_perl'] 'options_cgi' => $lng['extras']['execute_perl']
); );
$paging = new paging($userinfo, TABLE_PANEL_HTACCESS, $fields); $paging = new paging($userinfo, $db, TABLE_PANEL_HTACCESS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "` $result = $db->query("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit() $paging->setEntries($db->num_rows($result));
);
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid']));
$paging->setEntries(Database::num_rows());
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
@@ -260,9 +251,12 @@ if ($page == 'overview') {
$cperlenabled = customerHasPerlEnabled($userinfo['customerid']); $cperlenabled = customerHasPerlEnabled($userinfo['customerid']);
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))
if ($paging->checkDisplay($i)) { {
if (strpos($row['path'], $userinfo['documentroot']) === 0) { if($paging->checkDisplay($i))
{
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 // don't show nothing wehn it's the docroot, show slash
if ($row['path'] == '') { $row['path'] = '/'; } if ($row['path'] == '') { $row['path'] = '/'; }
@@ -281,124 +275,113 @@ if ($page == 'overview') {
} }
eval("echo \"" . getTemplate("extras/htaccess") . "\";"); eval("echo \"" . getTemplate("extras/htaccess") . "\";");
} elseif ($action == 'delete' && $id != 0) { }
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "` elseif($action == 'delete'
WHERE `customerid` = :customerid && $id != 0)
AND `id` = :id" {
); $result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if (isset($result['customerid']) && $result['customerid'] != '' && $result['customerid'] == $userinfo['customerid']) { if(isset($result['customerid'])
if (isset($_POST['send']) && $_POST['send'] == 'send') { && $result['customerid'] != ''
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_HTACCESS . "` && $result['customerid'] == $userinfo['customerid'])
WHERE `customerid`= :customerid {
AND `id`= :id" if(isset($_POST['send'])
); && $_POST['send'] == 'send')
Database::pexecute($stmt, array("customerid" => $userinfo['customerid'], "id" => $id)); {
$db->query("DELETE FROM `" . TABLE_PANEL_HTACCESS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
$log->logAction(USR_ACTION, LOG_INFO, "deleted htaccess for '" . str_replace($userinfo['documentroot'], '', $result['path']) . "'"); $log->logAction(USR_ACTION, LOG_INFO, "deleted htaccess for '" . str_replace($userinfo['documentroot'], '', $result['path']) . "'");
inserttask('1'); inserttask('1');
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} else { }
else
{
ask_yesno('extras_reallydelete_pathoptions', $filename, array('id' => $id, 'page' => $page, 'action' => $action), str_replace($userinfo['documentroot'], '', $result['path'])); ask_yesno('extras_reallydelete_pathoptions', $filename, array('id' => $id, 'page' => $page, 'action' => $action), str_replace($userinfo['documentroot'], '', $result['path']));
} }
} }
} elseif ($action == 'add') { }
if (isset($_POST['send']) && $_POST['send'] == 'send') { elseif($action == 'add')
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$path = makeCorrectDir(validate($_POST['path'], 'path')); $path = makeCorrectDir(validate($_POST['path'], 'path'));
$userpath = $path; $userpath = $path;
$path = makeCorrectDir($userinfo['documentroot'] . '/' . $path); $path = makeCorrectDir($userinfo['documentroot'] . '/' . $path);
$path_dupe_check_stmt = Database::prepare("SELECT `id`, `path` FROM `" . TABLE_PANEL_HTACCESS . "` $path_dupe_check = $db->query_first("SELECT `id`, `path` FROM `" . TABLE_PANEL_HTACCESS . "` WHERE `path`='" . $db->escape($path) . "' AND `customerid`='" . (int)$userinfo['customerid'] . "'");
WHERE `path`= :path
AND `customerid`= :customerid"
);
Database::pexecute($path_dupe_check_stmt, array("path" => $path, "customerid" => $userinfo['customerid']));
$path_dupe_check = $path_dupe_check_stmt->fetch(PDO::FETCH_ASSOC);
if (!$_POST['path']) { if(!$_POST['path'])
{
standard_error('invalidpath'); standard_error('invalidpath');
} }
if (isset($_POST['options_cgi']) && (int)$_POST['options_cgi'] != 0) { if(isset($_POST['options_cgi']))
$options_cgi = '1'; {
} else { $options_cgi = intval($_POST['options_cgi']);
}
else
{
$options_cgi = '0'; $options_cgi = '0';
} }
$error404path = ''; $error404path = correctErrorDocument($_POST['error404path']);
if (isset($_POST['error404path'])) { $error403path = correctErrorDocument($_POST['error403path']);
$error404path = correctErrorDocument($_POST['error404path']); $error500path = correctErrorDocument($_POST['error500path']);
}
$error403path = ''; if($path_dupe_check['path'] == $path)
if (isset($_POST['error403path'])) { {
$error403path = correctErrorDocument($_POST['error403path']);
}
$error500path = '';
if (isset($_POST['error500path'])) {
$error500path = correctErrorDocument($_POST['error500path']);
}
if ($path_dupe_check['path'] == $path) {
standard_error('errordocpathdupe', $userpath); standard_error('errordocpathdupe', $userpath);
} elseif ($path == '') { }
elseif($path == '')
{
standard_error('patherror'); standard_error('patherror');
} else { }
$stmt = Database::prepare('INSERT INTO `' . TABLE_PANEL_HTACCESS . '` SET else
`customerid` = :customerid, {
`path` = :path, $db->query('INSERT INTO `' . TABLE_PANEL_HTACCESS . '` SET
`options_indexes` = :options_indexes, `customerid` = "'.(int)$userinfo['customerid'].'",
`error404path` = :error404path, `path` = "'.$db->escape($path).'",
`error403path` = :error403path, `options_indexes` = "'.$db->escape($_POST['options_indexes'] == '1' ? '1' : '0').'",
`error500path` = :error500path, `error404path` = "'.$db->escape($error404path).'",
`options_cgi` = :options_cgi' `error403path` = "'.$db->escape($error403path).'",
); `error500path` = "'.$db->escape($error500path).'",
$params = array( `options_cgi` = "'.$db->escape($options_cgi).'"');
"customerid" => $userinfo['customerid'],
"path" => $path,
"options_indexes" => $_POST['options_indexes'] == '1' ? '1' : '0',
"error403path" => $error403path,
"error404path" => $error404path,
"error500path" => $error500path,
"options_cgi" => $options_cgi
);
Database::pexecute($stmt, $params);
$log->logAction(USR_ACTION, LOG_INFO, "added htaccess for '" . $path . "'"); $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));
} }
} else { }
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']); else
{
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']);
$options_indexes = makeyesno('options_indexes', '1', '0', '0');
$cperlenabled = customerHasPerlEnabled($userinfo['customerid']); $cperlenabled = customerHasPerlEnabled($userinfo['customerid']);
$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") . "\";");
} }
} elseif (($action == 'edit') && ($id != 0)) { }
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "` elseif(($action == 'edit')
WHERE `customerid` = :customerid && ($id != 0))
AND `id` = :id" {
); $result = $db->query_first('SELECT * FROM `' . TABLE_PANEL_HTACCESS . '` WHERE `customerid` = "' . (int)$userinfo['customerid'] . '" AND `id` = "' . (int)$id . '"');
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if ((isset($result['customerid'])) && ($result['customerid'] != '') && ($result['customerid'] == $userinfo['customerid'])) { if((isset($result['customerid']))
if (isset($_POST['send']) && $_POST['send'] == 'send') { && ($result['customerid'] != '')
&& ($result['customerid'] == $userinfo['customerid']))
{
if(isset($_POST['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; $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($options_cgi != '1')
{
$options_cgi = '0'; $options_cgi = '0';
} }
@@ -406,38 +389,23 @@ if ($page == 'overview') {
$error403path = correctErrorDocument($_POST['error403path']); $error403path = correctErrorDocument($_POST['error403path']);
$error500path = correctErrorDocument($_POST['error500path']); $error500path = correctErrorDocument($_POST['error500path']);
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']) || ($options_cgi != $result['options_cgi']))
) { {
inserttask('1'); inserttask('1');
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_HTACCESS . "` $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 . '"');
SET `options_indexes` = :options_indexes,
`error404path` = :error404path,
`error403path` = :error403path,
`error500path` = :error500path,
`options_cgi` = :options_cgi
WHERE `customerid` = :customerid
AND `id` = :id"
);
$params = array(
"customerid" => $userinfo['customerid'],
"options_indexes" => $_POST['options_indexes'] == '1' ? '1' : '0',
"error403path" => $error403path,
"error404path" => $error404path,
"error500path" => $error500path,
"options_cgi" => $options_cgi,
"id" => $id
);
Database::pexecute($stmt, $params);
$log->logAction(USR_ACTION, LOG_INFO, "edited htaccess for '" . str_replace($userinfo['documentroot'], '', $result['path']) . "'"); $log->logAction(USR_ACTION, LOG_INFO, "edited htaccess for '" . str_replace($userinfo['documentroot'], '', $result['path']) . "'");
} }
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} else { }
if (strpos($result['path'], $userinfo['documentroot']) === 0) { else
{
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 // don't show nothing wehn it's the docroot, show slash
if ($result['path'] == '') { $result['path'] = '/'; } if ($result['path'] == '') { $result['path'] = '/'; }
@@ -446,21 +414,14 @@ if ($page == 'overview') {
$result['error404path'] = $result['error404path']; $result['error404path'] = $result['error404path'];
$result['error403path'] = $result['error403path']; $result['error403path'] = $result['error403path'];
$result['error500path'] = $result['error500path']; $result['error500path'] = $result['error500path'];
$cperlenabled = customerHasPerlEnabled($userinfo['customerid']);
/*
$options_indexes = makeyesno('options_indexes', '1', '0', $result['options_indexes']); $options_indexes = makeyesno('options_indexes', '1', '0', $result['options_indexes']);
$cperlenabled = customerHasPerlEnabled($userinfo['customerid']);
$options_cgi = makeyesno('options_cgi', '1', '0', $result['options_cgi']); $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,38 +14,43 @@
* @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');
require './lib/init.php';
$id = 0; /**
if (isset($_POST['id'])) { * Include our init.php, which manages Sessions, Language etc.
*/
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 == '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']
'description' => $lng['panel']['ftpdesc']
); );
$paging = new paging($userinfo, TABLE_FTP_USERS, $fields); $paging = new paging($userinfo, $db, TABLE_FTP_USERS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$result = $db->query("SELECT `id`, `username`, `homedir` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . $userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
$result_stmt = Database::prepare("SELECT `id`, `username`, `description`, `homedir` FROM `" . TABLE_FTP_USERS . "` $paging->setEntries($db->num_rows($result));
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()
);
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid']));
$ftps_count = Database::num_rows();
$paging->setEntries($ftps_count);
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
@@ -54,229 +59,165 @@ if ($page == 'overview') {
$count = 0; $count = 0;
$accounts = ''; $accounts = '';
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { 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++;
} }
$i++; $i++;
} }
eval("echo \"" . getTemplate('ftp/accounts') . "\";"); $ftps_count = $db->num_rows($result);
} elseif ($action == 'delete' && $id != 0) { eval("echo \"" . getTemplate("ftp/accounts") . "\";");
$result_stmt = Database::prepare("SELECT `id`, `username`, `homedir`, `up_count`, `up_bytes`, `down_count`, `down_bytes` FROM `" . TABLE_FTP_USERS . "` }
WHERE `customerid` = :customerid elseif($action == 'delete'
AND `id` = :id" && $id != 0)
); {
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $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 . "'");
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if (isset($result['username']) && $result['username'] != $userinfo['loginname']) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "`
SET `up_count` = `up_count` + :up_count,
`up_bytes` = `up_bytes` + :up_bytes,
`down_count` = `down_count` + :down_count,
`down_bytes` = `down_bytes` + :down_bytes
WHERE `username` = :username"
);
$params = array(
"up_count" => $result['up_count'],
"up_bytes" => $result['up_bytes'],
"down_count" => $result['down_count'],
"down_bytes" => $result['down_bytes'],
"username" => $userinfo['loginname']
);
Database::pexecute($stmt, $params);
$result_stmt = Database::prepare("SELECT `username`, `homedir` FROM `" . TABLE_FTP_USERS . "`
WHERE `customerid` = :customerid
AND `id` = :id"
);
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$stmt = Database::prepare("DELETE FROM `" . TABLE_FTP_QUOTATALLIES . "` WHERE `name` = :name");
Database::pexecute($stmt, array("name" => $result['username']));
$stmt = Database::prepare("DELETE FROM `" . TABLE_FTP_USERS . "`
WHERE `customerid` = :customerid
AND `id` = :id"
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
$stmt = Database::prepare("
UPDATE `" . TABLE_FTP_GROUPS . "` SET
`members` = REPLACE(`members`, :username,'')
WHERE `customerid` = :customerid
");
Database::pexecute($stmt, array("username" => ",".$result['username'], "customerid" => $userinfo['customerid']));
if(isset($result['username'])
&& $result['username'] != $userinfo['loginname'])
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `up_count`=`up_count`+'" . (int)$result['up_count'] . "', `up_bytes`=`up_bytes`+'" . (int)$result['up_bytes'] . "', `down_count`=`down_count`+'" . (int)$result['down_count'] . "', `down_bytes`=`down_bytes`+'" . (int)$result['down_bytes'] . "' WHERE `username`='" . $db->escape($userinfo['loginname']) . "'");
$result = $db->query("SELECT `username` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
while($row = $db->fetch_array($result))
{
$db->query("DELETE FROM `" . TABLE_FTP_QUOTATALLIES . "` WHERE `name` = '" . $db->escape($row['username']) . "'");
}
$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'] . "'");
$resetaccnumber = ($userinfo['ftps_used'] == '1') ? " , `ftp_lastaccountnumber`='0'" : ''; if($userinfo['ftps_used'] == '1')
{
$resetaccnumber = " , `ftp_lastaccountnumber`='0'";
}
else
{
$resetaccnumber = '';
}
// refs #293 // refs #293
if (isset($_POST['delete_userfiles']) && (int)$_POST['delete_userfiles'] == 1) { if(isset($_POST['delete_userfiles'])
&& (int)$_POST['delete_userfiles'] == 1)
{
inserttask('8', $userinfo['loginname'], $result['homedir']); inserttask('8', $userinfo['loginname'], $result['homedir']);
} }
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` $result = $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `ftps_used`=`ftps_used`-1 $resetaccnumber WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
SET `ftps_used` = `ftps_used` - 1 $resetaccnumber redirectTo($filename, Array('page' => $page, 's' => $s));
WHERE `customerid` = :customerid" }
); else
Database::pexecute($stmt, array("customerid" => $userinfo['customerid'])); {
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']); ask_yesno_withcheckbox('ftp_reallydelete', 'admin_customer_alsoremoveftphomedir', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['username']);
} }
} else { }
else
{
standard_error('ftp_cantdeletemainaccount'); standard_error('ftp_cantdeletemainaccount');
} }
} elseif ($action == 'add') { }
if ($userinfo['ftps_used'] < $userinfo['ftps'] || $userinfo['ftps'] == '-1') { elseif($action == 'add')
if (isset($_POST['send']) {
&& $_POST['send'] == 'send') { if($userinfo['ftps_used'] < $userinfo['ftps']
$description = validate($_POST['ftp_description'], 'description'); || $userinfo['ftps'] == '-1')
// @FIXME use a good path-validating regex here (refs #1231) {
if(isset($_POST['send'])
&& $_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::Get('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_stmt = Database::prepare("SELECT `id`, `domain`, `customerid` FROM `" . TABLE_PANEL_DOMAINS . "` $ftpdomain_check = $db->query_first("SELECT `id`, `domain`, `customerid` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `domain`='" . $db->escape($ftpdomain) . "' AND `customerid`='" . (int)$userinfo['customerid'] . "'");
WHERE `domain` = :domain if($ftpdomain_check['domain'] != $ftpdomain)
AND `customerid` = :customerid" {
);
Database::pexecute($ftpdomain_check_stmt, array("domain" => $ftpdomain, "customerid" => $userinfo['customerid']));
$ftpdomain_check = $ftpdomain_check_stmt->fetch(PDO::FETCH_ASSOC);
if ($ftpdomain_check['domain'] != $ftpdomain) {
standard_error('maindomainnonexist', $domain); standard_error('maindomainnonexist', $domain);
} }
$username = $ftpusername . "@" . $ftpdomain; $username = $ftpusername . "@" . $ftpdomain;
} else {
$username = $userinfo['loginname'] . Settings::Get('customer.ftpprefix') . (intval($userinfo['ftp_lastaccountnumber']) + 1);
} }
else
$username_check_stmt = Database::prepare("SELECT * FROM `" . TABLE_FTP_USERS . "` {
WHERE `username` = :username" $username = $userinfo['loginname'] . $settings['customer']['ftpprefix'] . (intval($userinfo['ftp_lastaccountnumber']) + 1);
); }
Database::pexecute($username_check_stmt, array("username" => $username));
$username_check = $username_check_stmt->fetch(PDO::FETCH_ASSOC); $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'] . "')");
$result = $db->query("SELECT `bytes_in_used` FROM `" . TABLE_FTP_QUOTATALLIES . "` WHERE `name` = '" . $userinfo['loginname'] . "'");
$stmt = Database::prepare("INSERT INTO `" . TABLE_FTP_USERS . "` while($row = $db->fetch_array($result))
(`customerid`, `username`, `description`, `password`, `homedir`, `login_enabled`, `uid`, `gid`) {
VALUES (:customerid, :username, :description, :password, :homedir, 'y', :guid, :guid)" $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')");
);
$params = array(
"customerid" => $userinfo['customerid'],
"username" => $username,
"description" => $description,
"password" => $cryptPassword,
"homedir" => $path,
"guid" => $userinfo['guid']
);
Database::pexecute($stmt, $params);
$result_stmt = Database::prepare("SELECT `bytes_in_used` FROM `" . TABLE_FTP_QUOTATALLIES . "`
WHERE `name` = :name"
);
Database::pexecute($result_stmt, array("name" => $userinfo['loginname']));
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
$stmt = Database::prepare("INSERT INTO `" . TABLE_FTP_QUOTATALLIES . "`
(`name`, `quota_type`, `bytes_in_used`, `bytes_out_used`, `bytes_xfer_used`, `files_in_used`, `files_out_used`, `files_xfer_used`)
VALUES (:name, 'user', :bytes_in_used, '0', '0', '0', '0', '0')"
);
Database::pexecute($stmt, array("name" => $username, "bytes_in_used" => $row['bytes_in_used']));
} }
$db->query("UPDATE `" . TABLE_FTP_GROUPS . "` SET `members`=CONCAT_WS(',',`members`,'" . $db->escape($username) . "') WHERE `customerid`='" . $userinfo['customerid'] . "' AND `gid`='" . (int)$userinfo['guid'] . "'");
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_GROUPS . "` $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `ftps_used`=`ftps_used`+1, `ftp_lastaccountnumber`=`ftp_lastaccountnumber`+1 WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
SET `members` = CONCAT_WS(',',`members`, :username)
WHERE `customerid`= :customerid
AND `gid`= :guid"
);
$params = array(
"username" => $username,
"customerid" => $userinfo['customerid'],
"guid" => $userinfo['guid']
);
Database::pexecute($stmt, $params);
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "`
SET `ftps_used` = `ftps_used` + 1,
`ftp_lastaccountnumber` = `ftp_lastaccountnumber` + 1
WHERE `customerid` = :customerid"
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid']));
$log->logAction(USR_ACTION, LOG_INFO, "added ftp-account '" . $username . " (" . $path . ")'"); $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']; $def_language = $userinfo['def_language'];
$result_stmt = Database::prepare("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "` $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\'');
WHERE `adminid` = :adminid
AND `language` = :lang
AND `templategroup`='mails'
AND `varname`='new_ftpaccount_by_customer_subject'"
);
Database::pexecute($result_stmt, array("adminid" => $userinfo['adminid'], "lang" => $def_language));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$mail_subject = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['customer']['ftp_add']['infomail_subject']), $replace_arr)); $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\'');
$def_language = $userinfo['def_language'];
$result_stmt = Database::prepare("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid` = :adminid
AND `language` = :lang
AND `templategroup`='mails'
AND `varname`='new_ftpaccount_by_customer_mailbody'"
);
Database::pexecute($result_stmt, array("adminid" => $userinfo['adminid'], "lang" => $def_language));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$mail_body = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['customer']['ftp_add']['infomail_body']['main']), $replace_arr)); $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 = $mail_subject;
@@ -300,147 +241,114 @@ if ($page == 'overview') {
$mail->ClearAddresses(); $mail->ClearAddresses();
} }
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} }
} else { }
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], '/'); else
{
$pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit'], '/');
if (Settings::Get('customer.ftpatdomain') == '1') { if($settings['customer']['ftpatdomain'] == '1')
$domainlist = array(); {
$domains = ''; $domains = '';
$result_domains_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` $result_domains = $db->query("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
WHERE `customerid`= :customerid"
);
Database::pexecute($result_domains_stmt, array("customerid" => $userinfo['customerid']));
while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) { 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) { }
$result_stmt = Database::prepare("SELECT `id`, `username`, `description`, `homedir`, `uid`, `gid` FROM `" . TABLE_FTP_USERS . "` elseif($action == 'edit'
WHERE `customerid` = :customerid && $id != 0)
AND `id` = :id" {
); $result = $db->query_first("SELECT `id`, `username`, `homedir`, `uid`, `gid` FROM `" . TABLE_FTP_USERS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if (isset($result['username']) && $result['username'] != '') { if(isset($result['username'])
if (isset($_POST['send']) && $_POST['send'] == 'send') { && $result['username'] != '')
// @FIXME use a good path-validating regex here (refs #1231) {
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$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); {
$log->logAction(USR_ACTION, LOG_INFO, "updated ftp-account password for '" . $result['username'] . "'");
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "` $db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `password`=ENCRYPT('" . $db->escape($password) . "') WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
SET `password` = :password }
WHERE `customerid` = :customerid
AND `id` = :id"
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid'], "id" => $id, "password" => $cryptPassword));
} }
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'] . "'");
$db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `homedir`= '" . $db->escape($path) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `id`='" . (int)$id . "'");
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "`
SET `homedir` = :homedir
WHERE `customerid` = :customerid
AND `id` = :id"
);
$params = array(
"homedir" => $path,
"customerid" => $userinfo['customerid'],
"id" => $id
);
Database::pexecute($stmt, $params);
} }
} }
$log->logAction(USR_ACTION, LOG_INFO, "edited ftp-account '" . $result['username'] . "'"); redirectTo($filename, Array('page' => $page, 's' => $s));
$description = validate($_POST['ftp_description'], 'description'); }
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "` else
SET `description` = :desc {
WHERE `customerid` = :customerid if(strpos($result['homedir'], $userinfo['documentroot']) === 0)
AND `id` = :id" {
);
Database::pexecute($stmt, array("desc" => $description, "customerid" => $userinfo['customerid'], "id" => $id));
redirectTo($filename, array('page' => $page, 's' => $s));
} 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'], $homedir); $pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit'], $homedir);
if (Settings::Get('customer.ftpatdomain') == '1') { if($settings['customer']['ftpatdomain'] == '1')
{
$domains = ''; $domains = '';
$result_domains_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` $result_domains = $db->query("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
WHERE `customerid` = :customerid"
);
Database::pexecute($result_domains_stmt, array("customerid" => $userinfo['customerid']));
while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) { 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,302 +14,176 @@
* @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');
require './lib/init.php';
if ($action == 'logout') { /**
$log->logAction(USR_ACTION, LOG_NOTICE, 'logged out'); * Include our init.php, which manages Sessions, Language etc.
*/
$params = array("customerid" => $userinfo['customerid']); require ("./lib/init.php");
if (Settings::Get('session.allow_multiple_login') == '1') {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` if($action == 'logout')
WHERE `userid` = :customerid {
AND `adminsession` = '0' $log->logAction(USR_ACTION, LOG_NOTICE, "logged out");
AND `hash` = :hash"
); if($settings['session']['allow_multiple_login'] == '1')
$params["hash"] = $s; {
} else { $db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['customerid'] . "' AND `adminsession` = '0' AND `hash` = '" . $s . "'");
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` }
WHERE `userid` = :customerid else
AND `adminsession` = '0'" {
); $db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['customerid'] . "' AND `adminsession` = '0'");
} }
Database::pexecute($stmt, $params);
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");
$domain_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `customerid` = :customerid
AND `parentdomainid` = '0'
AND `id` <> :standardsubdomain
");
Database::pexecute($domain_stmt, array("customerid" => $userinfo['customerid'], "standardsubdomain" => $userinfo['standardsubdomain']));
$domains = ''; $domains = '';
$result = $db->query("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `parentdomainid`='0' AND `id` <> '" . (int)$userinfo['standardsubdomain'] . "' ");
$domainArray = array(); $domainArray = array();
while ($row = $domain_stmt->fetch(PDO::FETCH_ASSOC)) { 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);
// standard-subdomain
$stdsubdomain = '';
if ($userinfo['standardsubdomain'] != '0') {
$std_domain_stmt = Database::prepare("
SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `customerid` = :customerid
AND `id` = :standardsubdomain
");
$std_domain = Database::pexecute_first($std_domain_stmt, array("customerid" => $userinfo['customerid'], "standardsubdomain" => $userinfo['standardsubdomain']));
$stdsubdomain = $std_domain['domain'];
}
$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);
$userinfo['diskspace'] = round($userinfo['diskspace'] / 1024, Settings::Get('panel.decimal_places')); /* $traffic=$db->query_first("SELECT SUM(http) AS http_sum, SUM(ftp_up) AS ftp_up_sum, SUM(ftp_down) AS ftp_down_sum, SUM(mail) AS mail_sum FROM ".TABLE_PANEL_TRAFFIC." WHERE year='".date('Y')."' AND month='".date('m')."' AND day<='".date('d')."' AND customerid='".$userinfo['customerid']."'");
$userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, Settings::Get('panel.decimal_places')); $userinfo['traffic_used']=$traffic['http_sum']+$traffic['ftp_up_sum']+$traffic['ftp_down_sum']+$traffic['mail_sum'];*/
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), Settings::Get('panel.decimal_places'));
$userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), Settings::Get('panel.decimal_places'));
$userinfo = str_replace_array('-1', $lng['customer']['unlimited'], $userinfo, 'diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps tickets subdomains');
$services_enabled = ""; $userinfo['diskspace'] = round($userinfo['diskspace'] / 1024, $settings['panel']['decimal_places']);
$se = array(); $userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, $settings['panel']['decimal_places']);
if ($userinfo['imap'] == '1') $se[] = "IMAP"; $userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $settings['panel']['decimal_places']);
if ($userinfo['pop3'] == '1') $se[] = "POP3"; $userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), $settings['panel']['decimal_places']);
if ($userinfo['phpenabled'] == '1') $se[] = "PHP"; $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');
if ($userinfo['perlenabled'] == '1') $se[] = "Perl/CGI"; $opentickets = 0;
$services_enabled = implode(", ", $se); $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 { }
// Update user password else
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` {
SET `password` = :newpassword $db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `password`='" . md5($new_password) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `password`='" . md5($old_password) . "'");
WHERE `customerid` = :customerid
AND `password` = :oldpassword"
);
$params = array(
"newpassword" => md5($new_password),
"customerid" => $userinfo['customerid'],
"oldpassword" => md5($old_password)
);
Database::pexecute($stmt, $params);
$log->logAction(USR_ACTION, LOG_NOTICE, 'changed password'); $log->logAction(USR_ACTION, LOG_NOTICE, 'changed password');
// Update ftp 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); {
$stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "` $db->query("UPDATE `" . TABLE_FTP_USERS . "` SET `password`=ENCRYPT('" . $db->escape($new_password) . "') WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `username`='" . $db->escape($userinfo['loginname']) . "'");
SET `password` = :password
WHERE `customerid` = :customerid
AND `username` = :username"
);
$params = array(
"password" => $cryptPassword,
"customerid" => $userinfo['customerid'],
"username" => $userinfo['loginname']
);
Database::pexecute($stmt, $params);
$log->logAction(USR_ACTION, LOG_NOTICE, 'changed main ftp password'); $log->logAction(USR_ACTION, LOG_NOTICE, 'changed main ftp password');
} }
// Update webalizer 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);
} }
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_HTPASSWDS . "` $db->query("UPDATE `" . TABLE_PANEL_HTPASSWDS . "` SET `password`='" . $db->escape($new_webalizer_password) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "' AND `username`='" . $db->escape($userinfo['loginname']) . "'");
SET `password` = :password
WHERE `customerid` = :customerid
AND `username` = :username"
);
$params = array(
"password" => $new_webalizer_password,
"customerid" => $userinfo['customerid'],
"username" => $userinfo['loginname']
);
Database::pexecute($stmt, $params);
} }
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])) {
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "`
SET `def_language` = :lang
WHERE `customerid` = :customerid"
);
Database::pexecute($stmt, array("lang" => $def_language, "customerid" => $userinfo['customerid']));
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_SESSIONS . "`
SET `language` = :lang
WHERE `hash` = :hash"
);
Database::pexecute($stmt, array("lang" => $def_language, "hash" => $s));
if(isset($languages[$def_language]))
{
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `def_language`='" . $db->escape($def_language) . "' WHERE `customerid`='" . (int)$userinfo['customerid'] . "'");
$db->query("UPDATE `" . TABLE_PANEL_SESSIONS . "` SET `language`='" . $db->escape($def_language) . "' WHERE `hash`='" . $db->escape($s) . "'");
$log->logAction(USR_ACTION, LOG_NOTICE, "changed default language to '" . $def_language . "'"); $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::Get('panel.standardlanguage'); else
if ($userinfo['def_language'] != '') { {
$language_options = '';
$default_lang = $settings['panel']['standardlanguage'];
if($userinfo['def_language'] != '') {
$default_lang = $userinfo['def_language']; $default_lang = $userinfo['def_language'];
} }
$language_options = ''; 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, $default_lang, 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');
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "`
SET `theme` = :theme
WHERE `customerid` = :customerid"
);
Database::pexecute($stmt, array("theme" => $theme, "customerid" => $userinfo['customerid']));
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_SESSIONS . "`
SET `theme` = :theme
WHERE `hash` = :hash"
);
Database::pexecute($stmt, array("theme" => $theme, "hash" => $s));
$log->logAction(USR_ACTION, LOG_NOTICE, "changed default theme to '" . $theme . "'");
redirectTo($filename, array('s' => $s));
} else {
$default_theme = Settings::Get('panel.default_theme');
if ($userinfo['theme'] != '') {
$default_theme = $userinfo['theme'];
}
$theme_options = '';
$themes_avail = getThemes();
foreach ($themes_avail as $t => $d) {
$theme_options.= makeoption($d, $t, $default_theme, true);
}
eval("echo \"" . getTemplate('index/change_theme') . "\";");
}
} elseif ($page == 'send_error_report' && Settings::Get('system.allow_error_report_customer') == '1') {
// only show this if we really have an exception to report
if (isset($_GET['errorid']) && $_GET['errorid'] != '') {
$errid = $_GET['errorid'];
// read error file
$err_dir = makeCorrectDir(FROXLOR_INSTALL_DIR."/logs/");
$err_file = makeCorrectFile($err_dir."/".$errid."_sql-error.log");
if (file_exists($err_file)) {
$error_content = file_get_contents($err_file);
$error = explode("|", $error_content);
$_error = array(
'code' => str_replace("\n", "", substr($error[1], 5)),
'message' => str_replace("\n", "", substr($error[2], 4)),
'file' => str_replace("\n", "", substr($error[3], 5 + strlen(FROXLOR_INSTALL_DIR))),
'line' => str_replace("\n", "", substr($error[4], 5)),
'trace' => str_replace(FROXLOR_INSTALL_DIR, "", substr($error[5], 6))
);
// build mail-content
$mail_body = "Dear froxlor-team,\n\n";
$mail_body .= "the following error has been reported by a user:\n\n";
$mail_body .= "-------------------------------------------------------------\n";
$mail_body .= $_error['code'].' '.$_error['message']."\n\n";
$mail_body .= "File: ".$_error['file'].':'.$_error['line']."\n\n";
$mail_body .= "Trace:\n".trim($_error['trace'])."\n\n";
$mail_body .= "-------------------------------------------------------------\n\n";
$mail_body .= "Froxlor-version: ".$version."\n\n";
$mail_body .= "End of report";
$mail_html = str_replace("\n", "<br />", $mail_body);
// send actual report to dev-team
if (isset($_POST['send'])
&& $_POST['send'] == 'send'
) {
// send mail and say thanks
$_mailerror = false;
try {
$mail->Subject = '[Froxlor] Error report by user';
$mail->AltBody = $mail_body;
$mail->MsgHTML($mail_html);
$mail->AddAddress('error-reports@froxlor.org', 'Froxlor Developer Team');
$mail->Send();
} catch(phpmailerException $e) {
$mailerr_msg = $e->errorMessage();
$_mailerror = true;
} catch (Exception $e) {
$mailerr_msg = $e->getMessage();
$_mailerror = true;
}
if ($_mailerror) {
// error when reporting an error...LOLFUQ
standard_error('send_report_error', $mailerr_msg);
}
// finally remove error from fs
@unlink($err_file);
redirectTo($filename, array('s' => $s));
}
// show a nice summary of the error-report
// before actually sending anything
eval("echo \"" . getTemplate("index/send_error_report") . "\";");
} else {
redirectTo($filename, array('s' => $s));
}
} else {
redirectTo($filename, array('s' => $s));
} }
} }
?>

View File

@@ -14,45 +14,46 @@
* @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');
require './lib/init.php';
// get sql-root access data /**
Database::needRoot(true); * Include our init.php, which manages Sessions, Language etc.
Database::needSqlData(); */
$sql_root = Database::getSqlData();
Database::needRoot(false);
if (isset($_POST['id'])) { $need_db_sql_data = true;
$need_root_db_sql_data = true;
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 == 'overview') { if($page == 'overview')
{
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_mysql"); $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_mysql");
Database::needSqlData();
$sql = Database::getSqlData();
$lng['mysql']['description'] = str_replace('<SQL_HOST>', $sql['host'], $lng['mysql']['description']); $lng['mysql']['description'] = str_replace('<SQL_HOST>', $sql['host'], $lng['mysql']['description']);
eval("echo \"" . getTemplate('mysql/mysql') . "\";"); eval("echo \"" . 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, TABLE_PANEL_DATABASES, $fields); $paging = new paging($userinfo, $db, TABLE_PANEL_DATABASES, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_DATABASES . "` $result = $db->query("SELECT * FROM `" . TABLE_PANEL_DATABASES . "` WHERE `customerid`='" . (int)$userinfo['customerid'] . "' " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit() $paging->setEntries($db->num_rows($result));
);
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid']));
$mysqls_count = Database::num_rows();
$paging->setEntries($mysqls_count);
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
@@ -61,182 +62,157 @@ if ($page == 'overview') {
$count = 0; $count = 0;
$mysqls = ''; $mysqls = '';
$dbservers_stmt = Database::query("SELECT COUNT(DISTINCT `dbserver`) as numservers FROM `".TABLE_PANEL_DATABASES."`"); while($row = $db->fetch_array($result))
$dbserver = $dbservers_stmt->fetch(PDO::FETCH_ASSOC); {
$count_mysqlservers = $dbserver['numservers']; if($paging->checkDisplay($i))
{
// Begin root-session
Database::needRoot(true);
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
if ($paging->checkDisplay($i)) {
$row = htmlentities_array($row); $row = htmlentities_array($row);
$mbdata_stmt = Database::prepare("SELECT SUM(data_length + index_length) as MB FROM information_schema.TABLES eval("\$mysqls.=\"" . getTemplate("mysql/mysqls_database") . "\";");
WHERE table_schema = :table_schema
GROUP BY table_schema"
);
Database::pexecute($mbdata_stmt, array("table_schema" => $row['databasename']));
$mbdata = $mbdata_stmt->fetch(PDO::FETCH_ASSOC);
$row['size'] = size_readable($mbdata['MB'], 'GiB', 'bi', '%01.' . (int)Settings::Get('panel.decimal_places') . 'f %s');
eval("\$mysqls.=\"" . getTemplate('mysql/mysqls_database') . "\";");
$count++; $count++;
} }
$i++; $i++;
} }
Database::needRoot(false);
// End root-session
eval("echo \"" . getTemplate('mysql/mysqls') . "\";"); $mysqls_count = $db->num_rows($result);
eval("echo \"" . getTemplate("mysql/mysqls") . "\";");
}
elseif($action == 'delete'
&& $id != 0)
{
$result = $db->query_first('SELECT `id`, `databasename`, `dbserver` FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . (int)$userinfo['customerid'] . '" AND `id`="' . (int)$id . '"');
} elseif ($action == 'delete' && $id != 0) { if(isset($result['databasename'])
$result_stmt = Database::prepare('SELECT `id`, `databasename`, `description`, `dbserver` FROM `' . TABLE_PANEL_DATABASES . '` && $result['databasename'] != '')
WHERE `customerid`="' . (int)$userinfo['customerid'] . '" {
AND `id`="' . (int)$id . '"' if(!isset($sql_root[$result['dbserver']]) || !is_array($sql_root[$result['dbserver']]))
); {
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid']));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if (isset($result['databasename']) && $result['databasename'] != '') {
Database::needRoot(true, $result['dbserver']);
Database::needSqlData();
$sql_root = Database::getSqlData();
Database::needRoot(false);
if (!isset($sql_root[$result['dbserver']]) || !is_array($sql_root[$result['dbserver']])) {
$result['dbserver'] = 0; $result['dbserver'] = 0;
} }
if (isset($_POST['send']) && $_POST['send'] == 'send') { if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
// Begin root-session // Begin root-session
Database::needRoot(true, $result['dbserver']);
$dbm = new DbManager($log); $db_root = new db($sql_root[$result['dbserver']]['host'], $sql_root[$result['dbserver']]['user'], $sql_root[$result['dbserver']]['password'], '');
$dbm->getManager()->deleteDatabase($result['databasename']); unset($db_root->password);
$log->logAction(USR_ACTION, LOG_INFO, "deleted database '" . $result['databasename'] . "'"); foreach(array_map('trim', array_unique(explode(',', $settings['system']['mysql_access_host']))) as $mysql_access_host)
Database::needRoot(false); {
$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('FLUSH PRIVILEGES');
$db_root->close();
// End root-session // End root-session
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_DATABASES . "` $db->query('DELETE FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . (int)$userinfo['customerid'] . '" AND `id`="' . (int)$id . '"');
WHERE `customerid` = :customerid
AND `id` = :id"
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
$resetaccnumber = ($userinfo['mysqls_used'] == '1') ? " , `mysql_lastaccountnumber` = '0' " : ''; if($userinfo['mysqls_used'] == '1')
{
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` $resetaccnumber = " , `mysql_lastaccountnumber`='0' ";
SET `mysqls_used` = `mysqls_used` - 1 " . $resetaccnumber . "
WHERE `customerid` = :customerid"
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid']));
redirectTo($filename, array('page' => $page, 's' => $s));
} else {
$dbnamedesc = $result['databasename'];
if (isset($result['description']) && $result['description'] != '') {
$dbnamedesc .= ' ('.$result['description'].')';
} }
ask_yesno('mysql_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $dbnamedesc); else
{
$resetaccnumber = '';
}
$result = $db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used`=`mysqls_used`-1 ' . $resetaccnumber . 'WHERE `customerid`="' . (int)$userinfo['customerid'] . '"');
redirectTo($filename, Array('page' => $page, 's' => $s));
}
else
{
ask_yesno('mysql_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['databasename']);
} }
} }
} elseif ($action == 'add') { }
if ($userinfo['mysqls_used'] < $userinfo['mysqls'] || $userinfo['mysqls'] == '-1') { elseif($action == 'add')
if (isset($_POST['send']) && $_POST['send'] == 'send') { {
if($userinfo['mysqls_used'] < $userinfo['mysqls']
|| $userinfo['mysqls'] == '-1')
{
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
$dbservers_stmt = Database::query("SELECT COUNT(DISTINCT `dbserver`) as numservers FROM `".TABLE_PANEL_DATABASES."`"); {
$_dbserver = $dbservers_stmt->fetch(PDO::FETCH_ASSOC); $username = $userinfo['loginname'] . $settings['customer']['mysqlprefix'] . (intval($userinfo['mysql_lastaccountnumber']) + 1);
$count_mysqlservers = $_dbserver['numservers'];
if ($count_mysqlservers > 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);
Database::needRoot(true, $dbserver);
Database::needSqlData(); if(!isset($sql_root[$dbserver]) || !is_array($sql_root[$dbserver]))
$sql_root = Database::getSqlData(); {
Database::needRoot(false);
if (!isset($sql_root) || !is_array($sql_root)) {
$dbserver = 0; $dbserver = 0;
} }
} }
else
{
$dbserver = 0;
}
// validate description before actual adding the database, #1052 // Begin root-session
$databasedescription = validate(trim($_POST['description']), 'description');
// create database, user, set permissions, etc.pp. $db_root = new db($sql_root[$dbserver]['host'], $sql_root[$dbserver]['user'], $sql_root[$dbserver]['password'], '');
$dbm = new DbManager($log); unset($db_root->password);
$username = $dbm->createDatabase( $db_root->query('CREATE DATABASE `' . $db_root->escape($username) . '`');
$userinfo['loginname'], $log->logAction(USR_ACTION, LOG_INFO, "created database '" . $username . "'");
$password, foreach(array_map('trim', explode(',', $settings['system']['mysql_access_host'])) as $mysql_access_host)
$userinfo['mysql_lastaccountnumber'] {
); $db_root->query('GRANT ALL PRIVILEGES ON `' . str_replace('_', '\_', $db_root->escape($username)) . '`.* TO `' . $db_root->escape($username) . '`@`' . $db_root->escape($mysql_access_host) . '` IDENTIFIED BY \'password\'');
$db_root->query('SET PASSWORD FOR `' . $db_root->escape($username) . '`@`' . $db_root->escape($mysql_access_host) . '` = PASSWORD(\'' . $db_root->escape($password) . '\')');
$log->logAction(USR_ACTION, LOG_NOTICE, "grant all privileges for '" . $username . "'@'" . $mysql_access_host . "'");
}
// Statement modified for Database description -- PH 2004-11-29 $db_root->query('FLUSH PRIVILEGES');
$stmt = Database::prepare('INSERT INTO `' . TABLE_PANEL_DATABASES . '` $db_root->close();
(`customerid`, `databasename`, `description`, `dbserver`)
VALUES (:customerid, :databasename, :description, :dbserver)'
);
$params = array(
"customerid" => $userinfo['customerid'],
"databasename" => $username,
"description" => $databasedescription,
"dbserver" => $dbserver
);
Database::pexecute($stmt, $params);
$stmt = Database::prepare('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` // End root-session
SET `mysqls_used` = `mysqls_used` + 1, `mysql_lastaccountnumber` = `mysql_lastaccountnumber` + 1 // Statement modifyed for Database description -- PH 2004-11-29
WHERE `customerid` = :customerid'
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid']));
if ($sendinfomail == 1) { $databasedescription = validate($_POST['description'], 'description');
$result = $db->query('INSERT INTO `' . TABLE_PANEL_DATABASES . '` (`customerid`, `databasename`, `description`, `dbserver`) VALUES ("' . (int)$userinfo['customerid'] . '", "' . $db->escape($username) . '", "' . $db->escape($databasedescription) . '", "' . $db->escape($dbserver) . '")');
$result = $db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used`=`mysqls_used`+1, `mysql_lastaccountnumber`=`mysql_lastaccountnumber`+1 WHERE `customerid`="' . (int)$userinfo['customerid'] . '"');
if($sendinfomail == 1)
{
$pma = $lng['admin']['notgiven']; $pma = $lng['admin']['notgiven'];
if (Settings::Get('panel.phpmyadmin_url') != '') { if($settings['panel']['phpmyadmin_url'] != '')
$pma = Settings::Get('panel.phpmyadmin_url'); {
$pma = $settings['panel']['phpmyadmin_url'];
} }
Database::needRoot(true, $dbserver);
Database::needSqlData();
$sql_root = Database::getSqlData();
Database::needRoot(false);
$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,
'DB_SRV' => $sql_root['caption'], 'DB_SRV' => $sql_root[$dbserver]['host'],
'PMA_URI' => $pma 'PMA_URI' => $pma
); );
$def_language = $userinfo['def_language']; $def_language = $userinfo['def_language'];
$result_stmt = Database::prepare("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "` $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\'');
WHERE `adminid` = :adminid
AND `language` = :lang
AND `templategroup`='mails'
AND `varname`='new_database_by_customer_subject'"
);
Database::pexecute($result_stmt, array("adminid" => $userinfo['adminid'], "lang" => $def_language));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$mail_subject = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['customer']['mysql_add']['infomail_subject']), $replace_arr)); $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\'');
$result_stmt = Database::prepare("SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
WHERE `adminid`= :adminid
AND `language`= :lang
AND `templategroup` = 'mails'
AND `varname` = 'new_database_by_customer_mailbody'"
);
Database::pexecute($result_stmt, array("adminid" => $userinfo['adminid'], "lang" => $def_language));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$mail_body = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['customer']['mysql_add']['infomail_body']['main']), $replace_arr)); $mail_body = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['customer']['mysql_add']['infomail_body']['main']), $replace_arr));
$_mailerror = false; $_mailerror = false;
@@ -262,98 +238,75 @@ if ($page == 'overview') {
$mail->ClearAddresses(); $mail->ClearAddresses();
} }
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} }
} else { }
else
$dbservers_stmt = Database::query("SELECT DISTINCT `dbserver` FROM `".TABLE_PANEL_DATABASES."`"); {
$mysql_servers = ''; $mysql_servers = '';
$count_mysqlservers = 0;
while ($dbserver = $dbservers_stmt->fetch(PDO::FETCH_ASSOC)) { foreach($sql_root as $mysql_server => $mysql_server_details)
Database::needRoot(true, $dbserver['dbserver']); {
Database::needSqlData(); $mysql_servers .= makeoption($mysql_server_details['caption'], $mysql_server);
$sql_root = Database::getSqlData();
$mysql_servers .= makeoption($sql_root['caption'], $dbserver['dbserver']);
$count_mysqlservers++;
} }
Database::needRoot(false);
$mysql_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/mysql/formfield.mysql_add.php'; $sendinfomail = makeyesno('sendinfomail', '1', '0', '0');
$mysql_add_form = htmlform::genHTMLForm($mysql_add_data);
$title = $mysql_add_data['mysql_add']['title']; eval("echo \"" . getTemplate("mysql/mysqls_add") . "\";");
$image = $mysql_add_data['mysql_add']['image'];
eval("echo \"" . getTemplate('mysql/mysqls_add') . "\";");
} }
} }
} elseif ($action == 'edit' && $id != 0) { }
$result_stmt = Database::prepare("SELECT `id`, `databasename`, `description`, `dbserver` FROM `" . TABLE_PANEL_DATABASES . "` elseif($action == 'edit'
WHERE `customerid` = :customerid && $id != 0)
AND `id` = :id" {
); $result = $db->query_first('SELECT `id`, `databasename`, `description`, `dbserver` FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid`="' . $userinfo['customerid'] . '" AND `id`="' . $id . '"');
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
if (isset($result['databasename']) && $result['databasename'] != '') { if(isset($result['databasename'])
if (!isset($sql_root[$result['dbserver']]) || !is_array($sql_root[$result['dbserver']])) { && $result['databasename'] != '')
{
if(!isset($sql_root[$result['dbserver']]) || !is_array($sql_root[$result['dbserver']]))
{
$result['dbserver'] = 0; $result['dbserver'] = 0;
} }
if (isset($_POST['send']) && $_POST['send'] == 'send') { if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
// 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'); $password = validate($_POST['mysql_password'], 'password');
if ($password != '') {
if($password != '')
{
// validate password // validate password
$password = validatePassword($password); $password = validatePassword($password);
// Begin root-session // Begin root-session
Database::needRoot(true); $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::Get('system.mysql_access_host'))) as $mysql_access_host) { unset($db_root->password);
$stmt = Database::prepare("SET PASSWORD FOR :dbname@:host = PASSWORD(:password)"); foreach(array_map('trim', explode(',', $settings['system']['mysql_access_host'])) as $mysql_access_host)
$params = array( {
"dbname" => $result['databasename'], $db_root->query('SET PASSWORD FOR `' . $db_root->escape($result['databasename']) . '`@`' . $db_root->escape($mysql_access_host) . '` = PASSWORD(\'' . $db_root->escape($password) . '\')');
"host" => $mysql_access_host,
"password" => $password
);
Database::pexecute($stmt, $params);
} }
$stmt = Database::prepare("FLUSH PRIVILEGES"); $db_root->query('FLUSH PRIVILEGES');
Database::pexecute($stmt); $db_root->close();
Database::needRoot(false);
// 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');
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_DATABASES . "` $result = $db->query('UPDATE `' . TABLE_PANEL_DATABASES . '` SET `description`="' . $db->escape($databasedescription) . '" WHERE `customerid`="' . (int)$userinfo['customerid'] . '" AND `id`="' . (int)$id . '"');
SET `description` = :desc redirectTo($filename, Array('page' => $page, 's' => $s));
WHERE `customerid` = :customerid }
AND `id` = :id" else
); {
Database::pexecute($stmt, array("desc" => $databasedescription, "customerid" => $userinfo['customerid'], "id" => $id)); eval("echo \"" . getTemplate("mysql/mysqls_edit") . "\";");
redirectTo($filename, array('page' => $page, 's' => $s));
} else {
$dbservers_stmt = Database::query("SELECT COUNT(DISTINCT `dbserver`) as numservers FROM `".TABLE_PANEL_DATABASES."`");
$dbserver = $dbservers_stmt->fetch(PDO::FETCH_ASSOC);
$count_mysqlservers = $dbserver['numservers'];
Database::needRoot(true, $result['dbserver']);
Database::needSqlData();
$sql_root = Database::getSqlData();
Database::needRoot(false);
$mysql_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/mysql/formfield.mysql_edit.php';
$mysql_edit_form = htmlform::genHTMLForm($mysql_edit_data);
$title = $mysql_edit_data['mysql_edit']['title'];
$image = $mysql_edit_data['mysql_edit']['image'];
eval("echo \"" . getTemplate('mysql/mysqls_edit') . "\";");
} }
} }
} }
} }
?>

View File

@@ -14,51 +14,49 @@
* @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');
require './lib/init.php';
if (isset($_POST['id'])) { /**
* Include our init.php, which manages Sessions, Language etc.
*/
require ("./lib/init.php");
if(isset($_POST['id']))
{
$id = intval($_POST['id']); $id = intval($_POST['id']);
}
//Check if the current user is allowed to see the current ticket. elseif(isset($_GET['id']))
$stmt = Database::prepare("SELECT `id` FROM `panel_tickets` WHERE `id` = :id AND `customerid` = :customerid"); {
$result = Database::pexecute_first($stmt, array("id" => $id, "customerid" => $userinfo['customerid']));
if ($result == null) {
// no rights to see the requested ticket
standard_error(array('ticketnotaccessible'));
}
} elseif (isset($_GET['id'])) {
$id = intval($_GET['id']); $id = intval($_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') { }
if ($action == '') { elseif($page == 'tickets')
{
if($action == '')
{
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_tickets::tickets"); $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_tickets::tickets");
$fields = array( $fields = array(
'status' => $lng['ticket']['status'], 'status' => $lng['ticket']['status'],
'priority' => $lng['ticket']['priority'],
'lastchange' => $lng['ticket']['lastchange'], 'lastchange' => $lng['ticket']['lastchange'],
'ticket_answers' => $lng['ticket']['ticket_answers'],
'subject' => $lng['ticket']['subject'], 'subject' => $lng['ticket']['subject'],
'lastreplier' => $lng['ticket']['lastreplier'] 'lastreplier' => $lng['ticket']['lastreplier']
); );
$paging = new paging($userinfo, TABLE_PANEL_TICKETS, $fields); $paging = new paging($userinfo, $db, TABLE_PANEL_TICKETS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
$stmt = Database::prepare('SELECT `main`.`id`, (SELECT COUNT(`sub`.`id`) FROM `' . TABLE_PANEL_TICKETS . '` `sub` $paging->sortfield = 'lastchange';
WHERE `sub`.`answerto` = `main`.`id`) AS `ticket_answers`, `main`.`lastchange`, `main`.`subject`, `main`.`status`, `main`.`lastreplier`, `main`.`priority` $paging->sortorder = 'desc';
FROM `' . TABLE_PANEL_TICKETS . '` as `main` $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());
WHERE `main`.`answerto` = "0" $paging->setEntries($db->num_rows($result));
AND `archived` = "0"
AND `customerid`= :customerid ' . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid']));
$paging->setEntries(Database::num_rows());
$sortcode = $paging->getHtmlSortCode($lng); $sortcode = $paging->getHtmlSortCode($lng);
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s); $arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
$searchcode = $paging->getHtmlSearchCode($lng); $searchcode = $paging->getHtmlSearchCode($lng);
@@ -68,35 +66,44 @@ if ($page == 'overview') {
$tickets = ''; $tickets = '';
$tickets_count = 0; $tickets_count = 0;
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result))
if ($paging->checkDisplay($i)) { {
if($paging->checkDisplay($i))
{
$tickets_count++; $tickets_count++;
$row = htmlentities_array($row); $row = htmlentities_array($row);
$row['lastchange'] = date("d.m.y H:i", $row['lastchange']); $row['lastchange'] = date("d.m.y H:i", $row['lastchange']);
if ($row['status'] >= 0 && $row['status'] <= 2) { if($row['status'] >= 0
&& $row['status'] <= 2)
{
$reopen = 0; $reopen = 0;
} else { }
else
{
$reopen = 1; $reopen = 1;
} }
$row['status'] = ticket::getStatusText($lng, $row['status']); $row['status'] = ticket::getStatusText($lng, $row['status']);
$row['priority'] = ticket::getPriorityText($lng, $row['priority']); $row['priority'] = ticket::getPriorityText($lng, $row['priority']);
if ($row['lastreplier'] == '1') { if($row['lastreplier'] == '1')
{
$row['lastreplier'] = $lng['ticket']['staff']; $row['lastreplier'] = $lng['ticket']['staff'];
$cananswer = 1; $cananswer = 1;
} else { }
else
{
$row['lastreplier'] = $lng['ticket']['customer']; $row['lastreplier'] = $lng['ticket']['customer'];
$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++;
} }
@@ -106,46 +113,60 @@ if ($page == 'overview') {
$supportavailable = 0; $supportavailable = 0;
$time = date("Hi", time()); $time = date("Hi", time());
$day = date("w", time()); $day = date("w", time());
$start = substr(Settings::Get('ticket.worktime_begin'), 0, 2) . substr(Settings::Get('ticket.worktime_begin'), 3, 2); $start = substr($settings['ticket']['worktime_begin'], 0, 2) . substr($settings['ticket']['worktime_begin'], 3, 2);
$end = substr(Settings::Get('ticket.worktime_end'), 0, 2) . substr(Settings::Get('ticket.worktime_end'), 3, 2); $end = substr($settings['ticket']['worktime_end'], 0, 2) . substr($settings['ticket']['worktime_end'], 3, 2);
if ($time >= $start && $time <= $end) { if($time >= $start
&& $time <= $end)
{
$supportavailable = 1; $supportavailable = 1;
} }
if (Settings::Get('ticket.worktime_sat') == "0" && $day == "6") { if($settings['ticket']['worktime_sat'] == "0"
&& $day == "6")
{
$supportavailable = 0; $supportavailable = 0;
} }
if (Settings::Get('ticket.worktime_sun') == "0" && $day == "0") { if($settings['ticket']['worktime_sun'] == "0"
&& $day == "0")
{
$supportavailable = 0; $supportavailable = 0;
} }
if (Settings::Get('ticket.worktime_all') == "1") { if($settings['ticket']['worktime_all'] == "1")
{
$supportavailable = 1; $supportavailable = 1;
} }
$ticketsopen = 0; $ticketsopen = 0;
$stmt = Database::prepare('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '` $opentickets = $db->query_first('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
WHERE `customerid` = :customerid WHERE `customerid` = "' . $userinfo['customerid'] . '"
AND `answerto` = "0" AND `answerto` = "0"
AND (`status` = "0" OR `status` = "1" OR `status` = "2")' AND (`status` = "0" OR `status` = "1" OR `status` = "2")');
);
$opentickets = Database::pexecute_first($stmt, array("customerid" => $userinfo['customerid']));
if (Settings::Get('ticket.concurrently_open') != - 1 && Settings::Get('ticket.concurrently_open') != '') { if($settings['ticket']['concurrently_open'] != - 1
$notmorethanxopentickets = strtr($lng['ticket']['notmorethanxopentickets'], array('%s' => Settings::Get('ticket.concurrently_open'))); && $settings['ticket']['concurrently_open'] != '')
} else { {
$notmorethanxopentickets = strtr($lng['ticket']['notmorethanxopentickets'], array('%s' => $settings['ticket']['concurrently_open']));
}
else
{
$notmorethanxopentickets = ''; $notmorethanxopentickets = '';
} }
$ticketsopen = (int)$opentickets['count']; $ticketsopen = (int)$opentickets['count'];
eval("echo \"" . getTemplate("tickets/tickets") . "\";"); eval("echo \"" . getTemplate("ticket/tickets") . "\";");
}
} elseif ($action == 'new') { elseif($action == 'new')
if ($userinfo['tickets_used'] < $userinfo['tickets'] || $userinfo['tickets'] == '-1') { {
if (isset($_POST['send']) && $_POST['send'] == 'send') { if($userinfo['tickets_used'] < $userinfo['tickets']
$newticket = ticket::getInstanceOf($userinfo, -1); || $userinfo['tickets'] == '-1')
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$newticket = ticket::getInstanceOf($userinfo, $db, $settings, -1);
$newticket->Set('subject', validate($_POST['subject'], 'subject'), true, false); $newticket->Set('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);
@@ -153,11 +174,16 @@ if ($page == 'overview') {
$newticket->Set('admin', (int)$userinfo['adminid'], true, false); $newticket->Set('admin', (int)$userinfo['adminid'], true, false);
$newticket->Set('message', validate(str_replace("\r\n", "\n", $_POST['message']), 'message', '/^[^\0]*$/'), true, false); $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)
{
standard_error(array('stringisempty', 'mysubject')); standard_error(array('stringisempty', 'mysubject'));
} elseif ($newticket->Get('message') == null) { }
elseif($newticket->Get('message') == null)
{
standard_error(array('stringisempty', 'mymessage')); standard_error(array('stringisempty', 'mymessage'));
} else { }
else
{
$now = time(); $now = time();
$newticket->Set('dt', $now, true, true); $newticket->Set('dt', $now, true, true);
$newticket->Set('lastchange', $now, true, true); $newticket->Set('lastchange', $now, true, true);
@@ -167,84 +193,86 @@ if ($page == 'overview') {
$newticket->Set('by', '0', true, true); $newticket->Set('by', '0', true, true);
$newticket->Insert(); $newticket->Insert();
$log->logAction(USR_ACTION, LOG_NOTICE, "opened support-ticket '" . $newticket->Get('subject') . "'"); $log->logAction(USR_ACTION, LOG_NOTICE, "opened support-ticket '" . $newticket->Get('subject') . "'");
$db->query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '`
$stmt = Database::prepare('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `tickets_used`=`tickets_used`+1 WHERE `customerid`="' . (int)$userinfo['customerid'] . '"');
SET `tickets_used`=`tickets_used` + 1
WHERE `customerid`= :customerid'
);
Database::pexecute($stmt, array("customerid" => $userinfo['customerid']));
// Customer mail // Customer mail
$newticket->sendMail((int)$userinfo['customerid'], 'new_ticket_for_customer_subject', $lng['mails']['new_ticket_for_customer']['subject'], 'new_ticket_for_customer_mailbody', $lng['mails']['new_ticket_for_customer']['mailbody']); $newticket->sendMail((int)$userinfo['customerid'], 'new_ticket_for_customer_subject', $lng['mails']['new_ticket_for_customer']['subject'], 'new_ticket_for_customer_mailbody', $lng['mails']['new_ticket_for_customer']['mailbody']);
// Admin mail // Admin mail
$newticket->sendMail(-1, 'new_ticket_by_customer_subject', $lng['mails']['new_ticket_by_customer']['subject'], 'new_ticket_by_customer_mailbody', $lng['mails']['new_ticket_by_customer']['mailbody']); $newticket->sendMail(-1, 'new_ticket_by_customer_subject', $lng['mails']['new_ticket_by_customer']['subject'], 'new_ticket_by_customer_mailbody', $lng['mails']['new_ticket_by_customer']['mailbody']);
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} }
} else { }
else
{
$categories = ''; $categories = '';
$result_stmt = Database::prepare('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` $result = $db->query_first('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` ORDER BY `logicalorder`, `name` ASC');
WHERE `adminid` = :adminid
ORDER BY `logicalorder`, `name` ASC'
);
$result = Database::pexecute_first($result_stmt, array("adminid" => $userinfo['adminid']));
if (isset($result['name']) && $result['name'] != '') { if(isset($result['name'])
$result2_stmt = Database::prepare('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` && $result['name'] != '')
WHERE `adminid` = :adminid {
ORDER BY `logicalorder`, `name` ASC' $result2 = $db->query('SELECT `id`, `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` ORDER BY `logicalorder`, `name` ASC');
);
Database::pexecute($result2_stmt, array("adminid" => $userinfo['adminid']));
while ($row = $result2_stmt->fetch(PDO::FETCH_ASSOC)) { while($row = $db->fetch_array($result2))
{
$categories.= makeoption($row['name'], $row['id']); $categories.= makeoption($row['name'], $row['id']);
} }
} else { }
else
{
$categories = makeoption($lng['ticket']['no_cat'], '0'); $categories = makeoption($lng['ticket']['no_cat'], '0');
} }
$priorities = makeoption($lng['ticket']['high'], '1'); $priorities = makeoption($lng['ticket']['unf_high'], '1', $settings['ticket']['default_priority']);
$priorities.= makeoption($lng['ticket']['normal'], '2'); $priorities.= makeoption($lng['ticket']['unf_normal'], '2', $settings['ticket']['default_priority']);
$priorities.= makeoption($lng['ticket']['low'], '3'); $priorities.= makeoption($lng['ticket']['unf_low'], '3', $settings['ticket']['default_priority']);
$ticketsopen = 0; $ticketsopen = 0;
$opentickets_stmt = Database::prepare('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '` $opentickets = $db->query_first('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
WHERE `customerid` = :customerid WHERE `customerid` = "' . $userinfo['customerid'] . '"
AND `answerto` = "0" AND `answerto` = "0"
AND (`status` = "0" OR `status` = "1" OR `status` = "2")' AND (`status` = "0" OR `status` = "1" OR `status` = "2")');
);
$opentickets = Database::pexecute_first($opentickets_stmt, array("customerid" => $userinfo['customerid']));
if (Settings::Get('ticket.concurrently_open') != -1 && Settings::Get('ticket.concurrently_open') != '') { if($settings['ticket']['concurrently_open'] != - 1
$notmorethanxopentickets = strtr($lng['ticket']['notmorethanxopentickets'], array('%s' => Settings::Get('ticket.concurrently_open'))); && $settings['ticket']['concurrently_open'] != '')
} else { {
$notmorethanxopentickets = strtr($lng['ticket']['notmorethanxopentickets'], array('%s' => $settings['ticket']['concurrently_open']));
}
else
{
$notmorethanxopentickets = ''; $notmorethanxopentickets = '';
} }
$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
{
standard_error('nomoreticketsavailable'); standard_error('nomoreticketsavailable');
} }
} elseif ($action == 'answer' && $id != 0) { }
if (isset($_POST['send']) && $_POST['send'] == 'send') { elseif($action == 'answer'
$replyticket = ticket::getInstanceOf($userinfo, -1); && $id != 0)
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$replyticket = ticket::getInstanceOf($userinfo, $db, $settings, -1);
$replyticket->Set('subject', validate($_POST['subject'], 'subject'), true, false); $replyticket->Set('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(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)
{
standard_error(array('stringisempty', 'mymessage')); standard_error(array('stringisempty', 'mymessage'));
} else { }
else
{
$now = time(); $now = time();
$replyticket->Set('customer', (int)$userinfo['customerid'], true, true); $replyticket->Set('customerid', (int)$userinfo['customerid'], true, true);
$replyticket->Set('lastchange', $now, true, true); $replyticket->Set('lastchange', $now, true, true);
$replyticket->Set('ip', $_SERVER['REMOTE_ADDR'], true, true); $replyticket->Set('ip', $_SERVER['REMOTE_ADDR'], true, true);
$replyticket->Set('status', '1', true, true); $replyticket->Set('status', '1', true, true);
@@ -253,9 +281,11 @@ if ($page == 'overview') {
$replyticket->Insert(); $replyticket->Insert();
// Update priority if changed // Update priority if changed
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
if ($replyticket->Get('priority') != $mainticket->Get('priority')) { $mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
if($replyticket->Get('priority') != $mainticket->Get('priority'))
{
$mainticket->Set('priority', $replyticket->Get('priority'), true); $mainticket->Set('priority', $replyticket->Get('priority'), true);
} }
@@ -265,112 +295,120 @@ if ($page == 'overview') {
$mainticket->Update(); $mainticket->Update();
$log->logAction(USR_ACTION, LOG_NOTICE, "answered support-ticket '" . $mainticket->Get('subject') . "'"); $log->logAction(USR_ACTION, LOG_NOTICE, "answered support-ticket '" . $mainticket->Get('subject') . "'");
$mainticket->sendMail(-1, 'new_reply_ticket_by_customer_subject', $lng['mails']['new_reply_ticket_by_customer']['subject'], 'new_reply_ticket_by_customer_mailbody', $lng['mails']['new_reply_ticket_by_customer']['mailbody']); $mainticket->sendMail(-1, 'new_reply_ticket_by_customer_subject', $lng['mails']['new_reply_ticket_by_customer']['subject'], 'new_reply_ticket_by_customer_mailbody', $lng['mails']['new_reply_ticket_by_customer']['mailbody']);
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} }
} else { }
else
{
$ticket_replies = ''; $ticket_replies = '';
$mainticket = ticket::getInstanceOf($userinfo, (int)$id); $mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
$dt = date("d.m.Y H:i\h", $mainticket->Get('dt')); $dt = date("d.m.Y H:i\h", $mainticket->Get('dt'));
$status = ticket::getStatusText($lng, $mainticket->Get('status')); $status = ticket::getStatusText($lng, $mainticket->Get('status'));
if ($mainticket->Get('status') >= 0 && $mainticket->Get('status') <= 2) { if($mainticket->Get('status') >= 0
&& $mainticket->Get('status') <= 2)
{
$isclosed = 0; $isclosed = 0;
} else { }
else
{
$isclosed = 1; $isclosed = 1;
} }
if ($mainticket->Get('by') == '1') { if($mainticket->Get('by') == '1')
{
$by = $lng['ticket']['staff']; $by = $lng['ticket']['staff'];
} else { }
$cid = $mainticket->Get('customer'); else
$usr_stmt = Database::prepare('SELECT `customerid`, `firstname`, `name`, `company`, `loginname` {
FROM `' . TABLE_PANEL_CUSTOMERS . '` $by = $lng['ticket']['customer'];
WHERE `customerid` = :customerid '
);
$usr = Database::pexecute_first($usr_stmt, array("customerid" => $cid));
$by = getCorrectFullUserDetails($usr);
} }
$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_stmt = Database::prepare('SELECT `name` FROM `' . TABLE_PANEL_TICKET_CATS . '` $result = $db->query('SELECT `name` FROM `' . TABLE_PANEL_TICKET_CATS . '`
WHERE `id`= :id ' WHERE `id`="' . (int)$mainticket->Get('category') . '"');
); $row = $db->fetch_array($result);
$row = Database::pexecute_first($result_stmt, array("id" => $mainticket->Get('category'))); $andere = $db->query('SELECT * FROM `' . TABLE_PANEL_TICKETS . '` WHERE `answerto`="' . (int)$id . '" ORDER BY `lastchange` ASC');
$andere_stmt = Database::prepare('SELECT * FROM `' . TABLE_PANEL_TICKETS . '` while($row2 = $db->fetch_array($andere))
WHERE `answerto`= :answerto {
ORDER BY `lastchange` ASC' $subticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$row2['id']);
);
Database::pexecute($andere_stmt, array("answerto" => $id));
$numrows_andere = Database::num_rows();
while ($row2 = $andere_stmt->fetch(PDO::FETCH_ASSOC)) {
$subticket = ticket::getInstanceOf($userinfo, (int)$row2['id']);
$lastchange = date("d.m.Y H:i\h", $subticket->Get('lastchange')); $lastchange = date("d.m.Y H:i\h", $subticket->Get('lastchange'));
if ($subticket->Get('by') == '1') { if($subticket->Get('by') == '1')
{
$by = $lng['ticket']['staff']; $by = $lng['ticket']['staff'];
} else { }
$by = getCorrectFullUserDetails($usr); else
{
$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);
$priorities.= makeoption($lng['ticket']['normal'], '2', $mainticket->Get('priority'), true, true); $priorities.= makeoption($lng['ticket']['normal'], '2', $mainticket->Get('priority'), true, true);
$priorities.= makeoption($lng['ticket']['low'], '3', $mainticket->Get('priority'), true, true); $priorities.= makeoption($lng['ticket']['low'], '3', $mainticket->Get('priority'), true, true);
$subject = htmlentities($mainticket->Get('subject')); $subject = $mainticket->Get('subject');
$ticket_replies_count = $numrows_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/customer/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' && $id != 0) { }
if (isset($_POST['send']) && $_POST['send'] == 'send') { elseif($action == 'close'
&& $id != 0)
{
if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$now = time(); $now = time();
$mainticket = ticket::getInstanceOf($userinfo, (int)$id); $mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
$mainticket->Set('lastchange', $now, true, true); $mainticket->Set('lastchange', $now, true, true);
$mainticket->Set('lastreplier', '0', true, true); $mainticket->Set('lastreplier', '0', true, true);
$mainticket->Set('status', '3', true, true); $mainticket->Set('status', '3', true, true);
$mainticket->Update(); $mainticket->Update();
$log->logAction(USR_ACTION, LOG_NOTICE, "closed support-ticket '" . $mainticket->Get('subject') . "'"); $log->logAction(USR_ACTION, LOG_NOTICE, "closed support-ticket '" . $mainticket->Get('subject') . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} else { }
$mainticket = ticket::getInstanceOf($userinfo, (int)$id); else
{
$mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
ask_yesno('ticket_reallyclose', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject')); ask_yesno('ticket_reallyclose', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject'));
} }
} elseif ($action == 'reopen' && $id != 0) { }
elseif($action == 'reopen'
&& $id != 0)
{
$ticketsopen = 0; $ticketsopen = 0;
$opentickets_stmt = Database::prepare('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '` $opentickets = $db->query_first('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
WHERE `customerid` = :customerid WHERE `customerid` = "' . $userinfo['customerid'] . '"
AND `answerto` = "0" AND `answerto` = "0"
AND (`status` = "0" OR `status` = "1" OR `status` = "2")' AND (`status` = "0" OR `status` = "1" OR `status` = "2")');
);
$opentickets = Database::pexecute_first($opentickets_stmt, array("customerid" => $userinfo['customerid']));
$ticketsopen = (int)$opentickets['count']; $ticketsopen = (int)$opentickets['count'];
if ($ticketsopen > Settings::Get('ticket.concurrently_open') && Settings::Get('ticket.concurrently_open') != - 1 && Settings::Get('ticket.concurrently_open') != '') { if($ticketsopen > $settings['ticket']['concurrently_open']
standard_error('notmorethanxopentickets', Settings::Get('ticket.concurrently_open')); && $settings['ticket']['concurrently_open'] != - 1
&& $settings['ticket']['concurrently_open'] != '')
{
standard_error('notmorethanxopentickets', $settings['ticket']['concurrently_open']);
} }
$now = time(); $now = time();
$mainticket = ticket::getInstanceOf($userinfo, (int)$id); $mainticket = ticket::getInstanceOf($userinfo, $db, $settings, (int)$id);
$mainticket->Set('lastchange', $now, true, true); $mainticket->Set('lastchange', $now, true, true);
$mainticket->Set('lastreplier', '0', true, true); $mainticket->Set('lastreplier', '0', true, true);
$mainticket->Set('status', '0', true, true); $mainticket->Set('status', '0', true, true);
$mainticket->Update(); $mainticket->Update();
$log->logAction(USR_ACTION, LOG_NOTICE, "reopened support-ticket '" . $mainticket->Get('subject') . "'"); $log->logAction(USR_ACTION, LOG_NOTICE, "reopened support-ticket '" . $mainticket->Get('subject') . "'");
redirectTo($filename, array('page' => $page, 's' => $s)); redirectTo($filename, Array('page' => $page, 's' => $s));
} }
} }
?>

View File

@@ -14,147 +14,271 @@
* @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');
$intrafficpage = 1;
require './lib/init.php'; /**
* Include our init.php, which manages Sessions, Language etc.
*/
require ("./lib/init.php");
$traffic = ''; $traffic = '';
$month = null; $month = null;
$year = null; $year = null;
if (isset($_POST['month']) && isset($_POST['year'])) { if(isset($_POST['month'])
&& 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']);
} }
//BAM! $_GET??? //BAM! $_GET???
elseif (isset($_GET['page']) && $_GET['page'] == 'current') {
if (date('d') != '01') { elseif (isset($_GET['page'])
&& $_GET['page'] == "current")
{
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) && !is_null($year)) { if(!is_null($month)
&& !is_null($year))
{
$traf['byte'] = 0; $traf['byte'] = 0;
$result_stmt = Database::prepare("SELECT SUM(`http`) as 'http', SUM(`ftp_up`) AS 'ftp_up', SUM(`ftp_down`) as 'ftp_down', SUM(`mail`) as 'mail', `day`, `month`, `year` $result = $db->query("SELECT MAX(`http`), MAX(`ftp_up`+`ftp_down`), MAX(`mail`)
FROM `" . TABLE_PANEL_TRAFFIC . "` FROM `" . TABLE_PANEL_TRAFFIC . "`
WHERE `customerid`= :customerid WHERE `customerid`='" . $userinfo['customerid'] . "'
AND `month` = :month AND `month` = '" . $month . "'
AND `year` = :year AND `year` = '" . $year . "'");
GROUP BY `day` $row = mysql_fetch_row($result);
ORDER BY `day` DESC" rsort($row);
); $traf['max'] = ($row[0] > $row[1] ? ($row[0] > $row[2] ? $row[0] : $row[2]) : ($row[1] > $row[2] ? $row[1] : $row[2]));;
$params = array( $result = $db->query("SELECT
"customerid" => $userinfo['customerid'], SUM(`http`) as 'http', SUM(`ftp_up`) AS 'ftp_up', SUM(`ftp_down`) as 'ftp_down', SUM(`mail`) as 'mail',
"month" => $month, `day`, `month`, `year`
"year" => $year FROM `" . TABLE_PANEL_TRAFFIC . "`
); WHERE `customerid`='" . $userinfo['customerid'] . "'
Database::pexecute($result_stmt, $params); AND `month` = '" . $month . "' AND `year` = '" . $year . "'
GROUP BY `day` ORDER BY `day` ASC");
$traffic_complete['http'] = 0; $traffic_complete['http'] = 0;
$traffic_complete['ftp'] = 0; $traffic_complete['ftp'] = 0;
$traffic_complete['mail'] = 0; $traffic_complete['mail'] = 0;
$show = ''; $show = '';
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { 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::Get('panel.decimal_places')) . " MiB up/ " . bcdiv($row['ftp_down'], 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)"; {
$traf['httptext'] = bcdiv($http, 1024, Settings::Get('panel.decimal_places')) . " MiB (HTTP)"; $traf['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['mailtext'] = bcdiv($mail, 1024, Settings::Get('panel.decimal_places')) . " MiB (Mail)"; $traf['httptext'] = bcdiv($http, 1024, $settings['panel']['decimal_places']) . " MB (HTTP)";
$traf['ftp'] = bcdiv($ftp, 1024, Settings::Get('panel.decimal_places')); $traf['mailtext'] = bcdiv($mail, 1024, $settings['panel']['decimal_places']) . " MB (Mail)";
$traf['http'] = bcdiv($http, 1024, Settings::Get('panel.decimal_places')); }
$traf['mail'] = bcdiv($mail, 1024, Settings::Get('panel.decimal_places')); else
$traf['byte'] = bcdiv($traf['byte'], 1024, Settings::Get('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::Get('panel.decimal_places')) . " MiB up/ " . round($row['ftp_down'] / 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)"; $traf['httptext'] = round($http / 1024, $settings['panel']['decimal_places']) . " MB (HTTP)";
$traf['httptext'] = round($http / 1024, Settings::Get('panel.decimal_places')) . " MiB (HTTP)"; $traf['mailtext'] = round($mail / 1024, $settings['panel']['decimal_places']) . " MB (Mail)";
$traf['mailtext'] = round($mail / 1024, Settings::Get('panel.decimal_places')) . " MiB (Mail)";
$traf['http'] = round($http, Settings::Get('panel.decimal_places'));
$traf['ftp'] = round($ftp, Settings::Get('panel.decimal_places'));
$traf['mail'] = round($mail, Settings::Get('panel.decimal_places'));
$traf['byte'] = round($traf['byte'] / 1024, Settings::Get('panel.decimal_places'));
} }
eval("\$traffic.=\"" . getTemplate('traffic/traffic_month') . "\";"); if($traf['byte'] != 0
$show = $lng['traffic']['months'][intval($row['month'])] . ' ' . $row['year']; && $traf['max'] != 0)
{
$proz = $traf['max'] / 100;
$traf['http'] = round($http / $proz, 0);
$traf['ftp'] = round($ftp / $proz, 0);
$traf['mail'] = round($mail / $proz, 0);
if($traf['http'] == 0)
{
$traf['http'] = 1;
}
if($traf['ftp'] == 0)
{
$traf['ftp'] = 1;
}
if($traf['mail'] == 0)
{
$traf['mail'] = 1;
}
}
else
{
$traf['http'] = 0;
$traf['ftp'] = 0;
$traf['mail'] = 0;
}
if(extension_loaded('bcmath'))
{
$traf['byte'] = bcdiv($traf['byte'], 1024, $settings['panel']['decimal_places']);
}
else
{
$traf['byte'] = round($traf['byte'] / 1024, $settings['panel']['decimal_places']);
}
eval("\$traffic.=\"" . getTemplate("traffic/traffic_month") . "\";");
$show = $lng['traffic']['months'][intval($row['month'])] . " " . $row['year'];
} }
$traffic_complete['http'] = size_readable($traffic_complete['http'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s'); if(extension_loaded('bcmath'))
$traffic_complete['ftp'] = size_readable($traffic_complete['ftp'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s'); {
$traffic_complete['mail'] = size_readable($traffic_complete['mail'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s'); $traffic_complete['http'] = bcdiv($traffic_complete['http'], 1024, $settings['panel']['decimal_places']);
$traffic_complete['ftp'] = bcdiv($traffic_complete['ftp'], 1024, $settings['panel']['decimal_places']);
$traffic_complete['mail'] = bcdiv($traffic_complete['mail'], 1024, $settings['panel']['decimal_places']);
}
else
{
$traffic_complete['http'] = round($traffic_complete['http'] / 1024, $settings['panel']['decimal_places']);
$traffic_complete['ftp'] = round($traffic_complete['ftp'] / 1024, $settings['panel']['decimal_places']);
$traffic_complete['mail'] = round($traffic_complete['mail'] / 1024, $settings['panel']['decimal_places']);
}
eval("echo \"" . getTemplate('traffic/traffic_details') . "\";"); eval("echo \"" . getTemplate("traffic/traffic_details") . "\";");
} else { }
$result_stmt = Database::prepare("SELECT `month`, `year`, SUM(`http`) AS http, SUM(`ftp_up`) AS ftp_up, SUM(`ftp_down`) AS ftp_down, SUM(`mail`) AS mail else
FROM `" . TABLE_PANEL_TRAFFIC . "` {
WHERE `customerid` = :customerid $result = $db->query("SELECT MAX(`http`), MAX(`ftp_up`+`ftp_down`), MAX(`mail`)
GROUP BY CONCAT(`year`,`month`) FROM `" . TABLE_PANEL_TRAFFIC . "`
ORDER BY CONCAT(`year`,`month`) DESC WHERE `customerid`='" . $userinfo['customerid'] . "'
LIMIT 12" GROUP BY CONCAT(`year`,`month`) ORDER BY CONCAT(`year`,`month`) DESC LIMIT 12");
);
Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'])); $nums = mysql_num_rows($result);
if($nums > 0)
{
$row = mysql_fetch_row($result);
rsort($row);
$traf['max'] = ($row[0] > $row[1] ? ($row[0] > $row[2] ? $row[0] : $row[2]) : ($row[1] > $row[2] ? $row[1] : $row[2]));
} else {
// no records yet
$traf['max'] = 0;
}
$result = $db->query("SELECT `month`, `year`, SUM(`http`) AS http, SUM(`ftp_up`) AS ftp_up, SUM(`ftp_down`) AS ftp_down, SUM(`mail`) AS mail
FROM `" . TABLE_PANEL_TRAFFIC . "` WHERE `customerid` = '" . $userinfo['customerid'] . "'
GROUP BY CONCAT(`year`,`month`) ORDER BY CONCAT(`year`,`month`) DESC LIMIT 12");
$traffic_complete['http'] = 0; $traffic_complete['http'] = 0;
$traffic_complete['ftp'] = 0; $traffic_complete['ftp'] = 0;
$traffic_complete['mail'] = 0; $traffic_complete['mail'] = 0;
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { 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::Get('panel.decimal_places')) . " MiB up/ " . bcdiv($ftp_down, 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)"; {
$traf['httptext'] = bcdiv($http, 1024, Settings::Get('panel.decimal_places')) . " MiB (HTTP)"; $traf['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::Get('panel.decimal_places')) . " MiB (Mail)"; $traf['httptext'] = bcdiv($http, 1024 * 1024, $settings['panel']['decimal_places']) . " GB (HTTP)";
$traf['ftp'] = bcdiv(($ftp_up + $ftp_down), 1024, Settings::Get('panel.decimal_places')); $traf['mailtext'] = bcdiv($mail, 1024 * 1024, $settings['panel']['decimal_places']) . " GB (Mail)";
$traf['http'] = bcdiv($http, 1024, Settings::Get('panel.decimal_places')); }
$traf['mail'] = bcdiv($mail, 1024, Settings::Get('panel.decimal_places')); else
$traf['byte'] = bcdiv($traf['byte'], 1024 * 1024, Settings::Get('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::Get('panel.decimal_places')) . " MiB up/ " . round($ftp_down / 1024, Settings::Get('panel.decimal_places')) . " MiB down (FTP)"; $traf['httptext'] = round($http / 1024 * 1024, $settings['panel']['decimal_places']) . " GB (HTTP)";
$traf['httptext'] = round($http / 1024, Settings::Get('panel.decimal_places')) . " MiB (HTTP)"; $traf['mailtext'] = round($mail / 1024 * 1024, $settings['panel']['decimal_places']) . " GB (Mail)";
$traf['mailtext'] = round($mail / 1024, Settings::Get('panel.decimal_places')) . " MiB (Mail)";
$traf['ftp'] = round(($ftp_up + $ftp_down) / 1024, Settings::Get('panel.decimal_places'));
$traf['http'] = round($http / 1024, Settings::Get('panel.decimal_places'));
$traf['mail'] = round($mail / 1024, Settings::Get('panel.decimal_places'));
$traf['byte'] = round($traf['byte'] / (1024 * 1024), Settings::Get('panel.decimal_places'));
} }
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") . "\";");
} }
$traffic_complete['http'] = size_readable($traffic_complete['http'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s'); if(extension_loaded('bcmath'))
$traffic_complete['ftp'] = size_readable($traffic_complete['ftp'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s'); {
$traffic_complete['mail'] = size_readable($traffic_complete['mail'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s'); $traffic_complete['http'] = bcdiv($traffic_complete['http'], 1024 * 1024, $settings['panel']['decimal_places']);
$traffic_complete['ftp'] = bcdiv($traffic_complete['ftp'], 1024 * 1024, $settings['panel']['decimal_places']);
$traffic_complete['mail'] = bcdiv($traffic_complete['mail'], 1024 * 1024, $settings['panel']['decimal_places']);
}
else
{
$traffic_complete['http'] = round($traffic_complete['http'] / 1024 * 1024, $settings['panel']['decimal_places']);
$traffic_complete['ftp'] = round($traffic_complete['ftp'] / 1024 * 1024, $settings['panel']['decimal_places']);
$traffic_complete['mail'] = round($traffic_complete['mail'] / 1024 * 1024, $settings['panel']['decimal_places']);
}
eval("echo \"" . 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

BIN
images/traffic_blue.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 B

BIN
images/traffic_green.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 B

BIN
images/traffic_red.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

BIN
images/traffic_yellow.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 827 B

586
index.php
View File

@@ -14,394 +14,292 @@
* @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');
require './lib/init.php';
if ($action == '') { /**
* Include our init.php, which manages Sessions, Language etc.
*/
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');
$stmt = Database::prepare("SELECT `loginname` AS `customer` FROM `" . TABLE_PANEL_CUSTOMERS . "` $row = $db->query_first("SELECT `loginname` AS `customer` FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `loginname`='" . $db->escape($loginname) . "'");
WHERE `loginname`= :loginname"
);
Database::pexecute($stmt, array("loginname" => $loginname));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
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::Get('login.domain_login') == 1) {
$domainname = $idna_convert->encode(preg_replace(array('/\:(\d)+$/', '/^https?\:\/\//'), '', $loginname));
$stmt = Database::prepare("SELECT `customerid` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `domain` = :domain"
);
Database::pexecute($stmt, array("domain" => $domainname));
$row2 = $stmt->fetch(PDO::FETCH_ASSOC);
if (isset($row2['customerid']) && $row2['customerid'] > 0) {
$loginname = getCustomerDetail($row2['customerid'], 'loginname');
if ($loginname !== false) {
$stmt = Database::prepare("SELECT `loginname` AS `customer` FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE `loginname`= :loginname"
);
Database::pexecute($stmt, array("loginname" => $loginname));
$row3 = $stmt->fetch(PDO::FETCH_ASSOC);
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)) { {
$stmt = Database::prepare("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "` if(hasUpdates($version))
WHERE `loginname`= :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'");
); /*
Database::pexecute($stmt, array("loginname" => $loginname)); * not an admin who can see updates
$row = $stmt->fetch(PDO::FETCH_ASSOC); */
if (!isset($row['admin'])) { if(!isset($row['admin']))
// not an admin who can see updates {
redirectTo('index.php'); redirectTo('index.php');
exit; exit;
} }
} else { }
$stmt = Database::prepare("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "` else
WHERE `loginname`= :loginname" {
); $row = $db->query_first("SELECT `loginname` AS `admin` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `loginname`='" . $db->escape($loginname) . "'");
Database::pexecute($stmt, array("loginname" => $loginname));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
} }
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 { }
// Log failed login else
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => $_SERVER['REMOTE_ADDR'])); {
$rstlog->logAction(LOGIN_ACTION, LOG_WARNING, "Unknown user '" . $loginname . "' tried to login."); redirectTo('index.php', Array('showmessage' => '2'), true);
redirectTo('index.php', array('showmessage' => '2'), true);
exit; exit;
} }
} }
$userinfo_stmt = Database::prepare("SELECT * FROM $table $userinfo = $db->query_first("SELECT * FROM $table WHERE `loginname`='" . $db->escape($loginname) . "'");
WHERE `loginname`= :loginname"
);
Database::pexecute($userinfo_stmt, array("loginname" => $loginname));
$userinfo = $userinfo_stmt->fetch(PDO::FETCH_ASSOC);
if ($userinfo['loginfail_count'] >= Settings::Get('login.maxloginattempts') && $userinfo['lastlogin_fail'] > (time() - Settings::Get('login.deactivatetime'))) { if($userinfo['loginfail_count'] >= $settings['login']['maxloginattempts']
redirectTo('index.php', array('showmessage' => '3'), true); && $userinfo['lastlogin_fail'] > (time() - $settings['login']['deactivatetime']))
{
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
$stmt = Database::prepare("UPDATE $table
SET `lastlogin_succ`= :lastlogin_succ, `loginfail_count`='0' $db->query("UPDATE $table SET `lastlogin_succ`='" . time() . "', `loginfail_count`='0' WHERE `$uid`='" . (int)$userinfo[$uid] . "'");
WHERE `$uid`= :uid"
);
Database::pexecute($stmt, array("lastlogin_succ" => time(), "uid" => $userinfo[$uid]));
$userinfo['userid'] = $userinfo[$uid]; $userinfo['userid'] = $userinfo[$uid];
$userinfo['adminsession'] = $adminsession; $userinfo['adminsession'] = $adminsession;
} else { }
else
{
// login incorrect // login incorrect
$stmt = Database::prepare("UPDATE $table
SET `lastlogin_fail`= :lastlogin_fail, `loginfail_count`=`loginfail_count`+1
WHERE `$uid`= :uid"
);
Database::pexecute($stmt, array("lastlogin_fail" => time(), "uid" => $userinfo[$uid]));
// Log failed login
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => $_SERVER['REMOTE_ADDR']));
$rstlog->logAction(LOGIN_ACTION, LOG_WARNING, "User '" . $loginname . "' tried to login with wrong password.");
$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']) && $userinfo['userid'] != '') { if(isset($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])) {
$language = Settings::Get('panel.standardlanguage');
} }
} else { elseif(!isset($languages[$language]))
$language = Settings::Get('panel.standardlanguage'); {
} $language = $settings['panel']['standardlanguage'];
if (isset($userinfo['theme']) && $userinfo['theme'] != '') {
$theme = $userinfo['theme'];
} else {
$theme = Settings::Get('panel.default_theme');
}
if (Settings::Get('session.allow_multiple_login') != '1') {
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_SESSIONS . "`
WHERE `userid` = :uid
AND `adminsession` = :adminsession"
);
Database::pexecute($stmt, array("uid" => $userinfo['userid'], "adminsession" => $userinfo['adminsession']));
}
// check for field 'theme' in session-table, refs #607
// Changed with #1287 to new method
$theme_field = false;
$stmt = Database::query("SHOW COLUMNS FROM panel_sessions LIKE 'theme'");
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
if ($row['Field'] == "theme") {
$has_theme = true;
} }
} }
else
$params = array( {
"hash" => $s, $language = $settings['panel']['standardlanguage'];
"userid" => $userinfo['userid'],
"ipaddress" => $remote_addr,
"useragent" => $http_user_agent,
"lastactivity" => time(),
"language" => $language,
"adminsession" => $userinfo['adminsession']
);
if ($has_theme) {
$params["theme"] = $theme;
$stmt = Database::prepare("INSERT INTO `" . TABLE_PANEL_SESSIONS . "`
(`hash`, `userid`, `ipaddress`, `useragent`, `lastactivity`, `language`, `adminsession`, `theme`)
VALUES (:hash, :userid, :ipaddress, :useragent, :lastactivity, :language, :adminsession, :theme)"
);
} else {
$stmt = Database::prepare("INSERT INTO `" . TABLE_PANEL_SESSIONS . "`
(`hash`, `userid`, `ipaddress`, `useragent`, `lastactivity`, `language`, `adminsession`)
VALUES (:hash, :userid, :ipaddress, :useragent, :lastactivity, :language, :adminsession)"
);
} }
Database::pexecute($stmt, $params);
if($settings['session']['allow_multiple_login'] != '1')
$qryparams = array(); {
if (isset($_POST['qrystr']) && $_POST['qrystr'] != "") { $db->query("DELETE FROM `" . TABLE_PANEL_SESSIONS . "` WHERE `userid` = '" . (int)$userinfo['userid'] . "' AND `adminsession` = '" . $db->escape($userinfo['adminsession']) . "'");
parse_str(urldecode($_POST['qrystr']), $qryparams);
} }
$qryparams['s'] = $s;
$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']) . "')");
if ($userinfo['adminsession'] == '1') {
if (hasUpdates($version)) { if($userinfo['adminsession'] == '1')
redirectTo('admin_updates.php', array('s' => $s), true); {
} else { if(hasUpdates($version))
if (isset($_POST['script']) && $_POST['script'] != "") { {
redirectTo($_POST['script'], $qryparams, true); redirectTo('admin_updates.php', Array('s' => $s), true);
} else { exit;
redirectTo('admin_index.php', $qryparams, true);
}
} }
} else { else
if (isset($_POST['script']) && $_POST['script'] != "") { {
redirectTo($_POST['script'], $qryparams, true); redirectTo('admin_index.php', Array('s' => $s), true);
} else { exit;
redirectTo('customer_index.php', $qryparams, 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: {
$successmessage = $lng['pwdreminder']['success']; case 1:
break; $message = $lng['pwdreminder']['success'];
case 2: break;
$message = $lng['error']['login']; case 2:
break; $message = $lng['error']['login'];
case 3: break;
$message = sprintf($lng['error']['login_blocked'], Settings::Get('login.deactivatetime')); case 3:
break; $message = $lng['error']['login_blocked'];
case 4: break;
$cmail = isset($_GET['customermail']) ? $_GET['customermail'] : 'unknown'; case 4:
$message = str_replace('%s', $cmail, $lng['error']['errorsendingmail']); $message = $lng['error']['errorsendingmail'];
break; break;
case 5:
$message = $lng['error']['user_banned'];
break;
case 6:
$successmessage = $lng['pwdreminder']['changed'];
break;
case 7:
$message = $lng['pwdreminder']['wrongcode'];
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'];
} }
// Pass the last used page if needed
$lastscript = "";
if (isset($_REQUEST['script']) && $_REQUEST['script'] != "") {
$lastscript = $_REQUEST['script'];
}
$lastqrystr = "";
if (isset($_REQUEST['qrystr']) && $_REQUEST['qrystr'] != "") {
$lastqrystr = $_REQUEST['qrystr'];
}
eval("echo \"" . getTemplate('login') . "\";"); eval("echo \"" . getTemplate("login") . "\";");
} }
} }
if ($action == 'forgotpwd') { if($action == 'forgotpwd')
{
$adminchecked = false; $adminchecked = false;
$message = ''; $message = '';
if (isset($_POST['send']) && $_POST['send'] == 'send') { if(isset($_POST['send'])
&& $_POST['send'] == 'send')
{
$loginname = validate($_POST['loginname'], 'loginname'); $loginname = validate($_POST['loginname'], 'loginname');
$email = validateEmail($_POST['loginemail'], 'email'); $email = validateEmail($_POST['loginemail'], 'email');
$result_stmt = Database::prepare("SELECT `adminid`, `customerid`, `firstname`, `name`, `company`, `email`, `loginname`, `def_language`, `deactivated` FROM `" . TABLE_PANEL_CUSTOMERS . "` $sql = "SELECT `adminid`, `customerid`, `firstname`, `name`, `company`, `email`, `loginname`, `def_language` FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE `loginname`= :loginname WHERE `loginname`='" . $db->escape($loginname) . "'
AND `email`= :email" AND `email`='" . $db->escape($email) . "'";
); $result = $db->query($sql);
Database::pexecute($result_stmt, array("loginname" => $loginname, "email" => $email));
if (Database::num_rows() == 0) { if($db->num_rows() == 0)
$result_stmt = Database::prepare("SELECT `adminid`, `name`, `email`, `loginname`, `def_language`, `deactivated` FROM `" . TABLE_PANEL_ADMINS . "` {
WHERE `loginname`= :loginname $sql = "SELECT `adminid`, `name`, `email`, `loginname`, `def_language` FROM `" . TABLE_PANEL_ADMINS . "`
AND `email`= :email" WHERE `loginname`='" . $db->escape($loginname) . "'
); AND `email`='" . $db->escape($email) . "'";
Database::pexecute($result_stmt, array("loginname" => $loginname, "email" => $email)); $result = $db->query($sql);
if (Database::num_rows() > 0) { if($db->num_rows() > 0)
{
$adminchecked = true; $adminchecked = true;
} else { }
$result_stmt = null; else
{
$result = null;
} }
} }
if ($result_stmt !== null) { if($result !== null)
$user = $result_stmt->fetch(PDO::FETCH_ASSOC); {
$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 ($settings['panel']['password_min_length'] <= 6) {
$password = substr(md5(uniqid(microtime(), 1)), 12, 6);
} else {
// make it two times larger than password_min_length
$rnd = '';
$minlength = $settings['panel']['password_min_length'];
while (strlen($rnd) < ($minlength * 2))
{
$rnd .= md5(uniqid(microtime(), 1));
}
$password = substr($rnd, (int)($minlength / 2), $minlength);
}
if (($adminchecked && Settings::Get('panel.allow_preset_admin') == '1') || $adminchecked == false) { if($adminchecked)
if ($user !== false) { {
// build a activation code $db->query("UPDATE `" . TABLE_PANEL_ADMINS . "` SET `password`='" . md5($password) . "'
$timestamp = time(); WHERE `loginname`='" . $user['loginname'] . "'
$first = substr(md5($user['loginname'] . $timestamp . rand(0, $timestamp)), 0, 15); AND `email`='" . $user['email'] . "'");
$third = substr(md5($user['email'] . $timestamp . rand(0, $timestamp)), -15); }
$activationcode = $first . $timestamp . $third . substr(md5($third . $timestamp), 0, 10); else
{
$db->query("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `password`='" . md5($password) . "'
WHERE `loginname`='" . $user['loginname'] . "'
AND `email`='" . $user['email'] . "'");
}
// Drop all existing activation codes for this user $rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'), $db, $settings);
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_ACTIVATION . "` $rstlog->logAction(USR_ACTION, LOG_WARNING, "Password for user '" . $user['loginname'] . "' has been reset!");
WHERE `userid` = :userid
AND `admin` = :admin"
);
$params = array(
"userid" => $adminchecked ? $user['adminid'] : $user['customerid'],
"admin" => $adminchecked ? 1 : 0
);
Database::pexecute($stmt, $params);
// Add new activation code to database
$stmt = Database::prepare("INSERT INTO `" . TABLE_PANEL_ACTIVATION . "`
(userid, admin, creation, activationcode)
VALUES (:userid, :admin, :creation, :activationcode)"
);
$params = array(
"userid" => $adminchecked ? $user['adminid'] : $user['customerid'],
"admin" => $adminchecked ? 1 : 0,
"creation" => $timestamp,
"activationcode" => $activationcode
);
Database::pexecute($stmt, $params);
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'));
$rstlog->logAction(USR_ACTION, LOG_WARNING, "User '" . $user['loginname'] . "' requested a link for setting a new password.");
// Set together our activation link
$protocol = empty( $_SERVER['HTTPS'] ) ? 'http' : 'https';
$host = $_SERVER['HTTP_HOST'];
$port = $_SERVER['SERVER_PORT'] != 80 ? ':' . $_SERVER['SERVER_PORT'] : '';
$script = $_SERVER['SCRIPT_NAME'];
$activationlink = $protocol . '://' . $host . $port . $script . '?action=resetpwd&resetcode=' . $activationcode;
$replace_arr = array( $replace_arr = array(
'SALUTATION' => getCorrectUserSalutation($user), 'SALUTATION' => getCorrectUserSalutation($user),
'USERNAME' => $user['loginname'], 'USERNAME' => $user['loginname'],
'LINK' => $activationlink 'PASSWORD' => $password
); );
$body = strtr($lng['pwdreminder']['body'], array('%s' => $user['firstname'] . ' ' . $user['name'], '%a' => $activationlink)); $body = strtr($lng['pwdreminder']['body'], array('%s' => $user['firstname'] . ' ' . $user['name'], '%p' => $password));
$def_language = ($user['def_language'] != '') ? $user['def_language'] : Settings::Get('panel.standardlanguage'); $def_language = ($user['def_language'] != '') ? $user['def_language'] : $settings['panel']['standardlanguage'];
$result_stmt = Database::prepare('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '` $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\'');
WHERE `adminid`= :adminid
AND `language`= :lang
AND `templategroup`=\'mails\'
AND `varname`=\'password_reset_subject\''
);
Database::pexecute($result_stmt, array("adminid" => $user['adminid'], "lang" => $def_language));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$mail_subject = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['pwdreminder']['subject']), $replace_arr)); $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\'');
$result_stmt = Database::prepare('SELECT `value` FROM `' . TABLE_PANEL_TEMPLATES . '`
WHERE `adminid`= :adminid
AND `language`= :lang
AND `templategroup`=\'mails\'
AND `varname`=\'password_reset_mailbody\''
);
Database::pexecute($result_stmt, array("adminid" => $user['adminid'], "lang" => $def_language));
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
$mail_body = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $body), $replace_arr)); $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 = $mail_subject;
$mail->AltBody = $mail_body; $mail->AltBody = $mail_body;
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body)); $mail->MsgHTML(str_replace("\\n", "<br />", $mail_body));
$mail->AddAddress($user['email'], $user['firstname'] . ' ' . $user['name']); $mail->AddAddress($user['email'], $user['firstname'] . ' ' . $user['name']);
$mail->Send(); $mail->Send();
} catch(phpmailerException $e) { } catch(phpmailerException $e) {
@@ -413,118 +311,46 @@ if ($action == 'forgotpwd') {
} }
if ($_mailerror) { if ($_mailerror) {
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset')); $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 { }
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset')); else
$rstlog->logAction(USR_ACTION, LOG_WARNING, "User '" . $loginname . "' requested to set a new password, but was not found in database!"); {
$message = $lng['login']['combination_not_found']; $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!");
$message = $lng['login']['usernotfound'];
} }
unset($user); unset($user);
} }
} else {
$message = $lng['login']['usernotfound'];
} }
} }
if ($adminchecked) {
if (Settings::Get('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::Get('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") . "\";");
} }
if ($action == 'resetpwd') { ?>
$message = '';
// Remove old activation codes
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_ACTIVATION . "`
WHERE creation < :oldest"
);
Database::pexecute($stmt, array("oldest" => time() - 86400));
if (isset($_GET['resetcode']) && strlen($_GET['resetcode']) == 50) {
// Check if activation code is valid
$activationcode = $_GET['resetcode'];
$timestamp = substr($activationcode, 15, 10);
$third = substr($activationcode, 25, 15);
$check = substr($activationcode, 40, 10);
if (substr(md5($third . $timestamp), 0, 10) == $check && $timestamp >= time() - 86400) {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$stmt = Database::prepare("SELECT `userid`, `admin` FROM `" . TABLE_PANEL_ACTIVATION . "`
WHERE `activationcode` = :activationcode"
);
$result = Database::pexecute_first($stmt, array("activationcode" => $activationcode));
if ($result !== false) {
if ($result['admin'] == 1) {
$new_password = validate($_POST['new_password'], 'new password');
$new_password_confirm = validate($_POST['new_password_confirm'], 'new password confirm');
} else {
$new_password = validatePassword($_POST['new_password'], 'new password');
$new_password_confirm = validatePassword($_POST['new_password_confirm'], 'new password confirm');
}
if ($new_password == '') {
$message = $new_password;
} elseif ($new_password_confirm == '') {
$message = $new_password_confirm;
} elseif ($new_password != $new_password_confirm) {
$message = $new_password . " != " . $new_password_confirm;
} else {
// Update user password
if ($result['admin'] == 1) {
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_ADMINS . "`
SET `password` = :newpassword
WHERE `adminid` = :userid"
);
} else {
$stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "`
SET `password` = :newpassword
WHERE `customerid` = :userid"
);
}
Database::pexecute($stmt, array("newpassword" => md5($new_password), "userid" => $result['userid']));
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'));
$rstlog->logAction(USR_ACTION, LOG_NOTICE, "changed password using password reset.");
// Remove activation code from DB
$stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_ACTIVATION . "`
WHERE `activationcode` = :activationcode
AND `userid` = :userid"
);
Database::pexecute($stmt, array("activationcode" => $activationcode, "userid" => $result['userid']));
redirectTo('index.php', array("showmessage" => '6'), true);
}
} else {
redirectTo('index.php', array("showmessage" => '7'), true);
}
}
eval("echo \"" . getTemplate('rpwd') . "\";");
} else {
redirectTo('index.php', array("showmessage" => '7'), true);
}
} else {
redirectTo('index.php');
}
}

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,919 @@
* 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');
}
// Check if magic_quotes_runtime is active
status_message('begin', $lng['install']['phpmagic_quotes_runtime']);
if(get_magic_quotes_runtime())
{
// Deactivate
set_magic_quotes_runtime(false);
status_message('orange', $lng['install']['active'] . '<br />' . $lng['install']['phpmagic_quotes_runtime_description']);
}
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']);
$tables_exist = false;
$sql = "SHOW TABLES FROM $mysql_database";
$result = mysql_query($sql);
// check the first row
if($result !== false)
{
$row = mysql_num_rows($result);
if($row > 0)
{
$tables_exist = true;
}
}
if($tables_exist)
{
$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) . "',
`def_language` = '". $db->escape($languages[$language]) . "',
`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,
`aps_packages_used` = 0,
`email_autoresponder` = -1,
`email_autoresponder_used` = 0");
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,75 +14,88 @@
* @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.3';
$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']['phppdo'] = 'PHP PDO extension and PDO-MySQL driver...';
$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']['phpcurl'] = 'PHP curl-extension...';
$lng['requirements']['bcmathdescription'] = 'Traffic-calculation related functions will not work correctly!';
$lng['requirements']['curldescription'] = 'Version-check and news-feed may not work correctly!';
$lng['requirements']['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']['lngtitle'] = 'Froxlor install - choose 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']['testing_mysql_fail'] = 'There seems to be a problem with the database-connection. Cannot continue. Please go back and check your credentials.'; * Progress
$lng['install']['backup_old_db'] = 'Creating backup of old database...'; */
$lng['install']['backup_binary_missing'] = 'Could not find mysqldump';
$lng['install']['backup_failed'] = 'Could not backup database'; $lng['install']['testing_mysql'] = 'Testing if MySQL-root-username and password are correct...';
$lng['install']['prepare_db'] = 'Preparing database...'; $lng['install']['erasing_old_db'] = 'Erasing old Database...';
$lng['install']['create_mysqluser_and_db'] = 'Creating database and username...'; $lng['install']['backup_old_db'] = 'Create backup of the old Database...';
$lng['install']['testing_new_db'] = 'Testing if database and user have been created correctly...'; $lng['install']['backing_up'] = 'Backing up';
$lng['install']['importing_data'] = 'Importing data...'; $lng['install']['backing_up_binary_missing'] = '/usr/bin/mysqldump is missing';
$lng['install']['changing_data'] = 'Adjusting settings...'; $lng['install']['create_mysqluser_and_db'] = 'Creating MySQL-database and username...';
$lng['install']['creating_entries'] = 'Inserting new values...'; $lng['install']['testing_new_db'] = 'Testing if MySQL-database and username have been created correctly...';
$lng['install']['adding_admin_user'] = 'Creating admin-account...'; $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_goback'] = 'Click here to go back'; * Renamed in 1.2.19-svn40
$lng['click_here_to_continue'] = 'Click here to continue'; */
$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';
/*
* Added in Froxlor 0.9.13
*/
$lng['install']['phpmagic_quotes_runtime'] = 'Checking whether magic_quotes_runtime is off';
$lng['install']['active'] = 'no';
$lng['install']['phpmagic_quotes_runtime_description'] = 'PHP setting "magic_quotes_runtime" must be set to "Off" in order to avoid strange behavior of Froxlor. Disabling it for now (this is only temporary, please fix our php.ini).';
?>

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,87 +2,100 @@
/** /**
* 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.3';
$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']['phppdo'] = 'PHP PDO Erweiterung und PDO-MySQL Treiber...';
$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']['phpcurl'] = 'PHP curl-Erweiterung...';
$lng['requirements']['bcmathdescription'] = 'Traffic-Berechnungs bezogene Funktionen stehen nicht vollständig zur Verfügung!';
$lng['requirements']['curldescription'] = 'Versions-Prüfung und News-Feed stehen nicht vollständig zur Verfügung!';
$lng['requirements']['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! Beheben Sie die angezeigten Probleme 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']['testing_mysql_fail'] = 'Bei der Verwendung der Datenbank gibt es scheinbar Probleme. Installation kann nicht fortgesetzt werden. Bitte Zugangsdaten prüfen und erneut versuchen.'; * Progress
$lng['install']['backup_old_db'] = 'Sicherung vorheriger Datenbank...'; */
$lng['install']['backup_binary_missing'] = 'Konnte mysqldump nicht finden';
$lng['install']['backup_failed'] = 'Sicherung fehlgeschlagen'; $lng['install']['testing_mysql'] = 'Teste, ob die MySQL-Root-Benutzerdaten richtig sind...';
$lng['install']['prepare_db'] = 'Datenbank wird vorbereitet...'; $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_goback'] = 'Einen Schritt zurück'; * Renamed in 1.2.19-svn40
$lng['click_here_to_continue'] = 'Installation fortführen'; */
$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';
/*
* Added in Froxlor 0.9.13
*/
$lng['install']['phpmagic_quotes_runtime'] = 'Pr&uuml;fe ob magic_quotes_runtime ausgeschalten ist';
$lng['install']['active'] = 'nein';
$lng['install']['phpmagic_quotes_runtime_description'] = 'Die PHP Einstellung "magic_quotes_runtime" muss deaktiviert sein ("Off"), um merkw&uuml;rdige Verhalten von Froxlor zu umgehen. Sie wurde deaktiviert (nur tempor&auml;r, bitte php.ini anpassen).';
?>

View File

@@ -0,0 +1,106 @@
<?php
/**
* This file is part of the SysCP project.
* Copyright (c) 2003-2007 the SysCP Team (see authors).
*
* For the full copyright and license information, please view the COPYING
* file that was distributed with this source code. You can also view the
* COPYING file online at http://files.syscp.org/misc/COPYING.txt
*
* @copyright (c) the authors
* @author Michael Duergner <michael@duergner.com>
* @license GPLv2 http://files.syscp.org/misc/COPYING.txt
* @package System
* @version $Id$
*/
if(@php_sapi_name() != 'cli'
&& @php_sapi_name() != 'cgi'
&& @php_sapi_name() != 'cgi-fcgi')
{
die('This script will only work in the shell.');
}
$pathtophpfiles = '/var/www/syscp';
$filename = 'htpasswd-htaccess-remover.php';
/**
* Includes the Usersettings eg. MySQL-Username/Passwort etc.
*/
require ("$pathtophpfiles/lib/userdata.inc.php");
/**
* Includes the MySQL-Tabledefinitions etc.
*/
require ("$pathtophpfiles/lib/tables.inc.php");
/**
* Includes the MySQL-Connection-Class
*/
require ("$pathtophpfiles/lib/class_mysqldb.php");
$debugMsg[] = 'Database Class has been loaded';
$db = new db($sql['host'], $sql['user'], $sql['password'], $sql['db']);
$db_root = new db($sql['host'], $sql['root_user'], $sql['root_password'], '');
if($db->link_id == 0
|| $db_root->link_id == 0)
{
/**
* Do not proceed further if no database connection could be established (either normal or root)
*/
die('Cant connect to mysqlserver. Please check userdata.inc.php! Exiting...');
}
unset($sql['password']);
unset($db->password);
$result = $db->query("SELECT `settingid`, `settinggroup`, `varname`, `value` FROM `" . TABLE_PANEL_SETTINGS . "`");
while($row = $db->fetch_array($result))
{
$settings["$row[settinggroup]"]["$row[varname]"] = $row['value'];
}
unset($row);
unset($result);
if(!isset($settings['panel']['version'])
|| $settings['panel']['version'] != $version)
{
/**
* Do not proceed further if the Database version is not the same as the script version
*/
die('Version of File doesnt match Version of Database. Exiting...');
}
/**
* Includes the Functions
*/
require ("$pathtophpfiles/lib/functions.php");
$result = $db->query('SELECT * FROM `' . TABLE_PANEL_HTACCESS . '` ');
while($row = $db->fetch_array($result))
{
if(file_exists($row['path'] . '.htaccess'))
{
unlink($row['path'] . '.htaccess');
}
}
$result = $db->query('SELECT * FROM `' . TABLE_PANEL_HTPASSWDS . '` ');
while($row = $db->fetch_array($result))
{
if(file_exists($row['path'] . '.htpasswd'))
{
unlink($row['path'] . '.htpasswd');
}
}
?>

View File

@@ -12,43 +12,50 @@
* @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
$baseLanguage = 'english.lng.php'; $baseLanguage = 'english.lng.php';
// Check if we're in the CLI // Check if we're in the CLI
if(@php_sapi_name() != 'cli'
&& @php_sapi_name() != 'cgi' if(@php_sapi_name() != 'cli')
&& @php_sapi_name() != 'cgi-fcgi' {
) {
die('This script will only work in the shell.'); die('This script will only work in the shell.');
} }
// Check argument count // Check argument count
if (sizeof($argv) != 2) {
if(sizeof($argv) != 2)
{
print_help($argv); print_help($argv);
exit; exit;
} }
// Load the contents of the given path // Load the contents of the given path
$path = $argv[1]; $path = $argv[1];
$files = array(); $files = array();
if ($dh = opendir($path)) { if($dh = opendir($path))
while (false !== ($file = readdir($dh))) { {
if ($file != "." while(false !== ($file = readdir($dh)))
{
if($file != "."
&& $file != ".." && $file != ".."
&& !is_dir($file) && !is_dir($file)
&& preg_match('/(.+)\.lng\.php/i', $file) && preg_match('/(.+)\.lng\.php/i', $file))
) { {
$files[$file] = str_replace('//', '/', $path . '/' . $file); $files[$file] = str_replace('//', '/', $path . '/' . $file);
} }
} }
closedir($dh); closedir($dh);
} else { }
else
{
print "ERROR: The path you requested cannot be read! \n "; print "ERROR: The path you requested cannot be read! \n ";
print "\n"; print "\n";
print_help(); print_help();
@@ -56,7 +63,9 @@ if ($dh = opendir($path)) {
} }
// check if there is the default language defined // check if there is the default language defined
if (!isset($files[$baseLanguage])) {
if(!isset($files[$baseLanguage]))
{
print "ERROR: The baselanguage cannot be found! \n"; print "ERROR: The baselanguage cannot be found! \n";
print "\n"; print "\n";
print_help(); print_help();
@@ -64,40 +73,49 @@ if (!isset($files[$baseLanguage])) {
} }
// import the baselanguage // import the baselanguage
$base = import($files[$baseLanguage]); $base = import($files[$baseLanguage]);
// and unset it in the files, because we don't need to compare base to base // and unset it in the files, because we don't need to compare base to base
unset($files[$baseLanguage]); unset($files[$baseLanguage]);
// compare each language with the baselanguage // compare each language with the baselanguage
foreach ($files as $key => $file) {
$comp = import($file);
foreach($files as $key => $file)
{
$comp = import($file);
print "\n\nComparing " . $baseLanguage . " to " . $key . "\n"; print "\n\nComparing " . $baseLanguage . " to " . $key . "\n";
$result = compare($base, $comp); $result = compare($base, $comp);
if (is_array($result) if(is_array($result)
&& sizeof($result) > 0 && sizeof($result) > 0)
) { {
print " found missing strings: \n"; print " found missing strings: \n";
foreach ($result as $value) { foreach($result as $value)
{
print " " . $value . "\n"; print " " . $value . "\n";
} }
} else { }
else
{
print " no missing strings found! \n "; print " no missing strings found! \n ";
} }
print "\nReverse Checking " . $key . " to " . $baseLanguage . "\n"; print "\nReverse Checking " . $key . " to " . $baseLanguage . "\n";
$result = compare($comp, $base); $result = compare($comp, $base);
if (is_array($result) if(is_array($result)
&& sizeof($result) > 0 && sizeof($result) > 0)
) { {
print " found strings not in basefile: \n"; print " found strings not in basefile: \n";
foreach ($result as $key => $value) { foreach($result as $key => $value)
{
print " " . $value . "\n"; print " " . $value . "\n";
} }
} else { }
else
{
print " There are no strings which are not in the basefile! \n "; print " There are no strings which are not in the basefile! \n ";
} }
} }
@@ -111,45 +129,56 @@ foreach ($files as $key => $file) {
* *
* @param array $argv * @param array $argv
*/ */
function print_help($argv) {
function print_help($argv)
{
print "Usage: php " . $argv[0] . " /PATH/TO/LNG \n"; print "Usage: php " . $argv[0] . " /PATH/TO/LNG \n";
print " \n "; print " \n ";
} }
function import($file) { function import($file)
{
$input = file($file); $input = file($file);
$return = array(); $return = array();
foreach($input as $key => $value)
foreach ($input as $key => $value) { {
if(!preg_match('/^\$/', $value))
if (!preg_match('/^\$/', $value)) { {
unset($input[$key]); unset($input[$key]);
} else { }
else
{
// generate the key // generate the key
$key = preg_replace('/^\$lng\[\'(.*)=(.*)$/U', '\\1', $value); $key = preg_replace('/^\$lng\[\'(.*)=(.*)$/U', '\\1', $value);
$key = str_replace('[\'', '/', $key); $key = str_replace('[\'', '/', $key);
$key = trim(str_replace('\']', '', $key)); $key = trim(str_replace('\']', '', $key));
//generate the value //generate the value
$value = trim($value); $value = trim($value);
// set the result // set the result
$return[$key] = $value; $return[$key] = $value;
} }
} }
return $return; return $return;
} }
function compare($array1, $array2) { function compare($array1, $array2)
{
$result = array(); $result = array();
foreach($array1 as $key => $value)
foreach ($array1 as $key => $value) { {
if(!isset($array2[$key]))
if (!isset($array2[$key])) { {
$result[$key] = $value; $result[$key] = $value;
} }
} }
return $result; return $result;
} }
?>

View File

@@ -1,559 +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;
color: #333;
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;
color: #333;
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;
color: #333;
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>

View File

@@ -1,124 +0,0 @@
#!/usr/bin/php
<?php
/**
* tsmarty2c.php - rips gettext strings from smarty template
*
* ------------------------------------------------------------------------- *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
* ------------------------------------------------------------------------- *
*
* This command line script rips gettext strings from smarty file,
* and prints them to stdout in C format, that can later be used with the
* standard gettext tools.
*
* Usage:
* ./tsmarty2c.php <filename or directory> <file2> <..> > smarty.c
*
* If a parameter is a directory, the template files within will be parsed.
*
* @package smarty-gettext
* @version $Id: tsmarty2c.php,v 1.3 2005/07/27 17:59:39 sagi Exp $
* @link http://smarty-gettext.sf.net/
* @author Sagi Bashari <sagi@boom.org.il>
* @copyright 2004-2005 Sagi Bashari
*/
// smarty open tag
$ldq = preg_quote('{');
// smarty close tag
$rdq = preg_quote('}');
// smarty command
$cmd = preg_quote('t');
// extensions of smarty files, used when going through a directory
$extensions = array('tpl');
// "fix" string - strip slashes, escape and convert new lines to \n
function fs($str)
{
$str = stripslashes($str);
$str = str_replace('"', '\"', $str);
$str = str_replace("\n", '\n', $str);
return $str;
}
// rips gettext strings from $file and prints them in C format
function do_file($file)
{
$content = @file_get_contents($file);
if (empty($content)) {
return;
}
global $ldq, $rdq, $cmd;
preg_match_all(
"/{$ldq}\s*({$cmd})\s*([^{$rdq}]*){$rdq}([^{$ldq}]*){$ldq}\/\\1{$rdq}/",
$content,
$matches
);
for ($i=0; $i < count($matches[0]); $i++) {
// TODO: add line number
echo "/* $file */\n"; // credit: Mike van Lammeren 2005-02-14
if (preg_match('/plural\s*=\s*["\']?\s*(.[^\"\']*)\s*["\']?/', $matches[2][$i], $match)) {
echo 'ngettext("'.fs($matches[3][$i]).'","'.fs($match[1]).'",x);'."\n";
} else {
echo 'gettext("'.fs($matches[3][$i]).'");'."\n";
}
echo "\n";
}
}
// go through a directory
function do_dir($dir)
{
$d = dir($dir);
while (false !== ($entry = $d->read())) {
if ($entry == '.' || $entry == '..') {
continue;
}
$entry = $dir.'/'.$entry;
if (is_dir($entry)) { // if a directory, go through it
do_dir($entry);
} else { // if file, parse only if extension is matched
$pi = pathinfo($entry);
if (isset($pi['extension']) && in_array($pi['extension'], $GLOBALS['extensions'])) {
do_file($entry);
}
}
}
$d->close();
}
for ($ac=1; $ac < $_SERVER['argc']; $ac++) {
if (is_dir($_SERVER['argv'][$ac])) { // go through directory
do_dir($_SERVER['argv'][$ac]);
} else { // do file
do_file($_SERVER['argv'][$ac]);
}
}
?>

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