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

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