get rid of most of the checkstyle warnings

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2018-12-24 13:50:45 +01:00
parent 30f5902b88
commit 7416a41a42
41 changed files with 129 additions and 119 deletions

View File

@@ -423,7 +423,7 @@ abstract class ApiCommand extends ApiParameter
"var" => $varname
), true, true);
// @fixme html_entity_decode
$content = html_entity_decode(\Froxlor\PhpHelper::replace_variables((($result['value'] != '') ? $result['value'] : $default), $replace_arr));
$content = html_entity_decode(\Froxlor\PhpHelper::replaceVariables((($result['value'] != '') ? $result['value'] : $default), $replace_arr));
return $content;
}

View File

@@ -58,7 +58,7 @@ class Froxlor extends \Froxlor\Api\ApiCommand
// check for customized version to not output
// "There is a newer version of froxlor" besides the error-message
$isnewerversion = - 1;
} elseif (\Froxlor\Froxlor::version_compare2($this->version, $_version) == - 1) {
} elseif (\Froxlor\Froxlor::versionCompare2($this->version, $_version) == - 1) {
// there is a newer version - yay
$isnewerversion = 1;
} else {

View File

@@ -762,14 +762,14 @@ class Apache extends HttpConfigBase
if (Settings::Get('system.logfiles_piped') == '1' && Settings::Get('system.logfiles_script') != '') {
// replace for error_log
$command = \Froxlor\PhpHelper::replace_variables(Settings::Get('system.logfiles_script'), array(
$command = \Froxlor\PhpHelper::replaceVariables(Settings::Get('system.logfiles_script'), array(
'LOGFILE' => $error_log,
'DOMAIN' => $domain['domain'],
'CUSTOMER' => $domain['loginname']
));
$logfiles_text .= ' ErrorLog "| ' . $command . "\"\n";
// replace for access_log
$command = \Froxlor\PhpHelper::replace_variables(Settings::Get('system.logfiles_script'), array(
$command = \Froxlor\PhpHelper::replaceVariables(Settings::Get('system.logfiles_script'), array(
'LOGFILE' => $access_log,
'DOMAIN' => $domain['domain'],
'CUSTOMER' => $domain['loginname']

View File

@@ -54,7 +54,7 @@ class HttpConfigBase
'SCHEME' => ($is_ssl_vhost) ? 'https' : 'http',
'DOCROOT' => $domain['documentroot']
);
return \Froxlor\PhpHelper::replace_variables($template, $templateVars);
return \Froxlor\PhpHelper::replaceVariables($template, $templateVars);
}
protected function getMyPath($ip_port = null)

View File

@@ -167,7 +167,7 @@ class Fcgid
$phpini_file .= "; php.ini created/changed on " . date("Y.m.d H:i:s") . " for domain '" . $this->domain['domain'] . "' with id #" . $this->domain['id'] . " from php template '" . $phpconfig['description'] . "' with id #" . $phpconfig['id'] . "\n";
$phpini_file .= "; Do not change anything in this file, it will be overwritten by the Froxlor Cronjob!\n";
$phpini_file .= ";\n\n";
$phpini_file .= \Froxlor\PhpHelper::replace_variables($phpconfig['phpsettings'], $php_ini_variables);
$phpini_file .= \Froxlor\PhpHelper::replaceVariables($phpconfig['phpsettings'], $php_ini_variables);
$phpini_file = str_replace('"none"', 'none', $phpini_file);
// $phpini_file = preg_replace('/\"+/', '"', $phpini_file);
$phpini_file_handler = fopen($this->getIniFile(), 'w');

View File

@@ -237,7 +237,7 @@ class Fpm
'CUSTOMER_HOMEDIR' => \Froxlor\FileDir::makeCorrectDir($this->domain['customerroot'])
);
$phpini = \Froxlor\PhpHelper::replace_variables($phpconfig['phpsettings'], $php_ini_variables);
$phpini = \Froxlor\PhpHelper::replaceVariables($phpconfig['phpsettings'], $php_ini_variables);
$phpini_array = explode("\n", $phpini);
$fpm_config .= "\n\n";

View File

@@ -106,11 +106,11 @@ class ReportsCron extends \Froxlor\Cron\FroxlorCron
'varname' => 'trafficmaxpercent_subject'
);
$result2 = Database::pexecute_first($result2_stmt, $result2_data);
$mail_subject = html_entity_decode(\Froxlor\PhpHelper::replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['trafficmaxpercent']['subject']), $replace_arr));
$mail_subject = html_entity_decode(\Froxlor\PhpHelper::replaceVariables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['trafficmaxpercent']['subject']), $replace_arr));
$result2_data['varname'] = 'trafficmaxpercent_mailbody';
$result2 = Database::pexecute_first($result2_stmt, $result2_data);
$mail_body = html_entity_decode(\Froxlor\PhpHelper::replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['trafficmaxpercent']['mailbody']), $replace_arr));
$mail_body = html_entity_decode(\Froxlor\PhpHelper::replaceVariables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['trafficmaxpercent']['mailbody']), $replace_arr));
$_mailerror = false;
$mailerr_msg = "";
@@ -208,11 +208,11 @@ class ReportsCron extends \Froxlor\Cron\FroxlorCron
'varname' => 'trafficmaxpercent_subject'
);
$result2 = Database::pexecute_first($result2_stmt, $result2_data);
$mail_subject = html_entity_decode(\Froxlor\PhpHelper::replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['trafficmaxpercent']['subject']), $replace_arr));
$mail_subject = html_entity_decode(\Froxlor\PhpHelper::replaceVariables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['trafficmaxpercent']['subject']), $replace_arr));
$result2_data['varname'] = 'trafficmaxpercent_mailbody';
$result2 = Database::pexecute_first($result2_stmt, $result2_data);
$mail_body = html_entity_decode(\Froxlor\PhpHelper::replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['trafficmaxpercent']['mailbody']), $replace_arr));
$mail_body = html_entity_decode(\Froxlor\PhpHelper::replaceVariables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['trafficmaxpercent']['mailbody']), $replace_arr));
$_mailerror = false;
$mailerr_msg = "";
@@ -407,11 +407,11 @@ class ReportsCron extends \Froxlor\Cron\FroxlorCron
'varname' => 'diskmaxpercent_subject'
);
$result2 = Database::pexecute_first($result2_stmt, $result2_data);
$mail_subject = html_entity_decode(\Froxlor\PhpHelper::replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['diskmaxpercent']['subject']), $replace_arr));
$mail_subject = html_entity_decode(\Froxlor\PhpHelper::replaceVariables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['diskmaxpercent']['subject']), $replace_arr));
$result2_data['varname'] = 'diskmaxpercent_mailbody';
$result2 = Database::pexecute_first($result2_stmt, $result2_data);
$mail_body = html_entity_decode(\Froxlor\PhpHelper::replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['diskmaxpercent']['mailbody']), $replace_arr));
$mail_body = html_entity_decode(\Froxlor\PhpHelper::replaceVariables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['diskmaxpercent']['mailbody']), $replace_arr));
$_mailerror = false;
$mailerr_msg = "";
@@ -500,11 +500,11 @@ class ReportsCron extends \Froxlor\Cron\FroxlorCron
'varname' => 'diskmaxpercent_subject'
);
$result2 = Database::pexecute_first($result2_stmt, $result2_data);
$mail_subject = html_entity_decode(\Froxlor\PhpHelper::replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['diskmaxpercent']['subject']), $replace_arr));
$mail_subject = html_entity_decode(\Froxlor\PhpHelper::replaceVariables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['diskmaxpercent']['subject']), $replace_arr));
$result2_data['varname'] = 'diskmaxpercent_mailbody';
$result2 = Database::pexecute_first($result2_stmt, $result2_data);
$mail_body = html_entity_decode(\Froxlor\PhpHelper::replace_variables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['diskmaxpercent']['mailbody']), $replace_arr));
$mail_body = html_entity_decode(\Froxlor\PhpHelper::replaceVariables((($result2['value'] != '') ? $result2['value'] : $lng['mails']['diskmaxpercent']['mailbody']), $replace_arr));
$_mailerror = false;
$mailerr_msg = "";

View File

@@ -229,7 +229,7 @@ class IntegrityCheck
* @param bool $fix
* Fix everything found directly
*/
public function SubdomainSslRedirect($fix = false)
public function subdomainSslRedirect($fix = false)
{
$ips = array();
$parentdomains = array();
@@ -301,7 +301,7 @@ class IntegrityCheck
}
if ($fix) {
return $this->SubdomainSslRedirect();
return $this->subdomainSslRedirect();
} else {
return true;
}

View File

@@ -217,8 +217,8 @@ class FileDir
'ADMIN_EMAIL' => $template['admin_email']
);
// @fixme replace_variables
$htmlcontent = PhpHelper::replace_variables($template['value'], $replace_arr);
// @fixme replaceVariables
$htmlcontent = PhpHelper::replaceVariables($template['value'], $replace_arr);
$indexhtmlpath = self::makeCorrectFile($destination . '/index.' . Settings::Get('system.index_file_extension'));
$index_html_handler = fopen($indexhtmlpath, 'w');
fwrite($index_html_handler, $htmlcontent);

View File

@@ -210,7 +210,7 @@ final class Froxlor
*
* @return integer 0 if equal, 1 if a>b and -1 if b>a
*/
public static function version_compare2($a, $b)
public static function versionCompare2($a, $b)
{
// split version into pieces and remove trailing .0

View File

@@ -55,16 +55,10 @@ class IdnaWrapper
*/
public function encode($to_encode)
{
$to_encode = $this->is_utf8($to_encode) ? $to_encode : utf8_encode($to_encode);
$to_encode = $this->isUtf8($to_encode) ? $to_encode : utf8_encode($to_encode);
return $this->idna_converter->encode($to_encode);
}
public function encode_uri($to_encode)
{
$to_encode = $this->is_utf8($to_encode) ? $to_encode : utf8_encode($to_encode);
return $this->idna_converter->encodeUri($to_encode);
}
/**
* Decode a domain name, a email address or a list of one of both.
*
@@ -87,7 +81,7 @@ class IdnaWrapper
*
* @return boolean
*/
private function is_utf8($string = null)
private function isUtf8($string = null)
{
if (function_exists("mb_detect_encoding")) {
if (mb_detect_encoding($string, 'UTF-8, ISO-8859-1') === 'UTF-8') {

View File

@@ -20,7 +20,7 @@ class PhpHelper
* @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')
public static function htmlentitiesArray($subject, $fields = '', $quote_style = ENT_QUOTES, $charset = 'UTF-8')
{
if (is_array($subject)) {
if (! is_array($fields)) {
@@ -30,7 +30,7 @@ class PhpHelper
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);
$subject[$field] = self::htmlentitiesArray($subject[$field], $fields, $quote_style, $charset);
}
}
} else {
@@ -55,7 +55,7 @@ class PhpHelper
* @return array The str_replace'd array
* @author Florian Lippert <flo@syscp.org>
*/
public static function str_replace_array($search, $replace, $subject, $fields = '')
public static function strReplaceArray($search, $replace, $subject, $fields = '')
{
if (is_array($subject)) {
$fields = self::array_trim(explode(' ', $fields));
@@ -162,7 +162,7 @@ class PhpHelper
if ($has_data) {
sort($data_files);
foreach ($data_files as $data_filename) {
$data = array_merge_recursive($data, include ($data_filename));
$data = array_merge_recursive($data, include $data_filename);
}
}
@@ -257,7 +257,7 @@ class PhpHelper
* @param
* string
*/
public static function size_readable($size, $max = null, $system = 'si', $retstring = '%01.2f %s')
public static function sizeReadable($size, $max = null, $system = 'si', $retstring = '%01.2f %s')
{
// Pick units
$systems = array(
@@ -312,7 +312,7 @@ class PhpHelper
*
* @return string The submitted string with the variables replaced.
*/
public static function replace_variables($text, $vars)
public static function replaceVariables($text, $vars)
{
$pattern = "/\{([a-zA-Z0-9\-_]+)\}/";
$matches = array();

View File

@@ -224,7 +224,7 @@ class Crypt
if ($pwd_hash == $pwd_check) {
// check for update of hash (only if our database is ready to handle the bigger string)
$is_ready = (\Froxlor\Froxlor::version_compare2("0.9.33", \Froxlor\Froxlor::getVersion()) <= 0 ? true : false);
$is_ready = (\Froxlor\Froxlor::versionCompare2("0.9.33", \Froxlor\Froxlor::getVersion()) <= 0 ? true : false);
if ($update_hash && $is_ready) {
$upd_stmt = \Froxlor\Database\Database::prepare("
UPDATE " . $table . " SET `password` = :newpasswd WHERE `" . $uid . "` = :uid

View File

@@ -155,7 +155,7 @@ class Form
} else {
$filename = '';
}
\Froxlor\UI\HTML::ask_yesno($question, $filename, array_merge($url_params, $submitted_fields, array(
\Froxlor\UI\HTML::askYesNo($question, $filename, array_merge($url_params, $submitted_fields, array(
$question => $question
)), $targetname);
}
@@ -259,7 +259,7 @@ class Form
} else {
$filename = '';
}
\Froxlor\UI\HTML::ask_yesno($question, $filename, array_merge($url_params, $submitted_fields, array(
\Froxlor\UI\HTML::askYesNo($question, $filename, array_merge($url_params, $submitted_fields, array(
$question => $question
)), $targetname);
}

View File

@@ -252,7 +252,7 @@ class HTML
*
* @return string outputs parsed question_yesno template
*/
public static function ask_yesno($text, $yesfile, $params = array(), $targetname = '', $back_nr = 1)
public static function askYesNo($text, $yesfile, $params = array(), $targetname = '', $back_nr = 1)
{
global $userinfo, $s, $header, $footer, $lng, $theme;
@@ -275,7 +275,7 @@ class HTML
exit();
}
public static function ask_yesno_withcheckbox($text, $chk_text, $yesfile, $params = array(), $targetname = '', $show_checkbox = true)
public static function askYesNoWithCheckbox($text, $chk_text, $yesfile, $params = array(), $targetname = '', $show_checkbox = true)
{
global $userinfo, $s, $header, $footer, $lng, $theme;