even more function to class conversion
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -31,7 +31,7 @@ return array(
|
||||
'type' => 'option',
|
||||
'default' => 'English',
|
||||
'option_mode' => 'one',
|
||||
'option_options_method' => 'getLanguages',
|
||||
'option_options_method' => array('\\Froxlor\\User', 'getLanguages'),
|
||||
'save_method' => 'storeSettingField'
|
||||
),
|
||||
'panel_default_theme' => array(
|
||||
|
||||
@@ -348,7 +348,7 @@ return array(
|
||||
'type' => 'option',
|
||||
'default' => '1',
|
||||
'option_mode' => 'one',
|
||||
'option_options_method' => 'getRedirectCodes',
|
||||
'option_options_method' => array('\\Froxlor\\Domain\\Domain', 'getRedirectCodes'),
|
||||
'save_method' => 'storeSettingField'
|
||||
)
|
||||
)
|
||||
|
||||
@@ -92,8 +92,8 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
|
||||
$traffic_percent = 100;
|
||||
}
|
||||
|
||||
$row = str_replace_array('-1', 'UL', $row, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps subdomains');
|
||||
$row = htmlentities_array($row);
|
||||
$row = \Froxlor\PhpHelper::str_replace_array('-1', 'UL', $row, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps subdomains');
|
||||
$row = \Froxlor\PhpHelper::htmlentities_array($row);
|
||||
|
||||
$row['custom_notes'] = ($row['custom_notes'] != '') ? nl2br($row['custom_notes']) : '';
|
||||
|
||||
@@ -327,7 +327,7 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
|
||||
$ipaddress .= makeoption($row['ip'], $row['id'], $result['ip']);
|
||||
}
|
||||
|
||||
$result = htmlentities_array($result);
|
||||
$result = \Froxlor\PhpHelper::htmlentities_array($result);
|
||||
|
||||
$admin_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/admin/formfield.admin_edit.php';
|
||||
$admin_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($admin_edit_data);
|
||||
|
||||
@@ -58,7 +58,7 @@ if ($page == 'cronjobs' || $page == 'overview') {
|
||||
$cmod = $row['module'];
|
||||
}
|
||||
if ($paging->checkDisplay($i)) {
|
||||
$row = htmlentities_array($row);
|
||||
$row = \Froxlor\PhpHelper::htmlentities_array($row);
|
||||
|
||||
$row['lastrun'] = date('d.m.Y H:i', $row['lastrun']);
|
||||
$row['isactive'] = ((int) $row['isactive'] == 1) ? $lng['panel']['yes'] : $lng['panel']['no'];
|
||||
|
||||
@@ -126,8 +126,8 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
|
||||
$islocked = 1;
|
||||
}
|
||||
|
||||
$row = str_replace_array('-1', 'UL', $row, 'diskspace traffic mysqls emails email_accounts email_forwarders ftps subdomains');
|
||||
$row = htmlentities_array($row);
|
||||
$row = \Froxlor\PhpHelper::str_replace_array('-1', 'UL', $row, 'diskspace traffic mysqls emails email_accounts email_forwarders ftps subdomains');
|
||||
$row = \Froxlor\PhpHelper::htmlentities_array($row);
|
||||
|
||||
// fix progress-bars if value is >100%
|
||||
if ($disk_percent > 100) {
|
||||
@@ -438,7 +438,7 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
|
||||
$result['mysqls'] = '';
|
||||
}
|
||||
|
||||
$result = htmlentities_array($result);
|
||||
$result = \Froxlor\PhpHelper::htmlentities_array($result);
|
||||
|
||||
$gender_options = makeoption($lng['gender']['undef'], 0, ($result['gender'] == '0' ? true : false), true, true);
|
||||
$gender_options .= makeoption($lng['gender']['male'], 1, ($result['gender'] == '1' ? true : false), true, true);
|
||||
|
||||
@@ -106,7 +106,7 @@ if ($page == 'domains' || $page == 'overview') {
|
||||
|
||||
if (isset($row['domain']) && $row['domain'] != '' && $paging->checkDisplay($i)) {
|
||||
$row['customername'] = getCorrectFullUserDetails($row);
|
||||
$row = htmlentities_array($row);
|
||||
$row = \Froxlor\PhpHelper::htmlentities_array($row);
|
||||
// display a nice list of IP's
|
||||
$row['ipandport'] = str_replace("\n", "<br />", $row['ipandport']);
|
||||
eval("\$domains.=\"" . \Froxlor\UI\Template::getTemplate("domains/domains_domain") . "\";");
|
||||
@@ -624,7 +624,7 @@ if ($page == 'domains' || $page == 'overview') {
|
||||
}
|
||||
}
|
||||
|
||||
$result = htmlentities_array($result);
|
||||
$result = \Froxlor\PhpHelper::htmlentities_array($result);
|
||||
|
||||
$domain_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/domains/formfield.domains_edit.php';
|
||||
$domain_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($domain_edit_data);
|
||||
@@ -667,7 +667,7 @@ if ($page == 'domains' || $page == 'overview') {
|
||||
}
|
||||
|
||||
// update customer/admin counters
|
||||
updateCounters(false);
|
||||
\Froxlor\User::updateCounters(false);
|
||||
\Froxlor\System\Cronjob::inserttask('1');
|
||||
\Froxlor\System\Cronjob::inserttask('4');
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ if ($page == 'overview') {
|
||||
$userinfo['diskspace_used'] = round($userinfo['diskspace_used'] / 1024, $dec_places);
|
||||
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $dec_places);
|
||||
$userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), $dec_places);
|
||||
$userinfo = str_replace_array('-1', $lng['customer']['unlimited'], $userinfo, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps subdomains');
|
||||
$userinfo = \Froxlor\PhpHelper::str_replace_array('-1', $lng['customer']['unlimited'], $userinfo, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps subdomains');
|
||||
|
||||
$userinfo['custom_notes'] = ($userinfo['custom_notes'] != '') ? nl2br($userinfo['custom_notes']) : '';
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ if ($page == 'ipsandports' || $page == 'overview') {
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
if ($paging->checkDisplay($i)) {
|
||||
$row = htmlentities_array($row);
|
||||
$row = \Froxlor\PhpHelper::htmlentities_array($row);
|
||||
if (filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
|
||||
$row['ip'] = '[' . $row['ip'] . ']';
|
||||
}
|
||||
@@ -146,7 +146,7 @@ if ($page == 'ipsandports' || $page == 'overview') {
|
||||
));
|
||||
} else {
|
||||
|
||||
$result = htmlentities_array($result);
|
||||
$result = \Froxlor\PhpHelper::htmlentities_array($result);
|
||||
|
||||
$ipsandports_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/ipsandports/formfield.ipsandports_edit.php';
|
||||
$ipsandports_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($ipsandports_edit_data);
|
||||
|
||||
@@ -63,7 +63,7 @@ if ($page == 'log' && $userinfo['change_serversettings'] == '1') {
|
||||
$_action = 0;
|
||||
foreach ($logrows as $row) {
|
||||
// if ($paging->checkDisplay($i)) {
|
||||
$row = htmlentities_array($row);
|
||||
$row = \Froxlor\PhpHelper::htmlentities_array($row);
|
||||
$row['date'] = date("d.m.y H:i:s", $row['date']);
|
||||
|
||||
if ($_action != $action) {
|
||||
|
||||
@@ -64,7 +64,7 @@ if ($page == 'message') {
|
||||
|
||||
$row['firstname'] = isset($row['firstname']) ? $row['firstname'] : '';
|
||||
$row['company'] = isset($row['company']) ? $row['company'] : '';
|
||||
$mail->AddAddress($row['email'], getCorrectUserSalutation(array(
|
||||
$mail->AddAddress($row['email'], \Froxlor\User::getCorrectUserSalutation(array(
|
||||
'firstname' => $row['firstname'],
|
||||
'name' => $row['name'],
|
||||
'company' => $row['company']
|
||||
|
||||
@@ -58,7 +58,7 @@ if ($page == '' || $page == 'overview') {
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
if ($paging->checkDisplay($i)) {
|
||||
$row = htmlentities_array($row);
|
||||
$row = \Froxlor\PhpHelper::htmlentities_array($row);
|
||||
$row['ts_format'] = date("d.m.Y H:i", $row['ts']);
|
||||
eval("\$plans.=\"" . \Froxlor\UI\Template::getTemplate("plans/plans_plan") . "\";");
|
||||
$count ++;
|
||||
@@ -112,7 +112,7 @@ if ($page == '' || $page == 'overview') {
|
||||
$value_arr['diskspace'] = - 1;
|
||||
}
|
||||
|
||||
$value_arr['traffic'] = doubleval_ressource($_POST['traffic']);
|
||||
$value_arr['traffic'] = $_POST['traffic'];
|
||||
if (isset($_POST['traffic_ul'])) {
|
||||
$value_arr['traffic'] = - 1;
|
||||
}
|
||||
@@ -271,7 +271,7 @@ if ($page == '' || $page == 'overview') {
|
||||
if ($result['name'] != '') {
|
||||
|
||||
$result['value'] = json_decode($result['value'], true);
|
||||
$result = htmlentities_array($result);
|
||||
$result = \Froxlor\PhpHelper::htmlentities_array($result);
|
||||
|
||||
foreach ($result['value'] as $index => $value) {
|
||||
$result[$index] = $value;
|
||||
@@ -290,7 +290,7 @@ if ($page == '' || $page == 'overview') {
|
||||
$value_arr['diskspace'] = - 1;
|
||||
}
|
||||
|
||||
$value_arr['traffic'] = doubleval_ressource($_POST['traffic']);
|
||||
$value_arr['traffic'] = $_POST['traffic'];
|
||||
if (isset($_POST['traffic_ul'])) {
|
||||
$value_arr['traffic'] = - 1;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
|
||||
if (isset($_POST['send']) && $_POST['send'] == 'send') {
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_INFO, "updated resource-counters");
|
||||
$updatecounters = updateCounters(true);
|
||||
$updatecounters = \Froxlor\User::updateCounters(true);
|
||||
$customers = '';
|
||||
foreach ($updatecounters['customers'] as $customerid => $customer) {
|
||||
eval("\$customers.=\"" . \Froxlor\UI\Template::getTemplate("settings/updatecounters_row_customer") . "\";");
|
||||
|
||||
@@ -426,7 +426,7 @@ if ($action == '') {
|
||||
));
|
||||
} else {
|
||||
|
||||
$result = htmlentities_array($result);
|
||||
$result = \Froxlor\PhpHelper::htmlentities_array($result);
|
||||
$template = $lng['admin']['templates'][str_replace('_subject', '', $result['varname'])];
|
||||
$subject = $result['value'];
|
||||
$result_stmt = Database::prepare("
|
||||
@@ -442,7 +442,7 @@ if ($action == '') {
|
||||
|
||||
// don't escape the already escaped language-string so save up before htmlentities()
|
||||
$language = $result['language'];
|
||||
$result = htmlentities_array($result);
|
||||
$result = \Froxlor\PhpHelper::htmlentities_array($result);
|
||||
$mailbody = $result['value'];
|
||||
|
||||
$template_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/templates/formfield.template_edit.php';
|
||||
@@ -487,7 +487,7 @@ if ($action == '') {
|
||||
's' => $s
|
||||
));
|
||||
} else {
|
||||
$row = htmlentities_array($row);
|
||||
$row = \Froxlor\PhpHelper::htmlentities_array($row);
|
||||
|
||||
$filetemplate_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/templates/formfield.filetemplate_edit.php';
|
||||
$filetemplate_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($filetemplate_edit_data);
|
||||
|
||||
@@ -64,7 +64,7 @@ if ($page == 'overview') {
|
||||
$redirect_url = 'admin_index.php?s=' . $s;
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/update_end') . "\";");
|
||||
|
||||
updateCounters();
|
||||
\Froxlor\User::updateCounters();
|
||||
\Froxlor\System\Cronjob::inserttask('1');
|
||||
@chmod('./lib/userdata.inc.php', 0440);
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ if (count($all_keys) == 0) {
|
||||
}
|
||||
|
||||
// escape stuff
|
||||
$row = htmlentities_array($key);
|
||||
$row = \Froxlor\PhpHelper::htmlentities_array($key);
|
||||
|
||||
// shorten keys
|
||||
$row['_apikey'] = substr($row['apikey'], 0, 20) . '...';
|
||||
|
||||
@@ -151,7 +151,7 @@ if ($page == 'overview') {
|
||||
if ($paging->checkDisplay($i)) {
|
||||
|
||||
if (isset($domain_array[$sortkey])) {
|
||||
$row = htmlentities_array($domain_array[$sortkey]);
|
||||
$row = \Froxlor\PhpHelper::htmlentities_array($domain_array[$sortkey]);
|
||||
if (Settings::Get('system.awstats_enabled') == '1') {
|
||||
$statsapp = 'awstats';
|
||||
} else {
|
||||
@@ -176,7 +176,7 @@ if ($page == 'overview') {
|
||||
if (Settings::Get('system.use_ssl') == '1' && \Froxlor\Domain\Domain::domainHasSslIpPort($row['id']) && $row['caneditdomain'] == '1' && $row['letsencrypt'] == 0) {
|
||||
$show_ssledit = true;
|
||||
}
|
||||
$row = htmlentities_array($row);
|
||||
$row = \Froxlor\PhpHelper::htmlentities_array($row);
|
||||
eval("\$domains.=\"" . \Froxlor\UI\Template::getTemplate("domains/domains_domain") . "\";");
|
||||
}
|
||||
}
|
||||
@@ -263,12 +263,12 @@ if ($page == 'overview') {
|
||||
));
|
||||
|
||||
while ($row_domain = $domains_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$aliasdomains .= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['id']);
|
||||
$aliasdomains .= \Froxlor\UI\HTML::makeoption($idna_convert->decode($row_domain['domain']), $row_domain['id']);
|
||||
}
|
||||
|
||||
$redirectcode = '';
|
||||
if (Settings::Get('customredirect.enabled') == '1') {
|
||||
$codes = getRedirectCodesArray();
|
||||
$codes = \Froxlor\Domain\Domain::getRedirectCodesArray();
|
||||
foreach ($codes as $rc) {
|
||||
$redirectcode .= makeoption($rc['code'] . ' (' . $lng['redirect_desc'][$rc['desc']] . ')', $rc['id']);
|
||||
}
|
||||
@@ -369,7 +369,7 @@ if ($page == 'overview') {
|
||||
$domains .= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['id'], $result['aliasdomain']);
|
||||
}
|
||||
|
||||
if (preg_match('/^https?\:\/\//', $result['documentroot']) && validateUrl($result['documentroot'])) {
|
||||
if (preg_match('/^https?\:\/\//', $result['documentroot']) && \Froxlor\Validate\Form\Strings::validateUrl($result['documentroot'])) {
|
||||
if (Settings::Get('panel.pathedit') == 'Dropdown') {
|
||||
$urlvalue = $result['documentroot'];
|
||||
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
|
||||
@@ -384,8 +384,8 @@ if ($page == 'overview') {
|
||||
|
||||
$redirectcode = '';
|
||||
if (Settings::Get('customredirect.enabled') == '1') {
|
||||
$def_code = getDomainRedirectId($id);
|
||||
$codes = getRedirectCodesArray();
|
||||
$def_code = \Froxlor\Domain\Domain::getDomainRedirectId($id);
|
||||
$codes = \Froxlor\Domain\Domain::getRedirectCodesArray();
|
||||
foreach ($codes as $rc) {
|
||||
$redirectcode .= makeoption($rc['code'] . ' (' . $lng['redirect_desc'][$rc['desc']] . ')', $rc['id'], $def_code);
|
||||
}
|
||||
@@ -411,7 +411,7 @@ if ($page == 'overview') {
|
||||
$result['temporary_ssl_redirect'] = $result['ssl_redirect'];
|
||||
$result['ssl_redirect'] = ($result['ssl_redirect'] == 0 ? 0 : 1);
|
||||
|
||||
$openbasedir = makeoption($lng['domain']['docroot'], 0, $result['openbasedir_path'], true) . makeoption($lng['domain']['homedir'], 1, $result['openbasedir_path'], true);
|
||||
$openbasedir = \Froxlor\UI\HTML::makeoption($lng['domain']['docroot'], 0, $result['openbasedir_path'], true) . makeoption($lng['domain']['homedir'], 1, $result['openbasedir_path'], true);
|
||||
|
||||
// create serveralias options
|
||||
$serveraliasoptions = "";
|
||||
@@ -459,7 +459,7 @@ if ($page == 'overview') {
|
||||
}
|
||||
|
||||
$domainip = $result_ipandport['ip'];
|
||||
$result = htmlentities_array($result);
|
||||
$result = \Froxlor\PhpHelper::htmlentities_array($result);
|
||||
|
||||
$subdomain_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/domains/formfield.domains_edit.php';
|
||||
$subdomain_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($subdomain_edit_data);
|
||||
@@ -512,7 +512,7 @@ if ($page == 'overview') {
|
||||
$do_insert = true;
|
||||
}
|
||||
|
||||
$result = htmlentities_array($result);
|
||||
$result = \Froxlor\PhpHelper::htmlentities_array($result);
|
||||
|
||||
$ssleditor_data = include_once dirname(__FILE__) . '/lib/formfields/customer/domains/formfield.domain_ssleditor.php';
|
||||
$ssleditor_form = \Froxlor\UI\HtmlForm::genHTMLForm($ssleditor_data);
|
||||
|
||||
@@ -120,7 +120,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);
|
||||
$row = \Froxlor\PhpHelper::htmlentities_array($row);
|
||||
eval("\$accounts.=\"" . \Froxlor\UI\Template::getTemplate("email/emails_email") . "\";");
|
||||
$count ++;
|
||||
}
|
||||
@@ -252,7 +252,7 @@ if ($page == 'overview') {
|
||||
}
|
||||
|
||||
$destinations_count = count($result['destination']);
|
||||
$result = htmlentities_array($result);
|
||||
$result = \Froxlor\PhpHelper::htmlentities_array($result);
|
||||
|
||||
$email_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_edit.php';
|
||||
|
||||
@@ -325,7 +325,7 @@ if ($page == 'overview') {
|
||||
}
|
||||
|
||||
$result['email_full'] = $idna_convert->decode($result['email_full']);
|
||||
$result = htmlentities_array($result);
|
||||
$result = \Froxlor\PhpHelper::htmlentities_array($result);
|
||||
$quota = Settings::Get('system.mail_quota');
|
||||
|
||||
$account_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_addaccount.php';
|
||||
@@ -367,7 +367,7 @@ if ($page == 'overview') {
|
||||
));
|
||||
} else {
|
||||
$result['email_full'] = $idna_convert->decode($result['email_full']);
|
||||
$result = htmlentities_array($result);
|
||||
$result = \Froxlor\PhpHelper::htmlentities_array($result);
|
||||
|
||||
$account_changepw_data = include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_accountchangepasswd.php';
|
||||
$account_changepw_form = \Froxlor\UI\HtmlForm::genHTMLForm($account_changepw_data);
|
||||
@@ -403,7 +403,7 @@ if ($page == 'overview') {
|
||||
));
|
||||
} else {
|
||||
$result['email_full'] = $idna_convert->decode($result['email_full']);
|
||||
$result = htmlentities_array($result);
|
||||
$result = \Froxlor\PhpHelper::htmlentities_array($result);
|
||||
|
||||
$quota_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_accountchangequota.php';
|
||||
$quota_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($quota_edit_data);
|
||||
@@ -473,7 +473,7 @@ if ($page == 'overview') {
|
||||
));
|
||||
} else {
|
||||
$result['email_full'] = $idna_convert->decode($result['email_full']);
|
||||
$result = htmlentities_array($result);
|
||||
$result = \Froxlor\PhpHelper::htmlentities_array($result);
|
||||
|
||||
$forwarder_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_addforwarder.php';
|
||||
$forwarder_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($forwarder_add_data);
|
||||
|
||||
@@ -73,7 +73,7 @@ if ($page == 'overview') {
|
||||
$row['path'] = str_replace($userinfo['documentroot'], "/", $row['path']);
|
||||
}
|
||||
$row['path'] = \Froxlor\FileDir::makeCorrectDir($row['path']);
|
||||
$row = htmlentities_array($row);
|
||||
$row = \Froxlor\PhpHelper::htmlentities_array($row);
|
||||
eval("\$htpasswds.=\"" . \Froxlor\UI\Template::getTemplate("extras/htpasswds_htpasswd") . "\";");
|
||||
$count ++;
|
||||
}
|
||||
@@ -163,7 +163,7 @@ if ($page == 'overview') {
|
||||
$result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']);
|
||||
}
|
||||
|
||||
$result = htmlentities_array($result);
|
||||
$result = \Froxlor\PhpHelper::htmlentities_array($result);
|
||||
|
||||
$htpasswd_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htpasswd_edit.php';
|
||||
$htpasswd_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($htpasswd_edit_data);
|
||||
@@ -219,7 +219,7 @@ if ($page == 'overview') {
|
||||
$row['options_indexes'] = str_replace('0', $lng['panel']['no'], $row['options_indexes']);
|
||||
$row['options_cgi'] = str_replace('1', $lng['panel']['yes'], $row['options_cgi']);
|
||||
$row['options_cgi'] = str_replace('0', $lng['panel']['no'], $row['options_cgi']);
|
||||
$row = htmlentities_array($row);
|
||||
$row = \Froxlor\PhpHelper::htmlentities_array($row);
|
||||
eval("\$htaccess.=\"" . \Froxlor\UI\Template::getTemplate("extras/htaccess_htaccess") . "\";");
|
||||
$count ++;
|
||||
}
|
||||
@@ -314,7 +314,7 @@ if ($page == 'overview') {
|
||||
* $options_indexes = makeyesno('options_indexes', '1', '0', $result['options_indexes']);
|
||||
* $options_cgi = makeyesno('options_cgi', '1', '0', $result['options_cgi']);
|
||||
*/
|
||||
$result = htmlentities_array($result);
|
||||
$result = \Froxlor\PhpHelper::htmlentities_array($result);
|
||||
|
||||
$htaccess_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htaccess_edit.php';
|
||||
$htaccess_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($htaccess_edit_data);
|
||||
|
||||
@@ -73,7 +73,7 @@ if ($page == 'overview') {
|
||||
|
||||
$row['documentroot'] = \Froxlor\FileDir::makeCorrectDir($row['documentroot']);
|
||||
|
||||
$row = htmlentities_array($row);
|
||||
$row = \Froxlor\PhpHelper::htmlentities_array($row);
|
||||
eval("\$accounts.=\"" . \Froxlor\UI\Template::getTemplate('ftp/accounts_account') . "\";");
|
||||
$count ++;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ if ($page == 'overview') {
|
||||
|
||||
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), Settings::Get('panel.decimal_places'));
|
||||
$userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), Settings::Get('panel.decimal_places'));
|
||||
$userinfo = str_replace_array('-1', $lng['customer']['unlimited'], $userinfo, 'diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps subdomains');
|
||||
$userinfo = \Froxlor\PhpHelper::str_replace_array('-1', $lng['customer']['unlimited'], $userinfo, 'diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps subdomains');
|
||||
|
||||
$userinfo['custom_notes'] = ($userinfo['custom_notes'] != '') ? nl2br($userinfo['custom_notes']) : '';
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ if ($page == 'log') {
|
||||
$_action = 0;
|
||||
foreach ($logrows as $row) {
|
||||
// if ($paging->checkDisplay($i)) {
|
||||
$row = htmlentities_array($row);
|
||||
$row = \Froxlor\PhpHelper::htmlentities_array($row);
|
||||
$row['date'] = date("d.m.y H:i:s", $row['date']);
|
||||
|
||||
if ($_action != $action) {
|
||||
|
||||
@@ -78,7 +78,7 @@ if ($page == 'overview') {
|
||||
Database::needRoot(true);
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if ($paging->checkDisplay($i)) {
|
||||
$row = htmlentities_array($row);
|
||||
$row = \Froxlor\PhpHelper::htmlentities_array($row);
|
||||
$mbdata_stmt = Database::prepare("SELECT SUM(data_length + index_length) as MB FROM information_schema.TABLES
|
||||
WHERE table_schema = :table_schema
|
||||
GROUP BY table_schema");
|
||||
|
||||
@@ -287,7 +287,7 @@ if ($action == '2fa_entercode') {
|
||||
$mail->Subject = $lng['mails']['2fa']['subject'];
|
||||
$mail->AltBody = $mail_body;
|
||||
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
|
||||
$mail->AddAddress($userinfo['email'], getCorrectUserSalutation($userinfo));
|
||||
$mail->AddAddress($userinfo['email'], \Froxlor\User::getCorrectUserSalutation($userinfo));
|
||||
$mail->Send();
|
||||
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
||||
$mailerr_msg = $e->errorMessage();
|
||||
@@ -480,7 +480,7 @@ if ($action == 'forgotpwd') {
|
||||
$activationlink = $protocol . '://' . $host . $port . $script . '?action=resetpwd&resetcode=' . $activationcode;
|
||||
|
||||
$replace_arr = array(
|
||||
'SALUTATION' => getCorrectUserSalutation($user),
|
||||
'SALUTATION' => \Froxlor\User::getCorrectUserSalutation($user),
|
||||
'USERNAME' => $loginname,
|
||||
'LINK' => $activationlink
|
||||
);
|
||||
@@ -516,7 +516,7 @@ if ($action == 'forgotpwd') {
|
||||
$mail->Subject = $mail_subject;
|
||||
$mail->AltBody = $mail_body;
|
||||
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
|
||||
$mail->AddAddress($user['email'], getCorrectUserSalutation($user));
|
||||
$mail->AddAddress($user['email'], \Froxlor\User::getCorrectUserSalutation($user));
|
||||
$mail->Send();
|
||||
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
||||
$mailerr_msg = $e->errorMessage();
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
use Froxlor\FroxlorLogger;
|
||||
|
||||
require_once __DIR__ . '/lib/updateFunctions.php';
|
||||
|
||||
if (! defined('_CRON_UPDATE')) {
|
||||
if (! defined('AREA') || (defined('AREA') && AREA != 'admin') || ! isset($userinfo['loginname']) || (isset($userinfo['loginname']) && $userinfo['loginname'] == '')) {
|
||||
header('Location: ../index.php');
|
||||
|
||||
@@ -737,7 +737,7 @@ class Admins extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
), true, true);
|
||||
|
||||
$this->logger()->logAction(ADM_ACTION, LOG_WARNING, "[API] deleted admin '" . $result['loginname'] . "'");
|
||||
updateCounters();
|
||||
\Froxlor\User::updateCounters();
|
||||
return $this->response(200, "successfull", $result);
|
||||
}
|
||||
throw new \Exception("Not allowed to execute given command.", 403);
|
||||
|
||||
@@ -666,7 +666,7 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
|
||||
'FIRSTNAME' => $firstname,
|
||||
'NAME' => $name,
|
||||
'COMPANY' => $company,
|
||||
'SALUTATION' => getCorrectUserSalutation(array(
|
||||
'SALUTATION' => \Froxlor\User::getCorrectUserSalutation(array(
|
||||
'firstname' => $firstname,
|
||||
'name' => $name,
|
||||
'company' => $company
|
||||
@@ -696,7 +696,7 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
|
||||
$this->mailer()->Subject = $mail_subject;
|
||||
$this->mailer()->AltBody = $mail_body;
|
||||
$this->mailer()->msgHTML(str_replace("\n", "<br />", $mail_body));
|
||||
$this->mailer()->addAddress($email, getCorrectUserSalutation(array(
|
||||
$this->mailer()->addAddress($email, \Froxlor\User::getCorrectUserSalutation(array(
|
||||
'firstname' => $firstname,
|
||||
'name' => $name,
|
||||
'company' => $company
|
||||
@@ -1662,7 +1662,7 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
|
||||
), true, true);
|
||||
|
||||
// now, recalculate the resource-usage for the old and the new admin
|
||||
updateCounters(false);
|
||||
\Froxlor\User::updateCounters(false);
|
||||
|
||||
$this->logger()->logAction(ADM_ACTION, LOG_INFO, "[API] moved user '" . $c_result['loginname'] . "' from admin/reseller '" . $c_result['adminname'] . " to admin/reseller '" . $a_result['loginname'] . "'");
|
||||
|
||||
|
||||
@@ -74,15 +74,15 @@ class DirOptions extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
||||
$path = \Froxlor\FileDir::makeCorrectDir($customer['documentroot'] . '/' . $path);
|
||||
|
||||
if (! empty($error404path)) {
|
||||
$error404path = correctErrorDocument($error404path, true);
|
||||
$error404path = $this->correctErrorDocument($error404path, true);
|
||||
}
|
||||
|
||||
if (! empty($error403path)) {
|
||||
$error403path = correctErrorDocument($error403path, true);
|
||||
$error403path = $this->correctErrorDocument($error403path, true);
|
||||
}
|
||||
|
||||
if (! empty($error500path)) {
|
||||
$error500path = correctErrorDocument($error500path, true);
|
||||
$error500path = $this->correctErrorDocument($error500path, true);
|
||||
}
|
||||
|
||||
// check for duplicate path
|
||||
@@ -236,15 +236,15 @@ class DirOptions extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
||||
$error500path = $this->getParam('error500path', true, $result['error500path']);
|
||||
|
||||
if (! empty($error404path)) {
|
||||
$error404path = correctErrorDocument($error404path, true);
|
||||
$error404path = $this->correctErrorDocument($error404path, true);
|
||||
}
|
||||
|
||||
if (! empty($error403path)) {
|
||||
$error403path = correctErrorDocument($error403path, true);
|
||||
$error403path = $this->correctErrorDocument($error403path, true);
|
||||
}
|
||||
|
||||
if (! empty($error500path)) {
|
||||
$error500path = correctErrorDocument($error500path, true);
|
||||
$error500path = $this->correctErrorDocument($error500path, true);
|
||||
}
|
||||
|
||||
if (($options_indexes != $result['options_indexes']) || ($error404path != $result['error404path']) || ($error403path != $result['error403path']) || ($error500path != $result['error500path']) || ($options_cgi != $result['options_cgi'])) {
|
||||
@@ -378,4 +378,46 @@ class DirOptions extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
||||
\Froxlor\System\Cronjob::inserttask('1');
|
||||
return $this->response(200, "successfull", $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* this functions validates a given value as ErrorDocument
|
||||
* refs #267
|
||||
*
|
||||
* @param
|
||||
* string error-document-string
|
||||
* @param bool $throw_exception
|
||||
*
|
||||
* @return string error-document-string
|
||||
*
|
||||
*/
|
||||
private function correctErrorDocument($errdoc = null, $throw_exception = false)
|
||||
{
|
||||
if ($errdoc !== null && $errdoc != '') {
|
||||
// not a URL
|
||||
if ((strtoupper(substr($errdoc, 0, 5)) != 'HTTP:' && strtoupper(substr($errdoc, 0, 6)) != 'HTTPS:') || ! \Froxlor\Validate\Form\Strings::validateUrl($errdoc)) {
|
||||
// a file
|
||||
if (substr($errdoc, 0, 1) != '"') {
|
||||
$errdoc = \Froxlor\FileDir::makeCorrectFile($errdoc);
|
||||
// apache needs a starting-slash (starting at the domains-docroot)
|
||||
if (! substr($errdoc, 0, 1) == '/') {
|
||||
$errdoc = '/' . $errdoc;
|
||||
}
|
||||
} // a string (check for ending ")
|
||||
else {
|
||||
// string won't work for lighty
|
||||
if (Settings::Get('system.webserver') == 'lighttpd') {
|
||||
\Froxlor\UI\Response::standard_error('stringerrordocumentnotvalidforlighty', '', $throw_exception);
|
||||
} elseif (substr($errdoc, - 1) != '"') {
|
||||
$errdoc .= '"';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (Settings::Get('system.webserver') == 'lighttpd') {
|
||||
\Froxlor\UI\Response::standard_error('urlerrordocumentnotvalidforlighty', '', $throw_exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $errdoc;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1617,7 +1617,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn
|
||||
\Froxlor\System\Cronjob::inserttask('11', $result['domain']);
|
||||
|
||||
$this->logger()->logAction(ADM_ACTION, LOG_INFO, "[API] deleted domain/subdomains (#" . $result['id'] . ")");
|
||||
updateCounters();
|
||||
\Froxlor\User::updateCounters();
|
||||
\Froxlor\System\Cronjob::inserttask('1');
|
||||
// Using nameserver, insert a task which rebuilds the server config
|
||||
\Froxlor\System\Cronjob::inserttask('4');
|
||||
|
||||
@@ -213,7 +213,7 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
|
||||
$_mailerror = false;
|
||||
$mailerr_msg = "";
|
||||
try {
|
||||
$this->mailer()->setFrom($admin['email'], getCorrectUserSalutation($admin));
|
||||
$this->mailer()->setFrom($admin['email'], \Froxlor\User::getCorrectUserSalutation($admin));
|
||||
$this->mailer()->Subject = $mail_subject;
|
||||
$this->mailer()->AltBody = $mail_body;
|
||||
$this->mailer()->msgHTML(str_replace("\n", "<br />", $mail_body));
|
||||
@@ -243,11 +243,11 @@ class EmailAccounts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Reso
|
||||
|
||||
$_mailerror = false;
|
||||
try {
|
||||
$this->mailer()->setFrom($admin['email'], getCorrectUserSalutation($admin));
|
||||
$this->mailer()->setFrom($admin['email'], \Froxlor\User::getCorrectUserSalutation($admin));
|
||||
$this->mailer()->Subject = $mail_subject;
|
||||
$this->mailer()->AltBody = $mail_body;
|
||||
$this->mailer()->msgHTML(str_replace("\n", "<br />", $mail_body));
|
||||
$this->mailer()->addAddress($idna_convert->encode($alternative_email), getCorrectUserSalutation($customer));
|
||||
$this->mailer()->addAddress($idna_convert->encode($alternative_email), \Froxlor\User::getCorrectUserSalutation($customer));
|
||||
$this->mailer()->send();
|
||||
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
||||
$mailerr_msg = $e->errorMessage();
|
||||
|
||||
@@ -187,8 +187,8 @@ class Ftps extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEntit
|
||||
|
||||
if ($sendinfomail == 1) {
|
||||
$replace_arr = array(
|
||||
'SALUTATION' => getCorrectUserSalutation($customer),
|
||||
'CUST_NAME' => getCorrectUserSalutation($customer), // < keep this for compatibility
|
||||
'SALUTATION' => \Froxlor\User::getCorrectUserSalutation($customer),
|
||||
'CUST_NAME' => \Froxlor\User::getCorrectUserSalutation($customer), // < keep this for compatibility
|
||||
'USR_NAME' => $username,
|
||||
'USR_PASS' => $password,
|
||||
'USR_PATH' => \Froxlor\FileDir::makeCorrectDir(str_replace($customer['documentroot'], "/", $path))
|
||||
@@ -204,7 +204,7 @@ class Ftps extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEntit
|
||||
$this->mailer()->Subject = $mail_subject;
|
||||
$this->mailer()->AltBody = $mail_body;
|
||||
$this->mailer()->msgHTML(str_replace("\n", "<br />", $mail_body));
|
||||
$this->mailer()->addAddress($customer['email'], getCorrectUserSalutation($customer));
|
||||
$this->mailer()->addAddress($customer['email'], \Froxlor\User::getCorrectUserSalutation($customer));
|
||||
$this->mailer()->send();
|
||||
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
||||
$mailerr_msg = $e->errorMessage();
|
||||
|
||||
@@ -127,8 +127,8 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
$userinfo = $customer;
|
||||
|
||||
$replace_arr = array(
|
||||
'SALUTATION' => getCorrectUserSalutation($userinfo),
|
||||
'CUST_NAME' => getCorrectUserSalutation($userinfo), // < keep this for compatibility
|
||||
'SALUTATION' => \Froxlor\User::getCorrectUserSalutation($userinfo),
|
||||
'CUST_NAME' => \Froxlor\User::getCorrectUserSalutation($userinfo), // < keep this for compatibility
|
||||
'DB_NAME' => $username,
|
||||
'DB_PASS' => $password,
|
||||
'DB_DESC' => $databasedescription,
|
||||
@@ -147,7 +147,7 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
|
||||
$this->mailer()->Subject = $mail_subject;
|
||||
$this->mailer()->AltBody = $mail_body;
|
||||
$this->mailer()->msgHTML(str_replace("\n", "<br />", $mail_body));
|
||||
$this->mailer()->addAddress($userinfo['email'], getCorrectUserSalutation($userinfo));
|
||||
$this->mailer()->addAddress($userinfo['email'], \Froxlor\User::getCorrectUserSalutation($userinfo));
|
||||
$this->mailer()->send();
|
||||
} catch (\PHPMailer\PHPMailer\Exception $e) {
|
||||
$mailerr_msg = $e->errorMessage();
|
||||
|
||||
@@ -302,7 +302,7 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
||||
));
|
||||
|
||||
if ($_doredirect) {
|
||||
addRedirectToDomain($subdomain_id, $redirectcode);
|
||||
\Froxlor\Domain\Domain::addRedirectToDomain($subdomain_id, $redirectcode);
|
||||
}
|
||||
|
||||
\Froxlor\System\Cronjob::inserttask('1');
|
||||
@@ -470,7 +470,7 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
||||
$isemaildomain = $this->getBoolParam('isemaildomain', true, $result['isemaildomain']);
|
||||
$openbasedir_path = $this->getParam('openbasedir_path', true, $result['openbasedir_path']);
|
||||
$phpsettingid = $this->getParam('phpsettingid', true, $result['phpsettingid']);
|
||||
$redirectcode = $this->getParam('redirectcode', true, getDomainRedirectId($id));
|
||||
$redirectcode = $this->getParam('redirectcode', true, \Froxlor\Domain\Domain::getDomainRedirectId($id));
|
||||
if (Settings::Get('system.use_ssl')) {
|
||||
$ssl_redirect = $this->getBoolParam('ssl_redirect', true, $result['ssl_redirect']);
|
||||
$letsencrypt = $this->getBoolParam('letsencrypt', true, $result['letsencrypt']);
|
||||
@@ -586,7 +586,7 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
||||
|
||||
// handle redirect
|
||||
if ($_doredirect) {
|
||||
updateRedirectOfDomain($id, $redirectcode);
|
||||
\Froxlor\Domain\Domain::updateRedirectOfDomain($id, $redirectcode);
|
||||
}
|
||||
|
||||
if ($path != $result['documentroot'] || $isemaildomain != $result['isemaildomain'] || $wwwserveralias != $result['wwwserveralias'] || $iswildcarddomain != $result['iswildcarddomain'] || $aliasdomain != $result['aliasdomain'] || $openbasedir_path != $result['openbasedir_path'] || $ssl_redirect != $result['ssl_redirect'] || $letsencrypt != $result['letsencrypt'] || $hsts_maxage != $result['hsts'] || $hsts_sub != $result['hsts_sub'] || $hsts_preload != $result['hsts_preload'] || $phpsettingid != $result['phpsettingid']) {
|
||||
@@ -855,7 +855,7 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc
|
||||
{
|
||||
// check whether an URL was specified
|
||||
$_doredirect = false;
|
||||
if (! empty($url) && validateUrl($url)) {
|
||||
if (! empty($url) && \Froxlor\Validate\Form\Strings::validateUrl($url)) {
|
||||
$path = $url;
|
||||
$_doredirect = true;
|
||||
} else {
|
||||
@@ -863,7 +863,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 (! preg_match('/^https?\:\/\//', $path) || ! \Froxlor\Validate\Form\Strings::validateUrl($path)) {
|
||||
if (strstr($path, ":") !== false) {
|
||||
\Froxlor\UI\Response::standard_error('pathmaynotcontaincolon', '', true);
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ class Apache extends HttpConfigBase
|
||||
foreach ($statusCodes as $statusCode) {
|
||||
if (Settings::Get('defaultwebsrverrhandler.err' . $statusCode) != '') {
|
||||
$defhandler = Settings::Get('defaultwebsrverrhandler.err' . $statusCode);
|
||||
if (! validateUrl($defhandler)) {
|
||||
if (! \Froxlor\Validate\Form\Strings::validateUrl($defhandler)) {
|
||||
if (substr($defhandler, 0, 1) != '"' && substr($defhandler, - 1, 1) != '"') {
|
||||
$defhandler = '"' . \Froxlor\FileDir::makeCorrectFile($defhandler) . '"';
|
||||
}
|
||||
@@ -1025,7 +1025,7 @@ class Apache extends HttpConfigBase
|
||||
$corrected_docroot = $domain['documentroot'];
|
||||
|
||||
// Get domain's redirect code
|
||||
$code = getDomainRedirectCode($domain['id']);
|
||||
$code = \Froxlor\Domain\Domain::getDomainRedirectCode($domain['id']);
|
||||
$modrew_red = '';
|
||||
if ($code != '') {
|
||||
$modrew_red = ' [R=' . $code . ';L,NE]';
|
||||
@@ -1190,7 +1190,7 @@ class Apache extends HttpConfigBase
|
||||
foreach ($statusCodes as $statusCode) {
|
||||
if (isset($row_diroptions['error' . $statusCode . 'path']) && $row_diroptions['error' . $statusCode . 'path'] != '') {
|
||||
$defhandler = $row_diroptions['error' . $statusCode . 'path'];
|
||||
if (! validateUrl($defhandler)) {
|
||||
if (! \Froxlor\Validate\Form\Strings::validateUrl($defhandler)) {
|
||||
if (substr($defhandler, 0, 1) != '"' && substr($defhandler, - 1, 1) != '"') {
|
||||
$defhandler = '"' . \Froxlor\FileDir::makeCorrectFile($defhandler) . '"';
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ class Lighttpd extends HttpConfigBase
|
||||
}
|
||||
|
||||
$defhandler = Settings::Get('defaultwebsrverrhandler.err404');
|
||||
if (! validateUrl($defhandler)) {
|
||||
if (! \Froxlor\Validate\Form\Strings::validateUrl($defhandler)) {
|
||||
$defhandler = \Froxlor\FileDir::makeCorrectFile($defhandler);
|
||||
}
|
||||
$this->lighttpd_data[$vhost_filename] = 'server.error-handler-404 = "' . $defhandler . '"';
|
||||
@@ -483,7 +483,7 @@ class Lighttpd extends HttpConfigBase
|
||||
$uri = $domain['documentroot'];
|
||||
|
||||
// Get domain's redirect code
|
||||
$code = getDomainRedirectCode($domain['id']);
|
||||
$code = \Froxlor\Domain\Domain::getDomainRedirectCode($domain['id']);
|
||||
|
||||
$vhost_content .= ' url.redirect-code = ' . $code . "\n";
|
||||
$vhost_content .= ' url.redirect = (' . "\n";
|
||||
@@ -701,7 +701,7 @@ class Lighttpd extends HttpConfigBase
|
||||
|
||||
if (! empty($row['error404path'])) {
|
||||
$defhandler = $row['error404path'];
|
||||
if (! validateUrl($defhandler)) {
|
||||
if (! \Froxlor\Validate\Form\Strings::validateUrl($defhandler)) {
|
||||
$defhandler = \Froxlor\FileDir::makeCorrectFile($domain['documentroot'] . '/' . $defhandler);
|
||||
}
|
||||
$error_string .= ' server.error-handler-404 = "' . $defhandler . '"' . "\n\n";
|
||||
|
||||
@@ -116,7 +116,7 @@ class Nginx extends HttpConfigBase
|
||||
foreach ($statusCodes as $statusCode) {
|
||||
if (Settings::Get('defaultwebsrverrhandler.err' . $statusCode) != '') {
|
||||
$defhandler = Settings::Get('defaultwebsrverrhandler.err' . $statusCode);
|
||||
if (! validateUrl($defhandler)) {
|
||||
if (! \Froxlor\Validate\Form\Strings::validateUrl($defhandler)) {
|
||||
$defhandler = \Froxlor\FileDir::makeCorrectFile($defhandler);
|
||||
}
|
||||
$this->nginx_data[$vhosts_filename] .= 'error_page ' . $statusCode . ' ' . $defhandler . ';' . "\n";
|
||||
@@ -499,7 +499,7 @@ class Nginx extends HttpConfigBase
|
||||
}
|
||||
|
||||
// Get domain's redirect code
|
||||
$code = getDomainRedirectCode($domain['id']);
|
||||
$code = \Froxlor\Domain\Domain::getDomainRedirectCode($domain['id']);
|
||||
|
||||
$vhost_content .= "\t" . 'if ($request_uri !~ ^/.well-known/acme-challenge/[-\w]+$) {' . "\n";
|
||||
$vhost_content .= "\t\t" . 'return ' . $code . ' ' . $uri . '$request_uri;' . "\n";
|
||||
@@ -703,7 +703,7 @@ class Nginx extends HttpConfigBase
|
||||
while ($row = $result_stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
if (! empty($row['error404path'])) {
|
||||
$defhandler = $row['error404path'];
|
||||
if (! validateUrl($defhandler)) {
|
||||
if (! \Froxlor\Validate\Form\Strings::validateUrl($defhandler)) {
|
||||
$defhandler = \Froxlor\FileDir::makeCorrectFile($defhandler);
|
||||
}
|
||||
$path_options .= "\t" . 'error_page 404 ' . $defhandler . ';' . "\n";
|
||||
@@ -711,7 +711,7 @@ class Nginx extends HttpConfigBase
|
||||
|
||||
if (! empty($row['error403path'])) {
|
||||
$defhandler = $row['error403path'];
|
||||
if (! validateUrl($defhandler)) {
|
||||
if (! \Froxlor\Validate\Form\Strings::validateUrl($defhandler)) {
|
||||
$defhandler = \Froxlor\FileDir::makeCorrectFile($defhandler);
|
||||
}
|
||||
$path_options .= "\t" . 'error_page 403 ' . $defhandler . ';' . "\n";
|
||||
@@ -719,7 +719,7 @@ class Nginx extends HttpConfigBase
|
||||
|
||||
if (! empty($row['error500path'])) {
|
||||
$defhandler = $row['error500path'];
|
||||
if (! validateUrl($defhandler)) {
|
||||
if (! \Froxlor\Validate\Form\Strings::validateUrl($defhandler)) {
|
||||
$defhandler = \Froxlor\FileDir::makeCorrectFile($defhandler);
|
||||
}
|
||||
$path_options .= "\t" . 'error_page 500 502 503 504 ' . $defhandler . ';' . "\n";
|
||||
|
||||
@@ -63,7 +63,7 @@ class ReportsCron extends \Froxlor\Cron\FroxlorCron
|
||||
'company' => $row['company']
|
||||
);
|
||||
$replace_arr = array(
|
||||
'SALUTATION' => getCorrectUserSalutation($rep_userinfo),
|
||||
'SALUTATION' => \Froxlor\User::getCorrectUserSalutation($rep_userinfo),
|
||||
'NAME' => $row['name'], // < keep this for compatibility
|
||||
'TRAFFIC' => round(($row['traffic'] / 1024), 2), /* traffic is stored in KB, template uses MB */
|
||||
'TRAFFICUSED' => round(($row['traffic_used'] / 1024), 2), /* traffic is stored in KB, template uses MB */
|
||||
@@ -362,7 +362,7 @@ class ReportsCron extends \Froxlor\Cron\FroxlorCron
|
||||
'company' => $row['company']
|
||||
);
|
||||
$replace_arr = array(
|
||||
'SALUTATION' => getCorrectUserSalutation($rep_userinfo),
|
||||
'SALUTATION' => \Froxlor\User::getCorrectUserSalutation($rep_userinfo),
|
||||
'NAME' => $row['name'], // < keep this for compatibility
|
||||
'DISKAVAILABLE' => round(($row['diskspace'] / 1024), 2), /* traffic is stored in KB, template uses MB */
|
||||
'DISKUSED' => round($row['diskspace_used'] / 1024, 2), /* traffic is stored in KB, template uses MB */
|
||||
|
||||
@@ -6,6 +6,176 @@ use Froxlor\Database\Database;
|
||||
class Domain
|
||||
{
|
||||
|
||||
/**
|
||||
* return an array of all enabled redirect-codes
|
||||
*
|
||||
* @return array array of enabled redirect-codes
|
||||
*/
|
||||
public static function getRedirectCodesArray()
|
||||
{
|
||||
$sql = "SELECT * FROM `" . TABLE_PANEL_REDIRECTCODES . "` WHERE `enabled` = '1' ORDER BY `id` ASC";
|
||||
$result_stmt = Database::query($sql);
|
||||
|
||||
$codes = array();
|
||||
while ($rc = $result_stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$codes[] = $rc;
|
||||
}
|
||||
|
||||
return $codes;
|
||||
}
|
||||
|
||||
/**
|
||||
* return an array of all enabled redirect-codes
|
||||
* for the settings form
|
||||
*
|
||||
* @param bool $add_desc
|
||||
* optional, default true, add the code-description
|
||||
*
|
||||
* @return array array of enabled redirect-codes
|
||||
*/
|
||||
public static function getRedirectCodes($add_desc = true)
|
||||
{
|
||||
global $lng;
|
||||
|
||||
$sql = "SELECT * FROM `" . TABLE_PANEL_REDIRECTCODES . "` WHERE `enabled` = '1' ORDER BY `id` ASC";
|
||||
$result_stmt = Database::query($sql);
|
||||
|
||||
$codes = array();
|
||||
while ($rc = $result_stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$codes[$rc['id']] = $rc['code'];
|
||||
if ($add_desc) {
|
||||
$codes[$rc['id']] .= ' (' . $lng['redirect_desc'][$rc['desc']] . ')';
|
||||
}
|
||||
}
|
||||
|
||||
return $codes;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the redirect-code for a given
|
||||
* domain-id
|
||||
*
|
||||
* @param integer $domainid
|
||||
* id of the domain
|
||||
*
|
||||
* @return string redirect-code
|
||||
*/
|
||||
public static function getDomainRedirectCode($domainid = 0)
|
||||
{
|
||||
|
||||
// get system default
|
||||
$default = '301';
|
||||
if (\Froxlor\Settings::Get('customredirect.enabled') == '1') {
|
||||
$all_codes = self::getRedirectCodes(false);
|
||||
$_default = $all_codes[\Froxlor\Settings::Get('customredirect.default')];
|
||||
$default = ($_default == '---') ? $default : $_default;
|
||||
}
|
||||
$code = $default;
|
||||
if ($domainid > 0) {
|
||||
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `r`.`code` as `redirect`
|
||||
FROM `" . TABLE_PANEL_REDIRECTCODES . "` `r`, `" . TABLE_PANEL_DOMAINREDIRECTS . "` `rc`
|
||||
WHERE `r`.`id` = `rc`.`rid` and `rc`.`did` = :domainid
|
||||
");
|
||||
$result = Database::pexecute_first($result_stmt, array(
|
||||
'domainid' => $domainid
|
||||
));
|
||||
|
||||
if (is_array($result) && isset($result['redirect'])) {
|
||||
$code = ($result['redirect'] == '---') ? $default : $result['redirect'];
|
||||
}
|
||||
}
|
||||
return $code;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the redirect-id for a given
|
||||
* domain-id
|
||||
*
|
||||
* @param integer $domainid
|
||||
* id of the domain
|
||||
*
|
||||
* @return integer redirect-code-id
|
||||
*/
|
||||
public static function getDomainRedirectId($domainid = 0)
|
||||
{
|
||||
$code = 1;
|
||||
if ($domainid > 0) {
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `r`.`id` as `redirect`
|
||||
FROM `" . TABLE_PANEL_REDIRECTCODES . "` `r`, `" . TABLE_PANEL_DOMAINREDIRECTS . "` `rc`
|
||||
WHERE `r`.`id` = `rc`.`rid` and `rc`.`did` = :domainid
|
||||
");
|
||||
$result = Database::pexecute_first($result_stmt, array(
|
||||
'domainid' => $domainid
|
||||
));
|
||||
|
||||
if (is_array($result) && isset($result['redirect'])) {
|
||||
$code = (int) $result['redirect'];
|
||||
}
|
||||
}
|
||||
return $code;
|
||||
}
|
||||
|
||||
/**
|
||||
* adds a redirectcode for a domain
|
||||
*
|
||||
* @param integer $domainid
|
||||
* id of the domain to add the code for
|
||||
* @param integer $redirect
|
||||
* selected redirect-id
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public static function addRedirectToDomain($domainid = 0, $redirect = 1)
|
||||
{
|
||||
if ($domainid > 0) {
|
||||
$ins_stmt = Database::prepare("
|
||||
INSERT INTO `" . TABLE_PANEL_DOMAINREDIRECTS . "` SET `rid` = :rid, `did` = :did
|
||||
");
|
||||
Database::pexecute($ins_stmt, array(
|
||||
'rid' => $redirect,
|
||||
'did' => $domainid
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* updates the redirectcode of a domain
|
||||
* if redirect-code is false, nothing happens
|
||||
*
|
||||
* @param integer $domainid
|
||||
* id of the domain to update
|
||||
* @param integer $redirect
|
||||
* selected redirect-id or false
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public static function updateRedirectOfDomain($domainid = 0, $redirect = false)
|
||||
{
|
||||
if ($redirect == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($domainid > 0) {
|
||||
$del_stmt = Database::prepare("
|
||||
DELETE FROM `" . TABLE_PANEL_DOMAINREDIRECTS . "` WHERE `did` = :domainid
|
||||
");
|
||||
Database::pexecute($del_stmt, array(
|
||||
'domainid' => $domainid
|
||||
));
|
||||
|
||||
$ins_stmt = Database::prepare("
|
||||
INSERT INTO `" . TABLE_PANEL_DOMAINREDIRECTS . "` SET `rid` = :rid, `did` = :did
|
||||
");
|
||||
Database::pexecute($ins_stmt, array(
|
||||
'rid' => $redirect,
|
||||
'did' => $domainid
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* check whether a domain has subdomains added as full-domains
|
||||
* #329
|
||||
|
||||
@@ -4,6 +4,185 @@ namespace Froxlor;
|
||||
class PhpHelper
|
||||
{
|
||||
|
||||
/**
|
||||
* Wrapper around htmlentities to handle arrays, with the advantage that you
|
||||
* can select which fields should be handled by htmlentities
|
||||
*
|
||||
* @param array $subject
|
||||
* The subject array
|
||||
* @param string $fields
|
||||
* The fields which should be checked for, separated by spaces
|
||||
* @param int $quote_style
|
||||
* See php documentation about this
|
||||
* @param string $charset
|
||||
* See php documentation about this
|
||||
*
|
||||
* @return array The array with htmlentitie'd strings
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
public static function htmlentities_array($subject, $fields = '', $quote_style = ENT_QUOTES, $charset = 'UTF-8')
|
||||
{
|
||||
if (is_array($subject)) {
|
||||
if (! is_array($fields)) {
|
||||
$fields = array_trim(explode(' ', $fields));
|
||||
}
|
||||
|
||||
foreach ($subject as $field => $value) {
|
||||
if ((! is_array($fields) || empty($fields)) || (is_array($fields) && ! empty($fields) && in_array($field, $fields))) {
|
||||
// Just call ourselve to manage multi-dimensional arrays
|
||||
$subject[$field] = self::htmlentities_array($subject[$field], $fields, $quote_style, $charset);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$subject = htmlentities($subject, $quote_style, $charset);
|
||||
}
|
||||
|
||||
return $subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces Strings in an array, with the advantage that you
|
||||
* can select which fields should be str_replace'd
|
||||
*
|
||||
* @param
|
||||
* mixed String or array of strings to search for
|
||||
* @param
|
||||
* mixed String or array to replace with
|
||||
* @param
|
||||
* array The subject array
|
||||
* @param
|
||||
* string The fields which should be checked for, separated by spaces
|
||||
* @return array The str_replace'd array
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
public static function str_replace_array($search, $replace, $subject, $fields = '')
|
||||
{
|
||||
if (is_array($subject)) {
|
||||
$fields = array_trim(explode(' ', $fields));
|
||||
foreach ($subject as $field => $value) {
|
||||
if ((! is_array($fields) || empty($fields)) || (is_array($fields) && ! empty($fields) && in_array($field, $fields))) {
|
||||
$subject[$field] = str_replace($search, $replace, $subject[$field]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$subject = str_replace($search, $replace, $subject);
|
||||
}
|
||||
|
||||
return $subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* froxlor php error handler
|
||||
*
|
||||
* @param int $errno
|
||||
* @param string $errstr
|
||||
* @param string $errfile
|
||||
* @param int $errline
|
||||
* @param array $errcontext
|
||||
*
|
||||
* @return void|boolean
|
||||
*/
|
||||
public static function phpErrHandler($errno, $errstr, $errfile, $errline, $errcontext)
|
||||
{
|
||||
if (! (error_reporting() & $errno)) {
|
||||
// This error code is not included in error_reporting
|
||||
return;
|
||||
}
|
||||
|
||||
if (! isset($_SERVER['SHELL']) || (isset($_SERVER['SHELL']) && $_SERVER['SHELL'] == '')) {
|
||||
global $theme;
|
||||
|
||||
// fallback
|
||||
if (empty($theme)) {
|
||||
$theme = "Sparkle";
|
||||
}
|
||||
// prevent possible file-path-disclosure
|
||||
$errfile = str_replace(\Froxlor\Froxlor::getInstallDir(), "", $errfile);
|
||||
// if we're not on the shell, output a nicer error-message
|
||||
$err_hint = file_get_contents(\Froxlor\Froxlor::getInstallDir() . '/templates/' . $theme . '/misc/phperrornice.tpl');
|
||||
// replace values
|
||||
$err_hint = str_replace("<TEXT>", '#' . $errno . ' ' . $errstr, $err_hint);
|
||||
$err_hint = str_replace("<DEBUG>", $errfile . ':' . $errline, $err_hint);
|
||||
|
||||
// show
|
||||
echo $err_hint;
|
||||
// return true to ignore php standard error-handler
|
||||
return true;
|
||||
}
|
||||
|
||||
// of on shell, use the php standard error-handler
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function loadConfigArrayDir()
|
||||
{
|
||||
// Workaround until we use gettext
|
||||
global $lng, $theme;
|
||||
|
||||
// we now use dynamic function parameters
|
||||
// so we can read from more than one directory
|
||||
// and still be valid for old calls
|
||||
$numargs = func_num_args();
|
||||
if ($numargs <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// variable that holds all dirs that will
|
||||
// be parsed for inclusion
|
||||
$configdirs = array();
|
||||
// if one of the parameters is an array
|
||||
// we assume that this is a list of
|
||||
// setting-groups to be selected
|
||||
$selection = null;
|
||||
for ($x = 0; $x < $numargs; $x ++) {
|
||||
$arg = func_get_arg($x);
|
||||
if (is_array($arg) && isset($arg[0])) {
|
||||
$selection = $arg;
|
||||
} else {
|
||||
$configdirs[] = $arg;
|
||||
}
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data_files = array();
|
||||
$has_data = false;
|
||||
|
||||
foreach ($configdirs as $data_dirname) {
|
||||
if (is_dir($data_dirname)) {
|
||||
$data_dirhandle = opendir($data_dirname);
|
||||
while (false !== ($data_filename = readdir($data_dirhandle))) {
|
||||
if ($data_filename != '.' && $data_filename != '..' && $data_filename != '' && substr($data_filename, - 4) == '.php') {
|
||||
$data_files[] = $data_dirname . $data_filename;
|
||||
}
|
||||
}
|
||||
$has_data = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($has_data) {
|
||||
sort($data_files);
|
||||
foreach ($data_files as $data_filename) {
|
||||
$data = array_merge_recursive($data, include ($data_filename));
|
||||
}
|
||||
}
|
||||
|
||||
// if we have specific setting-groups
|
||||
// to select, we'll handle this here
|
||||
// (this is for multiserver-client settings)
|
||||
$_data = array();
|
||||
if ($selection != null && is_array($selection) && isset($selection[0])) {
|
||||
$_data['groups'] = array();
|
||||
foreach ($data['groups'] as $group => $data) {
|
||||
if (in_array($group, $selection)) {
|
||||
$_data['groups'][$group] = $data;
|
||||
}
|
||||
}
|
||||
$data = $_data;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* ipv6 aware gethostbynamel function
|
||||
*
|
||||
|
||||
@@ -4,6 +4,106 @@ namespace Froxlor\UI;
|
||||
class HTML
|
||||
{
|
||||
|
||||
/**
|
||||
* Build Navigation Sidebar
|
||||
*
|
||||
* @param
|
||||
* array navigation data
|
||||
* @param
|
||||
* array userinfo the userinfo of the user
|
||||
* @return string the content of the navigation bar
|
||||
*
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
public static function buildNavigation($navigation, $userinfo)
|
||||
{
|
||||
global $theme;
|
||||
|
||||
$returnvalue = '';
|
||||
|
||||
// sanitize user-given input (url-manipulation)
|
||||
if (isset($_GET['page']) && is_array($_GET['page'])) {
|
||||
$_GET['page'] = (string) $_GET['page'][0];
|
||||
}
|
||||
if (isset($_GET['action']) && is_array($_GET['action'])) {
|
||||
$_GET['action'] = (string) $_GET['action'][0];
|
||||
}
|
||||
|
||||
foreach ($navigation as $box) {
|
||||
if ((! isset($box['show_element']) || $box['show_element'] === true) && (! isset($box['required_resources']) || $box['required_resources'] == '' || (isset($userinfo[$box['required_resources']]) && ((int) $userinfo[$box['required_resources']] > 0 || $userinfo[$box['required_resources']] == '-1')))) {
|
||||
$navigation_links = '';
|
||||
foreach ($box['elements'] as $element_id => $element) {
|
||||
if ((! isset($element['show_element']) || $element['show_element'] === true) && (! isset($element['required_resources']) || $element['required_resources'] == '' || (isset($userinfo[$element['required_resources']]) && ((int) $userinfo[$element['required_resources']] > 0 || $userinfo[$element['required_resources']] == '-1')))) {
|
||||
$target = '';
|
||||
$active = '';
|
||||
$navurl = '#';
|
||||
if (isset($element['url']) && trim($element['url']) != '') {
|
||||
// append sid only to local
|
||||
|
||||
if (! preg_match('/^https?\:\/\//', $element['url']) && (isset($userinfo['hash']) && $userinfo['hash'] != '')) {
|
||||
// generate sid with ? oder &
|
||||
|
||||
if (strpos($element['url'], '?') !== false) {
|
||||
$element['url'] .= '&s=' . $userinfo['hash'];
|
||||
} else {
|
||||
$element['url'] .= '?s=' . $userinfo['hash'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($element['new_window']) && $element['new_window'] == true) {
|
||||
$target = ' target="_blank"';
|
||||
}
|
||||
|
||||
if (isset($_GET['page']) && substr_count($element['url'], "page=" . $_GET['page']) > 0 && substr_count($element['url'], basename($_SERVER["SCRIPT_FILENAME"])) > 0 && isset($_GET['action']) && substr_count($element['url'], "action=" . $_GET['action']) > 0) {
|
||||
$active = ' active';
|
||||
} elseif (isset($_GET['page']) && substr_count($element['url'], "page=" . $_GET['page']) > 0 && substr_count($element['url'], basename($_SERVER["SCRIPT_FILENAME"])) > 0 && substr_count($element['url'], "action=") == 0 && ! isset($_GET['action'])) {
|
||||
$active = ' active';
|
||||
}
|
||||
|
||||
$navurl = htmlspecialchars($element['url']);
|
||||
$navlabel = $element['label'];
|
||||
} else {
|
||||
$navlabel = $element['label'];
|
||||
}
|
||||
|
||||
eval("\$navigation_links .= \"" . \Froxlor\UI\Template::getTemplate("navigation_link", 1) . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
if ($navigation_links != '') {
|
||||
$target = '';
|
||||
if (isset($box['url']) && trim($box['url']) != '') {
|
||||
// append sid only to local
|
||||
|
||||
if (! preg_match('/^https?\:\/\//', $box['url']) && (isset($userinfo['hash']) && $userinfo['hash'] != '')) {
|
||||
// generate sid with ? oder &
|
||||
|
||||
if (strpos($box['url'], '?') !== false) {
|
||||
$box['url'] .= '&s=' . $userinfo['hash'];
|
||||
} else {
|
||||
$box['url'] .= '?s=' . $userinfo['hash'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($box['new_window']) && $box['new_window'] == true) {
|
||||
$target = ' target="_blank"';
|
||||
}
|
||||
|
||||
$navurl = htmlspecialchars($box['url']);
|
||||
$navlabel = $box['label'];
|
||||
} else {
|
||||
$navurl = "#";
|
||||
$navlabel = $box['label'];
|
||||
}
|
||||
|
||||
eval("\$returnvalue .= \"" . \Froxlor\UI\Template::getTemplate("navigation_element", 1) . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $returnvalue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return HTML Code for a checkbox
|
||||
*
|
||||
|
||||
346
lib/Froxlor/User.php
Normal file
346
lib/Froxlor/User.php
Normal file
@@ -0,0 +1,346 @@
|
||||
<?php
|
||||
namespace Froxlor;
|
||||
|
||||
use Froxlor\Database\Database;
|
||||
|
||||
class User
|
||||
{
|
||||
|
||||
/**
|
||||
* Returns full style user details "Name, Firstname | Company"
|
||||
*
|
||||
* @param
|
||||
* array An array with keys firstname, name and company
|
||||
* @return string The full details
|
||||
*
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
public static function getCorrectFullUserDetails($userinfo)
|
||||
{
|
||||
$returnval = '';
|
||||
|
||||
if (isset($userinfo['firstname']) && isset($userinfo['name']) && isset($userinfo['company'])) {
|
||||
if ($userinfo['company'] == '') {
|
||||
$returnval = $userinfo['name'] . ', ' . $userinfo['firstname'];
|
||||
} else {
|
||||
if ($userinfo['name'] != '' && $userinfo['firstname'] != '') {
|
||||
$returnval = $userinfo['name'] . ', ' . $userinfo['firstname'] . ' | ' . $userinfo['company'];
|
||||
} else {
|
||||
$returnval = $userinfo['company'];
|
||||
}
|
||||
}
|
||||
} elseif (isset($userinfo['name'])) {
|
||||
$returnval = $userinfo['name'];
|
||||
}
|
||||
|
||||
return $returnval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns correct user salutation, either "Firstname Name" or "Company"
|
||||
*
|
||||
* @param
|
||||
* array An array with keys firstname, name and company
|
||||
* @return string The correct salutation
|
||||
*
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
public static function getCorrectUserSalutation($userinfo)
|
||||
{
|
||||
$returnval = '';
|
||||
|
||||
if (isset($userinfo['firstname']) && isset($userinfo['name']) && isset($userinfo['company'])) {
|
||||
// Always prefer firstname name
|
||||
|
||||
if ($userinfo['company'] != '' && $userinfo['name'] == '' && $userinfo['firstname'] == '') {
|
||||
$returnval = $userinfo['company'];
|
||||
} else {
|
||||
$returnval = $userinfo['firstname'] . ' ' . $userinfo['name'];
|
||||
}
|
||||
}
|
||||
|
||||
return $returnval;
|
||||
}
|
||||
|
||||
public static function getLanguages()
|
||||
{
|
||||
$result_stmt = \Froxlor\Database\Database::query("SELECT * FROM `" . TABLE_PANEL_LANGUAGE . "` ");
|
||||
$languages_array = array();
|
||||
|
||||
while ($row = $result_stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
if (! isset($languages_array[$row['language']]) && ! in_array($row['language'], $languages_array)) {
|
||||
$languages_array[$row['language']] = html_entity_decode($row['language']);
|
||||
}
|
||||
}
|
||||
|
||||
return $languages_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function which updates all counters of used ressources in panel_admins and panel_customers
|
||||
*
|
||||
* @param
|
||||
* bool Set to true to get an array with debug information
|
||||
* @return array Contains debug information if parameter 'returndebuginfo' is set to true
|
||||
*
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
*/
|
||||
public static function updateCounters($returndebuginfo = false)
|
||||
{
|
||||
$returnval = array();
|
||||
|
||||
if ($returndebuginfo === true) {
|
||||
$returnval = array(
|
||||
'admins' => array(),
|
||||
'customers' => array()
|
||||
);
|
||||
}
|
||||
|
||||
// Customers
|
||||
$customers_stmt = Database::prepare('SELECT * FROM `' . TABLE_PANEL_CUSTOMERS . '` ORDER BY `customerid`');
|
||||
Database::pexecute($customers_stmt);
|
||||
|
||||
$admin_resources = array();
|
||||
while ($customer = $customers_stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
|
||||
$cur_adm = $customer['adminid'];
|
||||
|
||||
// initialize admin-resources array for admin $customer['adminid']
|
||||
if (! isset($admin_resources[$cur_adm])) {
|
||||
$admin_resources[$cur_adm] = array();
|
||||
}
|
||||
|
||||
self::_addResourceCountEx($admin_resources[$cur_adm], $customer, 'diskspace_used', 'diskspace');
|
||||
self::_addResourceCountEx($admin_resources[$cur_adm], $customer, 'traffic_used', 'traffic_used'); // !!! yes, USED and USED
|
||||
|
||||
foreach (array(
|
||||
'mysqls',
|
||||
'ftps',
|
||||
'emails',
|
||||
'email_accounts',
|
||||
'email_forwarders',
|
||||
'email_quota',
|
||||
'subdomains'
|
||||
) as $field) {
|
||||
_addResourceCount($admin_resources[$cur_adm], $customer, $field . '_used', $field);
|
||||
}
|
||||
|
||||
$customer_mysqls_stmt = Database::prepare('SELECT COUNT(*) AS `number_mysqls` FROM `' . TABLE_PANEL_DATABASES . '`
|
||||
WHERE `customerid` = :cid');
|
||||
$customer_mysqls = Database::pexecute_first($customer_mysqls_stmt, array(
|
||||
"cid" => $customer['customerid']
|
||||
));
|
||||
$customer['mysqls_used_new'] = (int) $customer_mysqls['number_mysqls'];
|
||||
|
||||
$customer_emails_stmt = Database::prepare('SELECT COUNT(*) AS `number_emails` FROM `' . TABLE_MAIL_VIRTUAL . '`
|
||||
WHERE `customerid` = :cid');
|
||||
$customer_emails = Database::pexecute_first($customer_emails_stmt, array(
|
||||
"cid" => $customer['customerid']
|
||||
));
|
||||
$customer['emails_used_new'] = (int) $customer_emails['number_emails'];
|
||||
|
||||
$customer_emails_result_stmt = Database::prepare('SELECT `email`, `email_full`, `destination`, `popaccountid` AS `number_email_forwarders` FROM `' . TABLE_MAIL_VIRTUAL . '`
|
||||
WHERE `customerid` = :cid');
|
||||
Database::pexecute($customer_emails_result_stmt, array(
|
||||
"cid" => $customer['customerid']
|
||||
));
|
||||
$customer_email_forwarders = 0;
|
||||
$customer_email_accounts = 0;
|
||||
|
||||
while ($customer_emails_row = $customer_emails_result_stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
if ($customer_emails_row['destination'] != '') {
|
||||
$customer_emails_row['destination'] = explode(' ', \Froxlor\FileDir::makeCorrectDestination($customer_emails_row['destination']));
|
||||
$customer_email_forwarders += count($customer_emails_row['destination']);
|
||||
|
||||
if (in_array($customer_emails_row['email_full'], $customer_emails_row['destination'])) {
|
||||
$customer_email_forwarders -= 1;
|
||||
$customer_email_accounts ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$customer['email_accounts_used_new'] = $customer_email_accounts;
|
||||
$customer['email_forwarders_used_new'] = $customer_email_forwarders;
|
||||
|
||||
$customer_ftps_stmt = Database::prepare('SELECT COUNT(*) AS `number_ftps` FROM `' . TABLE_FTP_USERS . '` WHERE `customerid` = :cid');
|
||||
$customer_ftps = Database::pexecute_first($customer_ftps_stmt, array(
|
||||
"cid" => $customer['customerid']
|
||||
));
|
||||
$customer['ftps_used_new'] = ((int) $customer_ftps['number_ftps'] - 1);
|
||||
|
||||
$customer_subdomains_stmt = Database::prepare('SELECT COUNT(*) AS `number_subdomains` FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `customerid` = :cid AND `parentdomainid` <> "0"');
|
||||
$customer_subdomains = Database::pexecute_first($customer_subdomains_stmt, array(
|
||||
"cid" => $customer['customerid']
|
||||
));
|
||||
$customer['subdomains_used_new'] = (int) $customer_subdomains['number_subdomains'];
|
||||
|
||||
$customer_email_quota_stmt = Database::prepare('SELECT SUM(`quota`) AS `email_quota` FROM `' . TABLE_MAIL_USERS . '` WHERE `customerid` = :cid');
|
||||
$customer_email_quota = Database::pexecute_first($customer_email_quota_stmt, array(
|
||||
"cid" => $customer['customerid']
|
||||
));
|
||||
$customer['email_quota_used_new'] = (int) $customer_email_quota['email_quota'];
|
||||
|
||||
$stmt = Database::prepare('UPDATE `' . TABLE_PANEL_CUSTOMERS . '`
|
||||
SET `mysqls_used` = :mysqls_used,
|
||||
`emails_used` = :emails_used,
|
||||
`email_accounts_used` = :email_accounts_used,
|
||||
`email_forwarders_used` = :email_forwarders_used,
|
||||
`email_quota_used` = :email_quota_used,
|
||||
`ftps_used` = :ftps_used,
|
||||
`subdomains_used` = :subdomains_used
|
||||
WHERE `customerid` = :cid');
|
||||
$params = array(
|
||||
"mysqls_used" => $customer['mysqls_used_new'],
|
||||
"emails_used" => $customer['emails_used_new'],
|
||||
"email_accounts_used" => $customer['email_accounts_used_new'],
|
||||
"email_forwarders_used" => $customer['email_forwarders_used_new'],
|
||||
"email_quota_used" => $customer['email_quota_used_new'],
|
||||
"ftps_used" => $customer['ftps_used_new'],
|
||||
"subdomains_used" => $customer['subdomains_used_new'],
|
||||
"cid" => $customer['customerid']
|
||||
);
|
||||
Database::pexecute($stmt, $params);
|
||||
|
||||
if ($returndebuginfo === true) {
|
||||
$returnval['customers'][$customer['customerid']] = $customer;
|
||||
}
|
||||
}
|
||||
|
||||
// Admins
|
||||
$admins_stmt = Database::prepare('SELECT * FROM `' . TABLE_PANEL_ADMINS . '` ORDER BY `adminid`');
|
||||
Database::pexecute($admins_stmt, array());
|
||||
|
||||
while ($admin = $admins_stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$admin_customers_stmt = Database::prepare('SELECT COUNT(*) AS `number_customers` FROM `' . TABLE_PANEL_CUSTOMERS . '` WHERE `adminid` = :aid');
|
||||
$admin_customers = Database::pexecute_first($admin_customers_stmt, array(
|
||||
"aid" => $admin['adminid']
|
||||
));
|
||||
$admin['customers_used_new'] = $admin_customers['number_customers'];
|
||||
|
||||
$admin_domains_stmt = Database::prepare('SELECT COUNT(*) AS `number_domains` FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `adminid` = :aid AND `isemaildomain` = "1"');
|
||||
$admin_domains = Database::pexecute_first($admin_domains_stmt, array(
|
||||
"aid" => $admin['adminid']
|
||||
));
|
||||
$admin['domains_used_new'] = $admin_domains['number_domains'];
|
||||
|
||||
$cur_adm = $admin['adminid'];
|
||||
|
||||
if (! isset($admin_resources[$cur_adm])) {
|
||||
$admin_resources[$cur_adm] = array();
|
||||
}
|
||||
|
||||
foreach (array(
|
||||
'diskspace_used',
|
||||
'traffic_used',
|
||||
'mysqls_used',
|
||||
'ftps_used',
|
||||
'emails_used',
|
||||
'email_accounts_used',
|
||||
'email_forwarders_used',
|
||||
'email_quota_used',
|
||||
'subdomains_used'
|
||||
) as $field) {
|
||||
self::_initArrField($field, $admin_resources[$cur_adm], 0);
|
||||
$admin[$field . '_new'] = $admin_resources[$cur_adm][$field];
|
||||
}
|
||||
|
||||
$stmt = Database::prepare('UPDATE `' . TABLE_PANEL_ADMINS . '`
|
||||
SET `customers_used` = :customers_used,
|
||||
`domains_used` = :domains_used,
|
||||
`diskspace_used` = :diskspace_used,
|
||||
`mysqls_used` = :mysqls_used,
|
||||
`emails_used` = :emails_used,
|
||||
`email_accounts_used` = :email_accounts_used,
|
||||
`email_forwarders_used` = :email_forwarders_used,
|
||||
`email_quota_used` = :email_quota_used,
|
||||
`ftps_used` = :ftps_used,
|
||||
`subdomains_used` = :subdomains_used,
|
||||
`traffic_used` = :traffic_used
|
||||
WHERE `adminid` = :aid');
|
||||
|
||||
$params = array(
|
||||
"customers_used" => $admin['customers_used_new'],
|
||||
"domains_used" => $admin['domains_used_new'],
|
||||
"diskspace_used" => $admin['diskspace_used_new'],
|
||||
"mysqls_used" => $admin['mysqls_used_new'],
|
||||
"emails_used" => $admin['emails_used_new'],
|
||||
"email_accounts_used" => $admin['email_accounts_used_new'],
|
||||
"email_forwarders_used" => $admin['email_forwarders_used_new'],
|
||||
"email_quota_used" => $admin['email_quota_used_new'],
|
||||
"ftps_used" => $admin['ftps_used_new'],
|
||||
"subdomains_used" => $admin['subdomains_used_new'],
|
||||
"traffic_used" => $admin['traffic_used_new'],
|
||||
"aid" => $admin['adminid']
|
||||
);
|
||||
Database::pexecute($stmt, $params);
|
||||
|
||||
if ($returndebuginfo === true) {
|
||||
$returnval['admins'][$admin['adminid']] = $admin;
|
||||
}
|
||||
}
|
||||
|
||||
return $returnval;
|
||||
}
|
||||
|
||||
/**
|
||||
* if the customer does not have unlimited resources, add the used resources
|
||||
* to the admin-resource-counter
|
||||
*
|
||||
* @param array $arr
|
||||
* reference
|
||||
* @param array $customer_arr
|
||||
* @param string $used_field
|
||||
* @param string $field
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function _addResourceCount(&$arr, $customer_arr, $used_field = null, $field = null)
|
||||
{
|
||||
self::_initArrField($used_field, $arr, 0);
|
||||
if ($customer_arr[$field] != '-1') {
|
||||
$arr[$used_field] += intval($customer_arr[$used_field]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* if the customer does not have unlimited resources, add the used resources
|
||||
* to the admin-resource-counter
|
||||
* Special function wrapper for diskspace and traffic as they need to
|
||||
* be calculated otherwise to get the -1 for unlimited
|
||||
*
|
||||
* @param array $arr
|
||||
* reference
|
||||
* @param array $customer_arr
|
||||
* @param string $used_field
|
||||
* @param string $field
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function _addResourceCountEx(&$arr, $customer_arr, $used_field = null, $field = null)
|
||||
{
|
||||
self::_initArrField($used_field, $arr, 0);
|
||||
if ($field == 'diskspace' && ($customer_arr[$field] / 1024) != '-1') {
|
||||
$arr[$used_field] += intval($customer_arr[$used_field]);
|
||||
} elseif ($field == 'traffic_used') {
|
||||
$arr[$used_field] += intval($customer_arr[$used_field]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* initialize a field-value of an array if not yet initialized
|
||||
*
|
||||
* @param string $field
|
||||
* @param array $arr
|
||||
* reference
|
||||
* @param int $init_value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function _initArrField($field = null, &$arr, $init_value = 0)
|
||||
{
|
||||
if (! isset($arr[$field])) {
|
||||
$arr[$field] = $init_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ function validateFormFieldHiddenString($fieldname, $fielddata, $newfieldvalue)
|
||||
if (isset($fielddata['string_type']) && $fielddata['string_type'] == 'mail') {
|
||||
$returnvalue = (filter_var($newfieldvalue, FILTER_VALIDATE_EMAIL) == $newfieldvalue);
|
||||
} elseif (isset($fielddata['string_type']) && $fielddata['string_type'] == 'url') {
|
||||
$returnvalue = validateUrl($newfieldvalue);
|
||||
$returnvalue = \Froxlor\Validate\Form\Strings::validateUrl($newfieldvalue);
|
||||
} elseif (isset($fielddata['string_type']) && $fielddata['string_type'] == 'dir') {
|
||||
// add trailing slash to validate path if needed
|
||||
// refs #331
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* this functions validates a given value as ErrorDocument
|
||||
* refs #267
|
||||
*
|
||||
* @param
|
||||
* string error-document-string
|
||||
* @param bool $throw_exception
|
||||
*
|
||||
* @return string error-document-string
|
||||
*
|
||||
*/
|
||||
function correctErrorDocument($errdoc = null, $throw_exception = false)
|
||||
{
|
||||
$idna_convert = new idna_convert_wrapper();
|
||||
|
||||
if ($errdoc !== null && $errdoc != '') {
|
||||
// not a URL
|
||||
if ((strtoupper(substr($errdoc, 0, 5)) != 'HTTP:' && strtoupper(substr($errdoc, 0, 6)) != 'HTTPS:') || ! validateUrl($errdoc)) {
|
||||
// a file
|
||||
if (substr($errdoc, 0, 1) != '"') {
|
||||
$errdoc = \Froxlor\FileDir::makeCorrectFile($errdoc);
|
||||
// apache needs a starting-slash (starting at the domains-docroot)
|
||||
if (! substr($errdoc, 0, 1) == '/') {
|
||||
$errdoc = '/' . $errdoc;
|
||||
}
|
||||
} // a string (check for ending ")
|
||||
else {
|
||||
// string won't work for lighty
|
||||
if (Settings::Get('system.webserver') == 'lighttpd') {
|
||||
\Froxlor\UI\Response::standard_error('stringerrordocumentnotvalidforlighty', '', $throw_exception);
|
||||
} elseif (substr($errdoc, - 1) != '"') {
|
||||
$errdoc .= '"';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (Settings::Get('system.webserver') == 'lighttpd') {
|
||||
\Froxlor\UI\Response::standard_error('urlerrordocumentnotvalidforlighty', '', $throw_exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $errdoc;
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
*
|
||||
*/
|
||||
function getLanguages()
|
||||
{
|
||||
$result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_LANGUAGE . "` ");
|
||||
$languages_array = array();
|
||||
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if (! isset($languages_array[$row['language']]) && ! in_array($row['language'], $languages_array)) {
|
||||
$languages_array[$row['language']] = html_entity_decode($row['language']);
|
||||
}
|
||||
}
|
||||
|
||||
return $languages_array;
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
*
|
||||
*/
|
||||
function loadConfigArrayDir()
|
||||
{
|
||||
|
||||
// Workaround until we use gettext
|
||||
global $lng, $theme;
|
||||
|
||||
// we now use dynamic function parameters
|
||||
// so we can read from more than one directory
|
||||
// and still be valid for old calls
|
||||
$numargs = func_num_args();
|
||||
if ($numargs <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// variable that holds all dirs that will
|
||||
// be parsed for inclusion
|
||||
$configdirs = array();
|
||||
// if one of the parameters is an array
|
||||
// we assume that this is a list of
|
||||
// setting-groups to be selected
|
||||
$selection = null;
|
||||
for ($x = 0; $x < $numargs; $x ++) {
|
||||
$arg = func_get_arg($x);
|
||||
if (is_array($arg) && isset($arg[0])) {
|
||||
$selection = $arg;
|
||||
} else {
|
||||
$configdirs[] = $arg;
|
||||
}
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data_files = array();
|
||||
$has_data = false;
|
||||
|
||||
foreach ($configdirs as $data_dirname) {
|
||||
if (is_dir($data_dirname)) {
|
||||
$data_dirhandle = opendir($data_dirname);
|
||||
while (false !== ($data_filename = readdir($data_dirhandle))) {
|
||||
if ($data_filename != '.' && $data_filename != '..' && $data_filename != '' && substr($data_filename, - 4) == '.php') {
|
||||
$data_files[] = $data_dirname . $data_filename;
|
||||
}
|
||||
}
|
||||
$has_data = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($has_data) {
|
||||
sort($data_files);
|
||||
foreach ($data_files as $data_filename) {
|
||||
$data = array_merge_recursive($data, include ($data_filename));
|
||||
}
|
||||
}
|
||||
|
||||
// if we have specific setting-groups
|
||||
// to select, we'll handle this here
|
||||
// (this is for multiserver-client settings)
|
||||
$_data = array();
|
||||
if ($selection != null && is_array($selection) && isset($selection[0])) {
|
||||
$_data['groups'] = array();
|
||||
foreach ($data['groups'] as $group => $data) {
|
||||
if (in_array($group, $selection)) {
|
||||
$_data['groups'][$group] = $data;
|
||||
}
|
||||
}
|
||||
$data = $_data;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* froxlor php error handler
|
||||
*
|
||||
* @param int $errno
|
||||
* @param string $errstr
|
||||
* @param string $errfile
|
||||
* @param int $errline
|
||||
* @param array $errcontext
|
||||
*
|
||||
* @return void|boolean
|
||||
*/
|
||||
function phpErrHandler($errno, $errstr, $errfile, $errline, $errcontext)
|
||||
{
|
||||
if (! (error_reporting() & $errno)) {
|
||||
// This error code is not included in error_reporting
|
||||
return;
|
||||
}
|
||||
|
||||
if (! isset($_SERVER['SHELL']) || (isset($_SERVER['SHELL']) && $_SERVER['SHELL'] == '')) {
|
||||
global $theme;
|
||||
|
||||
// fallback
|
||||
if (empty($theme)) {
|
||||
$theme = "Sparkle";
|
||||
}
|
||||
// prevent possible file-path-disclosure
|
||||
$errfile = str_replace(\Froxlor\Froxlor::getInstallDir(), "", $errfile);
|
||||
// if we're not on the shell, output a nicer error-message
|
||||
$err_hint = file_get_contents(\Froxlor\Froxlor::getInstallDir() . '/templates/' . $theme . '/misc/phperrornice.tpl');
|
||||
// replace values
|
||||
$err_hint = str_replace("<TEXT>", '#' . $errno . ' ' . $errstr, $err_hint);
|
||||
$err_hint = str_replace("<DEBUG>", $errfile . ':' . $errline, $err_hint);
|
||||
|
||||
// show
|
||||
echo $err_hint;
|
||||
// return true to ignore php standard error-handler
|
||||
return true;
|
||||
}
|
||||
|
||||
// of on shell, use the php standard error-handler
|
||||
return false;
|
||||
}
|
||||
@@ -1,287 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
*
|
||||
*/
|
||||
use Froxlor\Database\Database;
|
||||
|
||||
/**
|
||||
* Function which updates all counters of used ressources in panel_admins and panel_customers
|
||||
*
|
||||
* @param
|
||||
* bool Set to true to get an array with debug information
|
||||
* @return array Contains debug information if parameter 'returndebuginfo' is set to true
|
||||
*
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
*/
|
||||
function updateCounters($returndebuginfo = false)
|
||||
{
|
||||
$returnval = array();
|
||||
|
||||
if ($returndebuginfo === true) {
|
||||
$returnval = array(
|
||||
'admins' => array(),
|
||||
'customers' => array()
|
||||
);
|
||||
}
|
||||
|
||||
// Customers
|
||||
$customers_stmt = Database::prepare('SELECT * FROM `' . TABLE_PANEL_CUSTOMERS . '` ORDER BY `customerid`');
|
||||
Database::pexecute($customers_stmt);
|
||||
|
||||
$admin_resources = array();
|
||||
while ($customer = $customers_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
$cur_adm = $customer['adminid'];
|
||||
|
||||
// initialize admin-resources array for admin $customer['adminid']
|
||||
if (! isset($admin_resources[$cur_adm])) {
|
||||
$admin_resources[$cur_adm] = array();
|
||||
}
|
||||
|
||||
_addResourceCountEx($admin_resources[$cur_adm], $customer, 'diskspace_used', 'diskspace');
|
||||
_addResourceCountEx($admin_resources[$cur_adm], $customer, 'traffic_used', 'traffic_used'); // !!! yes, USED and USED
|
||||
|
||||
foreach (array(
|
||||
'mysqls',
|
||||
'ftps',
|
||||
'emails',
|
||||
'email_accounts',
|
||||
'email_forwarders',
|
||||
'email_quota',
|
||||
'subdomains'
|
||||
) as $field) {
|
||||
_addResourceCount($admin_resources[$cur_adm], $customer, $field . '_used', $field);
|
||||
}
|
||||
|
||||
$customer_mysqls_stmt = Database::prepare('SELECT COUNT(*) AS `number_mysqls` FROM `' . TABLE_PANEL_DATABASES . '`
|
||||
WHERE `customerid` = :cid');
|
||||
$customer_mysqls = Database::pexecute_first($customer_mysqls_stmt, array(
|
||||
"cid" => $customer['customerid']
|
||||
));
|
||||
$customer['mysqls_used_new'] = (int) $customer_mysqls['number_mysqls'];
|
||||
|
||||
$customer_emails_stmt = Database::prepare('SELECT COUNT(*) AS `number_emails` FROM `' . TABLE_MAIL_VIRTUAL . '`
|
||||
WHERE `customerid` = :cid');
|
||||
$customer_emails = Database::pexecute_first($customer_emails_stmt, array(
|
||||
"cid" => $customer['customerid']
|
||||
));
|
||||
$customer['emails_used_new'] = (int) $customer_emails['number_emails'];
|
||||
|
||||
$customer_emails_result_stmt = Database::prepare('SELECT `email`, `email_full`, `destination`, `popaccountid` AS `number_email_forwarders` FROM `' . TABLE_MAIL_VIRTUAL . '`
|
||||
WHERE `customerid` = :cid');
|
||||
Database::pexecute($customer_emails_result_stmt, array(
|
||||
"cid" => $customer['customerid']
|
||||
));
|
||||
$customer_email_forwarders = 0;
|
||||
$customer_email_accounts = 0;
|
||||
|
||||
while ($customer_emails_row = $customer_emails_result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if ($customer_emails_row['destination'] != '') {
|
||||
$customer_emails_row['destination'] = explode(' ', \Froxlor\FileDir::makeCorrectDestination($customer_emails_row['destination']));
|
||||
$customer_email_forwarders += count($customer_emails_row['destination']);
|
||||
|
||||
if (in_array($customer_emails_row['email_full'], $customer_emails_row['destination'])) {
|
||||
$customer_email_forwarders -= 1;
|
||||
$customer_email_accounts ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$customer['email_accounts_used_new'] = $customer_email_accounts;
|
||||
$customer['email_forwarders_used_new'] = $customer_email_forwarders;
|
||||
|
||||
$customer_ftps_stmt = Database::prepare('SELECT COUNT(*) AS `number_ftps` FROM `' . TABLE_FTP_USERS . '` WHERE `customerid` = :cid');
|
||||
$customer_ftps = Database::pexecute_first($customer_ftps_stmt, array(
|
||||
"cid" => $customer['customerid']
|
||||
));
|
||||
$customer['ftps_used_new'] = ((int) $customer_ftps['number_ftps'] - 1);
|
||||
|
||||
$customer_subdomains_stmt = Database::prepare('SELECT COUNT(*) AS `number_subdomains` FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `customerid` = :cid AND `parentdomainid` <> "0"');
|
||||
$customer_subdomains = Database::pexecute_first($customer_subdomains_stmt, array(
|
||||
"cid" => $customer['customerid']
|
||||
));
|
||||
$customer['subdomains_used_new'] = (int) $customer_subdomains['number_subdomains'];
|
||||
|
||||
$customer_email_quota_stmt = Database::prepare('SELECT SUM(`quota`) AS `email_quota` FROM `' . TABLE_MAIL_USERS . '` WHERE `customerid` = :cid');
|
||||
$customer_email_quota = Database::pexecute_first($customer_email_quota_stmt, array(
|
||||
"cid" => $customer['customerid']
|
||||
));
|
||||
$customer['email_quota_used_new'] = (int) $customer_email_quota['email_quota'];
|
||||
|
||||
$stmt = Database::prepare('UPDATE `' . TABLE_PANEL_CUSTOMERS . '`
|
||||
SET `mysqls_used` = :mysqls_used,
|
||||
`emails_used` = :emails_used,
|
||||
`email_accounts_used` = :email_accounts_used,
|
||||
`email_forwarders_used` = :email_forwarders_used,
|
||||
`email_quota_used` = :email_quota_used,
|
||||
`ftps_used` = :ftps_used,
|
||||
`subdomains_used` = :subdomains_used
|
||||
WHERE `customerid` = :cid');
|
||||
$params = array(
|
||||
"mysqls_used" => $customer['mysqls_used_new'],
|
||||
"emails_used" => $customer['emails_used_new'],
|
||||
"email_accounts_used" => $customer['email_accounts_used_new'],
|
||||
"email_forwarders_used" => $customer['email_forwarders_used_new'],
|
||||
"email_quota_used" => $customer['email_quota_used_new'],
|
||||
"ftps_used" => $customer['ftps_used_new'],
|
||||
"subdomains_used" => $customer['subdomains_used_new'],
|
||||
"cid" => $customer['customerid']
|
||||
);
|
||||
Database::pexecute($stmt, $params);
|
||||
|
||||
if ($returndebuginfo === true) {
|
||||
$returnval['customers'][$customer['customerid']] = $customer;
|
||||
}
|
||||
}
|
||||
|
||||
// Admins
|
||||
$admins_stmt = Database::prepare('SELECT * FROM `' . TABLE_PANEL_ADMINS . '` ORDER BY `adminid`');
|
||||
Database::pexecute($admins_stmt, array());
|
||||
|
||||
while ($admin = $admins_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$admin_customers_stmt = Database::prepare('SELECT COUNT(*) AS `number_customers` FROM `' . TABLE_PANEL_CUSTOMERS . '` WHERE `adminid` = :aid');
|
||||
$admin_customers = Database::pexecute_first($admin_customers_stmt, array(
|
||||
"aid" => $admin['adminid']
|
||||
));
|
||||
$admin['customers_used_new'] = $admin_customers['number_customers'];
|
||||
|
||||
$admin_domains_stmt = Database::prepare('SELECT COUNT(*) AS `number_domains` FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `adminid` = :aid AND `isemaildomain` = "1"');
|
||||
$admin_domains = Database::pexecute_first($admin_domains_stmt, array(
|
||||
"aid" => $admin['adminid']
|
||||
));
|
||||
$admin['domains_used_new'] = $admin_domains['number_domains'];
|
||||
|
||||
$cur_adm = $admin['adminid'];
|
||||
|
||||
if (! isset($admin_resources[$cur_adm])) {
|
||||
$admin_resources[$cur_adm] = array();
|
||||
}
|
||||
|
||||
foreach (array(
|
||||
'diskspace_used',
|
||||
'traffic_used',
|
||||
'mysqls_used',
|
||||
'ftps_used',
|
||||
'emails_used',
|
||||
'email_accounts_used',
|
||||
'email_forwarders_used',
|
||||
'email_quota_used',
|
||||
'subdomains_used'
|
||||
) as $field) {
|
||||
_initArrField($field, $admin_resources[$cur_adm], 0);
|
||||
$admin[$field . '_new'] = $admin_resources[$cur_adm][$field];
|
||||
}
|
||||
|
||||
$stmt = Database::prepare('UPDATE `' . TABLE_PANEL_ADMINS . '`
|
||||
SET `customers_used` = :customers_used,
|
||||
`domains_used` = :domains_used,
|
||||
`diskspace_used` = :diskspace_used,
|
||||
`mysqls_used` = :mysqls_used,
|
||||
`emails_used` = :emails_used,
|
||||
`email_accounts_used` = :email_accounts_used,
|
||||
`email_forwarders_used` = :email_forwarders_used,
|
||||
`email_quota_used` = :email_quota_used,
|
||||
`ftps_used` = :ftps_used,
|
||||
`subdomains_used` = :subdomains_used,
|
||||
`traffic_used` = :traffic_used
|
||||
WHERE `adminid` = :aid');
|
||||
|
||||
$params = array(
|
||||
"customers_used" => $admin['customers_used_new'],
|
||||
"domains_used" => $admin['domains_used_new'],
|
||||
"diskspace_used" => $admin['diskspace_used_new'],
|
||||
"mysqls_used" => $admin['mysqls_used_new'],
|
||||
"emails_used" => $admin['emails_used_new'],
|
||||
"email_accounts_used" => $admin['email_accounts_used_new'],
|
||||
"email_forwarders_used" => $admin['email_forwarders_used_new'],
|
||||
"email_quota_used" => $admin['email_quota_used_new'],
|
||||
"ftps_used" => $admin['ftps_used_new'],
|
||||
"subdomains_used" => $admin['subdomains_used_new'],
|
||||
"traffic_used" => $admin['traffic_used_new'],
|
||||
"aid" => $admin['adminid']
|
||||
);
|
||||
Database::pexecute($stmt, $params);
|
||||
|
||||
if ($returndebuginfo === true) {
|
||||
$returnval['admins'][$admin['adminid']] = $admin;
|
||||
}
|
||||
}
|
||||
|
||||
return $returnval;
|
||||
}
|
||||
|
||||
/**
|
||||
* initialize a field-value of an array if not yet initialized
|
||||
*
|
||||
* @param string $field
|
||||
* @param array $arr
|
||||
* reference
|
||||
* @param int $init_value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function _initArrField($field = null, &$arr, $init_value = 0)
|
||||
{
|
||||
if (! isset($arr[$field])) {
|
||||
$arr[$field] = $init_value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* if the customer does not have unlimited resources, add the used resources
|
||||
* to the admin-resource-counter
|
||||
*
|
||||
* @param array $arr
|
||||
* reference
|
||||
* @param array $customer_arr
|
||||
* @param string $used_field
|
||||
* @param string $field
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function _addResourceCount(&$arr, $customer_arr, $used_field = null, $field = null)
|
||||
{
|
||||
_initArrField($used_field, $arr, 0);
|
||||
if ($customer_arr[$field] != '-1') {
|
||||
$arr[$used_field] += intval($customer_arr[$used_field]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* if the customer does not have unlimited resources, add the used resources
|
||||
* to the admin-resource-counter
|
||||
* Special function wrapper for diskspace and traffic as they need to
|
||||
* be calculated otherwise to get the -1 for unlimited
|
||||
*
|
||||
* @param array $arr
|
||||
* reference
|
||||
* @param array $customer_arr
|
||||
* @param string $used_field
|
||||
* @param string $field
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function _addResourceCountEx(&$arr, $customer_arr, $used_field = null, $field = null)
|
||||
{
|
||||
_initArrField($used_field, $arr, 0);
|
||||
if ($field == 'diskspace' && ($customer_arr[$field] / 1024) != '-1') {
|
||||
$arr[$used_field] += intval($customer_arr[$used_field]);
|
||||
} elseif ($field == 'traffic_used') {
|
||||
$arr[$used_field] += intval($customer_arr[$used_field]);
|
||||
}
|
||||
}
|
||||
@@ -1,185 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
*/
|
||||
|
||||
/**
|
||||
* return an array of all enabled redirect-codes
|
||||
*
|
||||
* @return array array of enabled redirect-codes
|
||||
*/
|
||||
function getRedirectCodesArray()
|
||||
{
|
||||
$sql = "SELECT * FROM `" . TABLE_PANEL_REDIRECTCODES . "` WHERE `enabled` = '1' ORDER BY `id` ASC";
|
||||
$result_stmt = Database::query($sql);
|
||||
|
||||
$codes = array();
|
||||
while ($rc = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$codes[] = $rc;
|
||||
}
|
||||
|
||||
return $codes;
|
||||
}
|
||||
|
||||
/**
|
||||
* return an array of all enabled redirect-codes
|
||||
* for the settings form
|
||||
*
|
||||
* @param bool $add_desc
|
||||
* optional, default true, add the code-description
|
||||
*
|
||||
* @return array array of enabled redirect-codes
|
||||
*/
|
||||
function getRedirectCodes($add_desc = true)
|
||||
{
|
||||
global $lng;
|
||||
|
||||
$sql = "SELECT * FROM `" . TABLE_PANEL_REDIRECTCODES . "` WHERE `enabled` = '1' ORDER BY `id` ASC";
|
||||
$result_stmt = Database::query($sql);
|
||||
|
||||
$codes = array();
|
||||
while ($rc = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$codes[$rc['id']] = $rc['code'];
|
||||
if ($add_desc) {
|
||||
$codes[$rc['id']] .= ' (' . $lng['redirect_desc'][$rc['desc']] . ')';
|
||||
}
|
||||
}
|
||||
|
||||
return $codes;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the redirect-code for a given
|
||||
* domain-id
|
||||
*
|
||||
* @param integer $domainid
|
||||
* id of the domain
|
||||
*
|
||||
* @return string redirect-code
|
||||
*/
|
||||
function getDomainRedirectCode($domainid = 0)
|
||||
{
|
||||
|
||||
// get system default
|
||||
$default = '301';
|
||||
if (Settings::Get('customredirect.enabled') == '1') {
|
||||
$all_codes = getRedirectCodes(false);
|
||||
$_default = $all_codes[Settings::Get('customredirect.default')];
|
||||
$default = ($_default == '---') ? $default : $_default;
|
||||
}
|
||||
$code = $default;
|
||||
if ($domainid > 0) {
|
||||
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `r`.`code` as `redirect`
|
||||
FROM `" . TABLE_PANEL_REDIRECTCODES . "` `r`, `" . TABLE_PANEL_DOMAINREDIRECTS . "` `rc`
|
||||
WHERE `r`.`id` = `rc`.`rid` and `rc`.`did` = :domainid
|
||||
");
|
||||
$result = Database::pexecute_first($result_stmt, array(
|
||||
'domainid' => $domainid
|
||||
));
|
||||
|
||||
if (is_array($result) && isset($result['redirect'])) {
|
||||
$code = ($result['redirect'] == '---') ? $default : $result['redirect'];
|
||||
}
|
||||
}
|
||||
return $code;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the redirect-id for a given
|
||||
* domain-id
|
||||
*
|
||||
* @param integer $domainid
|
||||
* id of the domain
|
||||
*
|
||||
* @return integer redirect-code-id
|
||||
*/
|
||||
function getDomainRedirectId($domainid = 0)
|
||||
{
|
||||
$code = 1;
|
||||
if ($domainid > 0) {
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `r`.`id` as `redirect`
|
||||
FROM `" . TABLE_PANEL_REDIRECTCODES . "` `r`, `" . TABLE_PANEL_DOMAINREDIRECTS . "` `rc`
|
||||
WHERE `r`.`id` = `rc`.`rid` and `rc`.`did` = :domainid
|
||||
");
|
||||
$result = Database::pexecute_first($result_stmt, array(
|
||||
'domainid' => $domainid
|
||||
));
|
||||
|
||||
if (is_array($result) && isset($result['redirect'])) {
|
||||
$code = (int) $result['redirect'];
|
||||
}
|
||||
}
|
||||
return $code;
|
||||
}
|
||||
|
||||
/**
|
||||
* adds a redirectcode for a domain
|
||||
*
|
||||
* @param integer $domainid
|
||||
* id of the domain to add the code for
|
||||
* @param integer $redirect
|
||||
* selected redirect-id
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
function addRedirectToDomain($domainid = 0, $redirect = 1)
|
||||
{
|
||||
if ($domainid > 0) {
|
||||
$ins_stmt = Database::prepare("
|
||||
INSERT INTO `" . TABLE_PANEL_DOMAINREDIRECTS . "` SET `rid` = :rid, `did` = :did
|
||||
");
|
||||
Database::pexecute($ins_stmt, array(
|
||||
'rid' => $redirect,
|
||||
'did' => $domainid
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* updates the redirectcode of a domain
|
||||
* if redirect-code is false, nothing happens
|
||||
*
|
||||
* @param integer $domainid
|
||||
* id of the domain to update
|
||||
* @param integer $redirect
|
||||
* selected redirect-id or false
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
function updateRedirectOfDomain($domainid = 0, $redirect = false)
|
||||
{
|
||||
if ($redirect == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($domainid > 0) {
|
||||
$del_stmt = Database::prepare("
|
||||
DELETE FROM `" . TABLE_PANEL_DOMAINREDIRECTS . "` WHERE `did` = :domainid
|
||||
");
|
||||
Database::pexecute($del_stmt, array(
|
||||
'domainid' => $domainid
|
||||
));
|
||||
|
||||
$ins_stmt = Database::prepare("
|
||||
INSERT INTO `" . TABLE_PANEL_DOMAINREDIRECTS . "` SET `rid` = :rid, `did` = :did
|
||||
");
|
||||
Database::pexecute($ins_stmt, array(
|
||||
'rid' => $redirect,
|
||||
'did' => $domainid
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Build Navigation Sidebar
|
||||
*
|
||||
* @param
|
||||
* array navigation data
|
||||
* @param
|
||||
* array userinfo the userinfo of the user
|
||||
* @return string the content of the navigation bar
|
||||
*
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
function buildNavigation($navigation, $userinfo)
|
||||
{
|
||||
global $theme;
|
||||
|
||||
$returnvalue = '';
|
||||
|
||||
// sanitize user-given input (url-manipulation)
|
||||
if (isset($_GET['page']) && is_array($_GET['page'])) {
|
||||
$_GET['page'] = (string) $_GET['page'][0];
|
||||
}
|
||||
if (isset($_GET['action']) && is_array($_GET['action'])) {
|
||||
$_GET['action'] = (string) $_GET['action'][0];
|
||||
}
|
||||
|
||||
foreach ($navigation as $box) {
|
||||
if ((! isset($box['show_element']) || $box['show_element'] === true) && (! isset($box['required_resources']) || $box['required_resources'] == '' || (isset($userinfo[$box['required_resources']]) && ((int) $userinfo[$box['required_resources']] > 0 || $userinfo[$box['required_resources']] == '-1')))) {
|
||||
$navigation_links = '';
|
||||
foreach ($box['elements'] as $element_id => $element) {
|
||||
if ((! isset($element['show_element']) || $element['show_element'] === true) && (! isset($element['required_resources']) || $element['required_resources'] == '' || (isset($userinfo[$element['required_resources']]) && ((int) $userinfo[$element['required_resources']] > 0 || $userinfo[$element['required_resources']] == '-1')))) {
|
||||
$target = '';
|
||||
$active = '';
|
||||
$navurl = '#';
|
||||
if (isset($element['url']) && trim($element['url']) != '') {
|
||||
// append sid only to local
|
||||
|
||||
if (! preg_match('/^https?\:\/\//', $element['url']) && (isset($userinfo['hash']) && $userinfo['hash'] != '')) {
|
||||
// generate sid with ? oder &
|
||||
|
||||
if (strpos($element['url'], '?') !== false) {
|
||||
$element['url'] .= '&s=' . $userinfo['hash'];
|
||||
} else {
|
||||
$element['url'] .= '?s=' . $userinfo['hash'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($element['new_window']) && $element['new_window'] == true) {
|
||||
$target = ' target="_blank"';
|
||||
}
|
||||
|
||||
if (isset($_GET['page']) && substr_count($element['url'], "page=" . $_GET['page']) > 0 && substr_count($element['url'], basename($_SERVER["SCRIPT_FILENAME"])) > 0 && isset($_GET['action']) && substr_count($element['url'], "action=" . $_GET['action']) > 0) {
|
||||
$active = ' active';
|
||||
} elseif (isset($_GET['page']) && substr_count($element['url'], "page=" . $_GET['page']) > 0 && substr_count($element['url'], basename($_SERVER["SCRIPT_FILENAME"])) > 0 && substr_count($element['url'], "action=") == 0 && ! isset($_GET['action'])) {
|
||||
$active = ' active';
|
||||
}
|
||||
|
||||
$navurl = htmlspecialchars($element['url']);
|
||||
$navlabel = $element['label'];
|
||||
} else {
|
||||
$navlabel = $element['label'];
|
||||
}
|
||||
|
||||
eval("\$navigation_links .= \"" . \Froxlor\UI\Template::getTemplate("navigation_link", 1) . "\";");
|
||||
}
|
||||
}
|
||||
|
||||
if ($navigation_links != '') {
|
||||
$target = '';
|
||||
if (isset($box['url']) && trim($box['url']) != '') {
|
||||
// append sid only to local
|
||||
|
||||
if (! preg_match('/^https?\:\/\//', $box['url']) && (isset($userinfo['hash']) && $userinfo['hash'] != '')) {
|
||||
// generate sid with ? oder &
|
||||
|
||||
if (strpos($box['url'], '?') !== false) {
|
||||
$box['url'] .= '&s=' . $userinfo['hash'];
|
||||
} else {
|
||||
$box['url'] .= '?s=' . $userinfo['hash'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($box['new_window']) && $box['new_window'] == true) {
|
||||
$target = ' target="_blank"';
|
||||
}
|
||||
|
||||
$navurl = htmlspecialchars($box['url']);
|
||||
$navlabel = $box['label'];
|
||||
} else {
|
||||
$navurl = "#";
|
||||
$navlabel = $box['label'];
|
||||
}
|
||||
|
||||
eval("\$returnvalue .= \"" . \Froxlor\UI\Template::getTemplate("navigation_element", 1) . "\";");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $returnvalue;
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns full style user details "Name, Firstname | Company"
|
||||
*
|
||||
* @param
|
||||
* array An array with keys firstname, name and company
|
||||
* @return string The full details
|
||||
*
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
function getCorrectFullUserDetails($userinfo)
|
||||
{
|
||||
$returnval = '';
|
||||
|
||||
if (isset($userinfo['firstname']) && isset($userinfo['name']) && isset($userinfo['company'])) {
|
||||
if ($userinfo['company'] == '') {
|
||||
$returnval = $userinfo['name'] . ', ' . $userinfo['firstname'];
|
||||
} else {
|
||||
if ($userinfo['name'] != '' && $userinfo['firstname'] != '') {
|
||||
$returnval = $userinfo['name'] . ', ' . $userinfo['firstname'] . ' | ' . $userinfo['company'];
|
||||
} else {
|
||||
$returnval = $userinfo['company'];
|
||||
}
|
||||
}
|
||||
} elseif (isset($userinfo['name'])) {
|
||||
$returnval = $userinfo['name'];
|
||||
}
|
||||
|
||||
return $returnval;
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns correct user salutation, either "Firstname Name" or "Company"
|
||||
*
|
||||
* @param
|
||||
* array An array with keys firstname, name and company
|
||||
* @return string The correct salutation
|
||||
*
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
function getCorrectUserSalutation($userinfo)
|
||||
{
|
||||
$returnval = '';
|
||||
|
||||
if (isset($userinfo['firstname']) && isset($userinfo['name']) && isset($userinfo['company'])) {
|
||||
// Always prefer firstname name
|
||||
|
||||
if ($userinfo['company'] != '' && $userinfo['name'] == '' && $userinfo['firstname'] == '') {
|
||||
$returnval = $userinfo['company'];
|
||||
} else {
|
||||
$returnval = $userinfo['firstname'] . ' ' . $userinfo['name'];
|
||||
}
|
||||
}
|
||||
|
||||
return $returnval;
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns a double of the given value which isn't negative.
|
||||
* Returns -1 if the given value was -1.
|
||||
*
|
||||
* @param
|
||||
* any The value
|
||||
* @return double The positive value
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
function doubleval_ressource($the_value)
|
||||
{
|
||||
$the_value = doubleval($the_value);
|
||||
|
||||
if ($the_value < 0 && $the_value != '-1') {
|
||||
$the_value *= - 1;
|
||||
}
|
||||
|
||||
return $the_value;
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wrapper around html_entity_decode to handle arrays, with the advantage that you
|
||||
* can select which fields should be handled by htmlentities and with advantage,
|
||||
* that you can eliminate all html entities by setting complete=true
|
||||
*
|
||||
* @param
|
||||
* array The subject array
|
||||
* @param
|
||||
* string The fields which should be checked for, separated by spaces
|
||||
* @param
|
||||
* bool Select true to use html_entity_decode_complete instead of html_entity_decode
|
||||
* @param
|
||||
* int See php documentation about this
|
||||
* @param
|
||||
* string See php documentation about this
|
||||
* @return array The array with html_entity_decode'd strings
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
function html_entity_decode_array($subject, $fields = '', $complete = false, $quote_style = ENT_COMPAT, $charset = 'UTF-8')
|
||||
{
|
||||
if (is_array($subject)) {
|
||||
if (! is_array($fields)) {
|
||||
$fields = array_trim(explode(' ', $fields));
|
||||
}
|
||||
|
||||
foreach ($subject as $field => $value) {
|
||||
if ((! is_array($fields) || empty($fields)) || (is_array($fields) && ! empty($fields) && in_array($field, $fields))) {
|
||||
/**
|
||||
* Just call ourselve to manage multi-dimensional arrays
|
||||
*/
|
||||
|
||||
$subject[$field] = html_entity_decode_array($subject[$field], $fields, $complete, $quote_style, $charset);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($complete == true) {
|
||||
$subject = html_entity_decode_complete($subject, $quote_style, $charset);
|
||||
} else {
|
||||
$subject = html_entity_decode($subject, $quote_style, $charset);
|
||||
}
|
||||
}
|
||||
|
||||
return $subject;
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Calls html_entity_decode in a loop until the result doesn't differ from original anymore
|
||||
*
|
||||
* @param
|
||||
* string The string in which the html entities should be eliminated.
|
||||
* @return string The cleaned string
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
function html_entity_decode_complete($string)
|
||||
{
|
||||
global $theme;
|
||||
|
||||
if ($theme == 'Classic') {
|
||||
while ($string != html_entity_decode($string)) {
|
||||
$string = html_entity_decode($string);
|
||||
}
|
||||
} else {
|
||||
while ($string != html_entity_decode($string, ENT_COMPAT | ENT_HTML5, 'UTF-8')) {
|
||||
$string = html_entity_decode($string, ENT_COMPAT | ENT_HTML5, 'UTF-8');
|
||||
}
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wrapper around htmlentities to handle arrays, with the advantage that you
|
||||
* can select which fields should be handled by htmlentities
|
||||
*
|
||||
* @param
|
||||
* array The subject array
|
||||
* @param
|
||||
* string The fields which should be checked for, separated by spaces
|
||||
* @param
|
||||
* int See php documentation about this
|
||||
* @param
|
||||
* string See php documentation about this
|
||||
* @return array The array with htmlentitie'd strings
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
function htmlentities_array($subject, $fields = '', $quote_style = ENT_QUOTES, $charset = 'UTF-8')
|
||||
{
|
||||
if (is_array($subject)) {
|
||||
if (! is_array($fields)) {
|
||||
$fields = array_trim(explode(' ', $fields));
|
||||
}
|
||||
|
||||
foreach ($subject as $field => $value) {
|
||||
if ((! is_array($fields) || empty($fields)) || (is_array($fields) && ! empty($fields) && in_array($field, $fields))) {
|
||||
/**
|
||||
* Just call ourselve to manage multi-dimensional arrays
|
||||
*/
|
||||
|
||||
$subject[$field] = htmlentities_array($subject[$field], $fields, $quote_style, $charset);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$subject = htmlentities($subject, $quote_style, $charset);
|
||||
}
|
||||
|
||||
return $subject;
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Replaces Strings in an array, with the advantage that you
|
||||
* can select which fields should be str_replace'd
|
||||
*
|
||||
* @param
|
||||
* mixed String or array of strings to search for
|
||||
* @param
|
||||
* mixed String or array to replace with
|
||||
* @param
|
||||
* array The subject array
|
||||
* @param
|
||||
* string The fields which should be checked for, separated by spaces
|
||||
* @return array The str_replace'd array
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
function str_replace_array($search, $replace, $subject, $fields = '')
|
||||
{
|
||||
if (is_array($subject)) {
|
||||
$fields = array_trim(explode(' ', $fields));
|
||||
foreach ($subject as $field => $value) {
|
||||
if ((! is_array($fields) || empty($fields)) || (is_array($fields) && ! empty($fields) && in_array($field, $fields))) {
|
||||
$subject[$field] = str_replace($search, $replace, $subject[$field]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$subject = str_replace($search, $replace, $subject);
|
||||
}
|
||||
|
||||
return $subject;
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wrapper around stripslashes to handle arrays, with the advantage that you
|
||||
* can select which fields should be handled by htmlentities and with advantage,
|
||||
* that you can eliminate all slashes by setting complete=true
|
||||
*
|
||||
* @param
|
||||
* array The subject array
|
||||
* @param
|
||||
* int See php documentation about this
|
||||
* @param
|
||||
* string See php documentation about this
|
||||
* @param
|
||||
* string The fields which should be checked for, separated by spaces
|
||||
* @param
|
||||
* bool Select true to use stripslashes_complete instead of stripslashes
|
||||
* @return array The array with stripslashe'd strings
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
function stripslashes_array($subject, $fields = '', $complete = false)
|
||||
{
|
||||
if (is_array($subject)) {
|
||||
if (! is_array($fields)) {
|
||||
$fields = array_trim(explode(' ', $fields));
|
||||
}
|
||||
|
||||
foreach ($subject as $field => $value) {
|
||||
if ((! is_array($fields) || empty($fields)) || (is_array($fields) && ! empty($fields) && in_array($field, $fields))) {
|
||||
/**
|
||||
* Just call ourselve to manage multi-dimensional arrays
|
||||
*/
|
||||
|
||||
$subject[$field] = stripslashes_array($subject[$field], $fields, $complete);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($complete == true) {
|
||||
$subject = stripslashes_complete($subject);
|
||||
} else {
|
||||
$subject = stripslashes($subject);
|
||||
}
|
||||
}
|
||||
|
||||
return $subject;
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Calls stripslashes in a loop until the result doesn't differ from original anymore
|
||||
*
|
||||
* @param
|
||||
* string The string in which the slashes should be eliminated.
|
||||
* @return string The cleaned string
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
*/
|
||||
function stripslashes_complete($string)
|
||||
{
|
||||
while ($string != stripslashes($string)) {
|
||||
$string = stripslashes($string);
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2003-2009 the SysCP Team (see authors).
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Functions
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a valid from/to - mailheader (remove carriage-returns)
|
||||
*
|
||||
* @param
|
||||
* string The name of the recipient
|
||||
* @param
|
||||
* string The mailaddress
|
||||
* @return string A valid header-entry
|
||||
* @author Florian Aders <eleras@syscp.org>
|
||||
*/
|
||||
function buildValidMailFrom($name, $mailaddress)
|
||||
{
|
||||
$mailfrom = str_replace(array(
|
||||
"\r",
|
||||
"\n"
|
||||
), '', $name) . ' <' . str_replace(array(
|
||||
"\r",
|
||||
"\n"
|
||||
), '', $mailaddress) . '>';
|
||||
return $mailfrom;
|
||||
}
|
||||
11
lib/init.php
11
lib/init.php
@@ -110,7 +110,10 @@ if (! isset($sql) || ! is_array($sql)) {
|
||||
* Includes the Functions
|
||||
*/
|
||||
require \Froxlor\Froxlor::getInstallDir() . '/lib/functions.php';
|
||||
@set_error_handler('phpErrHandler');
|
||||
@set_error_handler(array(
|
||||
'\\Froxlor\\PhpHelper',
|
||||
'phpErrHandler'
|
||||
));
|
||||
|
||||
/**
|
||||
* Includes the MySQL-Tabledefinitions etc.
|
||||
@@ -416,10 +419,10 @@ if (AREA == 'admin' || AREA == 'customer') {
|
||||
)
|
||||
)
|
||||
);
|
||||
$navigation = buildNavigation($navigation_data['admin'], $userinfo);
|
||||
$navigation = \Froxlor\UI\HTML::buildNavigation($navigation_data['admin'], $userinfo);
|
||||
} else {
|
||||
$navigation_data = loadConfigArrayDir('lib/navigation/');
|
||||
$navigation = buildNavigation($navigation_data[AREA], $userinfo);
|
||||
$navigation_data = \Froxlor\PhpHelper::loadConfigArrayDir('lib/navigation/');
|
||||
$navigation = \Froxlor\UI\HTML::buildNavigation($navigation_data[AREA], $userinfo);
|
||||
}
|
||||
unset($navigation_data);
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ if (count($all_certs) == 0) {
|
||||
}
|
||||
}
|
||||
|
||||
$row = htmlentities_array($cert);
|
||||
$row = \Froxlor\PhpHelper::htmlentities_array($cert);
|
||||
eval("\$certificates.=\"" . \Froxlor\UI\Template::getTemplate("ssl_certificates/certs_cert", true) . "\";");
|
||||
} else {
|
||||
$message = sprintf($lng['domains']['ssl_certificate_error'], $cert['domain']);
|
||||
|
||||
Reference in New Issue
Block a user