fixed last remaining function calls which are class-methods now
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -561,7 +561,7 @@ class Apache extends HttpConfigBase
|
||||
|
||||
if ($domain['phpenabled_customer'] == 1 && $domain['phpenabled_vhost'] == '1') {
|
||||
// This vHost has PHP enabled and we are using the regular mod_php
|
||||
$cmail = getCustomerDetail($domain['customerid'], 'email');
|
||||
$cmail = \Froxlor\Customer\Customer::getCustomerDetail($domain['customerid'], 'email');
|
||||
$php_options_text .= ' php_admin_value sendmail_path "/usr/sbin/sendmail -t -f ' . $cmail . '"' . PHP_EOL;
|
||||
|
||||
if ($domain['openbasedir'] == '1') {
|
||||
@@ -1220,7 +1220,7 @@ class Apache extends HttpConfigBase
|
||||
// check for suexec-workaround, #319
|
||||
if ((int) Settings::Get('perl.suexecworkaround') == 1) {
|
||||
// symlink this directory to suexec-safe-path
|
||||
$loginname = getCustomerDetail($row_diroptions['customerid'], 'loginname');
|
||||
$loginname = \Froxlor\Customer\Customer::getCustomerDetail($row_diroptions['customerid'], 'loginname');
|
||||
$suexecpath = \Froxlor\FileDir::makeCorrectDir(Settings::Get('perl.suexecpath') . '/' . $loginname . '/' . md5($row_diroptions['path']) . '/');
|
||||
|
||||
if (! file_exists($suexecpath)) {
|
||||
@@ -1240,7 +1240,7 @@ class Apache extends HttpConfigBase
|
||||
// if no perl-execution is enabled but the workaround is,
|
||||
// we have to remove the symlink and folder in suexecpath
|
||||
if ((int) Settings::Get('perl.suexecworkaround') == 1) {
|
||||
$loginname = getCustomerDetail($row_diroptions['customerid'], 'loginname');
|
||||
$loginname = \Froxlor\Customer\Customer::getCustomerDetail($row_diroptions['customerid'], 'loginname');
|
||||
$suexecpath = \Froxlor\FileDir::makeCorrectDir(Settings::Get('perl.suexecpath') . '/' . $loginname . '/' . md5($row_diroptions['path']) . '/');
|
||||
$perlsymlink = \Froxlor\FileDir::makeCorrectFile($row_diroptions['path'] . '/cgi-bin');
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ class Fcgid
|
||||
|
||||
// remove +i attibute, so starter can be overwritten
|
||||
if (file_exists($this->getStarterFile())) {
|
||||
removeImmutable($this->getStarterFile());
|
||||
\Froxlor\FileDir::removeImmutable($this->getStarterFile());
|
||||
}
|
||||
|
||||
$starter_file_handler = fopen($this->getStarterFile(), 'w');
|
||||
@@ -104,7 +104,7 @@ class Fcgid
|
||||
fclose($starter_file_handler);
|
||||
\Froxlor\FileDir::safe_exec('chmod 750 ' . escapeshellarg($this->getStarterFile()));
|
||||
\Froxlor\FileDir::safe_exec('chown ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($this->getStarterFile()));
|
||||
setImmutable($this->getStarterFile());
|
||||
\Froxlor\FileDir::setImmutable($this->getStarterFile());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -419,7 +419,7 @@ class FileDir
|
||||
}
|
||||
$dir = self::makeCorrectDir($dir);
|
||||
}
|
||||
$_field .= makeoption($dir, $dir, $value);
|
||||
$_field .= \Froxlor\UI\HTML::makeoption($dir, $dir, $value);
|
||||
}
|
||||
$field = array(
|
||||
'type' => 'select',
|
||||
|
||||
@@ -32,23 +32,10 @@ use Froxlor\Database\Database;
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Classes
|
||||
*
|
||||
* @method static mixed Get ($setting = null) return a setting-value by its group and varname separated by a dot (group.varname)
|
||||
* @method static boolean Set ($setting = null, $value = null, $instant_save = true) update a setting / set a new value
|
||||
* @method static boolean IsInList ($setting = null, $entry = null) tests if a setting-value that i s a comma separated list contains an entry
|
||||
* @method static boolean AddNew ($setting = null, $value = null) add a new setting to the database (mainly used in updater)
|
||||
* @method static boolean Flush () Store all un-saved changes to the database and re-read in all settings
|
||||
* @method static void Stash () forget all un-saved changes to settings
|
||||
*/
|
||||
class Settings
|
||||
{
|
||||
|
||||
/**
|
||||
* current settings object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
private static $_obj = null;
|
||||
|
||||
/**
|
||||
* settings data
|
||||
*
|
||||
@@ -74,27 +61,30 @@ class Settings
|
||||
/**
|
||||
* private constructor, reads in all settings
|
||||
*/
|
||||
private function __construct()
|
||||
private static function init()
|
||||
{
|
||||
$this->_readSettings();
|
||||
self::$_updatedata = array();
|
||||
// prepare statement
|
||||
self::$_updstmt = Database::prepare("
|
||||
if (empty(self::$_data)) {
|
||||
self::_readSettings();
|
||||
self::$_updatedata = array();
|
||||
|
||||
// prepare statement
|
||||
self::$_updstmt = Database::prepare("
|
||||
UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = :value
|
||||
WHERE `settinggroup` = :group AND `varname` = :varname
|
||||
");
|
||||
");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read in all settings from the database
|
||||
* and set the internal $_data array
|
||||
*/
|
||||
private function _readSettings()
|
||||
private static function _readSettings()
|
||||
{
|
||||
$result_stmt = Database::query("
|
||||
SELECT `settingid`, `settinggroup`, `varname`, `value`
|
||||
FROM `" . TABLE_PANEL_SETTINGS . "`
|
||||
");
|
||||
SELECT `settingid`, `settinggroup`, `varname`, `value`
|
||||
FROM `" . TABLE_PANEL_SETTINGS . "`
|
||||
");
|
||||
self::$_data = array();
|
||||
while ($row = $result_stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
self::$_data[$row['settinggroup']][$row['varname']] = $row['value'];
|
||||
@@ -127,8 +117,9 @@ class Settings
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function pGet($setting = null)
|
||||
public function Get($setting = null)
|
||||
{
|
||||
self::init();
|
||||
$sstr = explode(".", $setting);
|
||||
// no separator - do'h
|
||||
if (! isset($sstr[1])) {
|
||||
@@ -151,9 +142,10 @@ class Settings
|
||||
*
|
||||
* @return boolean true, if the list contains $entry
|
||||
*/
|
||||
public function pIsInList($setting = null, $entry = null)
|
||||
public function IsInList($setting = null, $entry = null)
|
||||
{
|
||||
$s = Settings::Get($setting);
|
||||
self::init();
|
||||
$s = self::Get($setting);
|
||||
if ($s == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -171,10 +163,11 @@ class Settings
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function pSet($setting = null, $value = null, $instant_save = true)
|
||||
public function Set($setting = null, $value = null, $instant_save = true)
|
||||
{
|
||||
self::init();
|
||||
// check whether the setting exists
|
||||
if (Settings::Get($setting) !== null) {
|
||||
if (self::Get($setting) !== null) {
|
||||
// set new value in array
|
||||
$sstr = explode(".", $setting);
|
||||
if (! isset($sstr[1])) {
|
||||
@@ -183,7 +176,7 @@ class Settings
|
||||
self::$_data[$sstr[0]][$sstr[1]] = $value;
|
||||
// should we store to db instantly?
|
||||
if ($instant_save) {
|
||||
$this->_storeSetting($sstr[0], $sstr[1], $value);
|
||||
self::_storeSetting($sstr[0], $sstr[1], $value);
|
||||
} else {
|
||||
// set temporary data for usage
|
||||
if (! isset(self::$_data[$sstr[0]]) || ! is_array(self::$_data[$sstr[0]])) {
|
||||
@@ -210,11 +203,11 @@ class Settings
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function pAddNew($setting = null, $value = null)
|
||||
public function AddNew($setting = null, $value = null)
|
||||
{
|
||||
|
||||
self::init();
|
||||
// first check if it doesn't exist
|
||||
if (Settings::Get($setting) === null) {
|
||||
if (self::Get($setting) === null) {
|
||||
// validate parameter
|
||||
$sstr = explode(".", $setting);
|
||||
if (! isset($sstr[1])) {
|
||||
@@ -244,19 +237,20 @@ class Settings
|
||||
* Store all un-saved changes to the database and
|
||||
* re-read in all settings
|
||||
*/
|
||||
public function pFlush()
|
||||
public static function Flush()
|
||||
{
|
||||
self::init();
|
||||
if (is_array(self::$_updatedata) && count(self::$_updatedata) > 0) {
|
||||
// save all un-saved changes to the settings
|
||||
foreach (self::$_updatedata as $group => $vargroup) {
|
||||
foreach ($vargroup as $varname => $value) {
|
||||
$this->_storeSetting($group, $varname, $value);
|
||||
self::_storeSetting($group, $varname, $value);
|
||||
}
|
||||
}
|
||||
// now empty the array
|
||||
self::$_updatedata = array();
|
||||
// re-read in all settings
|
||||
return $this->_readSettings();
|
||||
return self::_readSettings();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -264,50 +258,13 @@ class Settings
|
||||
/**
|
||||
* forget all un-saved changes to settings
|
||||
*/
|
||||
public function pStash()
|
||||
public static function Stash()
|
||||
{
|
||||
self::init();
|
||||
// empty update array
|
||||
self::$_updatedata = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* create new object and return instance
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
private static function getInstance()
|
||||
{
|
||||
// do we got an object already?
|
||||
if (self::$_obj == null) {
|
||||
self::$_obj = new self();
|
||||
}
|
||||
// return it
|
||||
return self::$_obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* let's us interact with the settings-Object by using static
|
||||
* call like "Settings::function()"
|
||||
*
|
||||
* @param string $name
|
||||
* @param mixed $args
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function __callStatic($name, $args)
|
||||
{
|
||||
// as our functions are not static and therefore cannot
|
||||
// be called statically, we prefix a 'p' to all of
|
||||
// our public functions so we can use Settings::functionname()
|
||||
// which looks cooler and is easier to use
|
||||
$callback = array(
|
||||
self::getInstance(),
|
||||
"p" . $name
|
||||
);
|
||||
$result = call_user_func_array($callback, $args);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function loadSettingsInto(&$settings_data)
|
||||
{
|
||||
if (is_array($settings_data) && isset($settings_data['groups']) && is_array($settings_data['groups'])) {
|
||||
|
||||
@@ -173,7 +173,7 @@ class Form
|
||||
// Save fields
|
||||
foreach ($groupdetails['fields'] as $fieldname => $fielddetails) {
|
||||
if (isset($changed_fields[$fieldname])) {
|
||||
if (($saved_field = self::saveFormField($fieldname, $fielddetails, manipulateFormFieldData($fieldname, $fielddetails, $changed_fields[$fieldname]))) !== false) {
|
||||
if (($saved_field = self::saveFormField($fieldname, $fielddetails, self::manipulateFormFieldData($fieldname, $fielddetails, $changed_fields[$fieldname]))) !== false) {
|
||||
$saved_fields = array_merge($saved_fields, $saved_field);
|
||||
} else {
|
||||
\Froxlor\UI\Response::standard_error('errorwhensaving', $fieldname);
|
||||
@@ -525,4 +525,4 @@ class Form
|
||||
return $array1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user