From 7c68fa7bd09b04b5335a5f1a6cf1ad15f501f6f0 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Fri, 21 Dec 2018 19:16:49 +0100 Subject: [PATCH] fixed a few functions I've missed Signed-off-by: Michael Kaufmann --- 2fa.php | 4 ++-- actions/admin/settings/131.ssl.php | 2 +- admin_autoupdate.php | 12 +++++------ admin_configfiles.php | 6 +++--- admin_customers.php | 2 +- admin_domains.php | 16 +++++++-------- admin_index.php | 6 +++--- admin_logger.php | 2 +- admin_settings.php | 2 +- admin_templates.php | 4 ++-- admin_traffic.php | 4 ++-- admin_updates.php | 14 ++++++------- api_keys.php | 2 +- customer_index.php | 6 +++--- customer_logger.php | 2 +- index.php | 6 +++--- install/lib/updateFunctions.php | 14 +++++-------- .../updates/froxlor/0.9/update_0.9.inc.php | 2 +- install/updates/preconfig.php | 2 +- .../Cli/Action/ConfigServicesAction.php | 20 +++++++++---------- .../Cli/Action/SwitchServerIpAction.php | 8 ++++---- lib/Froxlor/Froxlor.php | 2 +- lib/Froxlor/FroxlorLogger.php | 2 +- lib/Froxlor/PhpHelper.php | 6 +++--- lib/Froxlor/SImExporter.php | 2 +- lib/Froxlor/Settings/Store.php | 4 ++-- templates/Sparkle/misc/ownershiphint.tpl | 2 +- 27 files changed, 75 insertions(+), 79 deletions(-) diff --git a/2fa.php b/2fa.php index 500a306b..e6a2e56f 100644 --- a/2fa.php +++ b/2fa.php @@ -4,8 +4,8 @@ if (! defined('AREA')) { exit(); } -use Froxlor\Database as Database; -use Froxlor\Settings as Settings; +use Froxlor\Database\Database; +use Froxlor\Settings; if (Settings::Get('2fa.enabled') != '1') { \Froxlor\UI\Response::dynamic_error("2FA not activated"); diff --git a/actions/admin/settings/131.ssl.php b/actions/admin/settings/131.ssl.php index b645b842..3300f567 100644 --- a/actions/admin/settings/131.ssl.php +++ b/actions/admin/settings/131.ssl.php @@ -173,7 +173,7 @@ return array( 'varname' => 'letsencryptchallengepath', 'type' => 'string', 'string_emptyallowed' => false, - 'default' => FROXLOR_INSTALL_DIR, + 'default' => \Froxlor\Froxlor::getInstallDir(), 'save_method' => 'storeSettingField' ), 'system_letsencryptkeysize' => array( diff --git a/admin_autoupdate.php b/admin_autoupdate.php index ce9d8141..d7615822 100644 --- a/admin_autoupdate.php +++ b/admin_autoupdate.php @@ -104,12 +104,12 @@ elseif ($page == 'getdownload') { $toCheck = str_replace('{version}', $newversion, CHECKSUM_URI); // check for local destination folder - if (! is_dir(FROXLOR_INSTALL_DIR . '/updates/')) { - mkdir(FROXLOR_INSTALL_DIR . '/updates/'); + if (! is_dir(\Froxlor\Froxlor::getInstallDir() . '/updates/')) { + mkdir(\Froxlor\Froxlor::getInstallDir() . '/updates/'); } // name archive - $localArchive = FROXLOR_INSTALL_DIR . '/updates/' . basename($toLoad); + $localArchive = \Froxlor\Froxlor::getInstallDir() . '/updates/' . basename($toLoad); $log->logAction(ADM_ACTION, LOG_NOTICE, "Downloading " . $toLoad . " to " . $localArchive); @@ -163,15 +163,15 @@ elseif ($page == 'getdownload') { elseif ($page == 'extract') { $toExtract = isset($_GET['archive']) ? $_GET['archive'] : null; - $localArchive = FROXLOR_INSTALL_DIR . '/updates/' . $toExtract; + $localArchive = \Froxlor\Froxlor::getInstallDir() . '/updates/' . $toExtract; if (isset($_POST['send']) && $_POST['send'] == 'send') { // decompress from zip $zip = new ZipArchive(); $res = $zip->open($localArchive); if ($res === true) { - $log->logAction(ADM_ACTION, LOG_NOTICE, "Extracting " . $localArchive . " to " . FROXLOR_INSTALL_DIR); - $zip->extractTo(FROXLOR_INSTALL_DIR); + $log->logAction(ADM_ACTION, LOG_NOTICE, "Extracting " . $localArchive . " to " . \Froxlor\Froxlor::getInstallDir()); + $zip->extractTo(\Froxlor\Froxlor::getInstallDir()); $zip->close(); // success - remove unused archive @unlink($localArchive); diff --git a/admin_configfiles.php b/admin_configfiles.php index 4611c076..1e14ddcf 100644 --- a/admin_configfiles.php +++ b/admin_configfiles.php @@ -65,7 +65,7 @@ if ($userinfo['change_serversettings'] == '1') { '' => Settings::Get('system.vmail_gid'), '' => (Settings::Get('system.use_ssl') == '1') ? 'imaps pop3s' : '', '' => \Froxlor\FileDir::makeCorrectDir($customer_tmpdir), - '' => \Froxlor\FileDir::makeCorrectDir(FROXLOR_INSTALL_DIR), + '' => \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir()), '' => \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.bindconf_directory')), '' => Settings::Get('system.apachereload_command'), '' => \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.logfiles_directory')), @@ -85,7 +85,7 @@ if ($userinfo['change_serversettings'] == '1') { $services = ""; $daemons = ""; - $config_dir = \Froxlor\FileDir::makeCorrectDir(FROXLOR_INSTALL_DIR . '/lib/configfiles/'); + $config_dir = \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir() . '/lib/configfiles/'); if ($distribution != "") { @@ -226,7 +226,7 @@ if ($userinfo['change_serversettings'] == '1') { } eval("echo \"" . \Froxlor\UI\Template::getTemplate("configfiles/configfiles") . "\";"); } else { - $basedir = FROXLOR_INSTALL_DIR; + $basedir = \Froxlor\Froxlor::getInstallDir(); eval("echo \"" . \Froxlor\UI\Template::getTemplate("configfiles/wizard") . "\";"); } } else { diff --git a/admin_customers.php b/admin_customers.php index 533ee762..8fe4300f 100644 --- a/admin_customers.php +++ b/admin_customers.php @@ -196,7 +196,7 @@ if ($page == 'customers' && $userinfo['customers'] != '0') { $target = (isset($_GET['target']) ? $_GET['target'] : 'index'); $redirect = "customer_" . $target . ".php"; - if (! file_exists(FROXLOR_INSTALL_DIR . "/" . $redirect)) { + if (! file_exists(\Froxlor\Froxlor::getInstallDir() . "/" . $redirect)) { $redirect = "customer_index.php"; } \Froxlor\UI\Response::redirectTo($redirect, array( diff --git a/admin_domains.php b/admin_domains.php index fad9eb43..b8c8be84 100644 --- a/admin_domains.php +++ b/admin_domains.php @@ -105,7 +105,7 @@ if ($page == 'domains' || $page == 'overview') { foreach ($domain_array as $row) { if (isset($row['domain']) && $row['domain'] != '' && $paging->checkDisplay($i)) { - $row['customername'] = getCorrectFullUserDetails($row); + $row['customername'] = \Froxlor\User::getCorrectFullUserDetails($row); $row = \Froxlor\PhpHelper::htmlentities_array($row); // display a nice list of IP's $row['ipandport'] = str_replace("\n", "
", $row['ipandport']); @@ -191,7 +191,7 @@ if ($page == 'domains' || $page == 'overview') { Database::pexecute($result_customers_stmt, $params); while ($row_customer = $result_customers_stmt->fetch(PDO::FETCH_ASSOC)) { - $customers .= \Froxlor\UI\HTML::makeoption(getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid']); + $customers .= \Froxlor\UI\HTML::makeoption(\Froxlor\User::getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid']); } $admins = ''; @@ -203,7 +203,7 @@ if ($page == 'domains' || $page == 'overview') { WHERE `domains_used` < `domains` OR `domains` = '-1' ORDER BY `name` ASC"); while ($row_admin = $result_admins_stmt->fetch(PDO::FETCH_ASSOC)) { - $admins .= \Froxlor\UI\HTML::makeoption(getCorrectFullUserDetails($row_admin) . ' (' . $row_admin['loginname'] . ')', $row_admin['adminid'], $userinfo['adminid']); + $admins .= \Froxlor\UI\HTML::makeoption(\Froxlor\User::getCorrectFullUserDetails($row_admin) . ' (' . $row_admin['loginname'] . ')', $row_admin['adminid'], $userinfo['adminid']); } } @@ -449,7 +449,7 @@ if ($page == 'domains' || $page == 'overview') { Database::pexecute($result_customers_stmt, $params); while ($row_customer = $result_customers_stmt->fetch(PDO::FETCH_ASSOC)) { - $customers .= \Froxlor\UI\HTML::makeoption(getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid'], $result['customerid']); + $customers .= \Froxlor\UI\HTML::makeoption(\Froxlor\User::getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid'], $result['customerid']); } } else { $customer_stmt = Database::prepare(" @@ -459,7 +459,7 @@ if ($page == 'domains' || $page == 'overview') { $customer = Database::pexecute_first($customer_stmt, array( 'customerid' => $result['customerid'] )); - $result['customername'] = getCorrectFullUserDetails($customer) . ' (' . $customer['loginname'] . ')'; + $result['customername'] = \Froxlor\User::getCorrectFullUserDetails($customer) . ' (' . $customer['loginname'] . ')'; } if ($userinfo['customers_see_all'] == '1') { @@ -475,7 +475,7 @@ if ($page == 'domains' || $page == 'overview') { )); while ($row_admin = $result_admins_stmt->fetch(PDO::FETCH_ASSOC)) { - $admins .= \Froxlor\UI\HTML::makeoption(getCorrectFullUserDetails($row_admin) . ' (' . $row_admin['loginname'] . ')', $row_admin['adminid'], $result['adminid']); + $admins .= \Froxlor\UI\HTML::makeoption(\Froxlor\User::getCorrectFullUserDetails($row_admin) . ' (' . $row_admin['loginname'] . ')', $row_admin['adminid'], $result['adminid']); } } else { $admin_stmt = Database::prepare(" @@ -484,7 +484,7 @@ if ($page == 'domains' || $page == 'overview') { $admin = Database::pexecute_first($admin_stmt, array( 'adminid' => $result['adminid'] )); - $result['adminname'] = getCorrectFullUserDetails($admin) . ' (' . $admin['loginname'] . ')'; + $result['adminname'] = \Froxlor\User::getCorrectFullUserDetails($admin) . ' (' . $admin['loginname'] . ')'; } } @@ -689,7 +689,7 @@ if ($page == 'domains' || $page == 'overview') { Database::pexecute($result_customers_stmt, $params); while ($row_customer = $result_customers_stmt->fetch(PDO::FETCH_ASSOC)) { - $customers .= \Froxlor\UI\HTML::makeoption(getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid']); + $customers .= \Froxlor\UI\HTML::makeoption(\Froxlor\User::getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid']); } $domain_import_data = include_once dirname(__FILE__) . '/lib/formfields/admin/domains/formfield.domains_import.php'; diff --git a/admin_index.php b/admin_index.php index a2bb2f78..c37fe039 100644 --- a/admin_index.php +++ b/admin_index.php @@ -314,7 +314,7 @@ if ($page == 'overview') { $errid = $_GET['errorid']; // read error file - $err_dir = \Froxlor\FileDir::makeCorrectDir(FROXLOR_INSTALL_DIR . "/logs/"); + $err_dir = \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir() . "/logs/"); $err_file = \Froxlor\FileDir::makeCorrectFile($err_dir . "/" . $errid . "_sql-error.log"); if (file_exists($err_file)) { @@ -325,9 +325,9 @@ if ($page == 'overview') { $_error = array( 'code' => str_replace("\n", "", substr($error[1], 5)), 'message' => str_replace("\n", "", substr($error[2], 4)), - 'file' => str_replace("\n", "", substr($error[3], 5 + strlen(FROXLOR_INSTALL_DIR))), + 'file' => str_replace("\n", "", substr($error[3], 5 + strlen(\Froxlor\Froxlor::getInstallDir()))), 'line' => str_replace("\n", "", substr($error[4], 5)), - 'trace' => str_replace(FROXLOR_INSTALL_DIR, "", substr($error[5], 6)) + 'trace' => str_replace(\Froxlor\Froxlor::getInstallDir(), "", substr($error[5], 6)) ); // build mail-content diff --git a/admin_logger.php b/admin_logger.php index 40aff17c..f12372aa 100644 --- a/admin_logger.php +++ b/admin_logger.php @@ -96,7 +96,7 @@ if ($page == 'log' && $userinfo['change_serversettings'] == '1') { } $log_count ++; - $row['type'] = getLogLevelDesc($row['type']); + $row['type'] = \Froxlor\FroxlorLogger::getInstanceOf()->getLogLevelDesc($row['type']); eval("\$log.=\"" . \Froxlor\UI\Template::getTemplate('logger/logger_log') . "\";"); $count ++; $_action = $action; diff --git a/admin_settings.php b/admin_settings.php index f305e27e..2dd5a0c8 100644 --- a/admin_settings.php +++ b/admin_settings.php @@ -30,7 +30,7 @@ $sql_root = Database::getSqlData(); Database::needRoot(false); if ($page == 'overview' && $userinfo['change_serversettings'] == '1') { - $settings_data = loadConfigArrayDir('./actions/admin/settings/'); + $settings_data = \Froxlor\PhpHelper::loadConfigArrayDir('./actions/admin/settings/'); if (isset($_POST['send']) && $_POST['send'] == 'send') { diff --git a/admin_templates.php b/admin_templates.php index 435fc62d..e8be5ca5 100644 --- a/admin_templates.php +++ b/admin_templates.php @@ -19,8 +19,8 @@ define('AREA', 'admin'); require './lib/init.php'; -use Froxlor\Database as Database; -use Froxlor\Settings as Settings; +use Froxlor\Database\Database; +use Froxlor\Settings; if (isset($_POST['subjectid'])) { $subjectid = intval($_POST['subjectid']); diff --git a/admin_traffic.php b/admin_traffic.php index 95dd97fe..93fe128e 100644 --- a/admin_traffic.php +++ b/admin_traffic.php @@ -18,8 +18,8 @@ define('AREA', 'admin'); require './lib/init.php'; -use Froxlor\Database as Database; -use Froxlor\Settings as Settings; +use Froxlor\Database\Database; +use Froxlor\Settings; if (isset($_POST['id'])) { $id = intval($_POST['id']); diff --git a/admin_updates.php b/admin_updates.php index 989308db..22fddc34 100644 --- a/admin_updates.php +++ b/admin_updates.php @@ -17,8 +17,8 @@ define('AREA', 'admin'); require './lib/init.php'; -use Froxlor\Database as Database; -use Froxlor\Settings as Settings; +use Froxlor\Database\Database; +use Froxlor\Settings; if ($page == 'overview') { $log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_updates"); @@ -28,7 +28,7 @@ if ($page == 'overview') { * have any version/dbversion in the database (don't know why) * so we have to set them both to run a correct upgrade */ - if (! isFroxlor()) { + if (! \Froxlor\Froxlor::isFroxlor()) { if (Settings::Get('panel.version') == null || Settings::Get('panel.version') == '') { Settings::Set('panel.version', '1.4.2.1'); } @@ -51,7 +51,7 @@ if ($page == 'overview') { } } - if (hasDbUpdates($dbversion) || hasUpdates($version)) { + if (\Froxlor\Froxlor::hasDbUpdates() || \Froxlor\Froxlor::hasUpdates()) { $successful_update = false; $message = ''; @@ -59,14 +59,14 @@ if ($page == 'overview') { if ((isset($_POST['update_preconfig']) && isset($_POST['update_changesagreed']) && intval($_POST['update_changesagreed']) != 0) || ! isset($_POST['update_preconfig'])) { eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/update_start') . "\";"); - include_once './install/updatesql.php'; + include_once \Froxlor\Froxlor::getInstallDir() . 'install/updatesql.php'; $redirect_url = 'admin_index.php?s=' . $s; eval("echo \"" . \Froxlor\UI\Template::getTemplate('update/update_end') . "\";"); \Froxlor\User::updateCounters(); \Froxlor\System\Cronjob::inserttask('1'); - @chmod('./lib/userdata.inc.php', 0440); + @chmod(\Froxlor\Froxlor::getInstallDir() . '/lib/userdata.inc.php', 0440); $successful_update = true; } else { @@ -94,7 +94,7 @@ if ($page == 'overview') { } $update_information = $ui_text; - include_once './install/updates/preconfig.php'; + include_once \Froxlor\Froxlor::getInstallDir() . '/install/updates/preconfig.php'; $preconfig = getPreConfig($current_version, $current_db_version); if ($preconfig != '') { $update_information .= '
' . $preconfig . $message; diff --git a/api_keys.php b/api_keys.php index eb73d710..691c705c 100644 --- a/api_keys.php +++ b/api_keys.php @@ -20,7 +20,7 @@ if (! defined('AREA')) { * */ -use Froxlor\Database as Database; +use Froxlor\Database\Database; // This file is being included in admin_index and customer_index // and therefore does not need to require lib/init.php diff --git a/customer_index.php b/customer_index.php index da39c633..4eaa87ac 100644 --- a/customer_index.php +++ b/customer_index.php @@ -285,7 +285,7 @@ if ($page == 'overview') { $errid = $_GET['errorid']; // read error file - $err_dir = \Froxlor\FileDir::makeCorrectDir(FROXLOR_INSTALL_DIR . "/logs/"); + $err_dir = \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir() . "/logs/"); $err_file = \Froxlor\FileDir::makeCorrectFile($err_dir . "/" . $errid . "_sql-error.log"); if (file_exists($err_file)) { @@ -296,9 +296,9 @@ if ($page == 'overview') { $_error = array( 'code' => str_replace("\n", "", substr($error[1], 5)), 'message' => str_replace("\n", "", substr($error[2], 4)), - 'file' => str_replace("\n", "", substr($error[3], 5 + strlen(FROXLOR_INSTALL_DIR))), + 'file' => str_replace("\n", "", substr($error[3], 5 + strlen(\Froxlor\Froxlor::getInstallDir()))), 'line' => str_replace("\n", "", substr($error[4], 5)), - 'trace' => str_replace(FROXLOR_INSTALL_DIR, "", substr($error[5], 6)) + 'trace' => str_replace(\Froxlor\Froxlor::getInstallDir(), "", substr($error[5], 6)) ); // build mail-content diff --git a/customer_logger.php b/customer_logger.php index ebee83d2..a3ec785e 100644 --- a/customer_logger.php +++ b/customer_logger.php @@ -109,7 +109,7 @@ if ($page == 'log') { } $log_count ++; - $row['type'] = getLogLevelDesc($row['type']); + $row['type'] = \Froxlor\FroxlorLogger::getInstanceOf()->getLogLevelDesc($row['type']); eval("\$log.=\"" . \Froxlor\UI\Template::getTemplate('logger/logger_log') . "\";"); $count ++; $_action = $action; diff --git a/index.php b/index.php index 4756820d..b4efd44c 100644 --- a/index.php +++ b/index.php @@ -211,7 +211,7 @@ if ($action == '2fa_entercode') { 'showmessage' => '3' )); exit(); - } elseif (validatePasswordLogin($userinfo, $password, $table, $uid)) { + } elseif (\Froxlor\System\Crypt::validatePasswordLogin($userinfo, $password, $table, $uid)) { // only show "you're banned" if the login was successful // because we don't want to publish that the user does exist if ($userinfo['deactivated']) { @@ -392,7 +392,7 @@ if ($action == 'forgotpwd') { if (isset($_POST['send']) && $_POST['send'] == 'send') { $loginname = \Froxlor\Validate\Validate::validate($_POST['loginname'], 'loginname'); - $email = validateEmail($_POST['loginemail'], 'email'); + $email = \Froxlor\Validate\Validate::validateEmail($_POST['loginemail'], 'email'); $result_stmt = Database::prepare("SELECT `adminid`, `customerid`, `firstname`, `name`, `company`, `email`, `loginname`, `def_language`, `deactivated` FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `loginname`= :loginname AND `email`= :email"); @@ -735,7 +735,7 @@ function finishLogin($userinfo) $qryparams['s'] = $s; if ($userinfo['adminsession'] == '1') { - if (hasUpdates($version) || hasDbUpdates($dbversion)) { + if (\Froxlor\Froxlor::hasUpdates() || \Froxlor\Froxlor::hasDbUpdates()) { \Froxlor\UI\Response::redirectTo('admin_updates.php', array( 's' => $s )); diff --git a/install/lib/updateFunctions.php b/install/lib/updateFunctions.php index c0351052..9348320a 100644 --- a/install/lib/updateFunctions.php +++ b/install/lib/updateFunctions.php @@ -30,8 +30,6 @@ */ function showUpdateStep($task = null, $needs_status = true) { - global $updatelog, $filelog; - if (! $needs_status) echo ""; @@ -42,8 +40,8 @@ function showUpdateStep($task = null, $needs_status = true) echo "
"; } - $updatelog->logAction(ADM_ACTION, LOG_WARNING, $task); - $filelog->logAction(ADM_ACTION, LOG_WARNING, $task); + \Froxlor\FroxlorLogger::getInstanceOf()->logAction(ADM_ACTION, LOG_WARNING, $task); + \Froxlor\FroxlorLogger::getInstanceOf()->logAction(ADM_ACTION, LOG_WARNING, $task); } /** @@ -59,8 +57,6 @@ function showUpdateStep($task = null, $needs_status = true) */ function lastStepStatus($status = -1, $message = '') { - global $updatelog, $filelog; - switch ($status) { case 0: @@ -85,9 +81,9 @@ function lastStepStatus($status = -1, $message = '') echo "" . $status_sign . "
"; if ($status == - 1 || $status == 2) { - $updatelog->logAction(ADM_ACTION, LOG_WARNING, 'Attention - last update task failed!!!'); - $filelog->logAction(ADM_ACTION, LOG_WARNING, 'Attention - last update task failed!!!'); + \Froxlor\FroxlorLogger::getInstanceOf()->logAction(ADM_ACTION, LOG_WARNING, 'Attention - last update task failed!!!'); + \Froxlor\FroxlorLogger::getInstanceOf()->logAction(ADM_ACTION, LOG_WARNING, 'Attention - last update task failed!!!'); } elseif ($status == 0 || $status == 1) { - $filelog->logAction(ADM_ACTION, LOG_WARNING, 'Success'); + \Froxlor\FroxlorLogger::getInstanceOf()->logAction(ADM_ACTION, LOG_WARNING, 'Success'); } } diff --git a/install/updates/froxlor/0.9/update_0.9.inc.php b/install/updates/froxlor/0.9/update_0.9.inc.php index ab2a5e23..cf729023 100644 --- a/install/updates/froxlor/0.9/update_0.9.inc.php +++ b/install/updates/froxlor/0.9/update_0.9.inc.php @@ -3202,7 +3202,7 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.9.35-dev4')) { showUpdateStep("Updating from 0.9.35-dev4 to 0.9.35-dev5", false); showUpdateStep("Adding more Let's Encrypt settings"); - Settings::AddNew("system.letsencryptchallengepath", FROXLOR_INSTALL_DIR); + Settings::AddNew("system.letsencryptchallengepath", \Froxlor\Froxlor::getInstallDir()); Settings::AddNew("system.letsencryptkeysize", '4096'); Settings::AddNew("system.letsencryptreuseold", 0); Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "` ADD `ssl_csr_file` MEDIUMTEXT AFTER `ssl_cert_chainfile`;"); diff --git a/install/updates/preconfig.php b/install/updates/preconfig.php index 04653803..dff759f8 100644 --- a/install/updates/preconfig.php +++ b/install/updates/preconfig.php @@ -47,7 +47,7 @@ function getPreConfig($current_version, $current_db_version) function versionInUpdate($current_version, $version_to_check) { - if (! isFroxlor()) { + if (! \Froxlor\Froxlor::isFroxlor()) { return true; } diff --git a/lib/Froxlor/Cli/Action/ConfigServicesAction.php b/lib/Froxlor/Cli/Action/ConfigServicesAction.php index 062db116..a29394d7 100644 --- a/lib/Froxlor/Cli/Action/ConfigServicesAction.php +++ b/lib/Froxlor/Cli/Action/ConfigServicesAction.php @@ -29,8 +29,8 @@ class ConfigServicesAction extends \Froxlor\Cli\Action $this->_checkConfigParam(true); $this->_parseConfig(); - require FROXLOR_INSTALL_DIR . '/lib/tables.inc.php'; - require FROXLOR_INSTALL_DIR . '/lib/functions.php'; + require \Froxlor\Froxlor::getInstallDir() . '/lib/tables.inc.php'; + require \Froxlor\Froxlor::getInstallDir() . '/lib/functions.php'; if (array_key_exists("import-settings", $this->_args)) { $this->_importSettings(); @@ -74,7 +74,7 @@ class ConfigServicesAction extends \Froxlor\Cli\Action 'distro' => "" ); - $config_dir = FROXLOR_INSTALL_DIR . '/lib/configfiles/'; + $config_dir = \Froxlor\Froxlor::getInstallDir() . '/lib/configfiles/'; // show list of available distro's $distros = glob($config_dir . '*.xml'); // tmp array @@ -236,7 +236,7 @@ class ConfigServicesAction extends \Froxlor\Cli\Action } if (! empty($decoded_config)) { - $config_dir = FROXLOR_INSTALL_DIR . '/lib/configfiles/'; + $config_dir = \Froxlor\Froxlor::getInstallDir() . '/lib/configfiles/'; $configfiles = new \Froxlor\Config\ConfigParser($config_dir . '/' . $decoded_config['distro'] . ".xml"); $services = $configfiles->getServices(); $replace_arr = $this->_getReplacerArray(); @@ -298,7 +298,7 @@ class ConfigServicesAction extends \Froxlor\Cli\Action // set is_configured flag Settings::Set('panel.is_configured', '1', true); // run cronjob at the end to ensure configs are all up to date - exec('php ' . FROXLOR_INSTALL_DIR . '/scripts/froxlor_master_cronjob.php --force'); + exec('php ' . \Froxlor\Froxlor::getInstallDir() . '/scripts/froxlor_master_cronjob.php --force'); // and done ConfigServicesCmd::printsucc("All services have been configured"); } else { @@ -347,7 +347,7 @@ class ConfigServicesAction extends \Froxlor\Cli\Action '' => Settings::Get('system.vmail_gid'), '' => (Settings::Get('system.use_ssl') == '1') ? 'imaps pop3s' : '', '' => \Froxlor\FileDir::makeCorrectDir($customer_tmpdir), - '' => \Froxlor\FileDir::makeCorrectDir(FROXLOR_INSTALL_DIR), + '' => \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir()), '' => \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.bindconf_directory')), '' => Settings::Get('system.apachereload_command'), '' => \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.logfiles_directory')), @@ -359,11 +359,11 @@ class ConfigServicesAction extends \Froxlor\Cli\Action private function _parseConfig() { - define('FROXLOR_INSTALL_DIR', $this->_args['froxlor-dir']); - if (! file_exists(FROXLOR_INSTALL_DIR . '/lib/classes/database/class.Database.php')) { - throw new \Exception("Could not find froxlor's Database class. Is froxlor really installed to '" . FROXLOR_INSTALL_DIR . "'?"); + define('\Froxlor\Froxlor::getInstallDir()', $this->_args['froxlor-dir']); + if (! file_exists(\Froxlor\Froxlor::getInstallDir() . '/lib/classes/database/class.Database.php')) { + throw new \Exception("Could not find froxlor's Database class. Is froxlor really installed to '" . \Froxlor\Froxlor::getInstallDir() . "'?"); } - if (! file_exists(FROXLOR_INSTALL_DIR . '/lib/userdata.inc.php')) { + if (! file_exists(\Froxlor\Froxlor::getInstallDir() . '/lib/userdata.inc.php')) { throw new \Exception("Could not find froxlor's userdata.inc.php file. You should use this script only with a fully installed and setup froxlor system."); } } diff --git a/lib/Froxlor/Cli/Action/SwitchServerIpAction.php b/lib/Froxlor/Cli/Action/SwitchServerIpAction.php index ba2fa4a4..97707faf 100644 --- a/lib/Froxlor/Cli/Action/SwitchServerIpAction.php +++ b/lib/Froxlor/Cli/Action/SwitchServerIpAction.php @@ -160,11 +160,11 @@ class SwitchServerIpAction extends \Froxlor\Cli\Action private function _parseConfig() { - define('FROXLOR_INSTALL_DIR', $this->_args['froxlor-dir']); - if (! file_exists(FROXLOR_INSTALL_DIR . '/lib/classes/database/class.Database.php')) { - throw new \Exception("Could not find froxlor's Database class. Is froxlor really installed to '" . FROXLOR_INSTALL_DIR . "'?"); + define('\Froxlor\Froxlor::getInstallDir()', $this->_args['froxlor-dir']); + if (! file_exists(\Froxlor\Froxlor::getInstallDir() . '/lib/classes/database/class.Database.php')) { + throw new \Exception("Could not find froxlor's Database class. Is froxlor really installed to '" . \Froxlor\Froxlor::getInstallDir() . "'?"); } - if (! file_exists(FROXLOR_INSTALL_DIR . '/lib/userdata.inc.php')) { + if (! file_exists(\Froxlor\Froxlor::getInstallDir() . '/lib/userdata.inc.php')) { throw new \Exception("Could not find froxlor's userdata.inc.php file. You should use this script only with a fully installed and setup froxlor system."); } } diff --git a/lib/Froxlor/Froxlor.php b/lib/Froxlor/Froxlor.php index 647e1607..072231e4 100644 --- a/lib/Froxlor/Froxlor.php +++ b/lib/Froxlor/Froxlor.php @@ -23,7 +23,7 @@ final class Froxlor */ public static function getInstallDir() { - return dirname(dirname(__DIR__)); + return dirname(dirname(__DIR__)) . '/'; } /** diff --git a/lib/Froxlor/FroxlorLogger.php b/lib/Froxlor/FroxlorLogger.php index fe1fdb26..693e99fa 100644 --- a/lib/Froxlor/FroxlorLogger.php +++ b/lib/Froxlor/FroxlorLogger.php @@ -184,7 +184,7 @@ class FroxlorLogger self::$crondebug_flag = (bool) $_flag; } - private function getLogLevelDesc($type) + public function getLogLevelDesc($type) { switch ($type) { case LOG_INFO: diff --git a/lib/Froxlor/PhpHelper.php b/lib/Froxlor/PhpHelper.php index 979fc842..5f33377b 100644 --- a/lib/Froxlor/PhpHelper.php +++ b/lib/Froxlor/PhpHelper.php @@ -24,7 +24,7 @@ class PhpHelper { if (is_array($subject)) { if (! is_array($fields)) { - $fields = array_trim(explode(' ', $fields)); + $fields = self::array_trim(explode(' ', $fields)); } foreach ($subject as $field => $value) { @@ -58,7 +58,7 @@ class PhpHelper public static function str_replace_array($search, $replace, $subject, $fields = '') { if (is_array($subject)) { - $fields = array_trim(explode(' ', $fields)); + $fields = self::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]); @@ -339,7 +339,7 @@ class PhpHelper * The array to trim * @return array The trim'med array */ - function array_trim($source) + public static function array_trim($source) { $returnval = array(); if (is_array($source)) { diff --git a/lib/Froxlor/SImExporter.php b/lib/Froxlor/SImExporter.php index ccc07eb4..469e4e27 100644 --- a/lib/Froxlor/SImExporter.php +++ b/lib/Froxlor/SImExporter.php @@ -1,7 +1,7 @@  

This mostly happens due to wrong ownership.
Try the following command to correct the ownership:

 

-

chown -R : 

+

chown -R : <\Froxlor\Froxlor::getInstallDir()>