fixed a few functions I've missed

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2018-12-21 19:16:49 +01:00
parent 7563907df5
commit 7c68fa7bd0
27 changed files with 75 additions and 79 deletions

View File

@@ -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");

View File

@@ -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(

View File

@@ -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);

View File

@@ -65,7 +65,7 @@ if ($userinfo['change_serversettings'] == '1') {
'<VIRTUAL_GID_MAPS>' => Settings::Get('system.vmail_gid'),
'<SSLPROTOCOLS>' => (Settings::Get('system.use_ssl') == '1') ? 'imaps pop3s' : '',
'<CUSTOMER_TMP>' => \Froxlor\FileDir::makeCorrectDir($customer_tmpdir),
'<BASE_PATH>' => \Froxlor\FileDir::makeCorrectDir(FROXLOR_INSTALL_DIR),
'<BASE_PATH>' => \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir()),
'<BIND_CONFIG_PATH>' => \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.bindconf_directory')),
'<WEBSERVER_RELOAD_CMD>' => Settings::Get('system.apachereload_command'),
'<CUSTOMER_LOGS>' => \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 {

View File

@@ -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(

View File

@@ -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", "<br />", $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';

View File

@@ -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

View File

@@ -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;

View File

@@ -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') {

View File

@@ -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']);

View File

@@ -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']);

View File

@@ -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 .= '<br />' . $preconfig . $message;

View File

@@ -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

View File

@@ -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

View File

@@ -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;

View File

@@ -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
));

View File

@@ -30,8 +30,6 @@
*/
function showUpdateStep($task = null, $needs_status = true)
{
global $updatelog, $filelog;
if (! $needs_status)
echo "<b>";
@@ -42,8 +40,8 @@ function showUpdateStep($task = null, $needs_status = true)
echo "</b><br />";
}
$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 "<span class=\"update-step update-step-" . $status_color . "\">" . $status_sign . "</span><br />";
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');
}
}

View File

@@ -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`;");

View File

@@ -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;
}

View File

@@ -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
'<VIRTUAL_GID_MAPS>' => Settings::Get('system.vmail_gid'),
'<SSLPROTOCOLS>' => (Settings::Get('system.use_ssl') == '1') ? 'imaps pop3s' : '',
'<CUSTOMER_TMP>' => \Froxlor\FileDir::makeCorrectDir($customer_tmpdir),
'<BASE_PATH>' => \Froxlor\FileDir::makeCorrectDir(FROXLOR_INSTALL_DIR),
'<BASE_PATH>' => \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir()),
'<BIND_CONFIG_PATH>' => \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.bindconf_directory')),
'<WEBSERVER_RELOAD_CMD>' => Settings::Get('system.apachereload_command'),
'<CUSTOMER_LOGS>' => \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.");
}
}

View File

@@ -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.");
}
}

View File

@@ -23,7 +23,7 @@ final class Froxlor
*/
public static function getInstallDir()
{
return dirname(dirname(__DIR__));
return dirname(dirname(__DIR__)) . '/';
}
/**

View File

@@ -184,7 +184,7 @@ class FroxlorLogger
self::$crondebug_flag = (bool) $_flag;
}
private function getLogLevelDesc($type)
public function getLogLevelDesc($type)
{
switch ($type) {
case LOG_INFO:

View File

@@ -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)) {

View File

@@ -1,7 +1,7 @@
<?php
namespace Froxlor;
use Froxlor\Database as Database;
use Froxlor\Database\Database;
/**
* This file is part of the Froxlor project.

View File

@@ -259,7 +259,7 @@ class Store
if ($returnvalue !== false && is_array($fielddata) && isset($fielddata['settinggroup']) && $fielddata['settinggroup'] == 'system' && isset($fielddata['varname']) && $fielddata['varname'] == 'ipaddress') {
$mysql_access_host_array = array_map('trim', explode(',', Settings::Get('system.mysql_access_host')));
$mysql_access_host_array[] = $newfieldvalue;
$mysql_access_host_array = array_unique(array_trim($mysql_access_host_array));
$mysql_access_host_array = array_unique(\Froxlor\PhpHelper::array_trim($mysql_access_host_array));
$mysql_access_host = implode(',', $mysql_access_host_array);
\Froxlor\Database\DbManager::correctMysqlUsers($mysql_access_host_array);
Settings::Set('system.mysql_access_host', $mysql_access_host);
@@ -289,7 +289,7 @@ class Store
'cleanMySQLAccessHost'
), $mysql_access_host_array);
$mysql_access_host_array = array_unique(array_trim($mysql_access_host_array));
$mysql_access_host_array = array_unique(\Froxlor\PhpHelper::array_trim($mysql_access_host_array));
$newfieldvalue = implode(',', $mysql_access_host_array);
\Froxlor\Database\DbManager::correctMysqlUsers($mysql_access_host_array);
}

View File

@@ -25,7 +25,7 @@
<p>&nbsp;</p>
<p>This mostly happens due to wrong ownership.<br />Try the following command to correct the ownership:</p>
<p>&nbsp;</p>
<p><pre>chown -R <USER>:<GROUP> <FROXLOR_INSTALL_DIR></pre></p>
<p><pre>chown -R <USER>:<GROUP> <\Froxlor\Froxlor::getInstallDir()></pre></p>
</div>
</div>
<aside class="right">