refactor UI functions

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2018-12-21 11:22:03 +01:00
parent b0df4e46d6
commit c0e89bbd05
84 changed files with 2742 additions and 1106 deletions

View File

@@ -8,7 +8,7 @@ use Froxlor\Database as Database;
use Froxlor\Settings as Settings;
if (Settings::Get('2fa.enabled') != '1') {
dynamic_error("2FA not activated");
\Froxlor\UI\Response::dynamic_error("2FA not activated");
}
/**
@@ -47,7 +47,7 @@ if ($action == 'delete') {
'd2fa' => "",
'id' => $uid
));
standard_success($lng['2fa']['2fa_removed']);
\Froxlor\UI\Response::standard_success($lng['2fa']['2fa_removed']);
} elseif ($action == 'add') {
$type = isset($_POST['type_2fa']) ? $_POST['type_2fa'] : '0';
@@ -63,7 +63,7 @@ if ($action == 'delete') {
'd2fa' => $data,
'id' => $uid
));
standard_success(sprintf($lng['2fa']['2fa_added'], $filename, $s));
\Froxlor\UI\Response::standard_success(sprintf($lng['2fa']['2fa_added'], $filename, $s));
}
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed 2fa::overview");
@@ -88,4 +88,4 @@ elseif ($userinfo['type_2fa'] == '2') {
// authenticator 2fa enabled
$ga_qrcode = $tfa->getQRCodeImageAsDataUri($userinfo['loginname'], $userinfo['data_2fa']);
}
eval("echo \"" . getTemplate("2fa/overview", true) . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("2fa/overview", true) . "\";");

View File

@@ -124,7 +124,6 @@ return array(
'varname' => 'password_regex',
'type' => 'string',
'default' => '',
/* 'plausibility_check_method' => 'checkValidRegEx', */
'save_method' => 'storeSettingField',
),
'customer_accountprefix' => array(
@@ -133,7 +132,8 @@ return array(
'varname' => 'accountprefix',
'type' => 'string',
'default' => '',
'plausibility_check_method' => 'checkUsername',
'plausibility_check_method' => array(
'\\Froxlor\\Validate\\Check', 'checkUsername'),
'save_method' => 'storeSettingField',
),
'customer_mysqlprefix' => array(
@@ -142,7 +142,8 @@ return array(
'varname' => 'mysqlprefix',
'type' => 'string',
'default' => '',
'plausibility_check_method' => 'checkUsername',
'plausibility_check_method' => array(
'\\Froxlor\\Validate\\Check', 'checkUsername'),
'save_method' => 'storeSettingField',
),
'customer_ftpprefix' => array(

View File

@@ -16,7 +16,6 @@
* @package Settings
*
*/
return array(
'groups' => array(
'system' => array(
@@ -30,46 +29,58 @@ return array(
'string_type' => 'dir',
'default' => '/var/customers/webs/',
'save_method' => 'storeSettingField',
'plausibility_check_method' => 'checkPathConflicts'
),
'plausibility_check_method' => array(
'\\Froxlor\\Validate\\Check',
'checkPathConflicts'
)
),
'system_documentroot_use_default_value' => array(
'label' => $lng['serversettings']['documentroot_use_default_value'],
'settinggroup' => 'system',
'varname' => 'documentroot_use_default_value',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_ipaddress' => array(
'label' => $lng['serversettings']['ipaddress'],
'settinggroup' => 'system',
'varname' => 'ipaddress',
'type' => 'option',
'option_mode' => 'one',
'option_options_method' => array('\\Froxlor\\Domain\\IpAddr', 'getIpAddresses'),
'default' => '',
'save_method' => 'storeSettingIpAddress',
'option_options_method' => array(
'\\Froxlor\\Domain\\IpAddr',
'getIpAddresses'
),
'default' => '',
'save_method' => 'storeSettingIpAddress'
),
'system_defaultip' => array(
'label' => $lng['serversettings']['defaultip'],
'settinggroup' => 'system',
'varname' => 'defaultip',
'type' => 'option',
'option_mode' => 'multiple',
'option_options_method' => array('\\Froxlor\\Domain\\IpAddr', 'getIpPortCombinations'),
'default' => '',
'save_method' => 'storeSettingDefaultIp',
'option_options_method' => array(
'\\Froxlor\\Domain\\IpAddr',
'getIpPortCombinations'
),
'default' => '',
'save_method' => 'storeSettingDefaultIp'
),
'system_defaultsslip' => array(
'label' => $lng['serversettings']['defaultsslip'],
'settinggroup' => 'system',
'varname' => 'defaultsslip',
'type' => 'option',
'option_mode' => 'multiple',
'option_options_method' => array('\\Froxlor\\Domain\\IpAddr', 'getSslIpPortCombinations'),
'default' => '',
'save_method' => 'storeSettingDefaultSslIp',
'option_options_method' => array(
'\\Froxlor\\Domain\\IpAddr',
'getSslIpPortCombinations'
),
'default' => '',
'save_method' => 'storeSettingDefaultSslIp'
),
'system_hostname' => array(
'label' => $lng['serversettings']['hostname'],
'settinggroup' => 'system',
@@ -77,15 +88,18 @@ return array(
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingHostname',
'plausibility_check_method' => 'checkHostname',
),
'plausibility_check_method' => array(
'\\Froxlor\\Validate\\Check',
'checkHostname'
)
),
'api_enabled' => array(
'label' => $lng['serversettings']['enable_api'],
'settinggroup' => 'api',
'varname' => 'enabled',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'save_method' => 'storeSettingField'
),
'system_validatedomain' => array(
'label' => $lng['serversettings']['validate_domain'],
@@ -93,25 +107,28 @@ return array(
'varname' => 'validate_domain',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_stdsubdomain' => array(
'label' => $lng['serversettings']['stdsubdomainhost'],
'settinggroup' => 'system',
'varname' => 'stdsubdomain',
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingHostname',
),
'save_method' => 'storeSettingHostname'
),
'system_mysql_access_host' => array(
'label' => $lng['serversettings']['mysql_access_host'],
'settinggroup' => 'system',
'varname' => 'mysql_access_host',
'type' => 'string',
'default' => '127.0.0.1,localhost',
'plausibility_check_method' => 'checkMysqlAccessHost',
'save_method' => 'storeSettingMysqlAccessHost',
'plausibility_check_method' => array(
'\\Froxlor\\Validate\\Check',
'checkMysqlAccessHost'
),
'save_method' => 'storeSettingMysqlAccessHost'
),
'system_nssextrausers' => array(
'label' => $lng['serversettings']['nssextrausers'],
'settinggroup' => 'system',
@@ -119,7 +136,7 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField'
),
),
'system_index_file_extension' => array(
'label' => $lng['serversettings']['index_file_extension'],
'settinggroup' => 'system',
@@ -127,28 +144,28 @@ return array(
'type' => 'string',
'string_regexp' => '/^[a-zA-Z0-9]{1,6}$/',
'default' => 'html',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_store_index_file_subs' => array(
'label' => $lng['serversettings']['system_store_index_file_subs'],
'settinggroup' => 'system',
'varname' => 'store_index_file_subs',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_httpuser' => array(
'settinggroup' => 'system',
'varname' => 'httpuser',
'type' => 'hidden',
'default' => 'www-data',
),
'default' => 'www-data'
),
'system_httpgroup' => array(
'settinggroup' => 'system',
'varname' => 'httpgroup',
'type' => 'hidden',
'default' => 'www-data',
),
'default' => 'www-data'
),
'system_report_enable' => array(
'label' => $lng['serversettings']['report']['report'],
'settinggroup' => 'system',
@@ -156,8 +173,8 @@ return array(
'type' => 'bool',
'default' => true,
'cronmodule' => 'froxlor/reports',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_report_webmax' => array(
'label' => $lng['serversettings']['report']['webmax'],
'settinggroup' => 'system',
@@ -166,8 +183,8 @@ return array(
'int_min' => 0,
'int_max' => 150,
'default' => 90,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_report_trafficmax' => array(
'label' => $lng['serversettings']['report']['trafficmax'],
'settinggroup' => 'system',
@@ -176,8 +193,8 @@ return array(
'int_min' => 0,
'int_max' => 150,
'default' => 90,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mail_use_smtp' => array(
'label' => $lng['serversettings']['mail_use_smtp'],
@@ -185,16 +202,16 @@ return array(
'varname' => 'mail_use_smtp',
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mail_smtp_host' => array(
'label' => $lng['serversettings']['mail_smtp_host'],
'settinggroup' => 'system',
'varname' => 'mail_smtp_host',
'type' => 'string',
'default' => 'localhost',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mail_smtp_port' => array(
'label' => $lng['serversettings']['mail_smtp_port'],
'settinggroup' => 'system',
@@ -203,41 +220,41 @@ return array(
'int_min' => 1,
'int_max' => 65535,
'default' => 25,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mail_smtp_usetls' => array(
'label' => $lng['serversettings']['mail_smtp_usetls'],
'settinggroup' => 'system',
'varname' => 'mail_smtp_usetls',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mail_smtp_auth' => array(
'label' => $lng['serversettings']['mail_smtp_auth'],
'settinggroup' => 'system',
'varname' => 'mail_smtp_auth',
'type' => 'bool',
'default' => true,
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mail_smtp_user' => array(
'label' => $lng['serversettings']['mail_smtp_user'],
'settinggroup' => 'system',
'varname' => 'mail_smtp_user',
'type' => 'string',
'default' => '',
'save_method' => 'storeSettingField',
),
'save_method' => 'storeSettingField'
),
'system_mail_smtp_passwd' => array(
'label' => $lng['serversettings']['mail_smtp_passwd'],
'settinggroup' => 'system',
'varname' => 'mail_smtp_passwd',
'type' => 'hiddenString',
'default' => '',
'save_method' => 'storeSettingField',
),
),
),
),
);
'save_method' => 'storeSettingField'
)
)
)
)
);

View File

@@ -34,7 +34,10 @@ return array(
'nginx' => 'Nginx'
),
'save_method' => 'storeSettingField',
'plausibility_check_method' => 'checkPhpInterfaceSetting',
'plausibility_check_method' => array(
'\\Froxlor\\Validate\\Check',
'checkPhpInterfaceSetting'
),
'overview_option' => true
),
'system_apache_24' => array(

View File

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

View File

@@ -14,7 +14,6 @@
* @package \Froxlor\Settings
*
*/
return array(
'groups' => array(
'phpfpm' => array(
@@ -27,9 +26,12 @@ return array(
'type' => 'bool',
'default' => false,
'save_method' => 'storeSettingField',
'plausibility_check_method' => 'checkFcgidPhpFpm',
'overview_option' => true
'plausibility_check_method' => array(
'\\Froxlor\\Validate\\Check',
'checkFcgidPhpFpm'
),
'overview_option' => true
),
'system_phpfpm_defaultini' => array(
'label' => $lng['serversettings']['mod_fcgid']['defaultini'],
'settinggroup' => 'phpfpm',
@@ -39,7 +41,7 @@ return array(
'option_mode' => 'one',
'option_options_method' => 'getPhpConfigs',
'save_method' => 'storeSettingField'
),
),
'system_phpfpm_aliasconfigdir' => array(
'label' => $lng['serversettings']['phpfpm_settings']['aliasconfigdir'],
'settinggroup' => 'phpfpm',
@@ -48,7 +50,7 @@ return array(
'string_type' => 'confdir',
'default' => '/var/www/php-fpm/',
'save_method' => 'storeSettingField'
),
),
'system_phpfpm_tmpdir' => array(
'label' => $lng['serversettings']['mod_fcgid']['tmpdir'],
'settinggroup' => 'phpfpm',
@@ -57,7 +59,7 @@ return array(
'string_type' => 'dir',
'default' => '/var/customers/tmp/',
'save_method' => 'storeSettingField'
),
),
'system_phpfpm_peardir' => array(
'label' => $lng['serversettings']['mod_fcgid']['peardir'],
'settinggroup' => 'phpfpm',
@@ -68,7 +70,7 @@ return array(
'string_emptyallowed' => true,
'default' => '/usr/share/php/:/usr/share/php5/',
'save_method' => 'storeSettingField'
),
),
'system_phpfpm_envpath' => array(
'label' => $lng['serversettings']['phpfpm_settings']['envpath'],
'settinggroup' => 'phpfpm',
@@ -88,7 +90,7 @@ return array(
'string_type' => 'dir',
'default' => '/var/lib/apache2/fastcgi/',
'save_method' => 'storeSettingField'
),
),
'system_phpfpm_use_mod_proxy' => array(
'label' => $lng['phpfpm']['use_mod_proxy'],
'settinggroup' => 'phpfpm',
@@ -97,7 +99,7 @@ return array(
'default' => false,
'visible' => \Froxlor\Settings::Get('system.apache24'),
'save_method' => 'storeSettingField'
),
),
'system_phpfpm_ini_flags' => array(
'label' => $lng['phpfpm']['ini_flags'],
'settinggroup' => 'phpfpm',
@@ -130,7 +132,7 @@ return array(
'default' => '',
'save_method' => 'storeSettingField'
)
),
),
),
);
)
)
)
);

View File

@@ -43,7 +43,7 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
'traffic_used' => $lng['customer']['traffic'] . ' (' . $lng['panel']['used'] . ')',
'deactivated' => $lng['admin']['deactivated']
);
$paging = new paging($userinfo, TABLE_PANEL_ADMINS, $fields);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_ADMINS, $fields);
$admins = '';
$result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_ADMINS . "` " . $paging->getSqlWhere(false) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
$numrows_admins = Database::num_rows();
@@ -97,14 +97,14 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
$row['custom_notes'] = ($row['custom_notes'] != '') ? nl2br($row['custom_notes']) : '';
eval("\$admins.=\"" . getTemplate("admins/admins_admin") . "\";");
eval("\$admins.=\"" . \Froxlor\UI\Template::getTemplate("admins/admins_admin") . "\";");
$count ++;
}
$i ++;
}
$admincount = $numrows_admins;
eval("echo \"" . getTemplate("admins/admins") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("admins/admins") . "\";");
} elseif ($action == 'su') {
try {
@@ -112,7 +112,7 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
$destination_admin = $result['loginname'];
@@ -142,11 +142,11 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
);
Database::pexecute($ins_stmt, $ins_data);
$log->logAction(ADM_ACTION, LOG_INFO, "switched adminuser and is now '" . $destination_admin . "'");
redirectTo('admin_index.php', array(
\Froxlor\UI\Response::redirectTo('admin_index.php', array(
's' => $s
));
} else {
redirectTo('index.php', array(
\Froxlor\UI\Response::redirectTo('index.php', array(
'action' => 'login'
));
}
@@ -156,20 +156,20 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if ($result['loginname'] != '') {
if ($result['adminid'] == $userinfo['userid']) {
standard_error('youcantdeleteyourself');
\Froxlor\UI\Response::standard_error('youcantdeleteyourself');
}
if (isset($_POST['send']) && $_POST['send'] == 'send') {
Admins::getLocal($this->getUserData(), array(
'id' => $id
))->delete();
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -187,9 +187,9 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
try {
Admins::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -222,12 +222,12 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
$mysqls_ul = makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
$admin_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/admin/formfield.admin_add.php';
$admin_add_form = htmlform::genHTMLForm($admin_add_data);
$admin_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($admin_add_data);
$title = $admin_add_data['admin_add']['title'];
$image = $admin_add_data['admin_add']['image'];
eval("echo \"" . getTemplate("admins/admins_add") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("admins/admins_add") . "\";");
}
} elseif ($action == 'edit' && $id != 0) {
try {
@@ -235,7 +235,7 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -245,9 +245,9 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
try {
Admins::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -330,12 +330,12 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
$result = htmlentities_array($result);
$admin_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/admin/formfield.admin_edit.php';
$admin_edit_form = htmlform::genHTMLForm($admin_edit_data);
$admin_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($admin_edit_data);
$title = $admin_edit_data['admin_edit']['title'];
$image = $admin_edit_data['admin_edit']['image'];
eval("echo \"" . getTemplate("admins/admins_edit") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("admins/admins_edit") . "\";");
}
}
}

View File

@@ -45,7 +45,7 @@ if ($action == 'delete' &&
if (!function_exists('apcu_cache_info') ||
!function_exists('apcu_sma_info')
) {
standard_error($lng['error']['no_apcuinfo']);
\Froxlor\UI\Response::standard_error($lng['error']['no_apcuinfo']);
}
if ($page == 'showinfo'
@@ -84,7 +84,7 @@ if ($page == 'showinfo'
$runtimelines = '';
foreach (ini_get_all('apcu') as $name => $v) {
$value = $v['local_value'];
eval("\$runtimelines.=\"" . getTemplate("settings/apcuinfo/runtime_line") . "\";");
eval("\$runtimelines.=\"" . \Froxlor\UI\Template::getTemplate("settings/apcuinfo/runtime_line") . "\";");
}
$freemem = bsize($mem_avail) . sprintf(" (%.1f%%)", $mem_avail * 100 / $mem_size);
@@ -124,14 +124,14 @@ if ($page == 'showinfo'
$img_src3 = '';
if (graphics_avail()) {
$img_src = $linker->getLink(array('section' => 'apcuinfo', 'page' => 'img1', 'action' => mt_rand(0, 1000000)));
eval("\$img_src1=\"" . getTemplate("settings/apcuinfo/img_line") . "\";");
eval("\$img_src1=\"" . \Froxlor\UI\Template::getTemplate("settings/apcuinfo/img_line") . "\";");
$img_src = $linker->getLink(array('section' => 'apcuinfo', 'page' => 'img2', 'action' => mt_rand(0, 1000000)));
eval("\$img_src2=\"" . getTemplate("settings/apcuinfo/img_line") . "\";");
eval("\$img_src2=\"" . \Froxlor\UI\Template::getTemplate("settings/apcuinfo/img_line") . "\";");
$img_src = $linker->getLink(array('section' => 'apcuinfo', 'page' => 'img3', 'action' => mt_rand(0, 1000000)));
eval("\$img_src3=\"" . getTemplate("settings/apcuinfo/img_line") . "\";");
eval("\$img_src3=\"" . \Froxlor\UI\Template::getTemplate("settings/apcuinfo/img_line") . "\";");
}
eval("echo \"" . getTemplate("settings/apcuinfo/showinfo") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/apcuinfo/showinfo") . "\";");
} elseif ($page == 'img1'
) {

View File

@@ -29,7 +29,7 @@ define('CHECKSUM_URI', "https://autoupdate.froxlor.org/froxlor-{version}.zip.sha
// check for archive-stuff
if (! extension_loaded('zip')) {
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s,
'page' => 'error',
'errno' => 2
@@ -62,7 +62,7 @@ if ($page == 'overview') {
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
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s,
'page' => 'error',
'errno' => 3
@@ -81,13 +81,13 @@ if ($page == 'overview') {
$text = 'There is a newer version available. Update to version <b>' . $_version . '</b> now?<br/>(Your current version is: ' . $version . ')';
$hiddenparams = '<input type="hidden" name="newversion" value="' . $_version . '" />';
$yesfile = $filename . '?s=' . $s . '&amp;page=getdownload';
eval("echo \"" . getTemplate("misc/question_yesno", true) . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("misc/question_yesno", true) . "\";");
exit();
} elseif ($isnewerversion == 0) {
// all good
standard_success('noupdatesavail');
\Froxlor\UI\Response::standard_success('noupdatesavail');
} else {
standard_error('customized_version');
\Froxlor\UI\Response::standard_error('customized_version');
}
}
}// download the new archive
@@ -122,7 +122,7 @@ elseif ($page == 'getdownload') {
try {
HttpClient::fileGet($toLoad, $localArchive);
} catch (Exception $e) {
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s,
'page' => 'error',
'errno' => 4
@@ -140,7 +140,7 @@ elseif ($page == 'getdownload') {
$filesum = hash_file('sha256', $localArchive);
if ($filesum != $shouldsum) {
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s,
'page' => 'error',
'errno' => 9
@@ -148,13 +148,13 @@ elseif ($page == 'getdownload') {
}
// to the next step
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s,
'page' => 'extract',
'archive' => basename($localArchive)
));
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s,
'page' => 'error',
'errno' => 6
@@ -177,7 +177,7 @@ elseif ($page == 'extract') {
@unlink($localArchive);
} else {
// error
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s,
'page' => 'error',
'errno' => 8
@@ -185,13 +185,13 @@ elseif ($page == 'extract') {
}
// redirect to update-page?
redirectTo('admin_updates.php', array(
\Froxlor\UI\Response::redirectTo('admin_updates.php', array(
's' => $s
));
}
if (! file_exists($localArchive)) {
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s,
'page' => 'error',
'errno' => 7
@@ -201,7 +201,7 @@ elseif ($page == 'extract') {
$text = 'Extract downloaded archive "' . $toExtract . '"?';
$hiddenparams = '';
$yesfile = $filename . '?s=' . $s . '&amp;page=extract&amp;archive=' . $toExtract;
eval("echo \"" . getTemplate("misc/question_yesno", true) . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("misc/question_yesno", true) . "\";");
}
// display error
elseif ($page == 'error') {
@@ -217,5 +217,5 @@ elseif ($page == 'error') {
// 7 = local archive does not exist
// 8 = could not extract archive
// 9 = checksum mismatch
standard_error('autoupdate_' . $errno);
\Froxlor\UI\Response::standard_error('autoupdate_' . $errno);
}

View File

@@ -25,7 +25,7 @@ if ($userinfo['change_serversettings'] == '1') {
if ($action == 'setconfigured')
{
Settings::Set('panel.is_configured', '1', true);
redirectTo('admin_configfiles.php', array(
\Froxlor\UI\Response::redirectTo('admin_configfiles.php', array(
's' => $s
));
}
@@ -178,7 +178,7 @@ if ($userinfo['change_serversettings'] == '1') {
if ($lasttype != '' && $lasttype != $_action['type']) {
$commands = trim($commands);
$numbrows = count(explode("\n", $commands));
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_commands") . "\";");
eval("\$configpage.=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_commands") . "\";");
$lasttype = '';
$commands = '';
}
@@ -209,14 +209,14 @@ if ($userinfo['change_serversettings'] == '1') {
$commands = trim($commands_pre);
if ($commands != "") {
$numbrows = count(explode("\n", $commands));
eval("\$commands_pre=\"" . getTemplate("configfiles/configfiles_commands") . "\";");
eval("\$commands_pre=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_commands") . "\";");
}
$commands = trim($commands_post);
if ($commands != "") {
$numbrows = count(explode("\n", $commands));
eval("\$commands_post=\"" . getTemplate("configfiles/configfiles_commands") . "\";");
eval("\$commands_post=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_commands") . "\";");
}
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_subfileblock") . "\";");
eval("\$configpage.=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_subfileblock") . "\";");
$commands = '';
$commands_pre = '';
$commands_post = '';
@@ -226,15 +226,15 @@ if ($userinfo['change_serversettings'] == '1') {
$commands = trim($commands);
if ($commands != '') {
$numbrows = count(explode("\n", $commands));
eval("\$configpage.=\"" . getTemplate("configfiles/configfiles_commands") . "\";");
eval("\$configpage.=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_commands") . "\";");
}
eval("echo \"" . getTemplate("configfiles/configfiles") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles") . "\";");
} else {
$basedir = FROXLOR_INSTALL_DIR;
eval("echo \"" . getTemplate("configfiles/wizard") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("configfiles/wizard") . "\";");
}
} else {
redirectTo('admin_index.php', array(
\Froxlor\UI\Response::redirectTo('admin_index.php', array(
's' => $s
));
}
@@ -248,7 +248,7 @@ function getFileContentContainer($file_content, &$replace_arr, $realname, $distr
$file_content = strtr($file_content, $replace_arr);
$file_content = htmlspecialchars($file_content);
$numbrows = count(explode("\n", $file_content));
eval("\$files=\"" . getTemplate("configfiles/configfiles_file") . "\";");
eval("\$files=\"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles_file") . "\";");
}
return $files;
}

View File

@@ -35,7 +35,7 @@ if ($page == 'cronjobs' || $page == 'overview') {
'c.interval' => $lng['cron']['interval'],
'c.isactive' => $lng['cron']['isactive']
);
$paging = new paging($userinfo, TABLE_PANEL_CRONRUNS, $fields);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_CRONRUNS, $fields);
$crons = '';
$result_stmt = Database::prepare("SELECT `c`.* FROM `" . TABLE_PANEL_CRONRUNS . "` `c` ORDER BY `module` ASC, `cronfile` ASC");
@@ -54,7 +54,7 @@ if ($page == 'cronjobs' || $page == 'overview') {
if ($cmod != $row['module']) {
$_mod = explode("/", $row['module']);
$module = ucfirst($_mod[1]);
eval("\$crons.=\"" . getTemplate('cronjobs/cronjobs_cronjobmodule') . "\";");
eval("\$crons.=\"" . \Froxlor\UI\Template::getTemplate('cronjobs/cronjobs_cronjobmodule') . "\";");
$cmod = $row['module'];
}
if ($paging->checkDisplay($i)) {
@@ -65,14 +65,14 @@ if ($page == 'cronjobs' || $page == 'overview') {
$description = $lng['crondesc'][$row['desc_lng_key']];
eval("\$crons.=\"" . getTemplate('cronjobs/cronjobs_cronjob') . "\";");
eval("\$crons.=\"" . \Froxlor\UI\Template::getTemplate('cronjobs/cronjobs_cronjob') . "\";");
$count ++;
}
$i ++;
}
eval("echo \"" . getTemplate('cronjobs/cronjobs') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('cronjobs/cronjobs') . "\";");
} elseif ($action == 'new') {
/*
* @TODO later
@@ -83,7 +83,7 @@ if ($page == 'cronjobs' || $page == 'overview') {
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if ($result['cronfile'] != '') {
@@ -91,9 +91,9 @@ if ($page == 'cronjobs' || $page == 'overview') {
try {
Cronjobs::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -117,12 +117,12 @@ if ($page == 'cronjobs' || $page == 'overview') {
}
$cronjobs_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/cronjobs/formfield.cronjobs_edit.php';
$cronjobs_edit_form = htmlform::genHTMLForm($cronjobs_edit_data);
$cronjobs_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($cronjobs_edit_data);
$title = $cronjobs_edit_data['cronjobs_edit']['title'];
$image = $cronjobs_edit_data['cronjobs_edit']['image'];
eval("echo \"" . getTemplate('cronjobs/cronjob_edit') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('cronjobs/cronjob_edit') . "\";");
}
}
} elseif ($action == 'delete' && $id != 0) {

View File

@@ -48,7 +48,7 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
'c.traffic_used' => $lng['customer']['traffic'] . ' (' . $lng['panel']['used'] . ')'
);
$paging = new paging($userinfo, TABLE_PANEL_CUSTOMERS, $fields);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_CUSTOMERS, $fields);
$customers = '';
$result_stmt = Database::prepare("
SELECT `c`.*, `a`.`loginname` AS `adminname`
@@ -139,7 +139,7 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
$row['custom_notes'] = ($row['custom_notes'] != '') ? nl2br($row['custom_notes']) : '';
eval("\$customers.=\"" . getTemplate("customers/customers_customer") . "\";");
eval("\$customers.=\"" . \Froxlor\UI\Template::getTemplate("customers/customers_customer") . "\";");
$count ++;
}
@@ -147,14 +147,14 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
}
$customercount = $num_rows;
eval("echo \"" . getTemplate("customers/customers") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("customers/customers") . "\";");
} elseif ($action == 'su' && $id != 0) {
try {
$json_result = Customers::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -163,7 +163,7 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
if ($destination_user != '') {
if ($result['deactivated'] == '1') {
standard_error("usercurrentlydeactivated", $destination_user);
\Froxlor\UI\Response::standard_error("usercurrentlydeactivated", $destination_user);
}
$result_stmt = Database::prepare("
SELECT * FROM `" . TABLE_PANEL_SESSIONS . "`
@@ -199,11 +199,11 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
if (! file_exists(FROXLOR_INSTALL_DIR . "/" . $redirect)) {
$redirect = "customer_index.php";
}
redirectTo($redirect, array(
\Froxlor\UI\Response::redirectTo($redirect, array(
's' => $s
), true);
} else {
redirectTo('index.php', array(
\Froxlor\UI\Response::redirectTo('index.php', array(
'action' => 'login'
));
}
@@ -213,7 +213,7 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -223,9 +223,9 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
'id' => $id
))->unlock();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -242,7 +242,7 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -253,9 +253,9 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
'delete_userfiles' => (isset($_POST['delete_userfiles']) ? (int) $_POST['delete_userfiles'] : 0)
))->delete();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -272,9 +272,9 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
try {
Customers::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -334,12 +334,12 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
}
$customer_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_add.php';
$customer_add_form = htmlform::genHTMLForm($customer_add_data);
$customer_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($customer_add_data);
$title = $customer_add_data['customer_add']['title'];
$image = $customer_add_data['customer_add']['image'];
eval("echo \"" . getTemplate("customers/customers_add") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("customers/customers_add") . "\";");
}
} elseif ($action == 'edit' && $id != 0) {
@@ -348,7 +348,7 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -375,9 +375,9 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
try {
Customers::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -479,12 +479,12 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
}
$customer_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_edit.php';
$customer_edit_form = htmlform::genHTMLForm($customer_edit_data);
$customer_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($customer_edit_data);
$title = $customer_edit_data['customer_edit']['title'];
$image = $customer_edit_data['customer_edit']['image'];
eval("echo \"" . getTemplate("customers/customers_edit") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("customers/customers_edit") . "\";");
}
}
}

View File

@@ -51,7 +51,7 @@ if ($page == 'domains' || $page == 'overview') {
'c.loginname' => $lng['login']['username'],
'd.aliasdomain' => $lng['domains']['aliasdomain']
);
$paging = new paging($userinfo, TABLE_PANEL_DOMAINS, $fields);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_DOMAINS, $fields);
$domains = "";
$result_stmt = Database::prepare("
SELECT `d`.*, `c`.`loginname`, `c`.`deactivated`, `c`.`name`, `c`.`firstname`, `c`.`company`, `c`.`standardsubdomain`, `ad`.`id` AS `aliasdomainid`, `ad`.`domain` AS `aliasdomain`
@@ -109,7 +109,7 @@ if ($page == 'domains' || $page == 'overview') {
$row = htmlentities_array($row);
// display a nice list of IP's
$row['ipandport'] = str_replace("\n", "<br />", $row['ipandport']);
eval("\$domains.=\"" . getTemplate("domains/domains_domain") . "\";");
eval("\$domains.=\"" . \Froxlor\UI\Template::getTemplate("domains/domains_domain") . "\";");
$count ++;
}
$i ++;
@@ -118,7 +118,7 @@ if ($page == 'domains' || $page == 'overview') {
$domainscount = $numrows_domains;
// Display the list
eval("echo \"" . getTemplate("domains/domains") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("domains/domains") . "\";");
} elseif ($action == 'delete' && $id != 0) {
try {
@@ -127,7 +127,7 @@ if ($page == 'domains' || $page == 'overview') {
'no_std_subdomain' => true
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -144,15 +144,15 @@ if ($page == 'domains' || $page == 'overview') {
try {
Domains::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} elseif ($alias_check['count'] > 0) {
standard_error('domains_cantdeletedomainwithaliases');
\Froxlor\UI\Response::standard_error('domains_cantdeletedomainwithaliases');
} else {
$showcheck = false;
@@ -172,9 +172,9 @@ if ($page == 'domains' || $page == 'overview') {
try {
Domains::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -337,12 +337,12 @@ if ($page == 'domains' || $page == 'overview') {
$add_date = date('Y-m-d');
$domain_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/domains/formfield.domains_add.php';
$domain_add_form = htmlform::genHTMLForm($domain_add_data);
$domain_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($domain_add_data);
$title = $domain_add_data['domain_add']['title'];
$image = $domain_add_data['domain_add']['image'];
eval("echo \"" . getTemplate("domains/domains_add") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("domains/domains_add") . "\";");
}
} elseif ($action == 'edit' && $id != 0) {
@@ -351,7 +351,7 @@ if ($page == 'domains' || $page == 'overview') {
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -418,9 +418,9 @@ if ($page == 'domains' || $page == 'overview') {
try {
Domains::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -627,14 +627,14 @@ if ($page == 'domains' || $page == 'overview') {
$result = htmlentities_array($result);
$domain_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/domains/formfield.domains_edit.php';
$domain_edit_form = htmlform::genHTMLForm($domain_edit_data);
$domain_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($domain_edit_data);
$title = $domain_edit_data['domain_edit']['title'];
$image = $domain_edit_data['domain_edit']['image'];
$speciallogwarning = sprintf($lng['admin']['speciallogwarning'], $lng['admin']['delete_statistics']);
eval("echo \"" . getTemplate("domains/domains_edit") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("domains/domains_edit") . "\";");
}
}
} elseif ($action == 'jqGetCustomerPHPConfigs') {
@@ -659,11 +659,11 @@ if ($page == 'domains' || $page == 'overview') {
$bulk = new \Froxlor\Bulk\DomainBulkAction($file_name, $customerid);
$result = $bulk->doImport($separator, $offset);
} catch (Exception $e) {
standard_error('domain_import_error', $e->getMessage());
\Froxlor\UI\Response::standard_error('domain_import_error', $e->getMessage());
}
if (! empty($bulk->getErrors())) {
dynamic_error(implode("<br>", $bulk->getErrors()));
\Froxlor\UI\Response::dynamic_error(implode("<br>", $bulk->getErrors()));
}
// update customer/admin counters
@@ -672,7 +672,7 @@ if ($page == 'domains' || $page == 'overview') {
\Froxlor\System\Cronjob::inserttask('4');
$result_str = $result['imported'] . ' / ' . $result['all'] . (! empty($result['note']) ? ' (' . $result['note'] . ')' : '');
standard_success('domain_import_successfully', $result_str, array(
\Froxlor\UI\Response::standard_success('domain_import_successfully', $result_str, array(
'filename' => $filename,
'action' => '',
'page' => 'domains'
@@ -693,12 +693,12 @@ if ($page == 'domains' || $page == 'overview') {
}
$domain_import_data = include_once dirname(__FILE__) . '/lib/formfields/admin/domains/formfield.domains_import.php';
$domain_import_form = htmlform::genHTMLForm($domain_import_data);
$domain_import_form = \Froxlor\UI\HtmlForm::genHTMLForm($domain_import_data);
$title = $domain_import_data['domain_import']['title'];
$image = $domain_import_data['domain_import']['image'];
eval("echo \"" . getTemplate("domains/domains_import") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("domains/domains_import") . "\";");
}
}
} elseif ($page == 'domaindnseditor' && Settings::Get('system.dnsenabled') == '1') {

View File

@@ -45,7 +45,7 @@ if ($action == 'logout') {
}
Database::pexecute($stmt, $params);
redirectTo('index.php');
\Froxlor\UI\Response::redirectTo('index.php');
}
if (isset($_POST['id'])) {
@@ -93,7 +93,7 @@ if ($page == 'overview') {
try {
$json_result = Froxlor::getLocal($userinfo)->checkUpdate();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -173,36 +173,36 @@ if ($page == 'overview') {
$uptime = '';
}
eval("echo \"" . getTemplate("index/index") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/index") . "\";");
} elseif ($page == 'change_password') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$old_password = validate($_POST['old_password'], 'old password');
if (! validatePasswordLogin($userinfo, $old_password, TABLE_PANEL_ADMINS, 'adminid')) {
standard_error('oldpasswordnotcorrect');
\Froxlor\UI\Response::standard_error('oldpasswordnotcorrect');
}
$new_password = validate($_POST['new_password'], 'new password');
$new_password_confirm = validate($_POST['new_password_confirm'], 'new password confirm');
if ($old_password == '') {
standard_error(array(
\Froxlor\UI\Response::standard_error(array(
'stringisempty',
'oldpassword'
));
} elseif ($new_password == '') {
standard_error(array(
\Froxlor\UI\Response::standard_error(array(
'stringisempty',
'newpassword'
));
} elseif ($new_password_confirm == '') {
standard_error(array(
\Froxlor\UI\Response::standard_error(array(
'stringisempty',
'newpasswordconfirm'
));
} elseif ($new_password != $new_password_confirm) {
standard_error('newpasswordconfirmerror');
\Froxlor\UI\Response::standard_error('newpasswordconfirmerror');
} else {
try {
Admins::getLocal($userinfo, array(
@@ -210,15 +210,15 @@ if ($page == 'overview') {
'admin_password' => $new_password
))->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$log->logAction(ADM_ACTION, LOG_NOTICE, 'changed password');
redirectTo($filename, Array(
\Froxlor\UI\Response::redirectTo($filename, Array(
's' => $s
));
}
} else {
eval("echo \"" . getTemplate("index/change_password") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/change_password") . "\";");
}
} elseif ($page == 'change_language') {
@@ -232,7 +232,7 @@ if ($page == 'overview') {
'def_language' => $def_language
))->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
// also update current session
@@ -246,7 +246,7 @@ if ($page == 'overview') {
));
}
$log->logAction(ADM_ACTION, LOG_NOTICE, "changed his/her default language to '" . $def_language . "'");
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} else {
@@ -262,7 +262,7 @@ if ($page == 'overview') {
$language_options .= makeoption($language_name, $language_file, $default_lang, true);
}
eval("echo \"" . getTemplate("index/change_language") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/change_language") . "\";");
}
} elseif ($page == 'change_theme') {
@@ -274,7 +274,7 @@ if ($page == 'overview') {
'theme' => $theme
))->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
// also update current session
@@ -288,7 +288,7 @@ if ($page == 'overview') {
));
$log->logAction(ADM_ACTION, LOG_NOTICE, "changed his/her theme to '" . $theme . "'");
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} else {
@@ -305,7 +305,7 @@ if ($page == 'overview') {
$theme_options .= makeoption($d, $t, $default_theme, true);
}
eval("echo \"" . getTemplate("index/change_theme") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/change_theme") . "\";");
}
} elseif ($page == 'send_error_report' && Settings::Get('system.allow_error_report_admin') == '1') {
@@ -363,25 +363,25 @@ if ($page == 'overview') {
if ($_mailerror) {
// error when reporting an error...LOLFUQ
standard_error('send_report_error', $mailerr_msg);
\Froxlor\UI\Response::standard_error('send_report_error', $mailerr_msg);
}
// finally remove error from fs
@unlink($err_file);
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
}
// show a nice summary of the error-report
// before actually sending anything
eval("echo \"" . getTemplate("index/send_error_report") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/send_error_report") . "\";");
} else {
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
}
} else {
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
}

View File

@@ -43,7 +43,7 @@ if ($page == 'ipsandports' || $page == 'overview') {
'ip' => $lng['admin']['ipsandports']['ip'],
'port' => $lng['admin']['ipsandports']['port']
);
$paging = new paging($userinfo, TABLE_PANEL_IPSANDPORTS, $fields);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_IPSANDPORTS, $fields);
$ipsandports = '';
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` " . $paging->getSqlWhere(false) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
Database::pexecute($result_stmt);
@@ -62,19 +62,19 @@ if ($page == 'ipsandports' || $page == 'overview') {
if (filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$row['ip'] = '[' . $row['ip'] . ']';
}
eval("\$ipsandports.=\"" . getTemplate("ipsandports/ipsandports_ipandport") . "\";");
eval("\$ipsandports.=\"" . \Froxlor\UI\Template::getTemplate("ipsandports/ipsandports_ipandport") . "\";");
$count ++;
}
$i ++;
}
eval("echo \"" . getTemplate("ipsandports/ipsandports") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("ipsandports/ipsandports") . "\";");
} elseif ($action == 'delete' && $id != 0) {
try {
$json_result = IpsAndPorts::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -86,10 +86,10 @@ if ($page == 'ipsandports' || $page == 'overview') {
'id' => $id
))->delete();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -106,21 +106,21 @@ if ($page == 'ipsandports' || $page == 'overview') {
try {
IpsAndPorts::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
} else {
$ipsandports_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/ipsandports/formfield.ipsandports_add.php';
$ipsandports_add_form = htmlform::genHTMLForm($ipsandports_add_data);
$ipsandports_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($ipsandports_add_data);
$title = $ipsandports_add_data['ipsandports_add']['title'];
$image = $ipsandports_add_data['ipsandports_add']['image'];
eval("echo \"" . getTemplate("ipsandports/ipsandports_add") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("ipsandports/ipsandports_add") . "\";");
}
} elseif ($action == 'edit' && $id != 0) {
try {
@@ -128,7 +128,7 @@ if ($page == 'ipsandports' || $page == 'overview') {
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -138,9 +138,9 @@ if ($page == 'ipsandports' || $page == 'overview') {
try {
IpsAndPorts::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -149,12 +149,12 @@ if ($page == 'ipsandports' || $page == 'overview') {
$result = htmlentities_array($result);
$ipsandports_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/ipsandports/formfield.ipsandports_edit.php';
$ipsandports_edit_form = htmlform::genHTMLForm($ipsandports_edit_data);
$ipsandports_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($ipsandports_edit_data);
$title = $ipsandports_edit_data['ipsandports_edit']['title'];
$image = $ipsandports_edit_data['ipsandports_edit']['image'];
eval("echo \"" . getTemplate("ipsandports/ipsandports_edit") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("ipsandports/ipsandports_edit") . "\";");
}
}
}

View File

@@ -32,7 +32,7 @@ if ($page == 'log'
'user' => $lng['logger']['user'],
'text' => $lng['logger']['action']
);
$paging = new paging($userinfo, TABLE_PANEL_LOG, $fields, null, null, 0, 'desc', 30);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_LOG, $fields, null, null, 0, 'desc', 30);
$query = 'SELECT * FROM `' . TABLE_PANEL_LOG . '` ' . $paging->getSqlWhere(false) . ' ' . $paging->getSqlOrderBy();
$result_stmt = Database::query($query . ' ' . $paging->getSqlLimit());
$result_cnt_stmt = Database::query($query);
@@ -99,12 +99,12 @@ if ($page == 'log'
}
$row['action'] = $_action;
eval("\$log.=\"" . getTemplate('logger/logger_action') . "\";");
eval("\$log.=\"" . \Froxlor\UI\Template::getTemplate('logger/logger_action') . "\";");
}
$log_count++;
$row['type'] = getLogLevelDesc($row['type']);
eval("\$log.=\"" . getTemplate('logger/logger_log') . "\";");
eval("\$log.=\"" . \Froxlor\UI\Template::getTemplate('logger/logger_log') . "\";");
$count++;
$_action = $action;
// }
@@ -113,7 +113,7 @@ if ($page == 'log'
$i++;
}
eval("echo \"" . getTemplate('logger/logger') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('logger/logger') . "\";");
} elseif ($action == 'truncate') {
@@ -126,7 +126,7 @@ if ($page == 'log'
);
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));
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
} else {
ask_yesno('logger_reallytruncate', $filename, array('page' => $page, 'action' => $action), TABLE_PANEL_LOG);
}

View File

@@ -53,7 +53,7 @@ if ($page == 'message') {
Database::pexecute($result, array('adminid' => $userinfo['adminid']));
}
} else {
standard_error('noreceipientsgiven');
\Froxlor\UI\Response::standard_error('noreceipientsgiven');
}
$subject = $_POST['subject'];
@@ -80,16 +80,16 @@ if ($page == 'message') {
}
$log->logAction(ADM_ACTION, LOG_ERR, 'Error sending mail: ' . $mailerr_msg);
standard_error('errorsendingmail', $row['email']);
\Froxlor\UI\Response::standard_error('errorsendingmail', $row['email']);
}
$mailcounter++;
$mail->ClearAddresses();
}
redirectTo($filename, array('page' => $page, 's' => $s, 'action' => 'showsuccess', 'sentitems' => $mailcounter));
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s, 'action' => 'showsuccess', 'sentitems' => $mailcounter));
} else {
standard_error('nomessagetosend');
\Froxlor\UI\Response::standard_error('nomessagetosend');
}
}
}
@@ -119,5 +119,5 @@ if ($page == 'message') {
}
$receipients .= makeoption($lng['panel']['customer'], 1);
eval("echo \"" . getTemplate('message/message') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('message/message') . "\";");
}

View File

@@ -34,7 +34,7 @@ if ($action == 'reset' &&
if (!function_exists('opcache_get_configuration')
) {
standard_error($lng['error']['no_opcacheinfo']);
\Froxlor\UI\Response::standard_error($lng['error']['no_opcacheinfo']);
}
if ($page == 'showinfo'
@@ -68,7 +68,7 @@ if ($page == 'showinfo'
$value=number_format($value,0,'.',' ');
}
$name=str_replace('_', ' ', $name);
eval("\$runtimelines.=\"" . getTemplate("settings/opcacheinfo/runtime_line") . "\";");
eval("\$runtimelines.=\"" . \Froxlor\UI\Template::getTemplate("settings/opcacheinfo/runtime_line") . "\";");
}
}
@@ -140,11 +140,11 @@ if ($page == 'showinfo'
$blacklistlines = '';
if (isset($opcache_info['blacklist']) && is_array($opcache_info['blacklist'])) {
foreach ($opcache_info['blacklist'] as $value) {
eval("\$blacklistlines.=\"" . getTemplate("settings/opcacheinfo/blacklist_line") . "\";");
eval("\$blacklistlines.=\"" . \Froxlor\UI\Template::getTemplate("settings/opcacheinfo/blacklist_line") . "\";");
}
}
eval("echo \"" . getTemplate("settings/opcacheinfo/showinfo") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/opcacheinfo/showinfo") . "\";");
}

View File

@@ -38,7 +38,7 @@ if ($page == 'overview') {
'with_subdomains' => true
))->listing();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -58,11 +58,11 @@ if ($page == 'overview') {
if ($subdomains_count == 0 && empty($domains)) {
$domains = $lng['admin']['phpsettings']['notused'];
}
eval("\$tablecontent.=\"" . getTemplate("phpconfig/overview_overview") . "\";");
eval("\$tablecontent.=\"" . \Froxlor\UI\Template::getTemplate("phpconfig/overview_overview") . "\";");
}
}
eval("echo \"" . getTemplate("phpconfig/overview") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/overview") . "\";");
}
if ($action == 'add') {
@@ -73,9 +73,9 @@ if ($page == 'overview') {
try {
PhpSettings::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -95,15 +95,15 @@ if ($page == 'overview') {
$pm_select.= makeoption('ondemand', 'ondemand', 'static', true, true);
$phpconfig_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php';
$phpconfig_add_form = htmlform::genHTMLForm($phpconfig_add_data);
$phpconfig_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($phpconfig_add_data);
$title = $phpconfig_add_data['phpconfig_add']['title'];
$image = $phpconfig_add_data['phpconfig_add']['image'];
eval("echo \"" . getTemplate("phpconfig/overview_add") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/overview_add") . "\";");
}
} else {
standard_error('nopermissionsorinvalidid');
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
}
}
@@ -112,7 +112,7 @@ if ($page == 'overview') {
try {
$json_result = PhpSettings::getLocal($userinfo, array('id' => $id))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -123,9 +123,9 @@ if ($page == 'overview') {
try {
PhpSettings::getLocal($userinfo, array('id' => $id))->delete();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -137,7 +137,7 @@ if ($page == 'overview') {
), $result['description']);
}
} else {
standard_error('nopermissionsorinvalidid');
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
}
}
@@ -146,7 +146,7 @@ if ($page == 'overview') {
try {
$json_result = PhpSettings::getLocal($userinfo, array('id' => $id))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -156,9 +156,9 @@ if ($page == 'overview') {
try {
PhpSettings::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -175,15 +175,15 @@ if ($page == 'overview') {
$pm_select.= makeoption('ondemand', 'ondemand', $result['pm'], true, true);
$phpconfig_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php';
$phpconfig_edit_form = htmlform::genHTMLForm($phpconfig_edit_data);
$phpconfig_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($phpconfig_edit_data);
$title = $phpconfig_edit_data['phpconfig_edit']['title'];
$image = $phpconfig_edit_data['phpconfig_edit']['image'];
eval("echo \"" . getTemplate("phpconfig/overview_edit") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/overview_edit") . "\";");
}
} else {
standard_error('nopermissionsorinvalidid');
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
}
}
} elseif ($page == 'fpmdaemons') {
@@ -193,7 +193,7 @@ if ($page == 'overview') {
try {
$json_result = FpmDaemons::getLocal($userinfo)->listing();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -206,10 +206,10 @@ if ($page == 'overview') {
$configs .= $configused . "<br>";
}
$count++;
eval("\$tablecontent.=\"" . getTemplate("phpconfig/fpmdaemons_overview") . "\";");
eval("\$tablecontent.=\"" . \Froxlor\UI\Template::getTemplate("phpconfig/fpmdaemons_overview") . "\";");
}
}
eval("echo \"" . getTemplate("phpconfig/fpmdaemons") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/fpmdaemons") . "\";");
}
if ($action == 'add') {
@@ -220,9 +220,9 @@ if ($page == 'overview') {
try {
FpmDaemons::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -233,15 +233,15 @@ if ($page == 'overview') {
$pm_select .= makeoption('ondemand', 'ondemand', 'static', true, true);
$fpmconfig_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.fpmconfig_add.php';
$fpmconfig_add_form = htmlform::genHTMLForm($fpmconfig_add_data);
$fpmconfig_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($fpmconfig_add_data);
$title = $fpmconfig_add_data['fpmconfig_add']['title'];
$image = $fpmconfig_add_data['fpmconfig_add']['image'];
eval("echo \"" . getTemplate("phpconfig/fpmconfig_add") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/fpmconfig_add") . "\";");
}
} else {
standard_error('nopermissionsorinvalidid');
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
}
}
@@ -250,12 +250,12 @@ if ($page == 'overview') {
try {
$json_result = FpmDaemons::getLocal($userinfo, array('id' => $id))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
if ($id == 1) {
standard_error('cannotdeletedefaultphpconfig');
\Froxlor\UI\Response::standard_error('cannotdeletedefaultphpconfig');
}
if ($result['id'] != 0 && $result['id'] == $id && (int) $userinfo['change_serversettings'] == 1 && $id != 1) // cannot delete the default php.config
@@ -264,9 +264,9 @@ if ($page == 'overview') {
try {
FpmDaemons::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -278,7 +278,7 @@ if ($page == 'overview') {
), $result['description']);
}
} else {
standard_error('nopermissionsorinvalidid');
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
}
}
@@ -287,7 +287,7 @@ if ($page == 'overview') {
try {
$json_result = FpmDaemons::getLocal($userinfo, array('id' => $id))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -297,9 +297,9 @@ if ($page == 'overview') {
try {
FpmDaemons::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -310,15 +310,15 @@ if ($page == 'overview') {
$pm_select .= makeoption('ondemand', 'ondemand', $result['pm'], true, true);
$fpmconfig_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.fpmconfig_edit.php';
$fpmconfig_edit_form = htmlform::genHTMLForm($fpmconfig_edit_data);
$fpmconfig_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($fpmconfig_edit_data);
$title = $fpmconfig_edit_data['fpmconfig_edit']['title'];
$image = $fpmconfig_edit_data['fpmconfig_edit']['image'];
eval("echo \"" . getTemplate("phpconfig/fpmconfig_edit") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("phpconfig/fpmconfig_edit") . "\";");
}
} else {
standard_error('nopermissionsorinvalidid');
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
}
}
}

View File

@@ -37,7 +37,7 @@ if ($page == '' || $page == 'overview') {
'adminname' => $lng['admin']['admin'],
'p.ts' => $lng['admin']['plans']['last_update']
);
$paging = new paging($userinfo, TABLE_PANEL_PLANS, $fields);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_PLANS, $fields);
$plans = '';
$result_stmt = Database::prepare("
SELECT p.*, a.loginname as adminname
@@ -60,13 +60,13 @@ if ($page == '' || $page == 'overview') {
if ($paging->checkDisplay($i)) {
$row = htmlentities_array($row);
$row['ts_format'] = date("d.m.Y H:i", $row['ts']);
eval("\$plans.=\"" . getTemplate("plans/plans_plan") . "\";");
eval("\$plans.=\"" . \Froxlor\UI\Template::getTemplate("plans/plans_plan") . "\";");
$count ++;
}
$i ++;
}
eval("echo \"" . getTemplate("plans/plans") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("plans/plans") . "\";");
} elseif ($action == 'delete' && $id != 0) {
$result_stmt = Database::prepare("
@@ -85,7 +85,7 @@ if ($page == '' || $page == 'overview') {
));
$log->logAction(ADM_ACTION, LOG_INFO, "Plan '" . $result['name'] . "' has been deleted by '" . $userinfo['loginname'] . "'");
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -97,7 +97,7 @@ if ($page == '' || $page == 'overview') {
), $result['name']);
}
} else {
standard_error('nopermissionsorinvalidid');
\Froxlor\UI\Response::standard_error('nopermissionsorinvalidid');
}
} elseif ($action == 'add') {
@@ -205,7 +205,7 @@ if ($page == '' || $page == 'overview') {
Database::pexecute($ins_stmt, $ins_data);
$log->logAction(ADM_ACTION, LOG_WARNING, "added plan '" . $name . "'");
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -254,12 +254,12 @@ if ($page == '' || $page == 'overview') {
unset($cust_add_data['customer_add']['sections']['section_cpre']);
// merge
$plans_add_data['plans_add']['sections'] = array_merge($plans_add_data['plans_add']['sections'], $cust_add_data['customer_add']['sections']);
$plans_add_form = htmlform::genHTMLForm($plans_add_data);
$plans_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($plans_add_data);
$title = $plans_add_data['plans_add']['title'];
$image = $plans_add_data['plans_add']['image'];
eval("echo \"" . getTemplate("plans/plans_add") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("plans/plans_add") . "\";");
}
} elseif ($action == 'edit' && $id != 0) {
$result_stmt = Database::prepare("
@@ -384,7 +384,7 @@ if ($page == '' || $page == 'overview') {
Database::pexecute($ins_stmt, $ins_data);
$log->logAction(ADM_ACTION, LOG_WARNING, "updated plan '" . $name . "'");
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -488,12 +488,12 @@ if ($page == '' || $page == 'overview') {
unset($cust_edit_data['customer_edit']['sections']['section_cpre']);
// merge
$plans_edit_data['plans_edit']['sections'] = array_merge($plans_edit_data['plans_edit']['sections'], $cust_edit_data['customer_edit']['sections']);
$plans_edit_form = htmlform::genHTMLForm($plans_edit_data);
$plans_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($plans_edit_data);
$title = $plans_edit_data['plans_edit']['title'];
$image = $plans_edit_data['plans_edit']['image'];
eval("echo \"" . getTemplate("plans/plans_edit") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("plans/plans_edit") . "\";");
}
}
} elseif ($action == 'jqGetPlanValues') {

View File

@@ -56,7 +56,7 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
// check if the session timeout is too low #815
if (isset($_POST['session_sessiontimeout']) && $_POST['session_sessiontimeout'] < 60) {
standard_error($lng['error']['session_timeout'], $lng['error']['session_timeout_desc']);
\Froxlor\UI\Response::standard_error($lng['error']['session_timeout'], $lng['error']['session_timeout_desc']);
}
if (processFormEx($settings_data, $_POST, array(
@@ -69,7 +69,7 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
// Using nameserver, insert a task which rebuilds the server config
\Froxlor\System\Cronjob::inserttask('4');
standard_success('settingssaved', '', array(
\Froxlor\UI\Response::standard_success('settingssaved', '', array(
'filename' => $filename,
'action' => $action,
'page' => $page
@@ -86,14 +86,14 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$settings_page = '';
if ($_part == '') {
eval("\$settings_page .= \"" . getTemplate("settings/settings_overview") . "\";");
eval("\$settings_page .= \"" . \Froxlor\UI\Template::getTemplate("settings/settings_overview") . "\";");
} else {
eval("\$settings_page .= \"" . getTemplate("settings/settings") . "\";");
eval("\$settings_page .= \"" . \Froxlor\UI\Template::getTemplate("settings/settings") . "\";");
}
eval("echo \"" . getTemplate("settings/settings_form_begin") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/settings_form_begin") . "\";");
eval("echo \$settings_page;");
eval("echo \"" . getTemplate("settings/settings_form_end") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/settings_form_end") . "\";");
}
} elseif ($page == 'phpinfo' && $userinfo['change_serversettings'] == '1') {
ob_start();
@@ -121,24 +121,24 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$phpinfoentries = "";
foreach ($section as $key => $val) {
if (is_array($val)) {
eval("\$phpinfoentries .= \"" . getTemplate("settings/phpinfo/phpinfo_3") . "\";");
eval("\$phpinfoentries .= \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo/phpinfo_3") . "\";");
} elseif (is_string($key)) {
eval("\$phpinfoentries .= \"" . getTemplate("settings/phpinfo/phpinfo_2") . "\";");
eval("\$phpinfoentries .= \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo/phpinfo_2") . "\";");
} else {
eval("\$phpinfoentries .= \"" . getTemplate("settings/phpinfo/phpinfo_1") . "\";");
eval("\$phpinfoentries .= \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo/phpinfo_1") . "\";");
}
}
// first header -> show actual php version
if (strtolower($name) == "phpinfo") {
$name = "PHP " . PHP_VERSION;
}
eval("\$phpinfohtml .= \"" . getTemplate("settings/phpinfo/phpinfo_table") . "\";");
eval("\$phpinfohtml .= \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo/phpinfo_table") . "\";");
}
$phpinfo = $phpinfohtml;
} else {
standard_error($lng['error']['no_phpinfo']);
\Froxlor\UI\Response::standard_error($lng['error']['no_phpinfo']);
}
eval("echo \"" . getTemplate("settings/phpinfo") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo") . "\";");
} elseif ($page == 'rebuildconfigs' && $userinfo['change_serversettings'] == '1') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
@@ -150,7 +150,7 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
// cron.d file
\Froxlor\System\Cronjob::inserttask('99');
standard_success('rebuildingconfigs', '', array(
\Froxlor\UI\Response::standard_success('rebuildingconfigs', '', array(
'filename' => 'admin_index.php'
));
} else {
@@ -166,15 +166,15 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$updatecounters = updateCounters(true);
$customers = '';
foreach ($updatecounters['customers'] as $customerid => $customer) {
eval("\$customers.=\"" . getTemplate("settings/updatecounters_row_customer") . "\";");
eval("\$customers.=\"" . \Froxlor\UI\Template::getTemplate("settings/updatecounters_row_customer") . "\";");
}
$admins = '';
foreach ($updatecounters['admins'] as $adminid => $admin) {
eval("\$admins.=\"" . getTemplate("settings/updatecounters_row_admin") . "\";");
eval("\$admins.=\"" . \Froxlor\UI\Template::getTemplate("settings/updatecounters_row_admin") . "\";");
}
eval("echo \"" . getTemplate("settings/updatecounters") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/updatecounters") . "\";");
} else {
ask_yesno('admin_counters_reallyupdate', $filename, array(
'page' => $page
@@ -187,7 +187,7 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$log->logAction(ADM_ACTION, LOG_WARNING, "wiped all cleartext mail passwords");
Database::query("UPDATE `" . TABLE_MAIL_USERS . "` SET `password` = '';");
Database::query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '0' WHERE `settinggroup` = 'system' AND `varname` = 'mailpwcleartext'");
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} else {
@@ -204,7 +204,7 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
// 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($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} else {
@@ -245,7 +245,7 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
// 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($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
's' => $s
));
} else {
@@ -268,13 +268,13 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$displayid = $id + 1;
$result = $integrity->$check();
$checkdesc = $lng['integrity_check'][$check];
eval("\$integritycheck.=\"" . getTemplate("settings/integritycheck_row") . "\";");
eval("\$integritycheck.=\"" . \Froxlor\UI\Template::getTemplate("settings/integritycheck_row") . "\";");
}
eval("echo \"" . getTemplate("settings/integritycheck") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/integritycheck") . "\";");
} elseif ($page == 'importexport' && $userinfo['change_serversettings'] == '1') {
// check for json-stuff
if (! extension_loaded('json')) {
standard_error('jsonextensionnotfound');
\Froxlor\UI\Response::standard_error('jsonextensionnotfound');
}
if (isset($_GET['action']) && $_GET['action'] == "export") {
@@ -283,7 +283,7 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$json_result = Froxlor::getLocal($userinfo)->exportSettings();
$json_export = json_decode($json_result, true)['data'];
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
header('Content-disposition: attachment; filename=Froxlor_settings-' . $version . '-' . $dbversion . '_' . date('d.m.Y') . '.json');
header('Content-type: application/json');
@@ -300,16 +300,16 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
'json_str' => $imp_content
))->importSettings();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
standard_success('settingsimported', '', array(
\Froxlor\UI\Response::standard_success('settingsimported', '', array(
'filename' => 'admin_settings.php'
));
}
dynamic_error("Upload failed");
\Froxlor\UI\Response::dynamic_error("Upload failed");
}
} else {
eval("echo \"" . getTemplate("settings/importexport/index") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/importexport/index") . "\";");
}
} elseif ($page == 'testmail') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
@@ -361,7 +361,7 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
if (! $_mailerror) {
// success
$mail->ClearAddresses();
standard_success('testmailsent', '', array(
\Froxlor\UI\Response::standard_success('testmailsent', '', array(
'filename' => 'admin_settings.php',
'page' => 'testmail'
));
@@ -377,5 +377,5 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$mail_smtp_host = Settings::Get('system.mail_smtp_host');
$mail_smtp_port = Settings::Get('system.mail_smtp_port');
eval("echo \"" . getTemplate("settings/testmail") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/testmail") . "\";");
}

View File

@@ -87,7 +87,7 @@ if ($action == '') {
$subjectid = $email['subject'];
$mailbodyid = $email['mailbody'];
$template = $lng['admin']['templates'][$action];
eval("\$templates.=\"" . getTemplate("templates/templates_template") . "\";");
eval("\$templates.=\"" . \Froxlor\UI\Template::getTemplate("templates/templates_template") . "\";");
}
}
@@ -125,9 +125,9 @@ if ($action == '') {
}
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
eval("\$filetemplates.=\"" . getTemplate("templates/templates_filetemplate") . "\";");
eval("\$filetemplates.=\"" . \Froxlor\UI\Template::getTemplate("templates/templates_filetemplate") . "\";");
}
eval("echo \"" . getTemplate("templates/templates") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/templates") . "\";");
} elseif($action == 'delete'
&& $subjectid != 0
@@ -156,7 +156,7 @@ if ($action == '') {
'idb' => $mailbodyid
));
$log->logAction(ADM_ACTION, LOG_INFO, "deleted template '" . $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])] . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
} else {
ask_yesno('admin_template_reallydelete', $filename, array('subjectid' => $subjectid, 'mailbodyid' => $mailbodyid, 'page' => $page, 'action' => $action), $result['language'] . ' - ' . $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])]);
@@ -186,14 +186,14 @@ if ($action == '') {
);
Database::pexecute($del_stmt, array('adminid' => $userinfo['adminid'], 'id' => $id));
$log->logAction(ADM_ACTION, LOG_INFO, "deleted template '" . $lng['admin']['templates'][$row['varname']] . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
} else {
ask_yesno('admin_template_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $lng['admin']['templates'][$row['varname']]);
}
} else {
standard_error('templatenotfound');
\Froxlor\UI\Response::standard_error('templatenotfound');
}
} elseif($action == 'add') {
@@ -225,12 +225,12 @@ if ($action == '') {
$lng = $lng_bak;
$template_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/templates/formfield.template_add.php';
$template_add_form = htmlform::genHTMLForm($template_add_data);
$template_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($template_add_data);
$title = $template_add_data['template_add']['title'];
$image = $template_add_data['template_add']['image'];
eval("echo \"" . getTemplate("templates/templates_add_2") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/templates_add_2") . "\";");
} elseif(isset($_POST['send'])
&& $_POST['send'] == 'send'
@@ -254,7 +254,7 @@ if ($action == '') {
$templates = array_diff($available_templates, $templates);
if (array_search($template, $templates) === false) {
standard_error('templatenotfound');
\Froxlor\UI\Response::standard_error('templatenotfound');
} else {
$ins_stmt = Database::prepare("
@@ -285,7 +285,7 @@ if ($action == '') {
Database::pexecute($ins_stmt, $ins_data);
$log->logAction(ADM_ACTION, LOG_INFO, "added template '" . $language . ' - ' . $template . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
}
} elseif(isset($_POST['filesend'])
@@ -312,7 +312,7 @@ if ($action == '') {
Database::pexecute($ins_stmt, $ins_data);
$log->logAction(ADM_ACTION, LOG_INFO, "added template '" . $template . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
} elseif(!isset($_GET['files'])) {
@@ -347,9 +347,9 @@ if ($action == '') {
}
if ($add) {
eval("echo \"" . getTemplate("templates/templates_add_1") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/templates_add_1") . "\";");
} else {
standard_error('alltemplatesdefined');
\Froxlor\UI\Response::standard_error('alltemplatesdefined');
}
} else {
@@ -361,7 +361,7 @@ if ($action == '') {
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid']));
if (Database::num_rows() == count($file_templates)) {
standard_error('alltemplatesdefined');
\Froxlor\UI\Response::standard_error('alltemplatesdefined');
} else {
@@ -377,12 +377,12 @@ if ($action == '') {
}
$filetemplate_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/templates/formfield.filetemplate_add.php';
$filetemplate_add_form = htmlform::genHTMLForm($filetemplate_add_data);
$filetemplate_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($filetemplate_add_data);
$title = $filetemplate_add_data['filetemplate_add']['title'];
$image = $filetemplate_add_data['filetemplate_add']['image'];
eval("echo \"" . getTemplate("templates/filetemplates_add") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/filetemplates_add") . "\";");
}
}
@@ -425,7 +425,7 @@ if ($action == '') {
));
$log->logAction(ADM_ACTION, LOG_INFO, "edited template '" . $result['varname'] . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
} else {
@@ -448,12 +448,12 @@ if ($action == '') {
$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);
$template_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($template_edit_data);
$title = $template_edit_data['template_edit']['title'];
$image = $template_edit_data['template_edit']['image'];
eval("echo \"" . getTemplate("templates/templates_edit") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/templates_edit") . "\";");
}
}
@@ -488,21 +488,21 @@ if ($action == '') {
));
$log->logAction(ADM_ACTION, LOG_INFO, "edited template '" . $row['varname'] . "'");
redirectTo($filename, array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
} else {
$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);
$filetemplate_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($filetemplate_edit_data);
$title = $filetemplate_edit_data['filetemplate_edit']['title'];
$image = $filetemplate_edit_data['filetemplate_edit']['image'];
eval("echo \"" . getTemplate("templates/filetemplates_edit") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("templates/filetemplates_edit") . "\";");
}
} else {
standard_error('templatenotfound');
\Froxlor\UI\Response::standard_error('templatenotfound');
}
}

View File

@@ -117,7 +117,7 @@ if ($page == 'overview' || $page == 'customers') {
$virtual_host[$months[(int)$traffic_month['month']]] = \Froxlor\PhpHelper::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") . "\");");
eval("\$domain_list .= sprintf(\"%s\", \"" . \Froxlor\UI\Template::getTemplate("traffic/index_table_row") . "\");");
}
// sum up totals
$virtual_host = array(
@@ -127,8 +127,8 @@ if ($page == 'overview' || $page == 'customers') {
$virtual_host[$month] = ($bytes == 0 ? '-' : \Froxlor\PhpHelper::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("\$total_list = sprintf(\"%s\", \"" . \Froxlor\UI\Template::getTemplate("traffic/index_table_row") . "\");");
eval("\$stats_tables .= sprintf(\"%s\", \"" . \Froxlor\UI\Template::getTemplate("traffic/index_table") . "\");");
}
eval("echo \"" . getTemplate("traffic/index") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("traffic/index") . "\";");
}

View File

@@ -69,12 +69,12 @@ if ($page == 'overview') {
&& intval($_POST['update_changesagreed']) != 0)
|| !isset($_POST['update_preconfig'])
) {
eval("echo \"" . getTemplate('update/update_start') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/update_start') . "\";");
include_once './install/updatesql.php';
$redirect_url = 'admin_index.php?s=' . $s;
eval("echo \"" . getTemplate('update/update_end') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/update_end') . "\";");
updateCounters();
\Froxlor\System\Cronjob::inserttask('1');
@@ -114,11 +114,11 @@ if ($page == 'overview') {
$update_information .= $lng['update']['update_information']['part_b'];
eval("echo \"" . getTemplate('update/index') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/index') . "\";");
}
} else {
$success_message = $lng['update']['noupdatesavail'];
$redirect_url = 'admin_index.php?s=' . $s;
eval("echo \"" . getTemplate('update/noupdatesavail') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/noupdatesavail') . "\";");
}
}

View File

@@ -157,7 +157,7 @@ if (AREA == 'admin' && $userinfo['customers_see_all'] == '0') {
);
}
$paging = new paging($userinfo, TABLE_API_KEYS, $fields);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_API_KEYS, $fields);
$keys_stmt_query .= $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit();
$keys_stmt = Database::prepare($keys_stmt_query);
@@ -171,7 +171,7 @@ if (count($all_keys) == 0) {
$sortcode = "";
$searchcode = "";
$pagingcode = "";
eval("\$apikeys.=\"" . getTemplate("api_keys/keys_error", true) . "\";");
eval("\$apikeys.=\"" . \Froxlor\UI\Template::getTemplate("api_keys/keys_error", true) . "\";");
} else {
$count = count($all_keys);
$paging->setEntries($count);
@@ -226,10 +226,10 @@ if (count($all_keys) == 0) {
// infinity
$row['valid_until'] = "";
}
eval("\$apikeys.=\"" . getTemplate("api_keys/keys_key", true) . "\";");
eval("\$apikeys.=\"" . \Froxlor\UI\Template::getTemplate("api_keys/keys_key", true) . "\";");
} else {
continue;
}
}
}
eval("echo \"" . getTemplate("api_keys/keys_list", true) . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("api_keys/keys_list", true) . "\";");

View File

@@ -27,7 +27,7 @@ use Froxlor\Api\Commands\Certificates as Certificates;
// redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','domains')) {
redirectTo('customer_index.php');
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
if (isset($_POST['id'])) {
@@ -38,14 +38,14 @@ if (isset($_POST['id'])) {
if ($page == 'overview') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_domains");
eval("echo \"" . getTemplate("domains/domains") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("domains/domains") . "\";");
} elseif ($page == 'domains') {
if ($action == '') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_domains::domains");
$fields = array(
'd.domain' => $lng['domains']['domainname']
);
$paging = new paging($userinfo, TABLE_PANEL_DOMAINS, $fields);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_DOMAINS, $fields);
$domains_stmt = Database::prepare("SELECT `d`.`id`, `d`.`customerid`, `d`.`domain`, `d`.`documentroot`, `d`.`isbinddomain`, `d`.`isemaildomain`, `d`.`caneditdomain`, `d`.`iswildcarddomain`, `d`.`parentdomainid`, `d`.`letsencrypt`, `d`.`registration_date`, `d`.`termination_date`, `ad`.`id` AS `aliasdomainid`, `ad`.`domain` AS `aliasdomain`, `da`.`id` AS `domainaliasid`, `da`.`domain` AS `domainalias` FROM `" . TABLE_PANEL_DOMAINS . "` `d`
LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `ad` ON `d`.`aliasdomain`=`ad`.`id`
LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `da` ON `da`.`aliasdomain`=`d`.`id`
@@ -152,7 +152,7 @@ if ($page == 'overview') {
} else {
$statsapp = 'webalizer';
}
eval("\$domains.=\"" . getTemplate("domains/domains_delimiter") . "\";");
eval("\$domains.=\"" . \Froxlor\UI\Template::getTemplate("domains/domains_delimiter") . "\";");
}
if ($paging->sortfield == 'd.domain' && $paging->sortorder == 'asc') {
@@ -172,21 +172,21 @@ if ($page == 'overview') {
$show_ssledit = true;
}
$row = htmlentities_array($row);
eval("\$domains.=\"" . getTemplate("domains/domains_domain") . "\";");
eval("\$domains.=\"" . \Froxlor\UI\Template::getTemplate("domains/domains_domain") . "\";");
}
}
$i+= count($domain_array);
}
eval("echo \"" . getTemplate("domains/domainlist") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("domains/domainlist") . "\";");
} elseif ($action == 'delete' && $id != 0) {
try {
$json_result = SubDomains::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -198,14 +198,14 @@ if ($page == 'overview') {
try {
SubDomains::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
} else {
ask_yesno('domains_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $idna_convert->decode($result['domain']));
}
} else {
standard_error('domains_cantdeletemaindomain');
\Froxlor\UI\Response::standard_error('domains_cantdeletemaindomain');
}
} elseif ($action == 'add') {
if ($userinfo['subdomains_used'] < $userinfo['subdomains'] || $userinfo['subdomains'] == '-1') {
@@ -213,9 +213,9 @@ if ($page == 'overview') {
try {
SubDomains::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
} else {
$stmt = Database::prepare("SELECT `id`, `domain`, `documentroot`, `ssl_redirect`,`isemaildomain`,`letsencrypt` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `customerid` = :customerid
@@ -294,12 +294,12 @@ if ($page == 'overview') {
}
$subdomain_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/domains/formfield.domains_add.php';
$subdomain_add_form = htmlform::genHTMLForm($subdomain_add_data);
$subdomain_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($subdomain_add_data);
$title = $subdomain_add_data['domain_add']['title'];
$image = $subdomain_add_data['domain_add']['image'];
eval("echo \"" . getTemplate("domains/domains_add") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("domains/domains_add") . "\";");
}
}
} elseif ($action == 'edit' && $id != 0) {
@@ -309,7 +309,7 @@ if ($page == 'overview') {
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -318,9 +318,9 @@ if ($page == 'overview') {
try {
SubDomains::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
} else {
$result['domain'] = $idna_convert->decode($result['domain']);
@@ -437,15 +437,15 @@ if ($page == 'overview') {
$result = htmlentities_array($result);
$subdomain_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/domains/formfield.domains_edit.php';
$subdomain_edit_form = htmlform::genHTMLForm($subdomain_edit_data);
$subdomain_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($subdomain_edit_data);
$title = $subdomain_edit_data['domain_edit']['title'];
$image = $subdomain_edit_data['domain_edit']['image'];
eval("echo \"" . getTemplate("domains/domains_edit") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("domains/domains_edit") . "\";");
}
} else {
standard_error('domains_canteditdomain');
\Froxlor\UI\Response::standard_error('domains_canteditdomain');
}
}
} elseif ($page == 'domainssleditor') {
@@ -460,10 +460,10 @@ if ($page == 'overview') {
Certificates::getLocal($userinfo, $_POST)->update();
}
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
// back to domain overview
redirectTo($filename, array('page' => 'domains', 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => 'domains', 's' => $s));
}
$stmt = Database::prepare("SELECT * FROM `".TABLE_PANEL_DOMAIN_SSL_SETTINGS."`
@@ -486,12 +486,12 @@ if ($page == 'overview') {
$result = htmlentities_array($result);
$ssleditor_data = include_once dirname(__FILE__).'/lib/formfields/customer/domains/formfield.domain_ssleditor.php';
$ssleditor_form = htmlform::genHTMLForm($ssleditor_data);
$ssleditor_form = \Froxlor\UI\HtmlForm::genHTMLForm($ssleditor_data);
$title = $ssleditor_data['domain_ssleditor']['title'];
$image = $ssleditor_data['domain_ssleditor']['image'];
eval("echo \"" . getTemplate("domains/domain_ssleditor") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("domains/domain_ssleditor") . "\";");
}
} elseif ($page == 'domaindnseditor' && $userinfo['dnsenabled'] == '1' && Settings::Get('system.dnsenabled') == '1') {

View File

@@ -28,7 +28,7 @@ use Froxlor\Api\Commands\EmailForwarders as EmailForwarders;
// redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','email')) {
redirectTo('customer_index.php');
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
if (isset($_POST['id'])) {
@@ -39,7 +39,7 @@ if (isset($_POST['id'])) {
if ($page == 'overview') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_email");
eval("echo \"" . getTemplate("email/email") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("email/email") . "\";");
} elseif ($page == 'emails') {
if ($action == '') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_email::emails");
@@ -48,7 +48,7 @@ if ($page == 'overview') {
'm.email_full' => $lng['emails']['emailaddress'],
'm.destination' => $lng['emails']['forwarders']
);
$paging = new paging($userinfo, TABLE_MAIL_VIRTUAL, $fields);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_MAIL_VIRTUAL, $fields);
$result_stmt = Database::prepare('SELECT `m`.`id`, `m`.`domainid`, `m`.`email`, `m`.`email_full`, `m`.`iscatchall`, `u`.`quota`, `m`.`destination`, `m`.`popaccountid`, `d`.`domain`, `u`.`mboxsize` FROM `' . TABLE_MAIL_VIRTUAL . '` `m`
LEFT JOIN `' . TABLE_PANEL_DOMAINS . '` `d` ON (`m`.`domainid` = `d`.`id`)
LEFT JOIN `' . TABLE_MAIL_USERS . '` `u` ON (`m`.`popaccountid` = `u`.`id`)
@@ -93,7 +93,7 @@ if ($page == 'overview') {
if ($paging->checkDisplay($i)) {
if ($domainname != $idna_convert->decode($row['domain'])) {
$domainname = $idna_convert->decode($row['domain']);
eval("\$accounts.=\"" . getTemplate("email/emails_domain") . "\";");
eval("\$accounts.=\"" . \Froxlor\UI\Template::getTemplate("email/emails_domain") . "\";");
}
$emails_count++;
@@ -121,7 +121,7 @@ if ($page == 'overview') {
$row['mboxsize'] = \Froxlor\PhpHelper::size_readable($row['mboxsize'], 'GiB', 'bi', '%01.' . (int)Settings::Get('panel.decimal_places') . 'f %s');
$row = htmlentities_array($row);
eval("\$accounts.=\"" . getTemplate("email/emails_email") . "\";");
eval("\$accounts.=\"" . \Froxlor\UI\Template::getTemplate("email/emails_email") . "\";");
$count++;
}
@@ -137,14 +137,14 @@ if ($page == 'overview') {
$emaildomains_count = $emaildomains_count_stmt->fetch(PDO::FETCH_ASSOC);
$emaildomains_count = $emaildomains_count['count'];
eval("echo \"" . getTemplate("email/emails") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("email/emails") . "\";");
} elseif ($action == 'delete' && $id != 0) {
try {
$json_result = Emails::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -155,9 +155,9 @@ if ($page == 'overview') {
'id' => $id
))->delete();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
} else {
if ($result['popaccountid'] != '0') {
$show_checkbox = true;
@@ -173,10 +173,10 @@ if ($page == 'overview') {
try {
$json_result = Emails::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
redirectTo($filename, array('page' => $page, 'action' => 'edit', 'id' => $result['id'], 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 'action' => 'edit', 'id' => $result['id'], 's' => $s));
} else {
$result_stmt = Database::prepare("SELECT `id`, `domain`, `customerid` FROM `" . TABLE_PANEL_DOMAINS . "`
WHERE `customerid`= :cid
@@ -198,15 +198,15 @@ if ($page == 'overview') {
unset($email_add_data['emails_add']['sections']['section_a']['fields']['iscatchall']);
}
$email_add_form = htmlform::genHTMLForm($email_add_data);
$email_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($email_add_data);
$title = $email_add_data['emails_add']['title'];
$image = $email_add_data['emails_add']['image'];
eval("echo \"" . getTemplate("email/emails_add") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("email/emails_add") . "\";");
}
} else {
standard_error('allresourcesused');
\Froxlor\UI\Response::standard_error('allresourcesused');
}
} elseif ($action == 'edit' && $id != 0) {
try {
@@ -214,7 +214,7 @@ if ($page == 'overview') {
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -230,7 +230,7 @@ if ($page == 'overview') {
$destination = $idna_convert->decode($destination);
if ($destination != $result['email_full'] && $destination != '') {
eval("\$forwarders.=\"" . getTemplate("email/emails_edit_forwarder") . "\";");
eval("\$forwarders.=\"" . \Froxlor\UI\Template::getTemplate("email/emails_edit_forwarder") . "\";");
$forwarders_count++;
}
@@ -246,12 +246,12 @@ if ($page == 'overview') {
unset($email_edit_data['emails_edit']['sections']['section_a']['fields']['mail_catchall']);
}
$email_edit_form = htmlform::genHTMLForm($email_edit_data);
$email_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($email_edit_data);
$title = $email_edit_data['emails_edit']['title'];
$image = $email_edit_data['emails_edit']['image'];
eval("echo \"" . getTemplate("email/emails_edit") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("email/emails_edit") . "\";");
}
} elseif ($action == 'togglecatchall' && $id != 0) {
try {
@@ -259,7 +259,7 @@ if ($page == 'overview') {
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -269,9 +269,9 @@ if ($page == 'overview') {
'iscatchall' => ($result['iscatchall'] == '1' ? 0 : 1)
))->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array('page' => $page, 'action' => 'edit', 'id' => $id, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 'action' => 'edit', 'id' => $id, 's' => $s));
}
} elseif ($page == 'accounts') {
if ($action == 'add' && $id != 0) {
@@ -281,7 +281,7 @@ if ($page == 'overview') {
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -289,13 +289,13 @@ if ($page == 'overview') {
try {
EmailAccounts::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
} else {
if (\Froxlor\Validate\Validate::checkMailAccDeletionState($result['email_full'])) {
standard_error(array('mailaccistobedeleted'), $result['email_full']);
if (\Froxlor\Validate\Check::checkMailAccDeletionState($result['email_full'])) {
\Froxlor\UI\Response::standard_error(array('mailaccistobedeleted'), $result['email_full']);
}
$result['email_full'] = $idna_convert->decode($result['email_full']);
@@ -303,21 +303,21 @@ if ($page == 'overview') {
$quota = Settings::Get('system.mail_quota');
$account_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_addaccount.php';
$account_add_form = htmlform::genHTMLForm($account_add_data);
$account_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($account_add_data);
$title = $account_add_data['emails_addaccount']['title'];
$image = $account_add_data['emails_addaccount']['image'];
eval("echo \"" . getTemplate("email/account_add") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("email/account_add") . "\";");
}
} else {
standard_error(array('allresourcesused', 'allocatetoomuchquota'), $quota);
\Froxlor\UI\Response::standard_error(array('allresourcesused', 'allocatetoomuchquota'), $quota);
}
} elseif ($action == 'changepw' && $id != 0) {
try {
$json_result = Emails::getLocal($userinfo, array('id' => $id))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -326,27 +326,27 @@ if ($page == 'overview') {
try {
EmailAccounts::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
} else {
$result['email_full'] = $idna_convert->decode($result['email_full']);
$result = htmlentities_array($result);
$account_changepw_data = include_once dirname(__FILE__).'/lib/formfields/customer/email/formfield.emails_accountchangepasswd.php';
$account_changepw_form = htmlform::genHTMLForm($account_changepw_data);
$account_changepw_form = \Froxlor\UI\HtmlForm::genHTMLForm($account_changepw_data);
$title = $account_changepw_data['emails_accountchangepasswd']['title'];
$image = $account_changepw_data['emails_accountchangepasswd']['image'];
eval("echo \"" . getTemplate("email/account_changepw") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("email/account_changepw") . "\";");
}
}
} elseif ($action == 'changequota' && Settings::Get('system.mail_quota_enabled') == '1' && $id != 0) {
try {
$json_result = Emails::getLocal($userinfo, array('id' => $id))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -355,27 +355,27 @@ if ($page == 'overview') {
try {
EmailAccounts::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
} else {
$result['email_full'] = $idna_convert->decode($result['email_full']);
$result = htmlentities_array($result);
$quota_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/email/formfield.emails_accountchangequota.php';
$quota_edit_form = htmlform::genHTMLForm($quota_edit_data);
$quota_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($quota_edit_data);
$title = $quota_edit_data['emails_accountchangequota']['title'];
$image = $quota_edit_data['emails_accountchangequota']['image'];
eval("echo \"" . getTemplate("email/account_changequota") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("email/account_changequota") . "\";");
}
}
} elseif ($action == 'delete' && $id != 0) {
try {
$json_result = Emails::getLocal($userinfo, array('id' => $id))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -384,9 +384,9 @@ if ($page == 'overview') {
try {
EmailAccounts::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
} else {
ask_yesno_withcheckbox('email_reallydelete_account', 'admin_customer_alsoremovemail', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $idna_convert->decode($result['email_full']));
}
@@ -398,7 +398,7 @@ if ($page == 'overview') {
try {
$json_result = Emails::getLocal($userinfo, array('id' => $id))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -407,30 +407,30 @@ if ($page == 'overview') {
try {
EmailForwarders::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
} else {
$result['email_full'] = $idna_convert->decode($result['email_full']);
$result = htmlentities_array($result);
$forwarder_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/email/formfield.emails_addforwarder.php';
$forwarder_add_form = htmlform::genHTMLForm($forwarder_add_data);
$forwarder_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($forwarder_add_data);
$title = $forwarder_add_data['emails_addforwarder']['title'];
$image = $forwarder_add_data['emails_addforwarder']['image'];
eval("echo \"" . getTemplate("email/forwarder_add") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("email/forwarder_add") . "\";");
}
}
} else {
standard_error('allresourcesused');
\Froxlor\UI\Response::standard_error('allresourcesused');
}
} elseif ($action == 'delete' && $id != 0) {
try {
$json_result = Emails::getLocal($userinfo, array('id' => $id))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -452,9 +452,9 @@ if ($page == 'overview') {
try {
EmailForwarders::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => 'emails', 'action' => 'edit', 'id' => $id, 's' => $s));
} else {
ask_yesno('email_reallydelete_forwarder', $filename, array('id' => $id, 'forwarderid' => $forwarderid, 'page' => $page, 'action' => $action), $idna_convert->decode($result['email_full']) . ' -> ' . $idna_convert->decode($forwarder));
}

View File

@@ -27,7 +27,7 @@ use Froxlor\Api\Commands\CustomerBackups as CustomerBackups;
// redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options', 'extras')) {
redirectTo('customer_index.php');
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
if (isset($_POST['id'])) {
@@ -38,12 +38,12 @@ if (isset($_POST['id'])) {
if ($page == 'overview') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras");
eval("echo \"" . getTemplate("extras/extras") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/extras") . "\";");
} elseif ($page == 'htpasswds') {
// redirect if this customer sub-page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options', 'extras.directoryprotection')) {
redirectTo('customer_index.php');
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
if ($action == '') {
@@ -52,7 +52,7 @@ if ($page == 'overview') {
'username' => $lng['login']['username'],
'path' => $lng['panel']['path']
);
$paging = new paging($userinfo, TABLE_PANEL_HTPASSWDS, $fields);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_HTPASSWDS, $fields);
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "`
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
Database::pexecute($result_stmt, array(
@@ -74,21 +74,21 @@ if ($page == 'overview') {
}
$row['path'] = \Froxlor\FileDir::makeCorrectDir($row['path']);
$row = htmlentities_array($row);
eval("\$htpasswds.=\"" . getTemplate("extras/htpasswds_htpasswd") . "\";");
eval("\$htpasswds.=\"" . \Froxlor\UI\Template::getTemplate("extras/htpasswds_htpasswd") . "\";");
$count ++;
}
$i ++;
}
eval("echo \"" . getTemplate("extras/htpasswds") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htpasswds") . "\";");
} elseif ($action == 'delete' && $id != 0) {
try {
$json_result = DirProtections::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -97,9 +97,9 @@ if ($page == 'overview') {
try {
DirProtections::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -120,9 +120,9 @@ if ($page == 'overview') {
try {
DirProtections::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -130,12 +130,12 @@ if ($page == 'overview') {
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
$htpasswd_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htpasswd_add.php';
$htpasswd_add_form = htmlform::genHTMLForm($htpasswd_add_data);
$htpasswd_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($htpasswd_add_data);
$title = $htpasswd_add_data['htpasswd_add']['title'];
$image = $htpasswd_add_data['htpasswd_add']['image'];
eval("echo \"" . getTemplate("extras/htpasswds_add") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htpasswds_add") . "\";");
}
} elseif ($action == 'edit' && $id != 0) {
try {
@@ -143,7 +143,7 @@ if ($page == 'overview') {
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -152,9 +152,9 @@ if ($page == 'overview') {
try {
DirProtections::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -166,12 +166,12 @@ if ($page == 'overview') {
$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);
$htpasswd_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($htpasswd_edit_data);
$title = $htpasswd_edit_data['htpasswd_edit']['title'];
$image = $htpasswd_edit_data['htpasswd_edit']['image'];
eval("echo \"" . getTemplate("extras/htpasswds_edit") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htpasswds_edit") . "\";");
}
}
}
@@ -179,7 +179,7 @@ if ($page == 'overview') {
// redirect if this customer sub-page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options', 'extras.pathoptions')) {
redirectTo('customer_index.php');
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
if ($action == '') {
@@ -192,7 +192,7 @@ if ($page == 'overview') {
'error500path' => $lng['extras']['error500path'],
'options_cgi' => $lng['extras']['execute_perl']
);
$paging = new paging($userinfo, TABLE_PANEL_HTACCESS, $fields);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_HTACCESS, $fields);
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "`
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
Database::pexecute($result_stmt, array(
@@ -220,21 +220,21 @@ if ($page == 'overview') {
$row['options_cgi'] = str_replace('1', $lng['panel']['yes'], $row['options_cgi']);
$row['options_cgi'] = str_replace('0', $lng['panel']['no'], $row['options_cgi']);
$row = htmlentities_array($row);
eval("\$htaccess.=\"" . getTemplate("extras/htaccess_htaccess") . "\";");
eval("\$htaccess.=\"" . \Froxlor\UI\Template::getTemplate("extras/htaccess_htaccess") . "\";");
$count ++;
}
$i ++;
}
eval("echo \"" . getTemplate("extras/htaccess") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htaccess") . "\";");
} elseif ($action == 'delete' && $id != 0) {
try {
$json_result = DirOptions::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -243,9 +243,9 @@ if ($page == 'overview') {
try {
DirOptions::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -262,9 +262,9 @@ if ($page == 'overview') {
try {
DirOptions::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -273,12 +273,12 @@ if ($page == 'overview') {
$cperlenabled = customerHasPerlEnabled($userinfo['customerid']);
$htaccess_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htaccess_add.php';
$htaccess_add_form = htmlform::genHTMLForm($htaccess_add_data);
$htaccess_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($htaccess_add_data);
$title = $htaccess_add_data['htaccess_add']['title'];
$image = $htaccess_add_data['htaccess_add']['image'];
eval("echo \"" . getTemplate("extras/htaccess_add") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htaccess_add") . "\";");
}
} elseif (($action == 'edit') && ($id != 0)) {
try {
@@ -286,7 +286,7 @@ if ($page == 'overview') {
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -295,9 +295,9 @@ if ($page == 'overview') {
try {
DirOptions::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
's' => $s
));
@@ -317,12 +317,12 @@ if ($page == 'overview') {
$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);
$htaccess_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($htaccess_edit_data);
$title = $htaccess_edit_data['htaccess_edit']['title'];
$image = $htaccess_edit_data['htaccess_edit']['image'];
eval("echo \"" . getTemplate("extras/htaccess_edit") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htaccess_edit") . "\";");
}
}
}
@@ -330,7 +330,7 @@ if ($page == 'overview') {
// redirect if this customer sub-page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options', 'extras.backup')) {
redirectTo('customer_index.php');
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
if (Settings::Get('system.backupenabled') == 1) {
@@ -339,10 +339,10 @@ if ($page == 'overview') {
try {
CustomerBackups::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
standard_success('backupaborted');
redirectTo($filename, array(
\Froxlor\UI\Response::standard_success('backupaborted');
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => $page,
'action' => '',
's' => $s
@@ -355,7 +355,7 @@ if ($page == 'overview') {
try {
$json_result = CustomerBackups::getLocal($userinfo)->listing();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
$existing_backupJob = null;
@@ -367,9 +367,9 @@ if ($page == 'overview') {
try {
CustomerBackups::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
standard_success('backupscheduled');
\Froxlor\UI\Response::standard_success('backupscheduled');
} else {
if (! empty($existing_backupJob)) {
@@ -383,18 +383,18 @@ if ($page == 'overview') {
}
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
$backup_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.backup.php';
$backup_form = htmlform::genHTMLForm($backup_data);
$backup_form = \Froxlor\UI\HtmlForm::genHTMLForm($backup_data);
$title = $backup_data['backup']['title'];
$image = $backup_data['backup']['image'];
if (! empty($existing_backupJob)) {
// overwrite backup_form after we took everything from it we needed
eval("\$backup_form = \"" . getTemplate("extras/backup_listexisting") . "\";");
eval("\$backup_form = \"" . \Froxlor\UI\Template::getTemplate("extras/backup_listexisting") . "\";");
}
eval("echo \"" . getTemplate("extras/backup") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/backup") . "\";");
}
}
} else {
standard_error('backupfunctionnotenabled');
\Froxlor\UI\Response::standard_error('backupfunctionnotenabled');
}
}

View File

@@ -26,7 +26,7 @@ use Froxlor\Api\Commands\Ftps as Ftps;
// redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','ftp')) {
redirectTo('customer_index.php');
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
$id = 0;
@@ -38,7 +38,7 @@ if (isset($_POST['id'])) {
if ($page == 'overview') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_ftp");
eval("echo \"" . getTemplate('ftp/ftp') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/ftp') . "\";");
} elseif ($page == 'accounts') {
if ($action == '') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_ftp::accounts");
@@ -47,7 +47,7 @@ if ($page == 'overview') {
'homedir' => $lng['panel']['path'],
'description' => $lng['panel']['ftpdesc']
);
$paging = new paging($userinfo, TABLE_FTP_USERS, $fields);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_FTP_USERS, $fields);
$result_stmt = Database::prepare("SELECT `id`, `username`, `description`, `homedir`, `shell` FROM `" . TABLE_FTP_USERS . "`
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()
@@ -74,21 +74,21 @@ if ($page == 'overview') {
$row['documentroot'] = \Froxlor\FileDir::makeCorrectDir($row['documentroot']);
$row = htmlentities_array($row);
eval("\$accounts.=\"" . getTemplate('ftp/accounts_account') . "\";");
eval("\$accounts.=\"" . \Froxlor\UI\Template::getTemplate('ftp/accounts_account') . "\";");
$count++;
}
$i++;
}
eval("echo \"" . getTemplate('ftp/accounts') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/accounts') . "\";");
} elseif ($action == 'delete' && $id != 0) {
try {
$json_result = Ftps::getLocal($userinfo, array(
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -97,14 +97,14 @@ if ($page == 'overview') {
try {
Ftps::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
} else {
ask_yesno_withcheckbox('ftp_reallydelete', 'admin_customer_alsoremoveftphomedir', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['username']);
}
} else {
standard_error('ftp_cantdeletemainaccount');
\Froxlor\UI\Response::standard_error('ftp_cantdeletemainaccount');
}
} elseif ($action == 'add') {
if ($userinfo['ftps_used'] < $userinfo['ftps'] || $userinfo['ftps'] == '-1') {
@@ -112,9 +112,9 @@ if ($page == 'overview') {
try {
Ftps::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
} else {
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], '/');
@@ -155,12 +155,12 @@ if ($page == 'overview') {
//$sendinfomail = makeyesno('sendinfomail', '1', '0', '0');
$ftp_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/ftp/formfield.ftp_add.php';
$ftp_add_form = htmlform::genHTMLForm($ftp_add_data);
$ftp_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($ftp_add_data);
$title = $ftp_add_data['ftp_add']['title'];
$image = $ftp_add_data['ftp_add']['image'];
eval("echo \"" . getTemplate('ftp/accounts_add') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/accounts_add') . "\";");
}
}
} elseif ($action == 'edit' && $id != 0) {
@@ -169,7 +169,7 @@ if ($page == 'overview') {
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -178,9 +178,9 @@ if ($page == 'overview') {
try {
Ftps::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
} else {
if (strpos($result['homedir'], $userinfo['documentroot']) === 0) {
$homedir = str_replace($userinfo['documentroot'], "/", $result['homedir']);
@@ -217,12 +217,12 @@ if ($page == 'overview') {
}
$ftp_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/ftp/formfield.ftp_edit.php';
$ftp_edit_form = htmlform::genHTMLForm($ftp_edit_data);
$ftp_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($ftp_edit_data);
$title = $ftp_edit_data['ftp_edit']['title'];
$image = $ftp_edit_data['ftp_edit']['image'];
eval("echo \"" . getTemplate('ftp/accounts_edit') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/accounts_edit') . "\";");
}
}
}

View File

@@ -43,7 +43,7 @@ if ($action == 'logout') {
}
Database::pexecute($stmt, $params);
redirectTo('index.php');
\Froxlor\UI\Response::redirectTo('index.php');
}
if ($page == 'overview') {
@@ -105,31 +105,31 @@ if ($page == 'overview') {
if ($userinfo['perlenabled'] == '1') $se[] = "Perl/CGI";
$services_enabled = implode(", ", $se);
eval("echo \"" . getTemplate('index/index') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/index') . "\";");
} elseif ($page == 'change_password') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
$old_password = validate($_POST['old_password'], 'old password');
if (!validatePasswordLogin($userinfo,$old_password,TABLE_PANEL_CUSTOMERS,'customerid')) {
standard_error('oldpasswordnotcorrect');
\Froxlor\UI\Response::standard_error('oldpasswordnotcorrect');
}
$new_password = validatePassword($_POST['new_password'], 'new password');
$new_password_confirm = validatePassword($_POST['new_password_confirm'], 'new password confirm');
if ($old_password == '') {
standard_error(array('stringisempty', 'oldpassword'));
\Froxlor\UI\Response::standard_error(array('stringisempty', 'oldpassword'));
} elseif ($new_password == '') {
standard_error(array('stringisempty', 'newpassword'));
\Froxlor\UI\Response::standard_error(array('stringisempty', 'newpassword'));
} elseif ($new_password_confirm == '') {
standard_error(array('stringisempty', 'newpasswordconfirm'));
\Froxlor\UI\Response::standard_error(array('stringisempty', 'newpasswordconfirm'));
} elseif ($new_password != $new_password_confirm) {
standard_error('newpasswordconfirmerror');
\Froxlor\UI\Response::standard_error('newpasswordconfirmerror');
} else {
// Update user password
try {
Customers::getLocal($userinfo, array('id' => $userinfo['customerid'], 'new_customer_password' => $new_password))->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$log->logAction(USR_ACTION, LOG_NOTICE, 'changed password');
@@ -172,10 +172,10 @@ if ($page == 'overview') {
Database::pexecute($stmt, $params);
}
redirectTo($filename, array('s' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('s' => $s));
}
} else {
eval("echo \"" . getTemplate('index/change_password') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/change_password') . "\";");
}
} elseif ($page == 'change_language') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
@@ -184,7 +184,7 @@ if ($page == 'overview') {
try {
Customers::getLocal($userinfo, array('id' => $userinfo['customerid'], 'def_language' => $def_language))->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
// also update current session
@@ -195,7 +195,7 @@ if ($page == 'overview') {
Database::pexecute($stmt, array("lang" => $def_language, "hash" => $s));
}
$log->logAction(USR_ACTION, LOG_NOTICE, "changed default language to '" . $def_language . "'");
redirectTo($filename, array('s' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('s' => $s));
} else {
$default_lang = Settings::Get('panel.standardlanguage');
if ($userinfo['def_language'] != '') {
@@ -207,7 +207,7 @@ if ($page == 'overview') {
$language_options .= makeoption($language_name, $language_file, $default_lang, true);
}
eval("echo \"" . getTemplate('index/change_language') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/change_language') . "\";");
}
} elseif ($page == 'change_theme') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
@@ -215,7 +215,7 @@ if ($page == 'overview') {
try {
Customers::getLocal($userinfo, array('id' => $userinfo['customerid'], 'theme' => $theme))->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
// also update current session
@@ -226,7 +226,7 @@ if ($page == 'overview') {
Database::pexecute($stmt, array("theme" => $theme, "hash" => $s));
$log->logAction(USR_ACTION, LOG_NOTICE, "changed default theme to '" . $theme . "'");
redirectTo($filename, array('s' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('s' => $s));
} else {
$default_theme = Settings::Get('panel.default_theme');
if ($userinfo['theme'] != '') {
@@ -239,7 +239,7 @@ if ($page == 'overview') {
$theme_options.= makeoption($d, $t, $default_theme, true);
}
eval("echo \"" . getTemplate('index/change_theme') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/change_theme') . "\";");
}
} elseif ($page == 'send_error_report' && Settings::Get('system.allow_error_report_customer') == '1') {
@@ -300,22 +300,22 @@ if ($page == 'overview') {
if ($_mailerror) {
// error when reporting an error...LOLFUQ
standard_error('send_report_error', $mailerr_msg);
\Froxlor\UI\Response::standard_error('send_report_error', $mailerr_msg);
}
// finally remove error from fs
@unlink($err_file);
redirectTo($filename, array('s' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('s' => $s));
}
// show a nice summary of the error-report
// before actually sending anything
eval("echo \"" . getTemplate("index/send_error_report") . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("index/send_error_report") . "\";");
} else {
redirectTo($filename, array('s' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('s' => $s));
}
} else {
redirectTo($filename, array('s' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('s' => $s));
}
}
elseif ($page == 'apikeys' && Settings::Get('api.enabled') == 1) {

View File

@@ -24,7 +24,7 @@ use Froxlor\Settings;
// redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options', 'extras.logger')) {
redirectTo('customer_index.php');
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
if ($page == 'log') {
@@ -35,7 +35,7 @@ if ($page == 'log') {
'user' => $lng['logger']['user'],
'text' => $lng['logger']['action']
);
$paging = new paging($userinfo, TABLE_PANEL_LOG, $fields, null, null, 0, 'desc', 30);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_LOG, $fields, null, null, 0, 'desc', 30);
$query = 'SELECT * FROM `' . TABLE_PANEL_LOG . '` WHERE `user` = :loginname ' . $paging->getSqlWhere(true) . ' ' . $paging->getSqlOrderBy();
$result_stmt = Database::prepare($query . ' ' . $paging->getSqlLimit());
Database::pexecute($result_stmt, array(
@@ -105,12 +105,12 @@ if ($page == 'log') {
}
$row['action'] = $_action;
eval("\$log.=\"" . getTemplate('logger/logger_action') . "\";");
eval("\$log.=\"" . \Froxlor\UI\Template::getTemplate('logger/logger_action') . "\";");
}
$log_count ++;
$row['type'] = getLogLevelDesc($row['type']);
eval("\$log.=\"" . getTemplate('logger/logger_log') . "\";");
eval("\$log.=\"" . \Froxlor\UI\Template::getTemplate('logger/logger_log') . "\";");
$count ++;
$_action = $action;
// }
@@ -119,6 +119,6 @@ if ($page == 'log') {
$i ++;
}
eval("echo \"" . getTemplate('logger/logger') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('logger/logger') . "\";");
}
}

View File

@@ -26,7 +26,7 @@ use Froxlor\Api\Commands\Mysqls as Mysqls;
// redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','mysql')) {
redirectTo('customer_index.php');
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
// get sql-root access data
@@ -46,7 +46,7 @@ if ($page == 'overview') {
Database::needSqlData();
$sql = Database::getSqlData();
$lng['mysql']['description'] = str_replace('<SQL_HOST>', $sql['host'], $lng['mysql']['description']);
eval("echo \"" . getTemplate('mysql/mysql') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('mysql/mysql') . "\";");
} elseif ($page == 'mysqls') {
if ($action == '') {
$log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_mysql::mysqls");
@@ -54,7 +54,7 @@ if ($page == 'overview') {
'databasename' => $lng['mysql']['databasename'],
'description' => $lng['mysql']['databasedescription']
);
$paging = new paging($userinfo, TABLE_PANEL_DATABASES, $fields);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_DATABASES, $fields);
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_DATABASES . "`
WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit()
);
@@ -86,7 +86,7 @@ if ($page == 'overview') {
Database::pexecute($mbdata_stmt, array("table_schema" => $row['databasename']));
$mbdata = $mbdata_stmt->fetch(PDO::FETCH_ASSOC);
$row['size'] = \Froxlor\PhpHelper::size_readable($mbdata['MB'], 'GiB', 'bi', '%01.' . (int)Settings::Get('panel.decimal_places') . 'f %s');
eval("\$mysqls.=\"" . getTemplate('mysql/mysqls_database') . "\";");
eval("\$mysqls.=\"" . \Froxlor\UI\Template::getTemplate('mysql/mysqls_database') . "\";");
$count++;
}
$i++;
@@ -94,7 +94,7 @@ if ($page == 'overview') {
Database::needRoot(false);
// End root-session
eval("echo \"" . getTemplate('mysql/mysqls') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('mysql/mysqls') . "\";");
} elseif ($action == 'delete' && $id != 0) {
@@ -103,7 +103,7 @@ if ($page == 'overview') {
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -122,9 +122,9 @@ if ($page == 'overview') {
try {
Mysqls::getLocal($userinfo, $_POST)->delete();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
} else {
$dbnamedesc = $result['databasename'];
if (isset($result['description']) && $result['description'] != '') {
@@ -139,9 +139,9 @@ if ($page == 'overview') {
try {
Mysqls::getLocal($userinfo, $_POST)->add();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
} else {
$dbservers_stmt = Database::query("SELECT DISTINCT `dbserver` FROM `".TABLE_PANEL_DATABASES."`");
@@ -157,12 +157,12 @@ if ($page == 'overview') {
Database::needRoot(false);
$mysql_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/mysql/formfield.mysql_add.php';
$mysql_add_form = htmlform::genHTMLForm($mysql_add_data);
$mysql_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($mysql_add_data);
$title = $mysql_add_data['mysql_add']['title'];
$image = $mysql_add_data['mysql_add']['image'];
eval("echo \"" . getTemplate('mysql/mysqls_add') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('mysql/mysqls_add') . "\";");
}
}
} elseif ($action == 'edit' && $id != 0) {
@@ -171,7 +171,7 @@ if ($page == 'overview') {
'id' => $id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
@@ -180,9 +180,9 @@ if ($page == 'overview') {
try {
$json_result = Mysqls::getLocal($userinfo, $_POST)->update();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
redirectTo($filename, array('page' => $page, 's' => $s));
\Froxlor\UI\Response::redirectTo($filename, array('page' => $page, 's' => $s));
} else {
$dbservers_stmt = Database::query("SELECT COUNT(DISTINCT `dbserver`) as numservers FROM `".TABLE_PANEL_DATABASES."`");
@@ -195,12 +195,12 @@ if ($page == 'overview') {
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);
$mysql_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($mysql_edit_data);
$title = $mysql_edit_data['mysql_edit']['title'];
$image = $mysql_edit_data['mysql_edit']['image'];
eval("echo \"" . getTemplate('mysql/mysqls_edit') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('mysql/mysqls_edit') . "\";");
}
}
}

View File

@@ -26,7 +26,7 @@ use Froxlor\Settings;
// redirect if this customer page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options','traffic')) {
redirectTo('customer_index.php');
\Froxlor\UI\Response::redirectTo('customer_index.php');
}
$traffic = '';
@@ -105,7 +105,7 @@ if (!is_null($month) && !is_null($year)) {
$traf['byte'] = round($traf['byte'] / 1024, Settings::Get('panel.decimal_places'));
}
eval("\$traffic.=\"" . getTemplate('traffic/traffic_month') . "\";");
eval("\$traffic.=\"" . \Froxlor\UI\Template::getTemplate('traffic/traffic_month') . "\";");
$show = $lng['traffic']['months'][intval($row['month'])] . ' ' . $row['year'];
}
@@ -113,7 +113,7 @@ if (!is_null($month) && !is_null($year)) {
$traffic_complete['ftp'] = \Froxlor\PhpHelper::size_readable($traffic_complete['ftp'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s');
$traffic_complete['mail'] = \Froxlor\PhpHelper::size_readable($traffic_complete['mail'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s');
eval("echo \"" . getTemplate('traffic/traffic_details') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('traffic/traffic_details') . "\";");
} else {
$result_stmt = Database::prepare("SELECT `month`, `year`, SUM(`http`) AS http, SUM(`ftp_up`) AS ftp_up, SUM(`ftp_down`) AS ftp_down, SUM(`mail`) AS mail
FROM `" . TABLE_PANEL_TRAFFIC . "`
@@ -157,12 +157,12 @@ if (!is_null($month) && !is_null($year)) {
$traf['byte'] = round($traf['byte'] / (1024 * 1024), Settings::Get('panel.decimal_places'));
}
eval("\$traffic.=\"" . getTemplate('traffic/traffic_traffic') . "\";");
eval("\$traffic.=\"" . \Froxlor\UI\Template::getTemplate('traffic/traffic_traffic') . "\";");
}
$traffic_complete['http'] = \Froxlor\PhpHelper::size_readable($traffic_complete['http'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s');
$traffic_complete['ftp'] = \Froxlor\PhpHelper::size_readable($traffic_complete['ftp'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s');
$traffic_complete['mail'] = \Froxlor\PhpHelper::size_readable($traffic_complete['mail'] * 1024, 'GiB', 'bi', '%01.'.(int)Settings::Get('panel.decimal_places').'f %s');
eval("echo \"" . getTemplate('traffic/traffic') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('traffic/traffic') . "\";");
}

View File

@@ -59,7 +59,7 @@ if ($action == 'add_record' && ! empty($_POST)) {
))->add();
$success_message = $lng['success']['dns_record_added'];
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
} elseif ($action == 'delete') {
// remove entry
@@ -100,7 +100,7 @@ if (! empty($dom_entries)) {
$entriescount = count($dom_entries);
foreach ($dom_entries as $entry) {
$entry['content'] = wordwrap($entry['content'], 100, '<br>', true);
eval("\$existing_entries.=\"" . getTemplate("dns_editor/entry_bit", true) . "\";");
eval("\$existing_entries.=\"" . \Froxlor\UI\Template::getTemplate("dns_editor/entry_bit", true) . "\";");
}
}
@@ -119,16 +119,16 @@ foreach ($type_select_values as $_type) {
$type_select .= makeoption($_type, $_type, $type);
}
eval("\$record_list=\"" . getTemplate("dns_editor/list", true) . "\";");
eval("\$record_list=\"" . \Froxlor\UI\Template::getTemplate("dns_editor/list", true) . "\";");
try {
$json_result = DomainZones::getLocal($userinfo, array(
'id' => $domain_id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$result = json_decode($json_result, true)['data'];
$zonefile = implode("\n", $result);
eval("echo \"" . getTemplate("dns_editor/index", true) . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("dns_editor/index", true) . "\";");

View File

@@ -35,16 +35,16 @@ if ($action == '2fa_entercode') {
// page for entering the 2FA code after successful login
if (! isset($_SESSION) || ! isset($_SESSION['secret_2fa'])) {
// no session - redirect to index
redirectTo('index.php');
\Froxlor\UI\Response::redirectTo('index.php');
exit();
}
// show template to enter code
eval("echo \"" . getTemplate('2fa/entercode', true) . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('2fa/entercode', true) . "\";");
} elseif ($action == '2fa_verify') {
// verify code from 2fa code-enter form
if (! isset($_SESSION) || ! isset($_SESSION['secret_2fa'])) {
// no session - redirect to index
redirectTo('index.php');
\Froxlor\UI\Response::redirectTo('index.php');
exit();
}
$code = isset($_POST['2fa_code']) ? $_POST['2fa_code'] : null;
@@ -74,7 +74,7 @@ if ($action == '2fa_entercode') {
$userinfo = Database::pexecute_first($sel_stmt, $sel_param);
// whoops, no (valid) user? Start again
if (empty($userinfo)) {
redirectTo('index.php', array(
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '2'
));
}
@@ -84,7 +84,7 @@ if ($action == '2fa_entercode') {
// if not successful somehow - start again
if (! finishLogin($userinfo)) {
redirectTo('index.php', array(
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '2'
));
}
@@ -98,7 +98,7 @@ if ($action == '2fa_entercode') {
}
exit();
}
redirectTo('index.php', array(
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '2'
));
exit();
@@ -154,7 +154,7 @@ if ($action == '2fa_entercode') {
}
if ((\Froxlor\Froxlor::hasUpdates() || \Froxlor\Froxlor::hasDbUpdates()) && $is_admin == false) {
redirectTo('index.php');
\Froxlor\UI\Response::redirectTo('index.php');
exit();
}
@@ -169,7 +169,7 @@ if ($action == '2fa_entercode') {
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if (! isset($row['admin'])) {
// not an admin who can see updates
redirectTo('index.php');
\Froxlor\UI\Response::redirectTo('index.php');
exit();
}
} else {
@@ -192,7 +192,7 @@ if ($action == '2fa_entercode') {
));
$rstlog->logAction(LOGIN_ACTION, LOG_WARNING, "Unknown user '" . $loginname . "' tried to login.");
redirectTo('index.php', array(
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '2'
));
exit();
@@ -207,7 +207,7 @@ if ($action == '2fa_entercode') {
$userinfo = $userinfo_stmt->fetch(PDO::FETCH_ASSOC);
if ($userinfo['loginfail_count'] >= Settings::Get('login.maxloginattempts') && $userinfo['lastlogin_fail'] > (time() - Settings::Get('login.deactivatetime'))) {
redirectTo('index.php', array(
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '3'
));
exit();
@@ -216,7 +216,7 @@ if ($action == '2fa_entercode') {
// because we don't want to publish that the user does exist
if ($userinfo['deactivated']) {
unset($userinfo);
redirectTo('index.php', array(
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '5'
));
exit();
@@ -250,7 +250,7 @@ if ($action == '2fa_entercode') {
$rstlog->logAction(LOGIN_ACTION, LOG_WARNING, "User '" . $loginname . "' tried to login with wrong password.");
unset($userinfo);
redirectTo('index.php', array(
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '2'
));
exit();
@@ -302,7 +302,7 @@ if ($action == '2fa_entercode') {
'loginname' => '2fa code-sending'
));
$rstlog->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
redirectTo('index.php', array(
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '4',
'customermail' => $userinfo['email']
));
@@ -311,14 +311,14 @@ if ($action == '2fa_entercode') {
$mail->ClearAddresses();
}
redirectTo('index.php', array(
\Froxlor\UI\Response::redirectTo('index.php', array(
'action' => '2fa_entercode'
));
exit();
}
if (! finishLogin($userinfo)) {
redirectTo('index.php', array(
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '2'
));
}
@@ -382,7 +382,7 @@ if ($action == '2fa_entercode') {
$lastqrystr = htmlspecialchars($_REQUEST['qrystr'], ENT_QUOTES);
}
eval("echo \"" . getTemplate('login') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('login') . "\";");
}
}
@@ -422,7 +422,7 @@ if ($action == 'forgotpwd') {
/* Check whether user is banned */
if ($user['deactivated']) {
redirectTo('index.php', array(
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '8'
));
exit();
@@ -531,7 +531,7 @@ if ($action == 'forgotpwd') {
'loginname' => 'password_reset'
));
$rstlog->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
redirectTo('index.php', array(
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '4',
'customermail' => $user['email']
));
@@ -539,7 +539,7 @@ if ($action == 'forgotpwd') {
}
$mail->ClearAddresses();
redirectTo('index.php', array(
\Froxlor\UI\Response::redirectTo('index.php', array(
'showmessage' => '1'
));
exit();
@@ -569,7 +569,7 @@ if ($action == 'forgotpwd') {
}
}
eval("echo \"" . getTemplate('fpwd') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('fpwd') . "\";");
}
if ($action == 'resetpwd') {
@@ -641,25 +641,25 @@ if ($action == 'resetpwd') {
"activationcode" => $activationcode,
"userid" => $result['userid']
));
redirectTo('index.php', array(
\Froxlor\UI\Response::redirectTo('index.php', array(
"showmessage" => '6'
));
}
} else {
redirectTo('index.php', array(
\Froxlor\UI\Response::redirectTo('index.php', array(
"showmessage" => '7'
));
}
}
eval("echo \"" . getTemplate('rpwd') . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('rpwd') . "\";");
} else {
redirectTo('index.php', array(
\Froxlor\UI\Response::redirectTo('index.php', array(
"showmessage" => '7'
));
}
} else {
redirectTo('index.php');
\Froxlor\UI\Response::redirectTo('index.php');
}
}
@@ -736,27 +736,27 @@ function finishLogin($userinfo)
if ($userinfo['adminsession'] == '1') {
if (hasUpdates($version) || hasDbUpdates($dbversion)) {
redirectTo('admin_updates.php', array(
\Froxlor\UI\Response::redirectTo('admin_updates.php', array(
's' => $s
));
} else {
if (isset($_POST['script']) && $_POST['script'] != "") {
if (preg_match("/customer\_/", $_POST['script']) === 1) {
redirectTo('admin_customers.php', array(
\Froxlor\UI\Response::redirectTo('admin_customers.php', array(
"page" => "customers"
));
} else {
redirectTo($_POST['script'], $qryparams);
\Froxlor\UI\Response::redirectTo($_POST['script'], $qryparams);
}
} else {
redirectTo('admin_index.php', $qryparams);
\Froxlor\UI\Response::redirectTo('admin_index.php', $qryparams);
}
}
} else {
if (isset($_POST['script']) && $_POST['script'] != "") {
redirectTo($_POST['script'], $qryparams);
\Froxlor\UI\Response::redirectTo($_POST['script'], $qryparams);
} else {
redirectTo('customer_index.php', $qryparams);
\Froxlor\UI\Response::redirectTo('customer_index.php', $qryparams);
}
}
}

View File

@@ -34,7 +34,7 @@ $filelog = FroxlorLogger::getInstanceOf(array(
try {
$filelog->logAction(ADM_ACTION, LOG_WARNING, '-------------- START LOG --------------');
} catch (Exception $e) {
standard_error('exception', $e->getMessage());
\Froxlor\UI\Response::standard_error('exception', $e->getMessage());
}
if (\Froxlor\Froxlor::isFroxlor()) {

View File

@@ -233,14 +233,14 @@ class Admins extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
), true, true);
if (strtolower($loginname_check['loginname']) == strtolower($loginname) || strtolower($loginname_check_admin['loginname']) == strtolower($loginname)) {
standard_error('loginnameexists', $loginname, true);
\Froxlor\UI\Response::standard_error('loginnameexists', $loginname, true);
} // Accounts which match systemaccounts are not allowed, filtering them
elseif (preg_match('/^' . preg_quote(Settings::Get('customer.accountprefix'), '/') . '([0-9]+)/', $loginname)) {
standard_error('loginnameissystemaccount', Settings::Get('customer.accountprefix'), true);
\Froxlor\UI\Response::standard_error('loginnameissystemaccount', Settings::Get('customer.accountprefix'), true);
} elseif (! validateUsername($loginname)) {
standard_error('loginnameiswrong', $loginname, true);
\Froxlor\UI\Response::standard_error('loginnameiswrong', $loginname, true);
} elseif (! validateEmail($email)) {
standard_error('emailiswrong', $email, true);
\Froxlor\UI\Response::standard_error('emailiswrong', $email, true);
} else {
if ($customers_see_all != '1') {
@@ -505,7 +505,7 @@ class Admins extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
}
if (! validateEmail($email)) {
standard_error('emailiswrong', $email, true);
\Froxlor\UI\Response::standard_error('emailiswrong', $email, true);
} else {
if ($deactivated != '1') {
@@ -670,7 +670,7 @@ class Admins extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
// don't be stupid
if ($id == $this->getUserDetail('adminid')) {
standard_error('youcantdeleteyourself', '', true);
\Froxlor\UI\Response::standard_error('youcantdeleteyourself', '', true);
}
// delete admin

View File

@@ -272,7 +272,7 @@ class Certificates extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resou
private function addOrUpdateCertificate($domainid = 0, $ssl_cert_file = '', $ssl_key_file = '', $ssl_ca_file = '', $ssl_cert_chainfile = '', $do_insert = false)
{
if ($ssl_cert_file != '' && $ssl_key_file == '') {
standard_error('sslcertificateismissingprivatekey', '', true);
\Froxlor\UI\Response::standard_error('sslcertificateismissingprivatekey', '', true);
}
$do_verify = true;
@@ -295,7 +295,7 @@ class Certificates extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resou
// bool openssl_x509_check_private_key ( mixed $cert , mixed $key )
// Checks whether the given key is the private key that corresponds to cert.
if (openssl_x509_check_private_key($ssl_cert_file, $ssl_key_file) === false) {
standard_error('sslcertificateinvalidcertkeypair', '', true);
\Froxlor\UI\Response::standard_error('sslcertificateinvalidcertkeypair', '', true);
}
// check optional stuff
@@ -303,18 +303,18 @@ class Certificates extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resou
$ca_content = openssl_x509_parse($ssl_ca_file);
if (! is_array($ca_content)) {
// invalid
standard_error('sslcertificateinvalidca', '', true);
\Froxlor\UI\Response::standard_error('sslcertificateinvalidca', '', true);
}
}
if ($ssl_cert_chainfile != '') {
$chain_content = openssl_x509_parse($ssl_cert_chainfile);
if (! is_array($chain_content)) {
// invalid
standard_error('sslcertificateinvalidchain', '', true);
\Froxlor\UI\Response::standard_error('sslcertificateinvalidchain', '', true);
}
}
} else {
standard_error('sslcertificateinvalidcert', '', true);
\Froxlor\UI\Response::standard_error('sslcertificateinvalidcert', '', true);
}
}

View File

@@ -80,7 +80,7 @@ class CustomerBackups extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Re
// path cannot be the customers docroot
if ($path == \Froxlor\FileDir::makeCorrectDir($customer['documentroot'])) {
standard_error('backupfoldercannotbedocroot', '', true);
\Froxlor\UI\Response::standard_error('backupfoldercannotbedocroot', '', true);
}
if ($backup_dbs != '1') {

View File

@@ -297,11 +297,11 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
$traffic = $traffic * 1024 * 1024;
if (((($this->getUserDetail('diskspace_used') + $diskspace) > $this->getUserDetail('diskspace')) && ($this->getUserDetail('diskspace') / 1024) != '-1') || ((($this->getUserDetail('mysqls_used') + $mysqls) > $this->getUserDetail('mysqls')) && $this->getUserDetail('mysqls') != '-1') || ((($this->getUserDetail('emails_used') + $emails) > $this->getUserDetail('emails')) && $this->getUserDetail('emails') != '-1') || ((($this->getUserDetail('email_accounts_used') + $email_accounts) > $this->getUserDetail('email_accounts')) && $this->getUserDetail('email_accounts') != '-1') || ((($this->getUserDetail('email_forwarders_used') + $email_forwarders) > $this->getUserDetail('email_forwarders')) && $this->getUserDetail('email_forwarders') != '-1') || ((($this->getUserDetail('email_quota_used') + $email_quota) > $this->getUserDetail('email_quota')) && $this->getUserDetail('email_quota') != '-1' && Settings::Get('system.mail_quota_enabled') == '1') || ((($this->getUserDetail('ftps_used') + $ftps) > $this->getUserDetail('ftps')) && $this->getUserDetail('ftps') != '-1') || ((($this->getUserDetail('subdomains_used') + $subdomains) > $this->getUserDetail('subdomains')) && $this->getUserDetail('subdomains') != '-1') || (($diskspace / 1024) == '-1' && ($this->getUserDetail('diskspace') / 1024) != '-1') || ($mysqls == '-1' && $this->getUserDetail('mysqls') != '-1') || ($emails == '-1' && $this->getUserDetail('emails') != '-1') || ($email_accounts == '-1' && $this->getUserDetail('email_accounts') != '-1') || ($email_forwarders == '-1' && $this->getUserDetail('email_forwarders') != '-1') || ($email_quota == '-1' && $this->getUserDetail('email_quota') != '-1' && Settings::Get('system.mail_quota_enabled') == '1') || ($ftps == '-1' && $this->getUserDetail('ftps') != '-1') || ($subdomains == '-1' && $this->getUserDetail('subdomains') != '-1')) {
standard_error('youcantallocatemorethanyouhave', '', true);
\Froxlor\UI\Response::standard_error('youcantallocatemorethanyouhave', '', true);
}
if (! validateEmail($email)) {
standard_error('emailiswrong', $email, true);
\Froxlor\UI\Response::standard_error('emailiswrong', $email, true);
} else {
if ($loginname != '') {
@@ -310,12 +310,12 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
// Accounts which match systemaccounts are not allowed, filtering them
if (preg_match('/^' . preg_quote(Settings::Get('customer.accountprefix'), '/') . '([0-9]+)/', $loginname)) {
standard_error('loginnameissystemaccount', Settings::Get('customer.accountprefix'), true);
\Froxlor\UI\Response::standard_error('loginnameissystemaccount', Settings::Get('customer.accountprefix'), true);
}
// Additional filtering for Bug #962
if (function_exists('posix_getpwnam') && ! in_array("posix_getpwnam", explode(",", ini_get('disable_functions'))) && posix_getpwnam($loginname)) {
standard_error('loginnameissystemaccount', Settings::Get('customer.accountprefix'), true);
\Froxlor\UI\Response::standard_error('loginnameissystemaccount', Settings::Get('customer.accountprefix'), true);
}
} else {
$accountnumber = intval(Settings::Get('system.lastaccountnumber')) + 1;
@@ -341,12 +341,12 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
), true, true);
if (strtolower($loginname_check['loginname']) == strtolower($loginname) || strtolower($loginname_check_admin['loginname']) == strtolower($loginname)) {
standard_error('loginnameexists', $loginname, true);
\Froxlor\UI\Response::standard_error('loginnameexists', $loginname, true);
} elseif (! validateUsername($loginname, Settings::Get('panel.unix_names'), 14 - strlen(Settings::Get('customer.mysqlprefix')))) {
if (strlen($loginname) > 14 - strlen(Settings::Get('customer.mysqlprefix'))) {
standard_error('loginnameiswrong2', 14 - strlen(Settings::Get('customer.mysqlprefix')), true);
\Froxlor\UI\Response::standard_error('loginnameiswrong2', 14 - strlen(Settings::Get('customer.mysqlprefix')), true);
} else {
standard_error('loginnameiswrong', $loginname, true);
\Froxlor\UI\Response::standard_error('loginnameiswrong', $loginname, true);
}
}
@@ -354,7 +354,7 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
$documentroot = \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.documentroot_prefix') . '/' . $loginname);
if (file_exists($documentroot)) {
standard_error('documentrootexists', $documentroot, true);
\Froxlor\UI\Response::standard_error('documentrootexists', $documentroot, true);
}
if ($createstdsubdomain != '1') {
@@ -712,7 +712,7 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
if ($_mailerror) {
$this->logger()->logAction(ADM_ACTION, LOG_ERR, "[API] Error sending mail: " . $mailerr_msg);
standard_error('errorsendingmail', $email, true);
\Froxlor\UI\Response::standard_error('errorsendingmail', $email, true);
}
$this->mailer()->clearAddresses();
@@ -926,16 +926,16 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
$traffic = $traffic * 1024 * 1024;
if (((($this->getUserDetail('diskspace_used') + $diskspace - $result['diskspace']) > $this->getUserDetail('diskspace')) && ($this->getUserDetail('diskspace') / 1024) != '-1') || ((($this->getUserDetail('mysqls_used') + $mysqls - $result['mysqls']) > $this->getUserDetail('mysqls')) && $this->getUserDetail('mysqls') != '-1') || ((($this->getUserDetail('emails_used') + $emails - $result['emails']) > $this->getUserDetail('emails')) && $this->getUserDetail('emails') != '-1') || ((($this->getUserDetail('email_accounts_used') + $email_accounts - $result['email_accounts']) > $this->getUserDetail('email_accounts')) && $this->getUserDetail('email_accounts') != '-1') || ((($this->getUserDetail('email_forwarders_used') + $email_forwarders - $result['email_forwarders']) > $this->getUserDetail('email_forwarders')) && $this->getUserDetail('email_forwarders') != '-1') || ((($this->getUserDetail('email_quota_used') + $email_quota - $result['email_quota']) > $this->getUserDetail('email_quota')) && $this->getUserDetail('email_quota') != '-1' && Settings::Get('system.mail_quota_enabled') == '1') || ((($this->getUserDetail('ftps_used') + $ftps - $result['ftps']) > $this->getUserDetail('ftps')) && $this->getUserDetail('ftps') != '-1') || ((($this->getUserDetail('subdomains_used') + $subdomains - $result['subdomains']) > $this->getUserDetail('subdomains')) && $this->getUserDetail('subdomains') != '-1') || (($diskspace / 1024) == '-1' && ($this->getUserDetail('diskspace') / 1024) != '-1') || ($mysqls == '-1' && $this->getUserDetail('mysqls') != '-1') || ($emails == '-1' && $this->getUserDetail('emails') != '-1') || ($email_accounts == '-1' && $this->getUserDetail('email_accounts') != '-1') || ($email_forwarders == '-1' && $this->getUserDetail('email_forwarders') != '-1') || ($email_quota == '-1' && $this->getUserDetail('email_quota') != '-1' && Settings::Get('system.mail_quota_enabled') == '1') || ($ftps == '-1' && $this->getUserDetail('ftps') != '-1') || ($subdomains == '-1' && $this->getUserDetail('subdomains') != '-1')) {
standard_error('youcantallocatemorethanyouhave', '', true);
\Froxlor\UI\Response::standard_error('youcantallocatemorethanyouhave', '', true);
}
if ($email == '') {
standard_error(array(
\Froxlor\UI\Response::standard_error(array(
'stringisempty',
'emailadd'
), '', true);
} elseif (! validateEmail($email)) {
standard_error('emailiswrong', $email, true);
\Froxlor\UI\Response::standard_error('emailiswrong', $email, true);
}
}
@@ -1322,7 +1322,7 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
'adminid' => $move_to_admin
));
if ($move_result != true) {
standard_error('moveofcustomerfailed', $move_result, true);
\Froxlor\UI\Response::standard_error('moveofcustomerfailed', $move_result, true);
}
}
}

View File

@@ -97,7 +97,7 @@ class DirOptions extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
// duplicate check
if ($path_dupe_check['path'] == $path) {
standard_error('errordocpathdupe', $userpath, true);
\Froxlor\UI\Response::standard_error('errordocpathdupe', $userpath, true);
}
// insert the entry

View File

@@ -88,9 +88,9 @@ class DirProtections extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Res
// duplicate check
if ($username_path_check['username'] == $username && $username_path_check['path'] == $path) {
standard_error('userpathcombinationdupe', '', true);
\Froxlor\UI\Response::standard_error('userpathcombinationdupe', '', true);
} elseif ($password == $username) {
standard_error('passwordshouldnotbeusername', '', true);
\Froxlor\UI\Response::standard_error('passwordshouldnotbeusername', '', true);
}
// insert the entry
@@ -236,7 +236,7 @@ class DirProtections extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Res
);
if (! empty($password)) {
if ($password == $result['username']) {
standard_error('passwordshouldnotbeusername', '', true);
\Froxlor\UI\Response::standard_error('passwordshouldnotbeusername', '', true);
}
if (CRYPT_STD_DES == 1) {
$saltfordescrypt = substr(md5(uniqid(microtime(), 1)), 4, 2);

View File

@@ -73,7 +73,7 @@ class DomainZones extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour
}
if ($result['subisbinddomain'] != '1') {
standard_error('dns_domain_nodns', '', true);
\Froxlor\UI\Response::standard_error('dns_domain_nodns', '', true);
}
$idna_convert = new \Froxlor\Idna\IdnaWrapper();
@@ -326,7 +326,7 @@ class DomainZones extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour
}
if ($result['subisbinddomain'] != '1') {
standard_error('dns_domain_nodns', '', true);
\Froxlor\UI\Response::standard_error('dns_domain_nodns', '', true);
}
$zone = createDomainZone($id);

View File

@@ -232,11 +232,11 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
// validation
if ($p_domain == Settings::Get('system.hostname')) {
standard_error('admin_domain_emailsystemhostname', '', true);
\Froxlor\UI\Response::standard_error('admin_domain_emailsystemhostname', '', true);
}
if (substr($p_domain, 0, 4) == 'xn--') {
standard_error('domain_nopunycode', '', true);
\Froxlor\UI\Response::standard_error('domain_nopunycode', '', true);
}
$idna_convert = new \Froxlor\Idna\IdnaWrapper();
@@ -247,7 +247,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
// Check whether domain validation is enabled and if, validate the domain
if (Settings::Get('system.validate_domain') && ! validateDomain($domain)) {
standard_error(array(
\Froxlor\UI\Response::standard_error(array(
'stringiswrong',
'mydomain'
), '', true);
@@ -265,7 +265,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
'adminid' => $adminid
), true, true);
if (empty($admin)) {
dynamic_error("Selected admin cannot have any more domains or could not be found");
\Froxlor\UI\Response::dynamic_error("Selected admin cannot have any more domains or could not be found");
}
unset($admin);
}
@@ -342,7 +342,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
), true, true);
if (! isset($phpsettingid_check['id']) || $phpsettingid_check['id'] == '0' || $phpsettingid_check['id'] != $phpsettingid) {
standard_error('phpsettingidwrong', '', true);
\Froxlor\UI\Response::standard_error('phpsettingidwrong', '', true);
}
if ((int) Settings::Get('system.mod_fcgid') == 1) {
@@ -408,12 +408,12 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
// We can't enable let's encrypt for wildcard - domains if using acme-v1
if ($serveraliasoption == '0' && $letsencrypt == '1' && Settings::Get('system.leapiversion') == '1') {
standard_error('nowildcardwithletsencrypt', '', true);
\Froxlor\UI\Response::standard_error('nowildcardwithletsencrypt', '', true);
}
// if using acme-v2 we cannot issue wildcard-certificates
// because they currently only support the dns-01 challenge
if ($serveraliasoption == '0' && $letsencrypt == '1' && Settings::Get('system.leapiversion') == '2') {
standard_error('nowildcardwithletsencryptv2', '', true);
\Froxlor\UI\Response::standard_error('nowildcardwithletsencryptv2', '', true);
}
// Temporarily deactivate ssl_redirect until Let's Encrypt certificate was generated
@@ -423,7 +423,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
if (! preg_match('/^https?\:\/\//', $documentroot)) {
if (strstr($documentroot, ":") !== false) {
standard_error('pathmaynotcontaincolon', '', true);
\Froxlor\UI\Response::standard_error('pathmaynotcontaincolon', '', true);
} else {
$documentroot = \Froxlor\FileDir::makeCorrectDir($documentroot);
}
@@ -481,7 +481,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
}
if (count($ipandports) == 0) {
standard_error('noipportgiven', '', true);
\Froxlor\UI\Response::standard_error('noipportgiven', '', true);
}
if ($email_only == '1') {
@@ -504,21 +504,21 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
$idna_convert = new \Froxlor\Idna\IdnaWrapper();
if ($domain == '') {
standard_error(array(
\Froxlor\UI\Response::standard_error(array(
'stringisempty',
'mydomain'
), '', true);
} elseif ($documentroot == '') {
standard_error(array(
\Froxlor\UI\Response::standard_error(array(
'stringisempty',
'mydocumentroot'
), '', true);
} elseif ($customerid == 0) {
standard_error('adduserfirst', '', true);
\Froxlor\UI\Response::standard_error('adduserfirst', '', true);
} elseif (strtolower($domain_check['domain']) == strtolower($domain)) {
standard_error('domainalreadyexists', $idna_convert->decode($domain), true);
\Froxlor\UI\Response::standard_error('domainalreadyexists', $idna_convert->decode($domain), true);
} elseif ($aliasdomain_check['id'] != $aliasdomain) {
standard_error('domainisaliasorothercustomer', '', true);
\Froxlor\UI\Response::standard_error('domainisaliasorothercustomer', '', true);
} else {
$wwwserveralias = ($serveraliasoption == '1') ? '1' : '0';
$iswildcarddomain = ($serveraliasoption == '0') ? '1' : '0';
@@ -866,7 +866,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
}
$customer = Database::pexecute_first($customer_stmt, $params, true, true);
if (empty($customer) || $customer['customerid'] != $customerid) {
standard_error('customerdoesntexist', '', true);
\Froxlor\UI\Response::standard_error('customerdoesntexist', '', true);
}
} else {
$customerid = $result['customerid'];
@@ -891,7 +891,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
), true, true);
if (empty($admin) || $admin['adminid'] != $adminid) {
standard_error('admindoesntexist', '', true);
\Froxlor\UI\Response::standard_error('admindoesntexist', '', true);
}
} else {
$adminid = $result['adminid'];
@@ -966,7 +966,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
}
if (! preg_match('/^https?\:\/\//', $documentroot) && strstr($documentroot, ":") !== false) {
standard_error('pathmaynotcontaincolon', '', true);
\Froxlor\UI\Response::standard_error('pathmaynotcontaincolon', '', true);
}
} else {
$isbinddomain = $result['isbinddomain'];
@@ -991,7 +991,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
), true, true);
if (! isset($phpsettingid_check['id']) || $phpsettingid_check['id'] == '0' || $phpsettingid_check['id'] != $phpsettingid) {
standard_error('phpsettingidwrong', '', true);
\Froxlor\UI\Response::standard_error('phpsettingidwrong', '', true);
}
if ((int) Settings::Get('system.mod_fcgid') == 1) {
@@ -1048,12 +1048,12 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
// We can't enable let's encrypt for wildcard domains when using acme-v1
if ($serveraliasoption == '0' && $letsencrypt == '1' && Settings::Get('system.leapiversion') == '1') {
standard_error('nowildcardwithletsencrypt', '', true);
\Froxlor\UI\Response::standard_error('nowildcardwithletsencrypt', '', true);
}
// if using acme-v2 we cannot issue wildcard-certificates
// because they currently only support the dns-01 challenge
if ($serveraliasoption == '0' && $letsencrypt == '1' && Settings::Get('system.leapiversion') == '2') {
standard_error('nowildcardwithletsencryptv2', '', true);
\Froxlor\UI\Response::standard_error('nowildcardwithletsencryptv2', '', true);
}
// Temporarily deactivate ssl_redirect until Let's Encrypt certificate was generated
@@ -1121,11 +1121,11 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
}
if (count($ipandports) == 0) {
standard_error('noipportgiven', '', true);
\Froxlor\UI\Response::standard_error('noipportgiven', '', true);
}
if ($aliasdomain_check['id'] != $aliasdomain) {
standard_error('domainisaliasorothercustomer', '', true);
\Froxlor\UI\Response::standard_error('domainisaliasorothercustomer', '', true);
}
if ($issubof <= 0) {
@@ -1685,7 +1685,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
), $aip_param);
$ipandport_check = Database::pexecute_first($ipandport_check_stmt, $ip_params, true, true);
if (! isset($ipandport_check['id']) || $ipandport_check['id'] == '0' || $ipandport_check['id'] != $ipandport) {
standard_error('ipportdoesntexist', '', true);
\Froxlor\UI\Response::standard_error('ipportdoesntexist', '', true);
} else {
$ipandports[] = $ipandport;
}

View File

@@ -71,7 +71,7 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
// check for imap||pop3 == 1, see #1298
if ($customer['imap'] != '1' && $customer['pop3'] != '1') {
standard_error('notallowedtouseaccounts', '', true);
\Froxlor\UI\Response::standard_error('notallowedtouseaccounts', '', true);
}
// get email address
@@ -91,8 +91,8 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
throw new \Exception("Email address '" . $email_full . "' has already an account assigned.", 406);
}
if (\Froxlor\Validate\Validate::checkMailAccDeletionState($email_full)) {
standard_error(array(
if (\Froxlor\Validate\Check::checkMailAccDeletionState($email_full)) {
\Froxlor\UI\Response::standard_error(array(
'mailaccistobedeleted'
), $email_full, true);
}
@@ -101,7 +101,7 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
if (Settings::Get('panel.sendalternativemail') == 1) {
$alternative_email = $idna_convert->encode(validate($alternative_email, 'alternative_email', '', '', array(), true));
if (! validateEmail($alternative_email)) {
standard_error('emailiswrong', $alternative_email, true);
\Froxlor\UI\Response::standard_error('emailiswrong', $alternative_email, true);
}
} else {
$alternative_email = '';
@@ -110,7 +110,7 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
// validate quota if enabled
if (Settings::Get('system.mail_quota_enabled') == 1) {
if ($customer['email_quota'] != '-1' && ($quota == 0 || ($quota + $customer['email_quota_used']) > $customer['email_quota'])) {
standard_error('allocatetoomuchquota', $quota, true);
\Froxlor\UI\Response::standard_error('allocatetoomuchquota', $quota, true);
}
} else {
// disable
@@ -118,7 +118,7 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
}
if ($password == $email_full) {
standard_error('passwordshouldnotbeusername', '', true);
\Froxlor\UI\Response::standard_error('passwordshouldnotbeusername', '', true);
}
// encrypt the password
@@ -229,7 +229,7 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
if ($_mailerror) {
$this->logger()->logAction($this->isAdmin() ? ADM_ACTION : USR_ACTION, LOG_ERR, "[API] Error sending mail: " . $mailerr_msg);
standard_error('errorsendingmail', $email_full, true);
\Froxlor\UI\Response::standard_error('errorsendingmail', $email_full, true);
}
$this->mailer()->clearAddresses();
@@ -259,7 +259,7 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
if ($_mailerror) {
$this->logger()->logAction($this->isAdmin() ? ADM_ACTION : USR_ACTION, LOG_ERR, "[API] Error sending mail: " . $mailerr_msg);
standard_error(array(
\Froxlor\UI\Response::standard_error(array(
'errorsendingmail'
), $alternative_email, true);
}
@@ -344,7 +344,7 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
);
if (! empty($password)) {
if ($password == $result['email_full']) {
standard_error('passwordshouldnotbeusername', '', true);
\Froxlor\UI\Response::standard_error('passwordshouldnotbeusername', '', true);
}
$password = validatePassword($password, true);
$cryptPassword = \Froxlor\System\Crypt::makeCryptPassword($password);
@@ -358,7 +358,7 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
if (Settings::Get('system.mail_quota_enabled') == 1) {
if ($quota != $result['quota']) {
if ($customer['email_quota'] != '-1' && ($quota == 0 || ($quota + $customer['email_quota_used'] - $result['quota']) > $customer['email_quota'])) {
standard_error('allocatetoomuchquota', $quota, true);
\Froxlor\UI\Response::standard_error('allocatetoomuchquota', $quota, true);
}
if (! empty($upd_query)) {
$upd_query .= ", ";

View File

@@ -70,11 +70,11 @@ class EmailForwarders extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Re
$destination = trim($destination);
if (! validateEmail($destination)) {
standard_error('destinationiswrong', $destination, true);
\Froxlor\UI\Response::standard_error('destinationiswrong', $destination, true);
} elseif ($destination == $result['email']) {
standard_error('destinationalreadyexistasmail', $destination, true);
\Froxlor\UI\Response::standard_error('destinationalreadyexistasmail', $destination, true);
} elseif (in_array($destination, $result['destination_array'])) {
standard_error('destinationalreadyexist', $destination, true);
\Froxlor\UI\Response::standard_error('destinationalreadyexist', $destination, true);
}
// get needed customer info to reduce the email-forwarder-counter by one

View File

@@ -66,7 +66,7 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
'domainname' => $domain
));
if ($domain_check['isemaildomain'] == 0) {
standard_error('maindomainnonexist', $domain, true);
\Froxlor\UI\Response::standard_error('maindomainnonexist', $domain, true);
}
if (Settings::Get('catchall.catchall_enabled') != '1') {
@@ -87,7 +87,7 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
// validate it
if (! validateEmail($email_full)) {
standard_error('emailiswrong', $email_full, true);
\Froxlor\UI\Response::standard_error('emailiswrong', $email_full, true);
}
// get needed customer info to reduce the email-address-counter by one
@@ -107,9 +107,9 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
$email_check = Database::pexecute_first($stmt, $params, true, true);
if (strtolower($email_check['email_full']) == strtolower($email_full)) {
standard_error('emailexistalready', $email_full, true);
\Froxlor\UI\Response::standard_error('emailexistalready', $email_full, true);
} elseif ($email_check['email'] == $email) {
standard_error('youhavealreadyacatchallforthisdomain', '', true);
\Froxlor\UI\Response::standard_error('youhavealreadyacatchallforthisdomain', '', true);
}
$stmt = Database::prepare("
@@ -209,7 +209,7 @@ class Emails extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
// if enabling catchall is not allowed by settings, we do not need
// to run update()
if (Settings::Get('catchall.catchall_enabled') != '1') {
standard_error(array(
\Froxlor\UI\Response::standard_error(array(
'operationnotpermitted',
'featureisdisabled'
), 'catchall', true);

View File

@@ -165,7 +165,7 @@ class FpmDaemons extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
$limit_extensions = validate($limit_extensions, 'limit_extensions', '/^(\.[a-z]([a-z0-9]+)\ ?)+$/', '', array(), true);
if (strlen($description) == 0 || strlen($description) > 50) {
standard_error('descriptioninvalid', '', true);
\Froxlor\UI\Response::standard_error('descriptioninvalid', '', true);
}
$ins_stmt = Database::prepare("
@@ -281,7 +281,7 @@ class FpmDaemons extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
$limit_extensions = validate($limit_extensions, 'limit_extensions', '/^(\.[a-z]([a-z0-9]+)\ ?)+$/', '', array(), true);
if (strlen($description) == 0 || strlen($description) > 50) {
standard_error('descriptioninvalid', '', true);
\Froxlor\UI\Response::standard_error('descriptioninvalid', '', true);
}
$upd_stmt = Database::prepare("
@@ -341,7 +341,7 @@ class FpmDaemons extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
$id = $this->getParam('id');
if ($id == 1) {
standard_error('cannotdeletedefaultphpconfig', '', true);
\Froxlor\UI\Response::standard_error('cannotdeletedefaultphpconfig', '', true);
}
$result = $this->apiCall('FpmDaemons.get', array(

View File

@@ -87,7 +87,7 @@ class Froxlor extends \Froxlor\Api\ApiCommand
'additional_info' => $message_addinfo
));
} else {
standard_error('customized_version', '', true);
\Froxlor\UI\Response::standard_error('customized_version', '', true);
}
}
}

View File

@@ -95,7 +95,7 @@ class Ftps extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEntit
if (Settings::Get('customer.ftpatdomain') == '1') {
if ($ftpusername == '') {
standard_error(array(
\Froxlor\UI\Response::standard_error(array(
'stringisempty',
'username'
), '', true);
@@ -109,7 +109,7 @@ class Ftps extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEntit
), true, true);
if ($ftpdomain_check && $ftpdomain_check['domain'] != $ftpdomain) {
standard_error('maindomainnonexist', $ftpdomain, true);
\Froxlor\UI\Response::standard_error('maindomainnonexist', $ftpdomain, true);
}
$username = $ftpusername . "@" . $ftpdomain;
} else {
@@ -124,9 +124,9 @@ class Ftps extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEntit
), true, true);
if (! empty($username_check) && $username_check['username'] = $username) {
standard_error('usernamealreadyexists', $username, true);
\Froxlor\UI\Response::standard_error('usernamealreadyexists', $username, true);
} elseif ($username == $password) {
standard_error('passwordshouldnotbeusername', '', true);
\Froxlor\UI\Response::standard_error('passwordshouldnotbeusername', '', true);
} else {
$path = \Froxlor\FileDir::makeCorrectDir($customer['documentroot'] . '/' . $path);
$cryptPassword = \Froxlor\System\Crypt::makeCryptPassword($password);
@@ -216,7 +216,7 @@ class Ftps extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEntit
if ($_mailerror) {
$this->logger()->logAction($this->isAdmin() ? ADM_ACTION : USR_ACTION, LOG_ERR, "[API] Error sending mail: " . $mailerr_msg);
standard_error('errorsendingmail', $customer['email'], true);
\Froxlor\UI\Response::standard_error('errorsendingmail', $customer['email'], true);
}
$this->mailer()->clearAddresses();
@@ -356,7 +356,7 @@ class Ftps extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEntit
$password = validatePassword($password, true);
if ($password == $result['username']) {
standard_error('passwordshouldnotbeusername', '', true);
\Froxlor\UI\Response::standard_error('passwordshouldnotbeusername', '', true);
}
$cryptPassword = \Froxlor\System\Crypt::makeCryptPassword($password);

View File

@@ -205,7 +205,7 @@ class IpsAndPorts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour
));
if ($result_checkfordouble['id'] != '') {
standard_error('myipnotdouble', '', true);
\Froxlor\UI\Response::standard_error('myipnotdouble', '', true);
}
$ins_stmt = Database::prepare("
@@ -390,9 +390,9 @@ class IpsAndPorts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour
}
if ($result['ip'] != $ip && $result['ip'] == Settings::Get('system.ipaddress') && $result_sameipotherport['id'] == '') {
standard_error('cantchangesystemip', '', true);
\Froxlor\UI\Response::standard_error('cantchangesystemip', '', true);
} elseif ($result_checkfordouble['id'] != '' && $result_checkfordouble['id'] != $id) {
standard_error('myipnotdouble', '', true);
\Froxlor\UI\Response::standard_error('myipnotdouble', '', true);
} else {
$upd_stmt = Database::prepare("
@@ -506,13 +506,13 @@ class IpsAndPorts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour
$this->logger()->logAction(ADM_ACTION, LOG_WARNING, "[API] deleted IP/port '" . $result['ip'] . ":" . $result['port'] . "'");
return $this->response(200, "successfull", $result);
} else {
standard_error('cantdeletesystemip', '', true);
\Froxlor\UI\Response::standard_error('cantdeletesystemip', '', true);
}
} else {
standard_error('cantdeletedefaultip', '', true);
\Froxlor\UI\Response::standard_error('cantdeletedefaultip', '', true);
}
} else {
standard_error('ipstillhasdomains', '', true);
\Froxlor\UI\Response::standard_error('ipstillhasdomains', '', true);
}
}
throw new \Exception("Not allowed to execute given command.", 403);

View File

@@ -84,7 +84,7 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
// we've checked against the password in dbm->createDatabase
if ($username == false) {
standard_error('passwordshouldnotbeusername', '', true);
\Froxlor\UI\Response::standard_error('passwordshouldnotbeusername', '', true);
}
// add database info to froxlor
@@ -159,7 +159,7 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
if ($_mailerror) {
$this->logger()->logAction($this->isAdmin() ? ADM_ACTION : USR_ACTION, LOG_ERR, "[API] Error sending mail: " . $mailerr_msg);
standard_error('errorsendingmail', $userinfo['email'], true);
\Froxlor\UI\Response::standard_error('errorsendingmail', $userinfo['email'], true);
}
$this->mailer()->clearAddresses();
@@ -318,7 +318,7 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
$password = validatePassword($password, true);
if ($password == $result['databasename']) {
standard_error('passwordshouldnotbeusername', '', true);
\Froxlor\UI\Response::standard_error('passwordshouldnotbeusername', '', true);
}
// Begin root-session

View File

@@ -280,7 +280,7 @@ class PhpSettings extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour
}
if (strlen($description) == 0 || strlen($description) > 50) {
standard_error('descriptioninvalid', '', true);
\Froxlor\UI\Response::standard_error('descriptioninvalid', '', true);
}
$ins_stmt = Database::prepare("
@@ -475,7 +475,7 @@ class PhpSettings extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour
}
if (strlen($description) == 0 || strlen($description) > 50) {
standard_error('descriptioninvalid', '', true);
\Froxlor\UI\Response::standard_error('descriptioninvalid', '', true);
}
$upd_stmt = Database::prepare("
@@ -560,11 +560,11 @@ class PhpSettings extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour
));
if ((Settings::Get('system.mod_fcgid') == '1' && Settings::Get('system.mod_fcgid_defaultini_ownvhost') == $id) || (Settings::Get('phpfpm.enabled') == '1' && Settings::Get('phpfpm.vhost_defaultini') == $id)) {
standard_error('cannotdeletehostnamephpconfig', '', true);
\Froxlor\UI\Response::standard_error('cannotdeletehostnamephpconfig', '', true);
}
if ((Settings::Get('system.mod_fcgid') == '1' && Settings::Get('system.mod_fcgid_defaultini') == $id) || (Settings::Get('phpfpm.enabled') == '1' && Settings::Get('phpfpm.defaultini') == $id)) {
standard_error('cannotdeletedefaultphpconfig', '', true);
\Froxlor\UI\Response::standard_error('cannotdeletedefaultphpconfig', '', true);
}
// set php-config to default for all domains using the

View File

@@ -91,7 +91,7 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
// validation
if (substr($subdomain, 0, 4) == 'xn--') {
standard_error('domain_nopunycode', '', true);
\Froxlor\UI\Response::standard_error('domain_nopunycode', '', true);
}
$idna_convert = new \Froxlor\Idna\IdnaWrapper();
@@ -104,13 +104,13 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
$completedomain = $subdomain . '.' . $domain;
if (Settings::Get('system.validate_domain') && ! validateDomain($completedomain)) {
standard_error(array(
\Froxlor\UI\Response::standard_error(array(
'stringiswrong',
'mydomain'
), '', true);
}
if ($completedomain == Settings::Get('system.hostname')) {
standard_error('admin_domain_emailsystemhostname', '', true);
\Froxlor\UI\Response::standard_error('admin_domain_emailsystemhostname', '', true);
}
// check whether the domain already exists
@@ -128,7 +128,7 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
if ($completedomain_check) {
// no exception so far - domain exists
standard_error('domainexistalready', $completedomain, true);
\Froxlor\UI\Response::standard_error('domainexistalready', $completedomain, true);
}
// alias domain checked?
@@ -152,7 +152,7 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
"customerid" => $customer['customerid']
), true, true);
if ($aliasdomain_check['id'] != $aliasdomain) {
standard_error('domainisaliasorothercustomer', '', true);
\Froxlor\UI\Response::standard_error('domainisaliasorothercustomer', '', true);
}
\Froxlor\Domain\Domain::triggerLetsEncryptCSRForAliasDestinationDomain($aliasdomain, $this->logger());
}
@@ -181,13 +181,13 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
if (! $domain_check) {
// the given main-domain
standard_error('maindomainnonexist', $domain, true);
\Froxlor\UI\Response::standard_error('maindomainnonexist', $domain, true);
} elseif ($subdomain == 'www' && $domain_check['wwwserveralias'] == '1') {
// you cannot add 'www' as subdomain when the maindomain generates a www-alias
standard_error('wwwnotallowed', '', true);
\Froxlor\UI\Response::standard_error('wwwnotallowed', '', true);
} elseif (strtolower($completedomain_check['domain']) == strtolower($completedomain)) {
// the domain does already exist as main-domain
standard_error('domainexistalready', $completedomain, true);
\Froxlor\UI\Response::standard_error('domainexistalready', $completedomain, true);
}
// if allowed, check for 'is email domain'-flag
@@ -204,7 +204,7 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
$ssl_redirect = '1';
$_doredirect = true;
} else {
standard_error('sslredirectonlypossiblewithsslipport', '', true);
\Froxlor\UI\Response::standard_error('sslredirectonlypossiblewithsslipport', '', true);
}
}
@@ -214,7 +214,7 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
if (\Froxlor\Domain\Domain::domainHasSslIpPort($domain_check['id']) == true) {
$letsencrypt = '1';
} else {
standard_error('letsencryptonlypossiblewithsslipport', '', true);
\Froxlor\UI\Response::standard_error('letsencryptonlypossiblewithsslipport', '', true);
}
}
@@ -508,7 +508,7 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
"customerid" => $customer['customerid']
), true, true);
if ($aliasdomain_check['id'] != $aliasdomain) {
standard_error('domainisaliasorothercustomer', '', true);
\Froxlor\UI\Response::standard_error('domainisaliasorothercustomer', '', true);
}
\Froxlor\Domain\Domain::triggerLetsEncryptCSRForAliasDestinationDomain($aliasdomain, $this->logger());
}
@@ -540,7 +540,7 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
$ssl_redirect = '1';
$_doredirect = true;
} else {
standard_error('sslredirectonlypossiblewithsslipport', '', true);
\Froxlor\UI\Response::standard_error('sslredirectonlypossiblewithsslipport', '', true);
}
}
@@ -550,18 +550,18 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
if (\Froxlor\Domain\Domain::domainHasSslIpPort($result['id']) == true) {
$letsencrypt = '1';
} else {
standard_error('letsencryptonlypossiblewithsslipport', '', true);
\Froxlor\UI\Response::standard_error('letsencryptonlypossiblewithsslipport', '', true);
}
}
// We can't enable let's encrypt for wildcard - domains when using acme-v1
if ($iswildcarddomain == '1' && $letsencrypt == '1' && Settings::Get('system.leapiversion') == '1') {
standard_error('nowildcardwithletsencrypt');
\Froxlor\UI\Response::standard_error('nowildcardwithletsencrypt');
}
// if using acme-v2 we cannot issue wildcard-certificates
// because they currently only support the dns-01 challenge
if ($iswildcarddomain == '0' && $letsencrypt == '1' && Settings::Get('system.leapiversion') == '2') {
standard_error('nowildcardwithletsencryptv2');
\Froxlor\UI\Response::standard_error('nowildcardwithletsencryptv2');
}
// Temporarily deactivate ssl_redirect until Let's Encrypt certificate was generated
@@ -772,7 +772,7 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
), true, true);
if ($emails['count'] != '0') {
standard_error('domains_cantdeletedomainwithemail', '', true);
\Froxlor\UI\Response::standard_error('domains_cantdeletedomainwithemail', '', true);
}
}
@@ -864,7 +864,7 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
// check whether path is a real path
if (! preg_match('/^https?\:\/\//', $path) || ! validateUrl($path)) {
if (strstr($path, ":") !== false) {
standard_error('pathmaynotcontaincolon', '', true);
\Froxlor\UI\Response::standard_error('pathmaynotcontaincolon', '', true);
}
// If path is empty or '/' and 'Use domain name as default value for DocumentRoot path' is enabled in settings,
// set default path to subdomain or domain name

View File

@@ -399,8 +399,7 @@ class TasksCron extends \Froxlor\Cron\FroxlorCron
{
\Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_INFO, 'TasksCron: Task10 started - setting filesystem quota');
// @fixme
$usedquota = getFilesystemQuota();
$usedquota = \Froxlor\FileDir::getFilesystemQuota();
// Check whether we really have entries to check
if (is_array($usedquota) && count($usedquota) > 0) {

View File

@@ -150,7 +150,7 @@ class TrafficCron extends \Froxlor\Cron\FroxlorCron
// We are using the file-system quota, this will speed up the diskusage - collection
if (Settings::Get('system.diskquota_enabled')) {
$usedquota = getFilesystemQuota();
$usedquota = \Froxlor\FileDir::getFilesystemQuota();
}
/**

View File

@@ -33,12 +33,12 @@ class Dns
if ($domain) {
if ($domain['isbinddomain'] != '1') {
standard_error('dns_domain_nodns');
\Froxlor\UI\Response::standard_error('dns_domain_nodns');
}
$idna_convert = new \Froxlor\Idna\IdnaWrapper();
return $idna_convert->decode($domain['domain']);
}
standard_error('dns_notfoundorallowed');
\Froxlor\UI\Response::standard_error('dns_notfoundorallowed');
}
public static function createDomainZone($domain_id, $froxlorhostname = false, $isMainButSubTo = false)

View File

@@ -141,14 +141,31 @@ class FileDir
*
* @return boolean|array
*/
public static function checkDisallowedPaths($path = null) {
public static function checkDisallowedPaths($path = null)
{
/*
* disallow base-directories and /
*/
$disallowed_values = array(
"/", "/bin/", "/boot/", "/dev/", "/etc/", "/home/", "/lib/", "/lib32/", "/lib64/",
"/opt/", "/proc/", "/root/", "/run/", "/sbin/", "/sys/", "/tmp/", "/usr/", "/var/"
"/",
"/bin/",
"/boot/",
"/dev/",
"/etc/",
"/home/",
"/lib/",
"/lib32/",
"/lib64/",
"/opt/",
"/proc/",
"/root/",
"/run/",
"/sbin/",
"/sys/",
"/tmp/",
"/usr/",
"/var/"
);
$path = self::makeCorrectDir($path);
@@ -559,6 +576,55 @@ class FileDir
return 'chattr ' . (($remove === true) ? '-i ' : '+i ');
}
}
public static function getFilesystemQuota()
{
// enabled at all?
if (Settings::Get('system.diskquota_enabled')) {
// set linux defaults
$repquota_params = "-np";
// $quota_line_regex = "/^#([0-9]+)\s*[+-]{2}\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)/i";
$quota_line_regex = "/^#([0-9]+)\s+[+-]{2}\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/i";
// check for freebsd - which needs other values
if (self::isFreeBSD()) {
$repquota_params = "-nu";
$quota_line_regex = "/^([0-9]+)\s+[+-]{2}\s+(\d+)\s+(\d+)\s+(\d+)\s+(\S+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\S+)/i";
}
// Fetch all quota in the desired partition
exec(Settings::Get('system.diskquota_repquota_path') . " " . $repquota_params . " " . escapeshellarg(Settings::Get('system.diskquota_customer_partition')), $repquota);
$usedquota = array();
foreach ($repquota as $tmpquota) {
// Let's see if the line matches a quota - line
if (preg_match($quota_line_regex, $tmpquota, $matches)) {
// It matches - put it into an array with userid as key (for easy lookup later)
$usedquota[$matches[1]] = array(
'block' => array(
'used' => $matches[2],
'soft' => $matches[3],
'hard' => $matches[4],
'grace' => (isFreeBSD() ? '0' : $matches[5])
),
'file' => array(
'used' => $matches[6],
'soft' => $matches[7],
'hard' => $matches[8],
'grace' => (isFreeBSD() ? '0' : $matches[9])
)
);
}
}
return $usedquota;
}
return false;
}
}
/**

View File

@@ -204,7 +204,7 @@ class Cronjob
$text = $lng['crondesc'][$row['desc_lng_key']];
$value = $lastrun;
eval("\$cronjobs_last_run .= \"" . getTemplate("index/overview_item") . "\";");
eval("\$cronjobs_last_run .= \"" . \Froxlor\UI\Template::getTemplate("index/overview_item") . "\";");
}
return $cronjobs_last_run;
@@ -302,7 +302,7 @@ class Cronjob
$value .= '</ul>';
$text = $lng['tasks']['outstanding_tasks'];
eval("\$outstanding_tasks = \"" . getTemplate("index/overview_item") . "\";");
eval("\$outstanding_tasks = \"" . \Froxlor\UI\Template::getTemplate("index/overview_item") . "\";");
return $outstanding_tasks;
}

211
lib/Froxlor/UI/HTML.php Normal file
View File

@@ -0,0 +1,211 @@
<?php
namespace Froxlor\UI;
class HTML
{
/**
* Return HTML Code for a checkbox
*
* @param string $name
* The fieldname
* @param string $title
* The captions
* @param string $value
* The Value which will be returned
* @param bool $break
* Add a <br /> at the end of the checkbox
* @param string $selvalue
* Values which will be selected by default
* @param bool $title_trusted
* Whether the title may contain html or not
* @param bool $value_trusted
* Whether the value may contain html or not
*
* @return string HTML Code
*/
public static function makecheckbox($name, $title, $value, $break = false, $selvalue = null, $title_trusted = false, $value_trusted = false)
{
if ($selvalue !== NULL && $value == $selvalue) {
$checked = 'checked="checked"';
} else if (isset($_SESSION['requestData'][$name])) {
$checked = 'checked="checked"';
} else {
$checked = '';
}
if (! $title_trusted) {
$title = htmlspecialchars($title);
}
if (! $value_trusted) {
$value = htmlspecialchars($value);
}
$checkbox = '<label class="nobr"><input type="checkbox" name="' . $name . '" value="' . $value . '" ' . $checked . ' />&nbsp;' . $title . '</label>';
if ($break) {
$checkbox .= '<br />';
}
return $checkbox;
}
/**
* Return HTML Code for an option within a <select>
*
* @param string $title
* The caption
* @param string $value
* The Value which will be returned
* @param string $selvalue
* Values which will be selected by default.
* @param bool $title_trusted
* Whether the title may contain html or not
* @param bool $value_trusted
* Whether the value may contain html or not
* @param int $id
* @param bool $disabled
*
* @return string HTML Code
*/
public static function makeoption($title, $value, $selvalue = null, $title_trusted = false, $value_trusted = false, $id = null, $disabled = false)
{
if ($selvalue !== null && ((is_array($selvalue) && in_array($value, $selvalue)) || $value == $selvalue)) {
$selected = 'selected="selected"';
} else {
$selected = '';
}
if ($disabled) {
$selected .= ' disabled="disabled"';
}
if (! $title_trusted) {
$title = htmlspecialchars($title);
}
if (! $value_trusted) {
$value = htmlspecialchars($value);
}
$id_str = ' ';
if ($id !== null) {
$id_str = 'id="' . $id . '"';
}
$option = '<option value="' . $value . '" ' . $id_str . $selected . ' >' . $title . '</option>';
return $option;
}
/**
* Returns HTML Code for two radio buttons with two choices: yes and no
*
* @param
* string Name of HTML-Variable
* @param
* string Value which will be returned if user chooses yes
* @param
* string Value which will be returned if user chooses no
* @param
* string Value which is chosen by default
* @param
* bool Whether this element is disabled or not (default: false)
* @return string HTML Code
* @author Florian Lippert <flo@syscp.org> (2003-2009)
* @author Froxlor team <team@froxlor.org> (2010-)
*/
public static function makeyesno($name, $yesvalue, $novalue = '', $yesselected = '', $disabled = false)
{
global $lng, $theme;
if ($disabled) {
$d = ' disabled="disabled"';
} else {
$d = '';
}
if (isset($_SESSION['requestData'])) {
$yesselected = $yesselected & $_SESSION['requestData'][$name];
}
return '<select class="dropdown_noborder" id="' . $name . '" name="' . $name . '"' . $d . '>
<option value="' . $yesvalue . '"' . ($yesselected ? ' selected="selected"' : '') . '>' . $lng['panel']['yes'] . '</option><option value="' . $novalue . '"' . ($yesselected ? '' : ' selected="selected"') . '>' . $lng['panel']['no'] . '</option></select>';
}
/**
* Prints Question on screen
*
* @param string $text
* The question
* @param string $yesfile
* File which will be called with POST if user clicks yes
* @param array $params
* Values which will be given to $yesfile. Format: array(variable1=>value1, variable2=>value2, variable3=>value3)
* @param string $targetname
* Name of the target eg Domain or eMail address etc.
* @param int $back_nr
* Number of steps to go back when "No" is pressed
*
* @author Florian Lippert <flo@syscp.org>
* @author Froxlor team <team@froxlor.org> (2010-)
*
* @return string outputs parsed question_yesno template
*/
public static function ask_yesno($text, $yesfile, $params = array(), $targetname = '', $back_nr = 1)
{
global $userinfo, $s, $header, $footer, $lng, $theme;
$hiddenparams = '';
if (is_array($params)) {
foreach ($params as $field => $value) {
$hiddenparams .= '<input type="hidden" name="' . htmlspecialchars($field) . '" value="' . htmlspecialchars($value) . '" />' . "\n";
}
}
if (isset($lng['question'][$text])) {
$text = $lng['question'][$text];
}
$text = strtr($text, array(
'%s' => $targetname
));
eval("echo \"" . Template::getTemplate('misc/question_yesno', '1') . "\";");
exit();
}
public static function ask_yesno_withcheckbox($text, $chk_text, $yesfile, $params = array(), $targetname = '', $show_checkbox = true)
{
global $userinfo, $s, $header, $footer, $lng, $theme;
$hiddenparams = '';
if (is_array($params)) {
foreach ($params as $field => $value) {
$hiddenparams .= '<input type="hidden" name="' . htmlspecialchars($field) . '" value="' . htmlspecialchars($value) . '" />' . "\n";
}
}
if (isset($lng['question'][$text])) {
$text = $lng['question'][$text];
}
if (isset($lng['question'][$chk_text])) {
$chk_text = $lng['question'][$chk_text];
}
if ($show_checkbox) {
$checkbox = self::makecheckbox('delete_userfiles', $chk_text, '1', false, '0', true, true);
} else {
$checkbox = '<input type="hidden" name="delete_userfiles" value="0" />' . "\n";
;
}
$text = strtr($text, array(
'%s' => $targetname
));
eval("echo \"" . Template::getTemplate('misc/question_yesno_checkbox', '1') . "\";");
exit();
}
}

349
lib/Froxlor/UI/HtmlForm.php Normal file
View File

@@ -0,0 +1,349 @@
<?php
namespace Froxlor\UI;
/**
* 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 Classes
*
*/
class HtmlForm
{
/**
* internal tmp-variable to store form
* @var string
*/
private static $_form = '';
private static $_filename = '';
public static function genHTMLForm($data = array())
{
global $lng, $theme;
$nob = false;
self::$_form = '';
foreach($data as $fdata)
{
$sections = $fdata['sections'];
foreach($sections as $section)
{
/*
* here be section title & image
*/
$title = $section['title'];
$image = $section['image'];
if(isset($section['visible']) && $section['visible'] === false)
{
continue;
}
if (!isset($section['nobuttons']) || $section['nobuttons'] == false) {
eval("self::\$_form .= \"" . Template::getTemplate("misc/form/table_section", "1") . "\";");
} else {
$nob = true;
}
$nexto = false;
foreach($section['fields'] as $fieldname => $fielddata)
{
if(isset($fielddata['visible']) && $fielddata['visible'] === false)
{
continue;
}
if ($nexto === false || (isset($fielddata['next_to']) && $nexto['field'] != $fielddata['next_to'])) {
$label = $fielddata['label'];
$desc = (isset($fielddata['desc']) ? $fielddata['desc'] : '');
$style = (isset($fielddata['style']) ? ' class="'.$fielddata['style'].'"' : '');
$mandatory = self::_getMandatoryFlag($fielddata);
$data_field = self::_parseDataField($fieldname, $fielddata);
if (isset($fielddata['has_nextto'])) {
$nexto = array('field' => $fieldname);
$data_field.='{NEXTTOFIELD_'.$fieldname.'}';
} else {
$nexto = false;
}
eval("self::\$_form .= \"" . Template::getTemplate("misc/form/table_row", "1") . "\";");
} else {
$data_field = self::_parseDataField($fieldname, $fielddata);
$data_field = str_replace("\t", "", $data_field);
$data_field = $fielddata['next_to_prefix'].$data_field;
self::$_form = str_replace(
'{NEXTTOFIELD_'.$fielddata['next_to'].'}',
$data_field,
self::$_form
);
$nexto = false;
}
}
}
}
// add save/reset buttons at the end of the form
if (!$nob) {
eval("self::\$_form .= \"" . Template::getTemplate("misc/form/table_end", "1") . "\";");
}
return self::$_form;
}
private static function _parseDataField($fieldname, $data = array())
{
switch($data['type'])
{
case 'text':
return self::_textBox($fieldname, $data); break;
case 'textul':
return self::_textBox($fieldname, $data, 'text', true); break;
case 'password':
return self::_textBox($fieldname, $data, 'password'); break;
case 'hidden':
return self::_textBox($fieldname, $data, 'hidden'); break;
case 'yesno':
return self::_yesnoBox($data); break;
case 'select':
return self::_selectBox($fieldname, $data); break;
case 'label':
return self::_labelField($data); break;
case 'textarea':
return self::_textArea($fieldname, $data); break;
case 'checkbox':
return self::_checkbox($fieldname, $data); break;
case 'file':
return self::_file($fieldname, $data); break;
case 'int':
return self::_int($fieldname, $data); break;
}
}
private static function _getMandatoryFlag($data = array())
{
if(isset($data['mandatory']))
{
return '&nbsp;<span class="red">*</span>';
}
elseif(isset($data['mandatory_ex']))
{
return '&nbsp;<span class="red">**</span>';
}
return '';
}
private static function _textBox($fieldname = '', $data = array(), $type = 'text', $unlimited = false)
{
$return = '';
$extras = '';
if(isset($data['maxlength'])) {
$extras .= ' maxlength="'.$data['maxlength'].'"';
}
if(isset($data['size'])) {
$extras .= ' size="'.$data['size'].'"';
}
if(isset($data['autocomplete'])) {
$extras .= ' autocomplete="'.$data['autocomplete'].'"';
}
// add support to save reloaded forms
if (isset($data['value'])) {
$value = $data['value'];
} elseif (isset($_SESSION['requestData'][$fieldname])) {
$value = $_SESSION['requestData'][$fieldname];
} else {
$value = '';
}
$ulfield = ($unlimited == true ? '&nbsp;'.$data['ul_field'] : '');
if(isset($data['display']) && $data['display'] != '')
{
$ulfield = '<strong>'.$data['display'].'</strong>';
}
eval("\$return = \"" . Template::getTemplate("misc/form/input_text", "1") . "\";");
return $return;
}
private static function _textArea($fieldname = '', $data = array())
{
$return = '';
$extras = '';
if(isset($data['cols'])) {
$extras .= ' cols="'.$data['cols'].'"';
}
if(isset($data['rows'])) {
$extras .= ' rows="'.$data['rows'].'"';
}
// add support to save reloaded forms
if (isset($data['value'])) {
$value = $data['value'];
} elseif (isset($_SESSION['requestData'][$fieldname])) {
$value = $_SESSION['requestData'][$fieldname];
} else {
$value = '';
}
trim($value);
eval("\$return = \"" . Template::getTemplate("misc/form/input_textarea", "1") . "\";");
return $return;
}
private static function _yesnoBox($data = array())
{
return $data['yesno_var'];
}
private static function _labelField($data = array())
{
return $data['value'];
}
private static function _selectBox($fieldname = '', $data = array())
{
// add support to save reloaded forms
if (isset($data['select_var'])) {
$select_var = $data['select_var'];
} elseif (isset($_SESSION['requestData'][$fieldname])) {
$select_var = $_SESSION['requestData'][$fieldname];
} else {
$select_var = '';
}
return '<select
id="'.$fieldname.'"
name="'.$fieldname.'"
'.(isset($data['class']) ? ' class="'.$data['class'] .'" ' : '').'
>'
.$select_var.
'</select>';
}
/**
* Function to generate checkboxes.
*
* <code>
* $data = array(
* 'label' => $lng['customer']['email_imap'],
* 'type' => 'checkbox',
* 'values' => array(
* array( 'label' => 'active',
* 'value' => '1'
* )
* ),
* 'value' => array('1'),
* 'mandatory' => true
* )
* </code>
*
* @param string $fieldname contains the fieldname
* @param array $data contains the data array
*/
public static function _checkbox($fieldname = '', $data = array()) {
// $data['value'] contains checked items
$checked = array();
if (isset($data['value'])) {
$checked = $data['value'];
}
if (isset($_SESSION['requestData'])) {
if(isset($_SESSION['requestData'][$fieldname])) {
$checked = array($_SESSION['requestData'][$fieldname]);
}
}
// default value is none, so the checkbox isn't an array
$isArray = '';
if (count($data['values']) > 1 || (isset($data['is_array']) && $data['is_array'] == 1)) {
$isArray = '[]';
}
// will contain the output
$output = "";
foreach($data['values'] as $val) {
$key = $val['label'];
// is this box checked?
$isChecked = '';
if (is_array($checked) && count($checked) > 0) {
foreach($checked as $tmp) {
if ($tmp == $val['value']) {
$isChecked = ' checked="checked" ';
break;
}
}
}
$output .= '<label>';
if (empty($isArray)) {
$output .= '<input type="hidden" name="'.$fieldname.'" value="0" />';
}
$output .= '<input type="checkbox" name="'.$fieldname.$isArray.'" value="'.$val['value'].'" '.$isChecked.'/>';
$output .= $key.'</label>';
}
return $output;
}
private static function _file($fieldname = '', $data = array())
{
$return = '';
$extras = '';
if(isset($data['maxlength'])) {
$extras .= ' maxlength="'.$data['maxlength'].'"';
}
// add support to save reloaded forms
if (isset($data['value'])) {
$value = $data['value'];
} elseif (isset($_SESSION['requestData'][$fieldname])) {
$value = $_SESSION['requestData'][$fieldname];
} else {
$value = '';
}
if(isset($data['display']) && $data['display'] != '')
{
$ulfield = '<strong>'.$data['display'].'</strong>';
}
eval("\$return = \"" . Template::getTemplate("misc/form/input_file", "1") . "\";");
return $return;
}
private static function _int($fieldname = '', $data = array())
{
$return = '';
$extras = '';
if(isset($data['int_min'])) {
$extras .= ' min="'.$data['int_min'].'"';
}
if(isset($data['int_max'])) {
$extras .= ' max="'.$data['int_max'].'"';
}
// add support to save reloaded forms
if (isset($data['value'])) {
$value = $data['value'];
} elseif (isset($_SESSION['requestData'][$fieldname])) {
$value = $_SESSION['requestData'][$fieldname];
} else {
$value = '';
}
$type = 'number';
$ulfield = '';
eval("\$return = \"" . Template::getTemplate("misc/form/input_text", "1") . "\";");
return $return;
}
}

173
lib/Froxlor/UI/Linker.php Normal file
View File

@@ -0,0 +1,173 @@
<?php
namespace Froxlor\UI;
/**
* 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 Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Panel
*
*/
class Linker
{
private $protocol = '';
private $username = '';
private $password = '';
private $hostname = '';
private $port = 80;
private $filename = 'index.php';
private $args = array();
public function __construct($file = 'index.php', $sessionid = '', $hostname = '', $protocol = '', $port = '', $username = '', $password = '')
{
// Set the basic parts of our URL
$this->protocol = $protocol;
$this->username = $username;
$this->password = $password;
$this->hostname = $hostname;
$this->port = $port;
$this->filename = $file;
// @TODO: Remove this
$this->args['s'] = $sessionid;
}
public function __set($key, $value)
{
switch (strtolower($key)) {
case 'protocol':
$this->protocol = $value;
break;
case 'username':
$this->username = $value;
break;
case 'password':
$this->password = $value;
break;
case 'hostname':
$this->hostname = $value;
break;
case 'port':
$this->port = $value;
break;
case 'filename':
$this->filename = $value;
break;
default:
return false;
}
return true;
}
public function add($key, $value)
{
// Add a new value to our parameters (overwrite = enabled)
$this->args[$key] = $value;
}
public function del($key)
{
// If the key exists in our array -> delete it
if (isset($this->args[$key])) {
unset($this->args[$key]);
}
}
public function delAll()
{
// Just resetting the array
// Until the sessionid can be removed: save it
// @TODO: Remove this
$this->args = array(
's' => $this->args['s']
);
}
public function getLink()
{
$link = '';
// Build the basic URL
if (strlen($this->protocol) > 0 && strlen($this->hostname) > 0) {
$link = $this->protocol . '://';
}
// Let's see if we shall use a username in the URL
// This is only available if a hostname is used as well
if (strlen($this->username) > 0 && strlen($this->hostname) > 0) {
$link .= urlencode($this->username);
// Maybe we even have to append a password?
if ($this->password != '') {
$link .= ':' . urlencode($this->password);
}
// At least a username was given, add the @ to allow appending the hostname
$link .= '@';
}
// Add hostname, port and filename to the URL
if (strlen($this->hostname) > 0) {
$link .= $this->hostname;
// A port may only be used if hostname is used as well
if (strlen($this->port) > 0) {
$link .= ':' . $this->port;
}
}
// Overwrite $this->args with parameters of this function (if necessary)
if (func_num_args() == 1 && is_array(func_get_arg(0))) {
$arguments = func_get_arg(0);
$this->args = array_merge($this->args, $arguments);
}
// temporary until frontcontroller exists
// We got a section in the URL -> morph AREA and section into filename
// @TODO: Remove this
if (isset($this->args['section']) && strlen($this->args['section']) > 0) {
$link .= AREA . '_' . $this->args['section'] . '.php';
unset($this->args['section']);
} else {
// filename has a prefixed slash
$link .= $this->filename;
}
// Let's see if we are done (no arguments in query)
if (count($this->args) == 0) {
return $link;
}
// We have parameters, add them with a "?"
$link .= "?";
// Loop through arguments and add them to the link
foreach ($this->args as $key => $value) {
// For all but the first argument, prepend "&amp;"
if (substr($link, - 1) != "?") {
$link .= "&";
}
// Encode parameters and add them to the link
$link .= urlencode($key) . '=' . urlencode($value);
}
// Reset our class for further use
$this->delAll();
return $link;
}
}

520
lib/Froxlor/UI/Paging.php Normal file
View File

@@ -0,0 +1,520 @@
<?php
namespace Froxlor\UI;
/**
* 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 Classes
*
*/
/**
* Class to manage paging system
*
* @package Functions
*/
class Paging
{
/**
* Userinfo
*
* @var array
*/
private $userinfo = array();
/**
* MySQL-Table
*
* @var string
*/
private $table = '';
/**
* Fields with description which should be selectable
*
* @var array
*/
private $fields = array();
/**
* Entries per page
*
* @var int
*/
private $entriesperpage = 0;
/**
* Number of entries of table
*
* @var int
*/
private $entries = 0;
/**
* Sortorder, asc or desc
*
* @var string
*/
public $sortorder = 'asc';
/**
* Sortfield
*
* @var string
*/
public $sortfield = '';
/**
* Searchfield
*
* @var string
*/
private $searchfield = '';
/**
* Searchtext
*
* @var string
*/
private $searchtext = '';
/**
* Pagenumber
*
* @var int
*/
private $pageno = 0;
/**
* Switch natsorting on/off
*
* @var bool
*/
private $natSorting = false;
private $_limit = 0;
/**
* Class constructor.
* Loads settings from request or from userdata and saves them to session.
*
* @param
* array userinfo
* @param
* string Name of Table
* @param
* array Fields, in format array( 'fieldname_in_mysql' => 'field_caption' )
* @param
* int *deprecated* entries per page
* @param
* bool *deprecated* Switch natsorting on/off (global, affects all calls of sort)
* @param int $default_field
* default sorting-field-index
* @param string $default_order
* default sorting order 'asc' or 'desc'
*
*/
public function __construct($userinfo, $table, $fields, $entriesperpage = 0, $natSorting = false, $default_field = 0, $default_order = 'asc', $limit = 0)
{
// entries per page and natsorting-flag are not
// passed as parameter anymore, because these are
// from the settings anyway
$entriesperpage = \Froxlor\Settings::Get('panel.paging');
$natSorting = \Froxlor\Settings::Get('panel.natsorting');
$this->userinfo = $userinfo;
if (! is_array($this->userinfo['lastpaging'])) {
$this->userinfo['lastpaging'] = json_decode($this->userinfo['lastpaging'], true);
}
$this->table = $table;
$this->fields = $fields;
$this->entriesperpage = $entriesperpage;
$this->natSorting = $natSorting;
$checklastpaging = (isset($this->userinfo['lastpaging']['table']) && $this->userinfo['lastpaging']['table'] == $this->table);
$this->userinfo['lastpaging']['table'] = $this->table;
if (isset($_REQUEST['sortorder']) && (strtolower($_REQUEST['sortorder']) == 'desc' || strtolower($_REQUEST['sortorder']) == 'asc')) {
$this->sortorder = strtolower($_REQUEST['sortorder']);
} else {
if ($checklastpaging && isset($this->userinfo['lastpaging']['sortorder']) && (strtolower($this->userinfo['lastpaging']['sortorder']) == 'desc' || strtolower($this->userinfo['lastpaging']['sortorder']) == 'asc')) {
$this->sortorder = strtolower($this->userinfo['lastpaging']['sortorder']);
} else {
$this->sortorder = $default_order;
}
}
$this->userinfo['lastpaging']['sortorder'] = $this->sortorder;
if (isset($_REQUEST['sortfield']) && isset($fields[$_REQUEST['sortfield']])) {
$this->sortfield = $_REQUEST['sortfield'];
} else {
if ($checklastpaging && isset($this->userinfo['lastpaging']['sortfield']) && isset($fields[$this->userinfo['lastpaging']['sortfield']])) {
$this->sortfield = $this->userinfo['lastpaging']['sortfield'];
} else {
$fieldnames = array_keys($fields);
$this->sortfield = $fieldnames[$default_field];
}
}
$this->userinfo['lastpaging']['sortfield'] = $this->sortfield;
if (isset($_REQUEST['searchfield']) && isset($fields[$_REQUEST['searchfield']])) {
$this->searchfield = $_REQUEST['searchfield'];
} else {
if ($checklastpaging && isset($this->userinfo['lastpaging']['searchfield']) && isset($fields[$this->userinfo['lastpaging']['searchfield']])) {
$this->searchfield = $this->userinfo['lastpaging']['searchfield'];
} else {
$fieldnames = array_keys($fields);
$this->searchfield = $fieldnames[0];
}
}
$this->userinfo['lastpaging']['searchfield'] = $this->searchfield;
if (isset($_REQUEST['searchtext']) && (preg_match('/[-_@\p{L}\p{N}*.]+$/u', $_REQUEST['searchtext']) || $_REQUEST['searchtext'] === '')) {
$this->searchtext = trim($_REQUEST['searchtext']);
} else {
if ($checklastpaging && isset($this->userinfo['lastpaging']['searchtext']) && preg_match('/[-_@\p{L}\p{N}*.]+$/u', $this->userinfo['lastpaging']['searchtext'])) {
$this->searchtext = $this->userinfo['lastpaging']['searchtext'];
} else {
$this->searchtext = '';
}
}
$this->userinfo['lastpaging']['searchtext'] = $this->searchtext;
if (isset($_REQUEST['pageno']) && intval($_REQUEST['pageno']) != 0) {
$this->pageno = intval($_REQUEST['pageno']);
} else {
if ($checklastpaging && isset($this->userinfo['lastpaging']['pageno']) && intval($this->userinfo['lastpaging']['pageno']) != 0) {
$this->pageno = intval($this->userinfo['lastpaging']['pageno']);
} else {
$this->pageno = 1;
}
}
$this->userinfo['lastpaging']['pageno'] = $this->pageno;
$upd_stmt = \Froxlor\Database\Database::prepare("
UPDATE `" . TABLE_PANEL_SESSIONS . "` SET
`lastpaging` = :lastpaging
WHERE `hash` = :hash AND `userid` = :userid
AND `ipaddress` = :ipaddr AND `useragent` = :ua
AND `adminsession` = :adminsession
");
$upd_data = array(
'lastpaging' => json_encode($this->userinfo['lastpaging']),
'hash' => $userinfo['hash'],
'userid' => $userinfo['userid'],
'ipaddr' => $userinfo['ipaddress'],
'ua' => $userinfo['useragent'],
'adminsession' => $userinfo['adminsession']
);
\Froxlor\Database\Database::pexecute($upd_stmt, $upd_data);
$this->_limit = $limit;
}
/**
* Sets number of entries and adjusts pageno if the number of entries doesn't correspond to the pageno.
*
* @param
* int entries
*/
public function setEntries($entries)
{
$this->entries = $entries;
if (($this->pageno - 1) * $this->entriesperpage > $this->entries) {
$this->pageno = 1;
}
return true;
}
/**
* Checks if a row should be displayed or not, used in loops
*
* @param
* int number of row
* @return bool to display or not to display, that's the question
*/
public function checkDisplay($count)
{
$begin = (intval($this->pageno) - 1) * intval($this->entriesperpage);
$end = (intval($this->pageno) * intval($this->entriesperpage));
return (($count >= $begin && $count < $end) || $this->entriesperpage == 0);
}
/**
* Returns condition code for sql query
*
* @param
* bool should returned condition code start with WHERE (false) or AND (true)?
* @return string the condition code
*/
public function getSqlWhere($append = false)
{
if ($this->searchtext != '') {
if ($append == true) {
$condition = ' AND ';
} else {
$condition = ' WHERE ';
}
$searchfield = explode('.', $this->searchfield);
foreach ($searchfield as $id => $field) {
if (substr($field, - 1, 1) != '`') {
$field .= '`';
}
if ($field{0} != '`') {
$field = '`' . $field;
}
$searchfield[$id] = $field;
}
$searchfield = implode('.', $searchfield);
$ops = array(
'<',
'>',
'='
);
// check if we use an operator or not
$useOper = 0;
$oper = "=";
if (in_array(substr($this->searchtext, 0, 1), $ops)) {
$useOper = 1;
$oper = substr($this->searchtext, 0, 1);
}
// check for diskspace and whether searchtext is a number
// in any other case the logical-operators would make no sense
if (strpos($searchfield, 'diskspace') > 0 && is_numeric(substr($this->searchtext, $useOper))) {
// anything with diskspace is *1024
$searchtext = ((int) substr($this->searchtext, $useOper)) * 1024;
$useOper = 1;
} elseif (strpos($searchfield, 'traffic') > 0 && is_numeric(substr($this->searchtext, $useOper))) {
// anything with traffic is *1024*1024
$searchtext = ((int) substr($this->searchtext, $useOper)) * 1024 * 1024;
$useOper = 1;
} else {
// any other field
$searchtext = substr($this->searchtext, $useOper);
}
if ($useOper == 1 && is_numeric(substr($this->searchtext, $useOper))) {
// now as we use >, < or = we use the given operator and not LIKE
$condition .= $searchfield . " " . $oper . " " . \Froxlor\Database\Database::quote($searchtext);
} else {
$searchtext = str_replace('*', '%', $this->searchtext);
// append wildcards if user did not enter any
if (strpos($searchtext, '%') === false)
$searchtext = '%' . $searchtext . '%';
$condition .= $searchfield . " LIKE " . \Froxlor\Database\Database::quote($searchtext);
}
} else {
$condition = '';
}
return $condition;
}
/**
* Returns "order by"-code for sql query
*
* @param
* bool Switch natsorting on/off (local, affects just this call)
* @return string the "order by"-code
*/
public function getSqlOrderBy($natSorting = null)
{
$sortfield = explode('.', $this->sortfield);
foreach ($sortfield as $id => $field) {
if (substr($field, - 1, 1) != '`') {
$field .= '`';
}
if ($field{0} != '`') {
$field = '`' . $field;
}
$sortfield[$id] = $field;
}
$sortfield = implode('.', $sortfield);
$sortorder = strtoupper($this->sortorder);
if ($natSorting == true || ($natSorting === null && $this->natSorting == true)) {
// Acts similar to php's natsort(), found in one comment at http://my.opera.com/cpr/blog/show.dml/160556
$sortcode = "ORDER BY CONCAT( IF( ASCII( LEFT( " . $sortfield . ", 5 ) ) > 57,
LEFT( " . $sortfield . ", 1 ), 0 ),
IF( ASCII( RIGHT( " . $sortfield . ", 1 ) ) > 57,
LPAD( " . $sortfield . ", 255, '0' ),
LPAD( CONCAT( " . $sortfield . ", '-' ), 255, '0' )
)) " . $sortorder;
} else {
$sortcode = 'ORDER BY ' . $sortfield . ' ' . $sortorder;
}
return $sortcode;
}
/**
* Currently not used
*
* @return string always empty
*/
public function getSqlLimit()
{
if ($this->_limit > 0) {
$_offset = ($this->pageno - 1) * $this->_limit;
return ' LIMIT ' . $_offset . ',' . $this->_limit;
}
/**
* currently not in use
*/
return '';
}
/**
* Returns html code for sorting field
*
* @param
* array Language array
* @return string the html sortcode
*/
public function getHtmlSortCode($lng, $break = false)
{
$sortcode = '';
$fieldoptions = '';
$orderoptions = '';
foreach ($this->fields as $fieldname => $fieldcaption) {
$fieldoptions .= HTML::makeoption($fieldcaption, $fieldname, $this->sortfield, true, true);
}
$breakorws = ($break ? '<br />' : '&nbsp;');
foreach (array(
'asc' => $lng['panel']['ascending'],
'desc' => $lng['panel']['descending']
) as $sortordertype => $sortorderdescription) {
$orderoptions .= HTML::makeoption($sortorderdescription, $sortordertype, $this->sortorder, true, true);
}
eval("\$sortcode =\"" . Template::getTemplate("misc/htmlsortcode", '1') . "\";");
return $sortcode;
}
/**
* Returns html code for sorting arrows
*
* @param
* string URL to use as base for links
* @param
* string If set, only this field will be returned
* @return mixed An array or a string (if field is set) of html code of arrows
*/
public function getHtmlArrowCode($baseurl, $field = '')
{
global $theme;
if ($field != '' && isset($this->fields[$field])) {
$baseurl = htmlspecialchars($baseurl);
$fieldname = htmlspecialchars($field);
eval("\$arrowcode =\"" . Template::getTemplate("misc/htmlarrowcode", '1') . "\";");
} else {
$baseurl = htmlspecialchars($baseurl);
$arrowcode = array();
foreach ($this->fields as $fieldname => $fieldcaption) {
$fieldname = htmlspecialchars($fieldname);
eval("\$arrowcode[\$fieldname] =\"" . Template::getTemplate("misc/htmlarrowcode", '1') . "\";");
}
}
return $arrowcode;
}
/**
* Returns html code for searching field
*
* @param
* array Language array
* @return string the html searchcode
*/
public function getHtmlSearchCode($lng)
{
$searchcode = '';
$fieldoptions = '';
$searchtext = htmlspecialchars($this->searchtext);
foreach ($this->fields as $fieldname => $fieldcaption) {
$fieldoptions .= HTML::makeoption($fieldcaption, $fieldname, $this->searchfield, true, true);
}
eval("\$searchcode =\"" . Template::getTemplate("misc/htmlsearchcode", '1') . "\";");
return $searchcode;
}
/**
* Returns html code for paging
*
* @param
* string URL to use as base for links
* @return string the html pagingcode
*/
public function getHtmlPagingCode($baseurl)
{
if ($this->entriesperpage == 0) {
return '';
} else {
$pages = intval($this->entries / $this->entriesperpage);
}
if ($this->entries % $this->entriesperpage != 0) {
$pages ++;
}
if ($pages > 1) {
$start = $this->pageno - 4;
if ($start < 1) {
$start = 1;
}
$stop = $this->pageno + 4;
if ($stop > $pages) {
$stop = $pages;
}
$pagingcode = '<a href="' . htmlspecialchars($baseurl) . '&amp;pageno=1">&laquo;</a> <a href="' . htmlspecialchars($baseurl) . '&amp;pageno=' . ((intval($this->pageno) - 1) == 0 ? '1' : intval($this->pageno) - 1) . '">&lt;</a>&nbsp;';
for ($i = $start; $i <= $stop; $i ++) {
if ($i != $this->pageno) {
$pagingcode .= ' <a href="' . htmlspecialchars($baseurl) . '&amp;pageno=' . $i . '">' . $i . '</a>&nbsp;';
} else {
$pagingcode .= ' <strong>' . $i . '</strong>&nbsp;';
}
}
$pagingcode .= ' <a href="' . htmlspecialchars($baseurl) . '&amp;pageno=' . ((intval($this->pageno) + 1) > $pages ? $pages : intval($this->pageno) + 1) . '">&gt;</a> <a href="' . $baseurl . '&amp;pageno=' . $pages . '">&raquo;</a>';
} else {
$pagingcode = '';
}
return $pagingcode;
}
}

181
lib/Froxlor/UI/Response.php Normal file
View File

@@ -0,0 +1,181 @@
<?php
namespace Froxlor\UI;
class Response
{
/**
* Sends an header ( 'Location ...' ) to the browser.
*
* @param string $destination
* Destination
* @param array $get_variables
* Get-Variables
* @param boolean $isRelative
* if the target we are creating for a redirect
* should be a relative or an absolute url
*
* @return boolean false if params is not an array
*/
public static function redirectTo($destination, $get_variables = null, $isRelative = true)
{
global $s;
if (is_array($get_variables)) {
if (isset($get_variables['s'])) {
$linker = new Linker($destination, $get_variables['s']);
} else {
$linker = new Linker($destination, $s);
}
foreach ($get_variables as $key => $value) {
$linker->add($key, $value);
}
if ($isRelative) {
$linker->protocol = '';
$linker->hostname = '';
$path = './';
} else {
if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') {
$linker->protocol = 'https';
} else {
$linker->protocol = 'http';
}
$linker->hostname = $_SERVER['HTTP_HOST'];
if (dirname($_SERVER['PHP_SELF']) == '/') {
$path = '/';
} else {
$path = dirname($_SERVER['PHP_SELF']) . '/';
}
$linker->filename = $path . $destination;
}
header('Location: ' . $linker->getLink());
exit();
} elseif ($get_variables == null) {
if ($isRelative) {
$linker = new Linker($destination, $s);
} else {
$linker = new Linker($destination);
}
header('Location: ' . $linker->getLink());
exit();
}
return false;
}
/**
* Prints one ore more errormessages on screen
*
* @param array $errors
* Errormessages
* @param string $replacer
* A %s in the errormessage will be replaced by this string.
* @param bool $throw_exception
*
* @author Florian Lippert <flo@syscp.org>
* @author Ron Brand <ron.brand@web.de>
*/
public static function standard_error($errors = '', $replacer = '', $throw_exception = false)
{
global $userinfo, $s, $header, $footer, $lng, $theme;
$_SESSION['requestData'] = $_POST;
$replacer = htmlentities($replacer);
if (! is_array($errors)) {
$errors = array(
$errors
);
}
$link = '';
if (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']) !== false) {
$link = '<a href="' . htmlentities($_SERVER['HTTP_REFERER']) . '">' . $lng['panel']['back'] . '</a>';
}
$error = '';
foreach ($errors as $single_error) {
if (isset($lng['error'][$single_error])) {
$single_error = $lng['error'][$single_error];
$single_error = strtr($single_error, array(
'%s' => $replacer
));
} else {
$error = 'Unknown Error (' . $single_error . '): ' . $replacer;
break;
}
if (empty($error)) {
$error = $single_error;
} else {
$error .= ' ' . $single_error;
}
}
if ($throw_exception) {
throw new \Exception(strip_tags($error), 400);
}
eval("echo \"" . Template::getTemplate('misc/error', '1') . "\";");
exit();
}
public static function dynamic_error($message)
{
global $userinfo, $s, $header, $footer, $lng, $theme;
$_SESSION['requestData'] = $_POST;
$link = '';
if (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']) !== false) {
$link = '<a href="' . htmlentities($_SERVER['HTTP_REFERER']) . '">' . $lng['panel']['back'] . '</a>';
}
$error = $message;
eval("echo \"" . Template::getTemplate('misc/error', '1') . "\";");
exit();
}
/**
* Prints one ore more errormessages on screen
*
* @param array $success_message
* Errormessages
* @param string $replacer
* A %s in the errormessage will be replaced by this string.
* @param array $params
* @param bool $throw_exception
*
* @author Florian Lippert <flo@syscp.org>
*/
public static function standard_success($success_message = '', $replacer = '', $params = array(), $throw_exception = false)
{
global $s, $header, $footer, $lng, $theme;
if (isset($lng['success'][$success_message])) {
$success_message = strtr($lng['success'][$success_message], array(
'%s' => htmlentities($replacer)
));
}
if ($throw_exception) {
throw new \Exception(strip_tags($success_message), 200);
}
if (is_array($params) && isset($params['filename'])) {
$redirect_url = $params['filename'] . '?s=' . $s;
unset($params['filename']);
foreach ($params as $varname => $value) {
if ($value != '') {
$redirect_url .= '&amp;' . $varname . '=' . $value;
}
}
} else {
$redirect_url = '';
}
eval("echo \"" . Template::getTemplate('misc/success', '1') . "\";");
exit();
}
}

125
lib/Froxlor/UI/Template.php Normal file
View File

@@ -0,0 +1,125 @@
<?php
namespace Froxlor\UI;
class Template
{
/**
* returns an array for the settings-array
*
* @return array
*/
public static function getThemes()
{
$themespath = \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir() . '/templates/');
$themes_available = array();
if (is_dir($themespath)) {
$its = new \DirectoryIterator($themespath);
foreach ($its as $it) {
if ($it->isDir() && $it->getFilename() != '.' && $it->getFilename() != '..' && $it->getFilename() != 'misc') {
$theme = $themespath . $it->getFilename();
if (file_exists($theme . '/config.json')) {
$themeconfig = json_decode(file_get_contents($theme . '/config.json'), true);
if (array_key_exists('variants', $themeconfig) && is_array($themeconfig['variants'])) {
foreach ($themeconfig['variants'] as $variant => $data) {
if ($variant == "default") {
$themes_available[$it->getFilename()] = $it->getFilename();
} elseif (array_key_exists('description', $data)) {
$themes_available[$it->getFilename() . '_' . $variant] = $data['description'];
} else {
$themes_available[$it->getFilename() . '_' . $variant] = $it->getFilename() . ' (' . $variant . ')';
}
}
} else {
$themes_available[$it->getFilename()] = $it->getFilename();
}
}
}
}
}
return $themes_available;
}
/**
* Get template from filesystem
*
* @param
* string Templatename
* @param
* string noarea If area should be used to get template
* @return string The Template
* @author Florian Lippert <flo@syscp.org>
*/
public static function getTemplate($template, $noarea = 0)
{
global $templatecache, $theme;
$fallback_theme = 'Sparkle';
if (! isset($theme) || $theme == '') {
$theme = $fallback_theme;
}
if ($noarea != 1) {
$template = AREA . '/' . $template;
}
if (! isset($templatecache[$theme][$template])) {
$filename = \Froxlor\Froxlor::getInstallDir() . 'templates/' . $theme . '/' . $template . '.tpl';
// check the current selected theme for the template
$templatefile = self::_checkAndParseTpl($filename);
if ($templatefile == false && $theme != $fallback_theme) {
// check fallback
$_filename = \Froxlor\Froxlor::getInstallDir() . 'templates/' . $fallback_theme . '/' . $template . '.tpl';
$templatefile = self::_checkAndParseTpl($_filename);
if ($templatefile == false) {
// check for old layout
$_filename = \Froxlor\Froxlor::getInstallDir() . 'templates/' . $template . '.tpl';
$templatefile = self::_checkAndParseTpl($_filename);
if ($templatefile == false) {
// not found
$templatefile = 'TEMPLATE NOT FOUND: ' . $filename;
}
}
}
$output = $templatefile;
$templatecache[$theme][$template] = $output;
}
return $templatecache[$theme][$template];
}
/**
* check whether a tpl file exists and if so, return it's content or else return false
*
* @param string $filename
*
* @return string|bool content on success, else false
*/
private static function _checkAndParseTpl($filename)
{
$templatefile = "";
if (file_exists($filename) && is_readable($filename)) {
$templatefile = addcslashes(file_get_contents($filename), '"\\');
// loop through template more than once in case we have an "if"-statement in another one
while (preg_match('/<if[ \t]*(.*)>(.*)(<\/if>|<else>(.*)<\/if>)/Uis', $templatefile)) {
$templatefile = preg_replace('/<if[ \t]*(.*)>(.*)(<\/if>|<else>(.*)<\/if>)/Uis', '".( ($1) ? ("$2") : ("$4") )."', $templatefile);
$templatefile = str_replace('\\\\', '\\', $templatefile);
}
return $templatefile;
}
return false;
}
}

View File

@@ -0,0 +1,205 @@
<?php
namespace Froxlor\Validate;
use Froxlor\Settings;
class Check
{
public static function checkFcgidPhpFpm($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
{
$returnvalue = array(
FORMFIELDS_PLAUSIBILITY_CHECK_OK
);
$check_array = array(
'system_mod_fcgid_enabled' => array(
'other_post_field' => 'system_phpfpm_enabled',
'other_enabled' => 'phpfpm.enabled',
'other_enabled_lng' => 'phpfpmstillenabled',
'deactivate' => array(
'phpfpm.enabled_ownvhost' => 0
)
),
'system_phpfpm_enabled' => array(
'other_post_field' => 'system_mod_fcgid_enabled',
'other_enabled' => 'system.mod_fcgid',
'other_enabled_lng' => 'fcgidstillenabled',
'deactivate' => array(
'system.mod_fcgid_ownvhost' => 0
)
)
);
// interface is to be enabled
if ((int) $newfieldvalue == 1) {
// check for POST value of the other field == 1 (active)
if (isset($_POST[$check_array[$fieldname]['other_post_field']]) && (int) $_POST[$check_array[$fieldname]['other_post_field']] == 1) {
// the other interface is activated already and STAYS activated
if ((int) Settings::Get($check_array[$fieldname]['other_enabled']) == 1) {
$returnvalue = array(
FORMFIELDS_PLAUSIBILITY_CHECK_ERROR,
$check_array[$fieldname]['other_enabled_lng']
);
} else {
// fcgid is being validated before fpm -> "ask" fpm about its state
if ($fieldname == 'system_mod_fcgid_enabled') {
$returnvalue = self::checkFcgidPhpFpm('system_phpfpm_enabled', null, $check_array[$fieldname]['other_post_field'], null);
} else {
// not, bot are nogo
$returnvalue = $returnvalue = array(
FORMFIELDS_PLAUSIBILITY_CHECK_ERROR,
'fcgidandphpfpmnogoodtogether'
);
}
}
}
if (in_array(FORMFIELDS_PLAUSIBILITY_CHECK_OK, $returnvalue)) {
// be sure to deactivate the other one for the froxlor-vhost
// to avoid having a settings-deadlock
foreach ($check_array[$fieldname]['deactivate'] as $setting => $value) {
Settings::Set($setting, $value, true);
}
}
}
return $returnvalue;
}
public function checkMysqlAccessHost($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
{
$mysql_access_host_array = array_map('trim', explode(',', $newfieldvalue));
foreach ($mysql_access_host_array as $host_entry) {
if (Validate::validate_ip2($host_entry, true, 'invalidip', true, true) == false && Validate::validateDomain($host_entry) == false && Validate::validateLocalHostname($host_entry) == false && $host_entry != '%') {
return array(
FORMFIELDS_PLAUSIBILITY_CHECK_ERROR,
'invalidmysqlhost',
$host_entry
);
}
}
return array(
FORMFIELDS_PLAUSIBILITY_CHECK_OK
);
}
public static function checkHostname($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
{
if (0 == strlen(trim($newfieldvalue)) || Validate::validateDomain($newfieldvalue) === false) {
return array(
FORMFIELDS_PLAUSIBILITY_CHECK_ERROR,
'invalidhostname'
);
} else {
return array(
FORMFIELDS_PLAUSIBILITY_CHECK_OK
);
}
}
/**
* check whether an email account is to be deleted
* reference: #1519
*
* @return bool true if the domain is to be deleted, false otherwise
*
*/
public static function checkMailAccDeletionState($email_addr = null)
{
// example data of task 7: a:2:{s:9:"loginname";s:4:"webX";s:5:"email";s:20:"deleteme@example.tld";}
// check for task
$result_tasks_stmt = \Froxlor\Database\Database::prepare("
SELECT * FROM `" . TABLE_PANEL_TASKS . "` WHERE `type` = '7' AND `data` LIKE :emailaddr
");
\Froxlor\Database\Database::pexecute($result_tasks_stmt, array(
'emailaddr' => "%" . $email_addr . "%"
));
$num_results = \Froxlor\Database\Database::num_rows();
// is there a task for deleting this email account?
if ($num_results > 0) {
return true;
}
return false;
}
public static function checkPathConflicts($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
{
if ((int) Settings::Get('system.mod_fcgid') == 1) {
// fcgid-configdir has changed -> check against customer-doc-prefix
if ($fieldname == "system_mod_fcgid_configdir") {
$newdir = \Froxlor\FileDir::makeCorrectDir($newfieldvalue);
$cdir = \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.documentroot_prefix'));
} // customer-doc-prefix has changed -> check against fcgid-configdir
elseif ($fieldname == "system_documentroot_prefix") {
$newdir = \Froxlor\FileDir::makeCorrectDir($newfieldvalue);
$cdir = \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.mod_fcgid_configdir'));
}
// neither dir can be within the other nor can they be equal
if (substr($newdir, 0, strlen($cdir)) == $cdir || substr($cdir, 0, strlen($newdir)) == $newdir || $newdir == $cdir) {
$returnvalue = array(
FORMFIELDS_PLAUSIBILITY_CHECK_ERROR,
'fcgidpathcannotbeincustomerdoc'
);
} else {
$returnvalue = array(
FORMFIELDS_PLAUSIBILITY_CHECK_OK
);
}
} else {
$returnvalue = array(
FORMFIELDS_PLAUSIBILITY_CHECK_OK
);
}
return $returnvalue;
}
public static function checkPhpInterfaceSetting($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
{
$returnvalue = array(
FORMFIELDS_PLAUSIBILITY_CHECK_OK
);
if ((int) Settings::Get('system.mod_fcgid') == 1) {
// fcgid only works for apache and lighttpd
if (strtolower($newfieldvalue) != 'apache2' && strtolower($newfieldvalue) != 'lighttpd') {
$returnvalue = array(
FORMFIELDS_PLAUSIBILITY_CHECK_ERROR,
'fcgidstillenableddeadlock'
);
}
}
return $returnvalue;
}
public static function checkUsername($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
{
if (! isset($allnewfieldvalues['customer_mysqlprefix'])) {
$allnewfieldvalues['customer_mysqlprefix'] = Settings::Get('customer.mysqlprefix');
}
$returnvalue = array();
if (validateUsername($newfieldvalue, Settings::Get('panel.unix_names'), 14 - strlen($allnewfieldvalues['customer_mysqlprefix'])) === true) {
$returnvalue = array(
FORMFIELDS_PLAUSIBILITY_CHECK_OK
);
} else {
$errmsg = 'accountprefixiswrong';
if ($fieldname == 'customer_mysqlprefix') {
$errmsg = 'mysqlprefixiswrong';
}
$returnvalue = array(
FORMFIELDS_PLAUSIBILITY_CHECK_ERROR,
$errmsg
);
}
return $returnvalue;
}
}

View File

@@ -1,8 +1,6 @@
<?php
namespace Froxlor\Validate;
use Froxlor\Settings;
class Validate
{
@@ -62,7 +60,7 @@ class Validate
$lng = 'stringformaterror';
}
standard_error($lng, $fieldname, $throw_exception);
\Froxlor\UI\Response::standard_error($lng, $fieldname, $throw_exception);
exit();
}
@@ -72,7 +70,7 @@ class Validate
* @param string $ip
* ip-address to check
* @param bool $return_bool
* whether to return bool or call standard_error()
* whether to return bool or call \Froxlor\UI\Response::standard_error()
* @param string $lng
* index for error-message (if $return_bool is false)
* @param bool $allow_localhost
@@ -100,7 +98,7 @@ class Validate
if ($return_bool) {
return false;
} else {
standard_error($lng, $ip, $throw_exception);
\Froxlor\UI\Response::standard_error($lng, $ip, $throw_exception);
exit();
}
}
@@ -119,7 +117,7 @@ class Validate
if ($return_bool) {
return false;
} else {
standard_error($lng, $ip, $throw_exception);
\Froxlor\UI\Response::standard_error($lng, $ip, $throw_exception);
exit();
}
}
@@ -152,20 +150,6 @@ class Validate
return false;
}
public static function checkHostname($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
{
if (0 == strlen(trim($newfieldvalue)) || self::validateDomain($newfieldvalue) === false) {
return array(
FORMFIELDS_PLAUSIBILITY_CHECK_ERROR,
'invalidhostname'
);
} else {
return array(
FORMFIELDS_PLAUSIBILITY_CHECK_OK
);
}
}
/**
* validate a local-hostname by regex
*
@@ -182,33 +166,6 @@ class Validate
return false;
}
/**
* check whether an email account is to be deleted
* reference: #1519
*
* @return bool true if the domain is to be deleted, false otherwise
*
*/
public static function checkMailAccDeletionState($email_addr = null)
{
// example data of task 7: a:2:{s:9:"loginname";s:4:"webX";s:5:"email";s:20:"deleteme@example.tld";}
// check for task
$result_tasks_stmt = \Froxlor\Database\Database::prepare("
SELECT * FROM `" . TABLE_PANEL_TASKS . "` WHERE `type` = '7' AND `data` LIKE :emailaddr
");
\Froxlor\Database\Database::pexecute($result_tasks_stmt, array(
'emailaddr' => "%" . $email_addr . "%"
));
$num_results = \Froxlor\Database\Database::num_rows();
// is there a task for deleting this email account?
if ($num_results > 0) {
return true;
}
return false;
}
/**
* Returns if an emailaddress is in correct format or not
*
@@ -222,30 +179,6 @@ class Validate
return filter_var($email, FILTER_VALIDATE_EMAIL);
}
public static function checkUsername($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
{
if (! isset($allnewfieldvalues['customer_mysqlprefix'])) {
$allnewfieldvalues['customer_mysqlprefix'] = Settings::Get('customer.mysqlprefix');
}
$returnvalue = array();
if (validateUsername($newfieldvalue, Settings::Get('panel.unix_names'), 14 - strlen($allnewfieldvalues['customer_mysqlprefix'])) === true) {
$returnvalue = array(
FORMFIELDS_PLAUSIBILITY_CHECK_OK
);
} else {
$errmsg = 'accountprefixiswrong';
if ($fieldname == 'customer_mysqlprefix') {
$errmsg = 'mysqlprefixiswrong';
}
$returnvalue = array(
FORMFIELDS_PLAUSIBILITY_CHECK_ERROR,
$errmsg
);
}
return $returnvalue;
}
/**
* Returns if an username is in correct format or not.
*
@@ -268,153 +201,6 @@ class Validate
}
}
/**
* validates a given regex
*
* @param string $regex
* regex to validate
*
* @return boolean
*/
public static function checkValidRegEx($regex = null)
{
if ($regex == null || $regex == '') {
return true;
}
}
public static function checkPathConflicts($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
{
if ((int) Settings::Get('system.mod_fcgid') == 1) {
// fcgid-configdir has changed -> check against customer-doc-prefix
if ($fieldname == "system_mod_fcgid_configdir") {
$newdir = \Froxlor\FileDir::makeCorrectDir($newfieldvalue);
$cdir = \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.documentroot_prefix'));
} // customer-doc-prefix has changed -> check against fcgid-configdir
elseif ($fieldname == "system_documentroot_prefix") {
$newdir = \Froxlor\FileDir::makeCorrectDir($newfieldvalue);
$cdir = \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.mod_fcgid_configdir'));
}
// neither dir can be within the other nor can they be equal
if (substr($newdir, 0, strlen($cdir)) == $cdir || substr($cdir, 0, strlen($newdir)) == $newdir || $newdir == $cdir) {
$returnvalue = array(
FORMFIELDS_PLAUSIBILITY_CHECK_ERROR,
'fcgidpathcannotbeincustomerdoc'
);
} else {
$returnvalue = array(
FORMFIELDS_PLAUSIBILITY_CHECK_OK
);
}
} else {
$returnvalue = array(
FORMFIELDS_PLAUSIBILITY_CHECK_OK
);
}
return $returnvalue;
}
public static function checkPhpInterfaceSetting($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
{
$returnvalue = array(
FORMFIELDS_PLAUSIBILITY_CHECK_OK
);
if ((int) Settings::Get('system.mod_fcgid') == 1) {
// fcgid only works for apache and lighttpd
if (strtolower($newfieldvalue) != 'apache2' && strtolower($newfieldvalue) != 'lighttpd') {
$returnvalue = array(
FORMFIELDS_PLAUSIBILITY_CHECK_ERROR,
'fcgidstillenableddeadlock'
);
}
}
return $returnvalue;
}
public static function checkFcgidPhpFpm($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
{
$returnvalue = array(
FORMFIELDS_PLAUSIBILITY_CHECK_OK
);
$check_array = array(
'system_mod_fcgid_enabled' => array(
'other_post_field' => 'system_phpfpm_enabled',
'other_enabled' => 'phpfpm.enabled',
'other_enabled_lng' => 'phpfpmstillenabled',
'deactivate' => array(
'phpfpm.enabled_ownvhost' => 0
)
),
'system_phpfpm_enabled' => array(
'other_post_field' => 'system_mod_fcgid_enabled',
'other_enabled' => 'system.mod_fcgid',
'other_enabled_lng' => 'fcgidstillenabled',
'deactivate' => array(
'system.mod_fcgid_ownvhost' => 0
)
)
);
// interface is to be enabled
if ((int) $newfieldvalue == 1) {
// check for POST value of the other field == 1 (active)
if (isset($_POST[$check_array[$fieldname]['other_post_field']]) && (int) $_POST[$check_array[$fieldname]['other_post_field']] == 1) {
// the other interface is activated already and STAYS activated
if ((int) Settings::Get($check_array[$fieldname]['other_enabled']) == 1) {
$returnvalue = array(
FORMFIELDS_PLAUSIBILITY_CHECK_ERROR,
$check_array[$fieldname]['other_enabled_lng']
);
} else {
// fcgid is being validated before fpm -> "ask" fpm about its state
if ($fieldname == 'system_mod_fcgid_enabled') {
$returnvalue = checkFcgidPhpFpm('system_phpfpm_enabled', null, $check_array[$fieldname]['other_post_field'], null);
} else {
// not, bot are nogo
$returnvalue = $returnvalue = array(
FORMFIELDS_PLAUSIBILITY_CHECK_ERROR,
'fcgidandphpfpmnogoodtogether'
);
}
}
}
if (in_array(FORMFIELDS_PLAUSIBILITY_CHECK_OK, $returnvalue)) {
// be sure to deactivate the other one for the froxlor-vhost
// to avoid having a settings-deadlock
foreach ($check_array[$fieldname]['deactivate'] as $setting => $value) {
Settings::Set($setting, $value, true);
}
}
}
return $returnvalue;
}
public function checkMysqlAccessHost($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues)
{
$mysql_access_host_array = array_map('trim', explode(',', $newfieldvalue));
foreach ($mysql_access_host_array as $host_entry) {
if (self::validate_ip2($host_entry, true, 'invalidip', true, true) == false && self::validateDomain($host_entry) == false && self::validateLocalHostname($host_entry) == false && $host_entry != '%') {
return array(
FORMFIELDS_PLAUSIBILITY_CHECK_ERROR,
'invalidmysqlhost',
$host_entry
);
}
}
return array(
FORMFIELDS_PLAUSIBILITY_CHECK_OK
);
}
public static function validateSqlInterval($interval = null)
{
if (! $interval === null || $interval != '') {

View File

@@ -89,9 +89,7 @@ class Autoloader {
// define the paths where to look for classes
$paths = array(
dirname(__FILE__) . '/',
dirname(dirname(__FILE__)) . '/scripts/',
dirname(dirname(__FILE__)) . '/install/',
dirname(dirname(__FILE__)) . '/install/'
);
// don't load anything from a namespace, it's not our responsibility

View File

@@ -21,6 +21,6 @@ function getFormFieldOutputBool($fieldname, $fielddata, $do_show = true)
{
$label = $fielddata['label'];
$boolswitch = makeYesNo($fieldname, '1', '0', $fielddata['value']);
eval("\$returnvalue = \"" . getTemplate("formfields/bool", true) . "\";");
eval("\$returnvalue = \"" . \Froxlor\UI\Template::getTemplate("formfields/bool", true) . "\";");
return $returnvalue;
}

View File

@@ -19,6 +19,6 @@ function getFormFieldOutputFile($fieldname, $fielddata, $do_show = true)
{
$label = $fielddata['label'];
$value = htmlentities($fielddata['value']);
eval("\$returnvalue = \"" . getTemplate("formfields/text", true) . "\";");
eval("\$returnvalue = \"" . \Froxlor\UI\Template::getTemplate("formfields/text", true) . "\";");
return $returnvalue;
}

View File

@@ -20,7 +20,7 @@
function getFormGroupOutput($groupname, $groupdetails) {
global $lng, $theme;
eval("\$group = \"" . getTemplate("settings/settings_group") . "\";");
eval("\$group = \"" . \Froxlor\UI\Template::getTemplate("settings/settings_group") . "\";");
return $group;
}
@@ -44,7 +44,7 @@ function getFormOverviewGroupOutput($groupname, $groupdetails) {
if($fielddetails['type'] != 'option'
&& $fielddetails['type'] != 'bool')
{
standard_error('overviewsettingoptionisnotavalidfield');
\Froxlor\UI\Response::standard_error('overviewsettingoptionisnotavalidfield');
}
if($fielddetails['type'] == 'option')
@@ -87,7 +87,7 @@ function getFormOverviewGroupOutput($groupname, $groupdetails) {
}
}
eval("\$group = \"" . getTemplate("settings/settings_overviewgroup") . "\";");
eval("\$group = \"" . \Froxlor\UI\Template::getTemplate("settings/settings_overviewgroup") . "\";");
return $group;
}

View File

@@ -51,7 +51,7 @@ function processForm(&$form, &$input, $url_params = array())
{
if(($error = validateFormField($fieldname, $fielddetails, $newfieldvalue)) !== true)
{
standard_error($error, $fieldname);
\Froxlor\UI\Response::standard_error($error, $fieldname);
}
else
{
@@ -85,7 +85,7 @@ function processForm(&$form, &$input, $url_params = array())
$error = $plausibility_check[1];
unset($plausibility_check[1]);
$targetname = implode(' ', $plausibility_check);
standard_error($error, $targetname);
\Froxlor\UI\Response::standard_error($error, $targetname);
}
elseif($plausibility_check[0] == FORMFIELDS_PLAUSIBILITY_CHECK_QUESTION)
{
@@ -109,7 +109,7 @@ function processForm(&$form, &$input, $url_params = array())
}
else
{
standard_error('plausibilitychecknotunderstood');
\Froxlor\UI\Response::standard_error('plausibilitychecknotunderstood');
}
}
}
@@ -132,7 +132,7 @@ function processForm(&$form, &$input, $url_params = array())
}
else
{
standard_error('errorwhensaving', $fieldname);
\Froxlor\UI\Response::standard_error('errorwhensaving', $fieldname);
}
}
}
@@ -193,7 +193,7 @@ function processFormEx(&$form, &$input, $url_params = array(), $part, $settings_
{
if(($error = validateFormField($fieldname, $fielddetails, $newfieldvalue)) !== true)
{
standard_error($error, $fieldname);
\Froxlor\UI\Response::standard_error($error, $fieldname);
}
else
{
@@ -236,7 +236,7 @@ function processFormEx(&$form, &$input, $url_params = array(), $part, $settings_
$error = $plausibility_check[1];
unset($plausibility_check[1]);
$targetname = implode(' ', $plausibility_check);
standard_error($error, $targetname);
\Froxlor\UI\Response::standard_error($error, $targetname);
}
elseif($plausibility_check[0] == FORMFIELDS_PLAUSIBILITY_CHECK_QUESTION)
{
@@ -260,7 +260,7 @@ function processFormEx(&$form, &$input, $url_params = array(), $part, $settings_
}
else
{
standard_error('plausibilitychecknotunderstood');
\Froxlor\UI\Response::standard_error('plausibilitychecknotunderstood');
}
}
}
@@ -292,7 +292,7 @@ function processFormEx(&$form, &$input, $url_params = array(), $part, $settings_
}
else
{
standard_error('errorwhensaving', $fieldname);
\Froxlor\UI\Response::standard_error('errorwhensaving', $fieldname);
}
}
}

View File

@@ -25,7 +25,7 @@ function getFormFieldOutputHidden($fieldname, $fielddata)
{
$label = $fielddata['label'];
$value = htmlentities($fielddata['value']);
eval("\$returnvalue .= \"" . getTemplate("formfields/hidden", true) . "\";");
eval("\$returnvalue .= \"" . \Froxlor\UI\Template::getTemplate("formfields/hidden", true) . "\";");
}
return $returnvalue;

View File

@@ -21,6 +21,6 @@ function getFormFieldOutputHiddenString($fieldname, $fielddata, $do_show = true)
{
$label = $fielddata['label'];
$value = htmlentities($fielddata['value']);
eval("\$returnvalue = \"" . getTemplate("formfields/hiddenstring", true) . "\";");
eval("\$returnvalue = \"" . \Froxlor\UI\Template::getTemplate("formfields/hiddenstring", true) . "\";");
return $returnvalue;
}

View File

@@ -20,6 +20,6 @@
function getFormFieldOutputLabel($fieldname, $fielddata)
{
$label = $fielddata['label'];
eval("\$returnvalue = \"" . getTemplate("formfields/label", true) . "\";");
eval("\$returnvalue = \"" . \Froxlor\UI\Template::getTemplate("formfields/label", true) . "\";");
return $returnvalue;
}

View File

@@ -40,7 +40,7 @@ function getFormFieldOutputOption($fieldname, $fielddata, $do_show = true)
{
$options .= makeoption($title, $value, $fielddata['value']);
}
eval("\$returnvalue = \"" . getTemplate("formfields/option", true) . "\";");
eval("\$returnvalue = \"" . \Froxlor\UI\Template::getTemplate("formfields/option", true) . "\";");
}
return $returnvalue;

View File

@@ -21,6 +21,6 @@ function getFormFieldOutputString($fieldname, $fielddata, $do_show = true)
{
$label = $fielddata['label'];
$value = htmlentities($fielddata['value']);
eval("\$returnvalue = \"" . getTemplate("formfields/string", true) . "\";");
eval("\$returnvalue = \"" . \Froxlor\UI\Template::getTemplate("formfields/string", true) . "\";");
return $returnvalue;
}

View File

@@ -21,6 +21,6 @@ function getFormFieldOutputText($fieldname, $fielddata, $do_show = true)
{
$label = $fielddata['label'];
$value = htmlentities($fielddata['value']);
eval("\$returnvalue = \"" . getTemplate("formfields/text", true) . "\";");
eval("\$returnvalue = \"" . \Froxlor\UI\Template::getTemplate("formfields/text", true) . "\";");
return $returnvalue;
}

View File

@@ -47,14 +47,14 @@ function correctErrorDocument($errdoc = null, $throw_exception = false) {
else {
// string won't work for lighty
if (Settings::Get('system.webserver') == 'lighttpd') {
standard_error('stringerrordocumentnotvalidforlighty', '', $throw_exception);
\Froxlor\UI\Response::standard_error('stringerrordocumentnotvalidforlighty', '', $throw_exception);
} elseif(substr($errdoc, -1) != '"') {
$errdoc .= '"';
}
}
} else {
if (Settings::Get('system.webserver') == 'lighttpd') {
standard_error('urlerrordocumentnotvalidforlighty', '', $throw_exception);
\Froxlor\UI\Response::standard_error('urlerrordocumentnotvalidforlighty', '', $throw_exception);
}
}
}

View File

@@ -80,7 +80,7 @@ function buildNavigation($navigation, $userinfo) {
$navlabel = $element['label'];
}
eval("\$navigation_links .= \"" . getTemplate("navigation_link", 1) . "\";");
eval("\$navigation_links .= \"" . \Froxlor\UI\Template::getTemplate("navigation_link", 1) . "\";");
}
}
@@ -110,7 +110,7 @@ function buildNavigation($navigation, $userinfo) {
$navlabel = $box['label'];
}
eval("\$returnvalue .= \"" . getTemplate("navigation_element", 1) . "\";");
eval("\$returnvalue .= \"" . \Froxlor\UI\Template::getTemplate("navigation_element", 1) . "\";");
}
}
}

View File

@@ -308,7 +308,7 @@ if ($language != 'English') {
include_once \Froxlor\FileDir::makeSecurePath('lng/lng_references.php');
// Initialize our new link - class
$linker = new linker('index.php', $s);
$linker = new \Froxlor\UI\Linker('index.php', $s);
/**
* global Theme-variable
@@ -359,7 +359,7 @@ if ($nosession == 1 && AREA != 'login') {
"script" => basename($_SERVER["SCRIPT_NAME"]),
"qrystr" => $_SERVER["QUERY_STRING"]
);
redirectTo('index.php', $params);
\Froxlor\UI\Response::redirectTo('index.php', $params);
exit();
}
@@ -441,10 +441,10 @@ if (array_key_exists('css', $_themeoptions['variants'][$themevariant]) && is_arr
}
}
}
eval("\$header = \"" . getTemplate('header', '1') . "\";");
eval("\$header = \"" . \Froxlor\UI\Template::getTemplate('header', '1') . "\";");
$current_year = date('Y', time());
eval("\$footer = \"" . getTemplate('footer', '1') . "\";");
eval("\$footer = \"" . \Froxlor\UI\Template::getTemplate('footer', '1') . "\";");
unset($js);
unset($css);

View File

@@ -32,7 +32,7 @@ $last_n = isset($_GET['number_of_lines']) ? (int) $_GET['number_of_lines'] : 100
// user's with logviewenabled = false
if (AREA != 'admin' && $userinfo['logviewenabled'] != '1') {
// back to domain overview
redirectTo($filename, array(
\Froxlor\UI\Response::redirectTo($filename, array(
'page' => 'domains',
's' => $s
));
@@ -46,7 +46,7 @@ if (function_exists('exec')) {
'id' => $domain_id
))->get();
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$domain = json_decode($json_result, true)['data'];
@@ -78,11 +78,11 @@ if (function_exists('exec')) {
$access_log_content = "Access-Log" . (AREA == 'admin' ? " '" . $access_log . "'" : "") . " does not seem to exist";
}
eval("echo \"" . getTemplate("logfiles_viewer/index", true) . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("logfiles_viewer/index", true) . "\";");
} else {
if (AREA == 'admin') {
dynamic_error('You need to allow the exec() function in the froxlor-vhost php-config');
\Froxlor\UI\Response::dynamic_error('You need to allow the exec() function in the froxlor-vhost php-config');
} else {
dynamic_error('Required function exec() is not allowed. Pllease contact the system administrator.');
\Froxlor\UI\Response::dynamic_error('Required function exec() is not allowed. Pllease contact the system administrator.');
}
}

View File

@@ -15,19 +15,6 @@
*
*/
require dirname(__DIR__) . '/vendor/autoload.php';
// -- helper function
function getCronFile($cronname) {
return makeCorrectFile(FROXLOR_INSTALL_DIR.'/scripts/jobs/cron_'.$cronname.'.php');
}
function addToQueue(&$jobs_to_run, $cronname) {
if (!in_array($cronname, $jobs_to_run)) {
$cronfile = getCronFile($cronname);
if (file_exists($cronfile)) {
array_unshift($jobs_to_run, $cronname);
}
}
}
\Froxlor\Cron\MasterCron::run();

View File

@@ -38,7 +38,7 @@ if ($action == 'delete') {
))->delete();
$success_message = sprintf($lng['domains']['ssl_certificate_removed'], $id);
} catch (Exception $e) {
dynamic_error($e->getMessage());
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
}
}
@@ -47,7 +47,7 @@ $log->logAction(USR_ACTION, LOG_NOTICE, "viewed domains::ssl_certificates");
$fields = array(
'd.domain' => $lng['domains']['domainname']
);
$paging = new paging($userinfo, TABLE_PANEL_DOMAIN_SSL_SETTINGS, $fields);
$paging = new \Froxlor\UI\Paging($userinfo, TABLE_PANEL_DOMAIN_SSL_SETTINGS, $fields);
// select all my (accessable) certificates
$certs_stmt_query = "SELECT s.*, d.domain, d.letsencrypt, c.customerid, c.loginname
@@ -86,7 +86,7 @@ if (count($all_certs) == 0) {
);
$searchcode = "";
$pagingcode = "";
eval("\$certificates.=\"" . getTemplate("ssl_certificates/certs_error", true) . "\";");
eval("\$certificates.=\"" . \Froxlor\UI\Template::getTemplate("ssl_certificates/certs_error", true) . "\";");
} else {
$paging->setEntries(count($all_certs));
$sortcode = $paging->getHtmlSortCode($lng);
@@ -150,14 +150,14 @@ if (count($all_certs) == 0) {
}
$row = htmlentities_array($cert);
eval("\$certificates.=\"" . getTemplate("ssl_certificates/certs_cert", true) . "\";");
eval("\$certificates.=\"" . \Froxlor\UI\Template::getTemplate("ssl_certificates/certs_cert", true) . "\";");
} else {
$message = sprintf($lng['domains']['ssl_certificate_error'], $cert['domain']);
eval("\$certificates.=\"" . getTemplate("ssl_certificates/certs_error", true) . "\";");
eval("\$certificates.=\"" . \Froxlor\UI\Template::getTemplate("ssl_certificates/certs_error", true) . "\";");
}
} else {
continue;
}
}
}
eval("echo \"" . getTemplate("ssl_certificates/certs_list", true) . "\";");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("ssl_certificates/certs_list", true) . "\";");