diff --git a/html/autocomplete.php b/html/autocomplete.php
index 0b0bce54d1e0c3491e32b4ab6fc4e9f401e71113..7ef44f98d50fc9ce1256ac58d1627b27514866e0 100644
--- a/html/autocomplete.php
+++ b/html/autocomplete.php
@@ -22,7 +22,7 @@
 /* Basic setup, remove eventually registered sessions */
 @require_once ("../include/php_setup.inc");
 @require_once ("functions.inc");
-@require_once ("variables.inc");
+@require_once("variables.inc");
 
 session_cache_limiter("private");
 session::start();
@@ -31,7 +31,7 @@ session::set('errorsAlreadyPosted', []);
 /* Logged in? Simple security check */
 if (!session::is_set('ui')) {
   logging::log('security', 'unknown', '', [], 'Error: autocomplete.php called without session');
-  header ('Location: index.php');
+  header('Location: index.php');
   exit;
 }
 
diff --git a/html/getbin.php b/html/getbin.php
index a41a60e7453d3ff0ba6b5498e1de58085f4c2a9a..6cbd8a73c0210052bbdce28b788cc69a1ec3e7d0 100644
--- a/html/getbin.php
+++ b/html/getbin.php
@@ -24,7 +24,7 @@
 @require_once('functions.inc');
 @require_once('variables.inc');
 
-error_reporting (0);
+error_reporting(0);
 session_cache_limiter('private');
 session::start();
 session::set('errorsAlreadyPosted', []);
@@ -32,7 +32,7 @@ session::set('errorsAlreadyPosted', []);
 /* Logged in? Simple security check */
 if (!session::is_set('ui')) {
   logging::log('security', 'unknown', '', [], 'Error: getbin.php called without session');
-  header ('Location: index.php');
+  header('Location: index.php');
   exit;
 }
 
@@ -54,5 +54,5 @@ if (session::is_set($key.'file')) {
 }
 
 echo session::get($key);
-error_reporting (E_ALL | E_STRICT);
+error_reporting(E_ALL | E_STRICT);
 ?>
diff --git a/html/index.php b/html/index.php
index b4821c7b5060f8c1f95783e270710b9cc95db568..12ddfc70f64384d64e2a5983398d5f0af8dfa012 100644
--- a/html/index.php
+++ b/html/index.php
@@ -22,8 +22,8 @@
 /* Load required includes */
 require_once ("../include/php_setup.inc");
 require_once ("functions.inc");
-require_once ("variables.inc");
-require_once ("class_logging.inc");
+require_once("variables.inc");
+require_once("class_logging.inc");
 
 /* Set headers */
 header('Content-type: text/html; charset=UTF-8');
@@ -43,30 +43,30 @@ function displayLogin ()
   if (isset($_POST['username'])) {
     $username = trim($_POST['username']);
   }
-  $smarty->assign ('date',      gmdate('D, d M Y H:i:s'));
-  $smarty->assign ('username',  $username);
-  $smarty->assign ('revision',  FD_VERSION);
-  $smarty->assign ('year',      date('Y'));
-  $smarty->append ('css_files', get_template_path('login.css'));
+  $smarty->assign('date',      gmdate('D, d M Y H:i:s'));
+  $smarty->assign('username',  $username);
+  $smarty->assign('revision',  FD_VERSION);
+  $smarty->assign('year',      date('Y'));
+  $smarty->append('css_files', get_template_path('login.css'));
   $smarty->assign('title',      _('Sign in'));
 
   /* Some error to display? */
   if (!isset($message)) {
     $message = "";
   }
-  $smarty->assign ("message", $message);
+  $smarty->assign("message", $message);
 
   /* Display SSL mode warning? */
   if (($ssl != '') && ($config->get_cfg_value('warnSSL') == 'TRUE')) {
-    $smarty->assign ('ssl', sprintf(_('Warning: <a href="%s">Session is not encrypted!</a>'), $ssl));
+    $smarty->assign('ssl', sprintf(_('Warning: <a href="%s">Session is not encrypted!</a>'), $ssl));
   } else {
-    $smarty->assign ('ssl', '');
+    $smarty->assign('ssl', '');
   }
 
   if (!$config->check_session_lifetime()) {
-    $smarty->assign ('lifetime', _('Warning: The session lifetime configured in your fusiondirectory.conf will be overridden by php.ini settings.'));
+    $smarty->assign('lifetime', _('Warning: The session lifetime configured in your fusiondirectory.conf will be overridden by php.ini settings.'));
   } else {
-    $smarty->assign ('lifetime', '');
+    $smarty->assign('lifetime', '');
   }
 
   /* Generate server list */
@@ -79,11 +79,11 @@ function displayLogin ()
   foreach ($config->data['LOCATIONS'] as $key => $ignored) {
     $servers[$key] = $key;
   }
-  $smarty->assign ("server_options", $servers);
-  $smarty->assign ("server_id", $selected);
+  $smarty->assign("server_options", $servers);
+  $smarty->assign("server_id", $selected);
 
   /* show login screen */
-  $smarty->assign ("PHPSESSID", session_id());
+  $smarty->assign("PHPSESSID", session_id());
   if (session::is_set('errors')) {
     $smarty->assign("errors", session::get('errors'));
   }
@@ -98,7 +98,7 @@ function displayLogin ()
   $smarty->assign("lang", preg_replace('/_.*$/', '', $lang));
   $smarty->assign("rtl",  Language::isRTL($lang));
 
-  $smarty->display (get_template_path('headers.tpl'));
+  $smarty->display(get_template_path('headers.tpl'));
   $smarty->assign("version", FD_VERSION);
 
   $smarty->display(get_template_path('login.tpl'));
@@ -165,7 +165,7 @@ if (!is_readable(CONFIG_DIR.'/'.CONFIG_FILE)) {
 $config = new config(CONFIG_DIR.'/'.CONFIG_FILE, $BASE_DIR);
 session::set('config', $config);
 session::set('DEBUGLEVEL', $config->get_cfg_value('DEBUGLEVEL'));
-@DEBUG (DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, 'config');
+@DEBUG(DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, 'config');
 
 /* Set template compile directory */
 $smarty->compile_dir = $config->get_cfg_value('templateCompileDirectory', SPOOL_DIR);
@@ -188,7 +188,7 @@ clean_smarty_compile_dir($smarty->compile_dir);
 
 Language::init();
 
-$smarty->assign ('focusfield', 'username');
+$smarty->assign('focusfield', 'username');
 
 if (isset($_POST['server'])) {
   $server = $_POST['server'];
@@ -206,7 +206,7 @@ if (
 
 /* If SSL is forced, just forward to the SSL enabled site */
 if (($config->get_cfg_value('forcessl') == 'TRUE') && ($ssl != '')) {
-  header ("Location: $ssl");
+  header("Location: $ssl");
   exit;
 }
 
@@ -288,7 +288,7 @@ class Index {
       return FALSE;
     } elseif (mb_strlen(static::$password, 'UTF-8') == 0) {
       $message = _('Please specify your password!');
-      $smarty->assign ('focusfield', 'password');
+      $smarty->assign('focusfield', 'password');
       return FALSE;
     }
     return TRUE;
@@ -307,7 +307,7 @@ class Index {
         logging::log('security', 'login', '', [], 'Authentication failed for user "'.static::$username.'"');
       }
       $message = _('Please check the username/password combination.');
-      $smarty->assign ('focusfield', 'password');
+      $smarty->assign('focusfield', 'password');
       return FALSE;
     }
     return TRUE;
@@ -342,7 +342,7 @@ class Index {
       if ($expired == POSIX_ACCOUNT_EXPIRED) {
         logging::log('security', 'login', '', [], 'Account for user "'.static::$username.'" has expired');
         $message = _('Account locked. Please contact your system administrator!');
-        $smarty->assign ('focusfield', 'username');
+        $smarty->assign('focusfield', 'username');
         return FALSE;
       }
     }
@@ -357,7 +357,7 @@ class Index {
     logging::log('security', 'login', '', [], 'User "'.static::$username.'" logged in successfully.');
     session::set('connected', 1);
     session::set('DEBUGLEVEL', $config->get_cfg_value('DEBUGLEVEL'));
-    header ('Location: main.php?global_check=1');
+    header('Location: main.php?global_check=1');
     exit;
   }
 
@@ -521,8 +521,6 @@ class Index {
     /* Reset error messages */
     $message = '';
 
-    //~ phpCAS::setDebug();
-
     // Initialize phpCAS
     phpCAS::client(
       CAS_VERSION_2_0,
@@ -533,7 +531,6 @@ class Index {
 
     // Set the CA certificate that is the issuer of the cert
     phpCAS::setCasServerCACert($config->get_cfg_value('casServerCaCertPath'));
-    //~ phpCAS::setNoCasServerValidation();
 
     // force CAS authentication
     phpCAS::forceAuthentication();
@@ -595,7 +592,7 @@ if ($config->get_cfg_value('httpAuthActivated') == 'TRUE') {
 }
 
 /* Translation of cookie-warning. Whether to display it, is determined by JavaScript */
-$smarty->assign ('cookies', '<b>'._('Warning').':</b> '._('Your browser has cookies disabled. Please enable cookies and reload this page before logging in!'));
+$smarty->assign('cookies', '<b>'._('Warning').':</b> '._('Your browser has cookies disabled. Please enable cookies and reload this page before logging in!'));
 
 /* Set focus to the error button if we've an error message */
 $focus = '';
diff --git a/html/main.php b/html/main.php
index 5f73eeb804edad08d9a0d5ea66ec97dab61422aa..334dfe1ca7d706e0592e7e09ecb903cadb0f6eda 100644
--- a/html/main.php
+++ b/html/main.php
@@ -25,7 +25,7 @@ $start = microtime();
 /* Basic setup, remove eventually registered sessions */
 require_once ("../include/php_setup.inc");
 require_once ("functions.inc");
-require_once ("variables.inc");
+require_once("variables.inc");
 
 /* Set headers */
 header('Content-type: text/html; charset=UTF-8');
@@ -45,14 +45,14 @@ session::set('runtime_cache', []);
 session::set('limit_exceeded', FALSE);
 
 if ($_SERVER["REQUEST_METHOD"] == "POST") {
-  @DEBUG (DEBUG_POST, __LINE__, __FUNCTION__, __FILE__, $_POST, "_POST");
+  @DEBUG(DEBUG_POST, __LINE__, __FUNCTION__, __FILE__, $_POST, "_POST");
 }
-@DEBUG (DEBUG_SESSION, __LINE__, __FUNCTION__, __FILE__, session::get_all (), "_SESSION");
+@DEBUG(DEBUG_SESSION, __LINE__, __FUNCTION__, __FILE__, session::get_all(), "_SESSION");
 
 /* Logged in? Simple security check */
 if (!session::is_set('connected')) {
   logging::log('security', 'login', '', [], 'main.php called without session - logging out');
-  header ('Location: index.php?message=nosession');
+  header('Location: index.php?message=nosession');
   exit;
 }
 
@@ -63,7 +63,7 @@ $config = session::get('config');
 
 /* If SSL is forced, just forward to the SSL enabled site */
 if (($config->get_cfg_value('forcessl') == 'TRUE') && ($ssl != '')) {
-  header ("Location: $ssl");
+  header("Location: $ssl");
   exit;
 }
 
@@ -84,7 +84,7 @@ if (session::get('_LAST_PAGE_REQUEST') != '') {
     if ($request_time > $max_life) {
       session::destroy();
       logging::log('security', 'login', '', [], 'main.php called with expired session - logging out');
-      header ('Location: index.php?signout=1&message=expired');
+      header('Location: index.php?signout=1&message=expired');
       exit;
     }
   }
@@ -92,7 +92,7 @@ if (session::get('_LAST_PAGE_REQUEST') != '') {
 session::set('_LAST_PAGE_REQUEST', time());
 
 
-@DEBUG (DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, "config");
+@DEBUG(DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, "config");
 
 /* Set template compile directory */
 $smarty->compile_dir = $config->get_cfg_value("templateCompileDirectory", SPOOL_DIR);
@@ -115,7 +115,7 @@ if (isset($global_check) && $config->get_cfg_value("forceglobals") == "TRUE") {
             FATAL_ERROR_DIALOG);
 
   logging::log('security', 'login', '', [], 'Register globals is on. For security reasons, this should be turned off.');
-  session::destroy ();
+  session::destroy();
   exit;
 }
 
@@ -133,14 +133,14 @@ $smarty->assign("hideMenus", FALSE);
 if ($config->get_cfg_value("handleExpiredAccounts") == "TRUE") {
   $expired = $ui->expired_status();
   if (($expired == POSIX_WARN_ABOUT_EXPIRATION) && !session::is_set('POSIX_WARN_ABOUT_EXPIRATION__DONE')) {
-    @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $expired, 'This user account ('.$ui->uid.') is about to expire');
+    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $expired, 'This user account ('.$ui->uid.') is about to expire');
 
     // The users password is about to xpire soon, display a warning message.
     logging::log('security', 'fusiondirectory', '', [], 'password for user "'.$ui->uid.'" is about to expire');
     msg_dialog::display(_('Password change'), _('Your password is about to expire, please change your password!'), INFO_DIALOG);
     session::set('POSIX_WARN_ABOUT_EXPIRATION__DONE', TRUE);
   } elseif ($expired == POSIX_FORCE_PASSWORD_CHANGE) {
-    @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $expired, "This user account expired");
+    @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $expired, "This user account expired");
 
     // The password is expired, we are now going to enforce a new one from the user.
 
@@ -167,7 +167,7 @@ if (isset($_GET['plug']) && $plist->plugin_access_allowed($_GET['plug'])) {
   session::set('plugin_dir', $plugin_dir);
   if ($plugin_dir == '') {
     logging::log('security', 'fusiondirectory', '', [], "main.php called with invalid plug parameter \"$plug\"");
-    header ('Location: index.php?signout=1&message=invalidparameter&plug='.$plug);
+    header('Location: index.php?signout=1&message=invalidparameter&plug='.$plug);
     exit;
   }
 } else {
@@ -201,7 +201,7 @@ if ($old_plugin_dir != $plugin_dir && $old_plugin_dir != "") {
 $ui->getSizeLimitHandler()->update();
 
 /* Check for memory */
-if (function_exists ("memory_get_usage")) {
+if (function_exists("memory_get_usage")) {
   if (memory_get_usage() > (to_byte(ini_get('memory_limit')) - 2048000 )) {
     msg_dialog::display(_("Configuration error"), _("Running out of memory!"), WARNING_DIALOG);
   }
@@ -215,7 +215,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
   foreach ($_POST as $key => $value) {
     if (preg_match("/^back[0-9]+$/", $key)) {
       $back = substr($key, 4);
-      header ("Location: main.php?plug=$back");
+      header("Location: main.php?plug=$back");
       exit;
     }
   }
@@ -223,7 +223,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
 
 /* Redirect on password back event */
 if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['password_back'])) {
-  header ("Location: main.php");
+  header("Location: main.php");
   exit;
 }
 
@@ -234,11 +234,11 @@ if (isset($_GET['reset'])) {
 }
 
 /* show web frontend */
-$smarty->assign ("date", date("l, dS F Y H:i:s O"));
+$smarty->assign("date", date("l, dS F Y H:i:s O"));
 $lang = session::get('lang');
-$smarty->assign ('lang',  preg_replace('/_.*$/', '', $lang));
-$smarty->assign ('rtl',   Language::isRTL($lang));
-$smarty->assign ('must',  '<span class="must">*</span>');
+$smarty->assign('lang',  preg_replace('/_.*$/', '', $lang));
+$smarty->assign('rtl',   Language::isRTL($lang));
+$smarty->assign('must',  '<span class="must">*</span>');
 if (isset($plug)) {
   $plug = "?plug=$plug";
 } else {
@@ -246,12 +246,12 @@ if (isset($plug)) {
 }
 
 if ($ui->ignore_acl_for_current_user()) {
-  $smarty->assign ('username', '<div style="color:#FF0000;">'._('User ACL checks disabled').'</div>&nbsp;'.$ui->uid);
+  $smarty->assign('username', '<div style="color:#FF0000;">'._('User ACL checks disabled').'</div>&nbsp;'.$ui->uid);
 } else {
-  $smarty->assign ('username', $ui->uid);
+  $smarty->assign('username', $ui->uid);
 }
-$smarty->assign ("menu", $plist->menu);
-$smarty->assign ("plug", "$plug");
+$smarty->assign("menu", $plist->menu);
+$smarty->assign("plug", "$plug");
 
 $smarty->assign("usePrototype", "false");
 
diff --git a/html/progress.php b/html/progress.php
index 6e69027f8d4b89d31ebaaf1b230a03d1b370aa09..e86554bdde45bd99a3d7479cbf3032cfafeb6f99 100644
--- a/html/progress.php
+++ b/html/progress.php
@@ -24,10 +24,10 @@ session_cache_limiter("private");
 
 /* Check for parameter completenes */
 if (!isset($_GET['x']) || !isset($_GET['y']) || !isset($_GET['p'])) {
-  die ("Missing parameters!");
+  die("Missing parameters!");
 }
 if (!is_numeric($_GET['x']) || !is_numeric($_GET['y'])) {
-  die ("Parameters must be numeric!");
+  die("Parameters must be numeric!");
 }
 
 $p = (int)($_GET['p']);
@@ -40,7 +40,7 @@ if ($p < 0) {
 } elseif ($p > 100) {
   $p = 100;
 }
-$p = intval ($p);
+$p = intval($p);
 
 /* Check dimensions */
 if ($x < 3 || $x > 1000) {
@@ -50,7 +50,7 @@ if ($y < 3 || $y > 700) {
   $y = 20;
 }
 
-if (!function_exists ("imagecreate")) {
+if (!function_exists("imagecreate")) {
   syslog(LOG_ERR, "FusionDirectory is missing the gd library, please install php5-gd to be able to see progress images.");
   echo "Please install the php5-gd library, FusionDirectory can't create images without it.";
   exit();
@@ -75,9 +75,9 @@ if (!function_exists ("imagecreate")) {
   }
 
   /* Draw image in GD image stream */
-  $im = imagecreate ($x, $y);
+  $im = imagecreat($x, $y);
   if (!$im) {
-    die ('Cannot Initialize new GD image stream');
+    die('Cannot Initialize new GD image stream');
   }
 
   /* Set colors */
@@ -87,18 +87,18 @@ if (!function_exists ("imagecreate")) {
   $tx_color = imagecolorallocate($im, 240,  10,   90);
 
   /* Draw progress bar */
-  imagerectangle ($im, 0, 0, $x - 1, $y - 1, $br_color);
-  imagefilledrectangle ($im, 1, 1, (($x - 2) * $p / 100),
+  imagerectangle($im, 0, 0, $x - 1, $y - 1, $br_color);
+  imagefilledrectangle($im, 1, 1, (($x - 2) * $p / 100),
       $y - 2, $fi_color);
 
   /* Is font to big for progress bar? */
   if ($font != 0) {
-    imagestring ($im, $font, ($x - $fx) / 2, ($y - $fy) / 2, "$p%", $tx_color);
+    imagestring($im, $font, ($x - $fx) / 2, ($y - $fy) / 2, "$p%", $tx_color);
   }
 
   /* Finally draw the image and remove context */
-  header ("Content-type: image/png");
-  imagepng ($im);
-  imagedestroy ($im);
+  header("Content-type: image/png");
+  imagepng($im);
+  imagedestroy($im);
 }
 ?>
diff --git a/html/setup.php b/html/setup.php
index 4695b6ad185955e606cb9c6ec637524c3327036f..4569caba6b079ddf0ff8c947515278b27d109d56 100644
--- a/html/setup.php
+++ b/html/setup.php
@@ -22,7 +22,7 @@
 /* Get standard functions */
 require_once ("../include/php_setup.inc");
 require_once ("functions.inc");
-require_once ("variables.inc");
+require_once("variables.inc");
 
 require_once("../setup/class_setup.inc");
 require_once("../setup/class_setupStep.inc");
diff --git a/include/class_IconTheme.inc b/include/class_IconTheme.inc
index f47e4b0e14b83601649cc9ef5b2810e08340d223..38f856e8d5d80bc6c33869889219c6b3a477fd63 100644
--- a/include/class_IconTheme.inc
+++ b/include/class_IconTheme.inc
@@ -68,7 +68,7 @@ class IconThemeDir
 
   public function MatchesSize ($size)
   {
-    switch($this->Type) {
+    switch ($this->Type) {
       case 'Fixed':
         return ($this->Size == $size);
       default:
@@ -80,7 +80,7 @@ class IconThemeDir
 
   public function SizeDistance ($size)
   {
-    switch($this->Type) {
+    switch ($this->Type) {
       case 'Fixed':
         return abs($this->Size - $size);
       default:
diff --git a/include/class_SnapshotHandler.inc b/include/class_SnapshotHandler.inc
index 066cdc1df978691b30499c8bd9ac5b396eeca1f0..7fbf9449a0cbdca754bfe9adcc429fe96c93a45c 100644
--- a/include/class_SnapshotHandler.inc
+++ b/include/class_SnapshotHandler.inc
@@ -268,7 +268,7 @@ class SnapshotHandler
       $new_dn                           = 'gosaSnapshotTimestamp='.$target['gosaSnapshotTimestamp'].','.$new_base;
       $ldap->cat($new_dn);
       $usec++;
-    } while($ldap->count());
+    } while ($ldap->count());
 
     /* Insert this new snapshot */
     $ldap->cd($this->snapshotRDN);
diff --git a/include/class_baseSelector.inc b/include/class_baseSelector.inc
index 99f6aa621d526541b539924c35191ff013f62f68..9aa823bf9746d9e9798023d06838699679227495 100644
--- a/include/class_baseSelector.inc
+++ b/include/class_baseSelector.inc
@@ -241,7 +241,7 @@ class baseSelector
         }
         $this->tree .= "<ul>\n";
       } elseif ($indent < $last_indent) {
-        for($i = 0; $i < ($last_indent - $indent); $i++) {
+        for ($i = 0; $i < ($last_indent - $indent); $i++) {
           $this->tree .= "</li></ul>\n";
         }
         $this->tree .= "</li>\n";
diff --git a/include/class_config.inc b/include/class_config.inc
index f372174600ccebd15104fe6c6b31e8fad3398544..40b927297bc2e22be2364eb8b237a6af06a24e61 100644
--- a/include/class_config.inc
+++ b/include/class_config.inc
@@ -192,7 +192,7 @@ class config
     }
 
     /* Look through attributes */
-    switch($this->tags[$this->level - 1]) {
+    switch ($this->tags[$this->level - 1]) {
       /* Handle location */
       case 'LOCATION':
         if ($this->tags[$this->level - 2] == 'MAIN') {
@@ -980,7 +980,7 @@ class config
           }
         }
       }
-      @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, join(',', array_unique($acl)), "Class $class categories");
+      @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, join(',', array_unique($acl)), "Class $class categories");
       /* Feed menu */
       if (isset($plInfo['plSection'])) {
         $section = $plInfo['plSection'];
diff --git a/include/class_divSelectBox.inc b/include/class_divSelectBox.inc
index 369e54e829d89193df5aa993b6be8315d215a621..1f54867f54f98816af1b4250b43d6d59c097708f 100644
--- a/include/class_divSelectBox.inc
+++ b/include/class_divSelectBox.inc
@@ -167,7 +167,7 @@ class divSelectBox
       if ($this->headers !== FALSE) {
         $this->cols = count($this->headers);
         $str .= '<tr>';
-        for($i = 0; $i < ($this->cols); $i++) {
+        for ($i = 0; $i < ($this->cols); $i++) {
           if ($i >= ($this->cols - 1)) {
             $str .= '<td style="height:100%;border:0px;">&nbsp;</td>';
           } else {
@@ -220,7 +220,7 @@ class divSelectBox
       $s_return .= "\n</tr>";
     }
     $s_return .= "\n<tr>";
-    for($i = 0; $i < ($this->cols); $i++) {
+    for ($i = 0; $i < ($this->cols); $i++) {
       if ($i >= ($this->cols - 1)) {
         $s_return .= '<td style="height:100%;border:0px;"><div style="font-size:1px;">&nbsp;</div></td>';
       } else {
diff --git a/include/class_filter.inc b/include/class_filter.inc
index b82e4aab9a9b6785dfc5f64c7e152bd9bb44dc66..2c5c030a9dd30405cc7ac1118127c00ab3e6a560 100644
--- a/include/class_filter.inc
+++ b/include/class_filter.inc
@@ -333,7 +333,7 @@ class filter
     $c          = 0;
 
     /* Fill cells with charaters */
-    for($i = 0, $l = mb_strlen($characters, 'UTF8'); $i < $l; $i++) {
+    for ($i = 0, $l = mb_strlen($characters, 'UTF8'); $i < $l; $i++) {
       if ($c == 0) {
         $alphabet .= "<tr>";
       }
@@ -398,7 +398,7 @@ class filter
     // Load template and replace elementsHtml[]
     foreach ($this->elements as $tag => $element) {
       $htmlCode = "";
-      switch($element['type']) {
+      switch ($element['type']) {
         case "textfield":
           $htmlCode = $this->getTextfield($element);
           $smarty->assign($tag.'DESC', sprintf(_('Searches in %s'), implode(', ', $element['autocomplete']['attribute'])));
@@ -417,7 +417,7 @@ class filter
           break;
 
         default:
-          throw new Exception ('Unknown element type specified: '.$element['type'].'!');
+          throw new Exception('Unknown element type specified: '.$element['type'].'!');
       }
       $smarty->assign("$tag", $htmlCode);
     }
diff --git a/include/class_ldap.inc b/include/class_ldap.inc
index 59ce8ad07c917bcfb2bd2b955399055caee92e80..6adda3f6ba0bff903ec8592f205ef6cfbe3093ba 100644
--- a/include/class_ldap.inc
+++ b/include/class_ldap.inc
@@ -132,11 +132,11 @@ class LDAP
     $this->reconnect  = FALSE;
     if ($this->cid = @ldap_connect($this->hostname)) {
       @ldap_set_option($this->cid, LDAP_OPT_PROTOCOL_VERSION, 3);
-      if (function_exists ("ldap_set_rebind_proc") && $this->follow_referral) {
+      if (function_exists("ldap_set_rebind_proc") && $this->follow_referral) {
         @ldap_set_option($this->cid, LDAP_OPT_REFERRALS, 1);
         @ldap_set_rebind_proc($this->cid, [&$this, "rebind"]);
       }
-      if (function_exists ("ldap_start_tls") && $this->tls) {
+      if (function_exists("ldap_start_tls") && $this->tls) {
         @ldap_start_tls($this->cid);
       }
 
@@ -254,7 +254,7 @@ class LDAP
 
       $start = microtime(TRUE);
       $this->clearResult($srp);
-      switch(strtolower($scope)) {
+      switch (strtolower($scope)) {
         case 'base':
           $this->sr[$srp] = @ldap_read($this->cid, $this->basedn, $filter, $attrs);
           break;
@@ -772,7 +772,7 @@ class LDAP
       $attrs = [$type => $param];
 
       /* Hardcoded classes */
-      switch($type) {
+      switch ($type) {
         case 'ou':
           $attrs['objectClass']  = ['organizationalUnit'];
           break;
@@ -851,7 +851,7 @@ class LDAP
       if (!$this->success()) {
         @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $cdn, 'dn');
         @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $attrs, 'Content');
-        @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->get_error (), 'LDAP error');
+        @DEBUG(DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $this->get_error(), 'LDAP error');
 
         msg_dialog::display(_('LDAP error'), msgPool::ldaperror($this->get_error(), $cdn, LDAP_ADD, get_class()), LDAP_ERROR);
         return FALSE;
@@ -1250,7 +1250,7 @@ class LDAP
       $objectclasses[$ocname] = [];
 
       foreach ($pattern as $chunk) {
-        switch($chunk) {
+        switch ($chunk) {
 
           case '(':
             $value = '';
diff --git a/include/class_ldapFilter.inc b/include/class_ldapFilter.inc
index cb81838ccdca88145685c2e379c3662480b80ec6..8078627d06ba0d5687320fbf2b74652bfc846f57 100644
--- a/include/class_ldapFilter.inc
+++ b/include/class_ldapFilter.inc
@@ -55,7 +55,7 @@ class ldapFilter
   function __invoke ($array)
   {
     $stopValue = FALSE;
-    switch($this->operator) {
+    switch ($this->operator) {
       case '!':
         return !$this->subparts[0]($array);
       case '|':
@@ -180,7 +180,7 @@ class ldapFilterLeaf extends ldapFilter
   function __invoke ($array)
   {
     if ($this->dnFilter) {
-      switch($this->operator) {
+      switch ($this->operator) {
         case '~=':
           trigger_error('Filter apply might not work as expected');
         case '=':
@@ -195,7 +195,7 @@ class ldapFilterLeaf extends ldapFilter
         $values = [$values];
       }
       foreach ($values as $value) {
-        switch($this->operator) {
+        switch ($this->operator) {
           case '~=':
             trigger_error('Filter apply might not work as expected');
           case '=':
diff --git a/include/class_ldapSizeLimit.inc b/include/class_ldapSizeLimit.inc
index 1fe0c8da8aae1d0b67662e1218584dbe87b5fdf5..1b89d5efb6d6c80a3a80c998f9a90e00972a6887 100644
--- a/include/class_ldapSizeLimit.inc
+++ b/include/class_ldapSizeLimit.inc
@@ -68,7 +68,7 @@ class ldapSizeLimit
   function update ()
   {
     if (isset($_POST['set_size_action']) && isset($_POST['action'])) {
-      switch($_POST['action']) {
+      switch ($_POST['action']) {
         case 'newlimit':
           if (isset($_POST['new_limit']) && tests::is_id($_POST['new_limit'])) {
             $this->sizeLimit  = intval($_POST['new_limit']);
diff --git a/include/class_listing.inc b/include/class_listing.inc
index 1aaf7a76eb8cf5d3639439a9b46f4aca9791d6f4..2d856971ee8256f0d68693584b594559ccdc0ccb 100644
--- a/include/class_listing.inc
+++ b/include/class_listing.inc
@@ -693,7 +693,7 @@ class listing
         $classes  = "";
         $components = explode(';', $cfg);
         foreach ($components as $part) {
-          switch($part) {
+          switch ($part) {
             case 'r':
               $res .= 'text-align:right;';
               break;
@@ -804,7 +804,7 @@ class listing
       list($cl, $method, $parts, $offset) = $filter;
       $params = [];
       foreach ($parts as $param) {
-        switch($param) {
+        switch ($param) {
           case 'row':
             $params[] = $row;
             break;
@@ -1117,7 +1117,7 @@ class listing
     $params = [func_get_arg(2)];
 
     // Collect sprintf params
-    for($i = 3;$i < func_num_args();$i++) {
+    for ($i = 3;$i < func_num_args();$i++) {
       $val = func_get_arg($i);
       if (empty($val)) {
         continue;
@@ -1415,7 +1415,7 @@ class listing
       }
 
       // Check for special types
-      switch($action['type']) {
+      switch ($action['type']) {
         case 'copypaste':
           $cut    = !isset($action['cut']) || $action['cut'] != "false";
           $copy   = !isset($action['copy']) || $action['copy'] != "false";
diff --git a/include/class_listingSortIterator.inc b/include/class_listingSortIterator.inc
index fee52d0be67924a53fd3983041eb1a79beab5aea..f011ebaf04f907fb08d828dfd06d1d36bb780ccd 100644
--- a/include/class_listingSortIterator.inc
+++ b/include/class_listingSortIterator.inc
@@ -75,7 +75,7 @@ class listingSortIterator implements Iterator {
           }
 
           // Take a look at the several types
-          switch($type) {
+          switch ($type) {
             // Sort for string by default
             default:
             case 'string':
diff --git a/include/class_msgPool.inc b/include/class_msgPool.inc
index 1edb06f2c3a3e22b9d8c9d6b4d01226d0dab19db..a4ca1009649e76705b68e6b16dd57fbfb16a57ba 100644
--- a/include/class_msgPool.inc
+++ b/include/class_msgPool.inc
@@ -443,7 +443,7 @@ class msgPool {
       $mismatch = "";
 
       mb_internal_encoding('UTF-8');
-      for($i = 0; $i <= mb_strlen($data); $i++) {
+      for ($i = 0; $i <= mb_strlen($data); $i++) {
         $currentChar = mb_substr($data, $i, 1);
         if (preg_match("$regex", $currentChar)) {
           $result .= $currentChar;
diff --git a/include/class_objects.inc b/include/class_objects.inc
index 8ec16c24d2e563968a7178879473d72a8681550a..e00d15fa64621a1681a2d8f1e33f9073c7b14563 100644
--- a/include/class_objects.inc
+++ b/include/class_objects.inc
@@ -129,7 +129,7 @@ class objects
                 (strpos($ui->get_permissions($key, $attrsAcls[$attr][0], $attrsAcls[$attr][1]), 'r') === FALSE)) {
               continue;
             }
-            switch($mode) {
+            switch ($mode) {
               case '*':
                 unset($fetched_attrs[$attr]['count']);
               case 'raw':
diff --git a/include/class_templateHandling.inc b/include/class_templateHandling.inc
index 041a8adca561bdea6987ca4037379a83d1654694..ef058d6740ad1d29338d44e9ee078846170669a0 100644
--- a/include/class_templateHandling.inc
+++ b/include/class_templateHandling.inc
@@ -319,7 +319,7 @@ class templateHandling
     }
     $res = '';
     for ($i = 0; $i < $length; ++$i) {
-      switch($chars) {
+      switch ($chars) {
         case 'd':
           /* digits */
           $res .= (string)random_int(0, 9);
@@ -388,7 +388,7 @@ class templateHandling
       $str = reset($str);
     }
     $result = [$str];
-    switch($m) {
+    switch ($m) {
       case 'F':
         // First
         $result = [reset($str)];
diff --git a/include/class_tests.inc b/include/class_tests.inc
index a943c932568ae119a334d80592962e9ce1c153d9..b239d89ab3c957d6ba247a7583936e7ab5c4a6ae 100644
--- a/include/class_tests.inc
+++ b/include/class_tests.inc
@@ -51,7 +51,7 @@ class tests
       return TRUE;
     }
 
-    return preg_match ("/^[\/0-9 ()+*-]+$/", $nr);
+    return preg_match("/^[\/0-9 ()+*-]+$/", $nr);
   }
 
 
@@ -89,7 +89,7 @@ class tests
     }
 
     /* Using @stephenhay regexp from http://mathiasbynens.be/demo/url-regex (removed ftp through) */
-    return preg_match ("@^(https?)://[^\s/$.?#].[^\s]*$@i", $url);
+    return preg_match("@^(https?)://[^\s/$.?#].[^\s]*$@i", $url);
   }
 
 
@@ -104,7 +104,7 @@ class tests
       return TRUE;
     }
 
-    return preg_match ("/^[a-z0-9 _-]+$/i", $dn);
+    return preg_match("/^[a-z0-9 _-]+$/i", $dn);
   }
 
 
@@ -122,9 +122,9 @@ class tests
     /* STRICT adds spaces and case insenstivity to the uid check.
        This is dangerous and should not be used. */
     if (strict_uid_mode()) {
-      return preg_match ("/^[a-z0-9_-]+$/", $uid);
+      return preg_match("/^[a-z0-9_-]+$/", $uid);
     } else {
-      return preg_match ("/^[a-z0-9 _.-]+$/i", $uid);
+      return preg_match("/^[a-z0-9 _.-]+$/i", $uid);
     }
   }
 
@@ -239,7 +239,7 @@ class tests
       return FALSE;
     }
 
-    return preg_match ("/^[0-9]+$/", $id);
+    return preg_match("/^[0-9]+$/", $id);
   }
 
 
@@ -257,7 +257,7 @@ class tests
       return FALSE;
     }
 
-    return preg_match ("/\/.+$/", $path);
+    return preg_match("/\/.+$/", $path);
   }
 
 
diff --git a/include/class_userinfo.inc b/include/class_userinfo.inc
index e7581b17f4f0f7d885c79e9df662c58fe9276c26..07f579dc18877157acd8e8eb0e3c285b9836c6ac 100644
--- a/include/class_userinfo.inc
+++ b/include/class_userinfo.inc
@@ -835,7 +835,7 @@ class userinfo
           }
           $tmp = $this->get_permissions($dn, $category.'/'.$oc);
           $types = $acl;
-          for($i = 0, $l = strlen($types); $i < $l; $i++) {
+          for ($i = 0, $l = strlen($types); $i < $l; $i++) {
             if (strpos($tmp, $types[$i]) === FALSE) {
               $acl = str_replace($types[$i], '', $acl);
             }
diff --git a/include/class_xml.inc b/include/class_xml.inc
index 1d194c544dcd179dc2255b4e1b7196f8a0e72fc0..459bfecd3168b199a21d80606281eb07e33e8419 100644
--- a/include/class_xml.inc
+++ b/include/class_xml.inc
@@ -44,7 +44,7 @@ class xml {
       return [];
     }
 
-    if (!function_exists ('xml_parser_create')) {
+    if (!function_exists('xml_parser_create')) {
       trigger_error('xml_parser_create function does not exists');
       return [];
     }
diff --git a/include/functions.inc b/include/functions.inc
index 9cbe4ffc4f6ef26999ea3a698930a93635158503..6a0bbab3de9172e186744b58c10dd007bb7d4ab3 100644
--- a/include/functions.inc
+++ b/include/functions.inc
@@ -33,16 +33,16 @@ require_once ('functions_debug.inc');
 require_once('accept-to-gettext.inc');
 
 /* Define constants for debugging */
-define ('DEBUG_TRACE',    1); /*! Debug level for tracing of common actions (save, check, etc.) */
-define ('DEBUG_LDAP',     2); /*! Debug level for LDAP queries */
-define ('DEBUG_DB',       4); /*! Debug level for database operations */
-define ('DEBUG_SHELL',    8); /*! Debug level for shell commands */
-define ('DEBUG_POST',     16); /*! Debug level for POST content */
-define ('DEBUG_SESSION',  32); /*! Debug level for SESSION content */
-define ('DEBUG_CONFIG',   64); /*! Debug level for CONFIG information */
-define ('DEBUG_ACL',      128); /*! Debug level for ACL infos */
-define ('DEBUG_SI',       256); /*! Debug level for communication with Argonaut */
-define ('DEBUG_MAIL',     512); /*! Debug level for all about mail (mailAccounts, imap, sieve etc.) */
+define('DEBUG_TRACE',    1); /*! Debug level for tracing of common actions (save, check, etc.) */
+define('DEBUG_LDAP',     2); /*! Debug level for LDAP queries */
+define('DEBUG_DB',       4); /*! Debug level for database operations */
+define('DEBUG_SHELL',    8); /*! Debug level for shell commands */
+define('DEBUG_POST',     16); /*! Debug level for POST content */
+define('DEBUG_SESSION',  32); /*! Debug level for SESSION content */
+define('DEBUG_CONFIG',   64); /*! Debug level for CONFIG information */
+define('DEBUG_ACL',      128); /*! Debug level for ACL infos */
+define('DEBUG_SI',       256); /*! Debug level for communication with Argonaut */
+define('DEBUG_MAIL',     512); /*! Debug level for all about mail (mailAccounts, imap, sieve etc.) */
 define('DEBUG_FAI',      1024); /* FAI(incomplete) */
 
 /* Define shadow states */
@@ -1184,7 +1184,7 @@ function dn2base ($dn, $ou = NULL)
     $dn = preg_replace("/,$ou/i", ',', $dn);
   }
 
-  return preg_replace ('/^[^,]+,/i', '', $dn);
+  return preg_replace('/^[^,]+,/i', '', $dn);
 }
 
 /*!
@@ -1381,7 +1381,7 @@ function gen_uids ($rule, $attributes)
   $stripped   = $rule;
   $variables  = [];
 
-  for($pos = 0; preg_match('/%([^%]+)%/', $stripped, $m, PREG_OFFSET_CAPTURE, $pos); ) {
+  for ($pos = 0; preg_match('/%([^%]+)%/', $stripped, $m, PREG_OFFSET_CAPTURE, $pos); ) {
     $variables[$pos]  = templateHandling::parseMask($m[1][0], $attributes);
     $replace          = '{'.$pos.'}';
     $stripped         = substr_replace($stripped, $replace, $m[0][1], strlen($m[0][0]));
@@ -1472,7 +1472,7 @@ function to_byte ($value)
 
   if (!is_numeric(substr($value, -1))) {
 
-    switch(substr($value, -1)) {
+    switch (substr($value, -1)) {
       case 'g':
         $mult = 1073741824;
         break;
@@ -1547,7 +1547,7 @@ function generate_alphabet ($count = 10)
   $c          = 0;
 
   /* Fill cells with charaters */
-  for($i = 0, $l = mb_strlen($characters, 'UTF8'); $i < $l; $i++) {
+  for ($i = 0, $l = mb_strlen($characters, 'UTF8'); $i < $l; $i++) {
     if ($c == 0) {
       $alphabet .= "<tr>";
     }
@@ -1800,7 +1800,7 @@ function array_key_ics ($ikey, array $items)
 function array_differs ($src, $dst)
 {
   /* If the count is differing, the arrays differ */
-  if (count ($src) != count ($dst)) {
+  if (count($src) != count($dst)) {
     return TRUE;
   }
 
@@ -2137,7 +2137,7 @@ function send_binary_content ($data, $name, $type = "application/octet-stream")
   header("Content-type: ".$type);
 
   /* Strip name if it is a complete path */
-  if (preg_match ("/\//", $name)) {
+  if (preg_match("/\//", $name)) {
     $name = basename($name);
   }
 
@@ -2316,7 +2316,7 @@ function load_all_classes ()
   }
 }
 
-if (!function_exists ('ldap_escape')) {
+if (!function_exists('ldap_escape')) {
   /* This bloc is for PHP<5.6 */
   define('LDAP_ESCAPE_FILTER', 0x01);
   define('LDAP_ESCAPE_DN',     0x02);
@@ -2336,13 +2336,13 @@ if (!function_exists ('ldap_escape')) {
         $charMaps[0][chr($i)] = sprintf('\\%02x', $i);
       }
 
-      for($i = 0, $l = count($charMaps[LDAP_ESCAPE_FILTER]); $i < $l; $i++) {
+      for ($i = 0, $l = count($charMaps[LDAP_ESCAPE_FILTER]); $i < $l; $i++) {
         $chr = $charMaps[LDAP_ESCAPE_FILTER][$i];
         unset($charMaps[LDAP_ESCAPE_FILTER][$i]);
         $charMaps[LDAP_ESCAPE_FILTER][$chr] = $charMaps[0][$chr];
       }
 
-      for($i = 0, $l = count($charMaps[LDAP_ESCAPE_DN]); $i < $l; $i++) {
+      for ($i = 0, $l = count($charMaps[LDAP_ESCAPE_DN]); $i < $l; $i++) {
         $chr = $charMaps[LDAP_ESCAPE_DN][$i];
         unset($charMaps[LDAP_ESCAPE_DN][$i]);
         $charMaps[LDAP_ESCAPE_DN][$chr] = $charMaps[0][$chr];
@@ -2364,7 +2364,7 @@ if (!function_exists ('ldap_escape')) {
 
     // Remove any chars to ignore from the list
     $ignore = (string)$ignore;
-    for($i = 0, $l = strlen($ignore); $i < $l; $i++) {
+    for ($i = 0, $l = strlen($ignore); $i < $l; $i++) {
       unset($charMap[$ignore[$i]]);
     }
 
@@ -2385,7 +2385,7 @@ if (!function_exists ('ldap_escape')) {
   }
 }
 
-if (!function_exists ('random_int')) {
+if (!function_exists('random_int')) {
   // PHP<7, we fallback on openssl_random_pseudo_bytes
   function random_int ($min, $max)
   {
@@ -2412,7 +2412,7 @@ if (!function_exists ('random_int')) {
       $rnd = hexdec(bin2hex($randomBytes));
       // discard irrelevant bits
       $rnd = $rnd & $filter;
-    } while($rnd > $range);
+    } while ($rnd > $range);
     return $min + $rnd;
   }
 }
diff --git a/include/functions_debug.inc b/include/functions_debug.inc
index 6b834f9454d0005a196011057dc282c6a39353fd..f96bccd4449377f552f686ba21c6b34e0c9d1dbe 100644
--- a/include/functions_debug.inc
+++ b/include/functions_debug.inc
@@ -128,7 +128,7 @@ class printAClass {
       $type = gettype($value);
 
       // change the color and format of the value
-      switch($type) {
+      switch ($type) {
         case 'array':
           break;
 
diff --git a/include/password-methods/class_password-methods-crypt.inc b/include/password-methods/class_password-methods-crypt.inc
index 3ff6a5d13baa7fa5da5016c09b260d1de61dba69..57c3ec5830e6c330deb1afe873c513cc16d9c5c3 100644
--- a/include/password-methods/class_password-methods-crypt.inc
+++ b/include/password-methods/class_password-methods-crypt.inc
@@ -46,7 +46,7 @@ class passwordMethodCrypt extends passwordMethod
    */
   function is_available ()
   {
-    return function_exists ('crypt');
+    return function_exists('crypt');
   }
 
   /*!
diff --git a/include/password-methods/class_password-methods-md5.inc b/include/password-methods/class_password-methods-md5.inc
index b13c00109ebc04daed204b1b95f63602072ac829..96e6375e19d14bbed6508a8ccbd56dd8e4e654a5 100644
--- a/include/password-methods/class_password-methods-md5.inc
+++ b/include/password-methods/class_password-methods-md5.inc
@@ -46,7 +46,7 @@ class passwordMethodMd5 extends passwordMethod
    */
   function is_available ()
   {
-    return function_exists ('md5');
+    return function_exists('md5');
   }
 
   /*!
diff --git a/include/password-methods/class_password-methods-sha.inc b/include/password-methods/class_password-methods-sha.inc
index 30285a1aa463becaba6445eebf29187b5df56c83..e2e13fb60d9adb1c6dfae6691c135d77a31a8ade 100644
--- a/include/password-methods/class_password-methods-sha.inc
+++ b/include/password-methods/class_password-methods-sha.inc
@@ -45,7 +45,7 @@ class passwordMethodsha extends passwordMethod
    */
   function is_available ()
   {
-    return (function_exists ('sha1') || function_exists ('mhash'));
+    return (function_exists('sha1') || function_exists('mhash'));
   }
 
   /*!
@@ -55,9 +55,9 @@ class passwordMethodsha extends passwordMethod
    */
   function generate_hash ($password)
   {
-    if (function_exists ('sha1')) {
+    if (function_exists('sha1')) {
       $hash = '{SHA}' . base64_encode(pack('H*', sha1($password)));
-    } elseif (function_exists ('mhash')) {
+    } elseif (function_exists('mhash')) {
       $hash = '{SHA}' . base64_encode(mHash(MHASH_SHA1, $password));
     } else {
       msg_dialog::display(_('Configuration error'), msgPool::missingext('mhash'), ERROR_DIALOG);
diff --git a/include/password-methods/class_password-methods-smd5.inc b/include/password-methods/class_password-methods-smd5.inc
index d5b0a8cef437b3a1f2f4568ed5ac25282c81a93a..73886bca0cbaea73dd593af74e7e1133e08b3811 100644
--- a/include/password-methods/class_password-methods-smd5.inc
+++ b/include/password-methods/class_password-methods-smd5.inc
@@ -45,7 +45,7 @@ class passwordMethodsmd5 extends passwordMethod
    */
   function is_available ()
   {
-    return function_exists ('md5');
+    return function_exists('md5');
   }
 
   /*!
diff --git a/include/password-methods/class_password-methods-ssha.inc b/include/password-methods/class_password-methods-ssha.inc
index 820efd749a07afaaad78058c8b6be4b920ae3575..705c2378f321470eca282f4e4217a7350a30c7b9 100644
--- a/include/password-methods/class_password-methods-ssha.inc
+++ b/include/password-methods/class_password-methods-ssha.inc
@@ -45,7 +45,7 @@ class passwordMethodssha extends passwordMethod
    */
   function is_available ()
   {
-    return (function_exists ('sha1') || function_exists ('mhash'));
+    return (function_exists('sha1') || function_exists('mhash'));
   }
 
   /*!
@@ -55,12 +55,12 @@ class passwordMethodssha extends passwordMethod
    */
   function generate_hash ($pwd)
   {
-    if (function_exists ('sha1')) {
+    if (function_exists('sha1')) {
       $salt = substr(pack('h*', md5(random_int(0, PHP_INT_MAX))), 0, 8);
       $salt = substr(pack('H*', sha1($salt.$pwd)), 0, 4);
       $pwd  = '{SSHA}'.base64_encode(pack('H*', sha1($pwd.$salt)).$salt);
       return $pwd;
-    } elseif (function_exists ('mhash')) {
+    } elseif (function_exists('mhash')) {
       $salt = mhash_keygen_s2k(MHASH_SHA1, $pwd, substr(pack('h*', md5(random_int(0, PHP_INT_MAX))), 0, 8), 4);
       $pwd  = '{SSHA}'.base64_encode(mhash(MHASH_SHA1, $pwd.$salt).$salt);
     } else {
@@ -75,9 +75,9 @@ class passwordMethodssha extends passwordMethod
     $hash = base64_decode(substr($hash, 6));
     $salt = substr($hash, 20);
     $hash = substr($hash, 0, 20);
-    if (function_exists ('sha1')) {
+    if (function_exists('sha1')) {
       $nhash = pack('H*', sha1($pwd . $salt));
-    } elseif (function_exists ('mhash')) {
+    } elseif (function_exists('mhash')) {
       $nhash = mhash(MHASH_SHA1, $pwd.$salt);
     } else {
       msg_dialog::display(_('Configuration error'), msgPool::missingext('mhash'), ERROR_DIALOG);
diff --git a/include/php_setup.inc b/include/php_setup.inc
index 7c09ab3d2ba3a83c4f3a81eda2a65445f67bf7ff..02f5d05f5501ba90196a590f75805577d233de20 100644
--- a/include/php_setup.inc
+++ b/include/php_setup.inc
@@ -51,7 +51,7 @@ function html_trace ($errstr = "")
     'cred_decrypt'      => [0,1],
     'LDAP/__construct'  => [1],
   ];
-  if (!function_exists ('debug_backtrace')) {
+  if (!function_exists('debug_backtrace')) {
     return  ['', ''];
   }
   $trace = array_slice(debug_backtrace(), 1);
@@ -70,7 +70,7 @@ function html_trace ($errstr = "")
                     '</td></tr>';
   $return_mailto  = rawurlencode('=== Trace ===');
   /* Generate trace history */
-  for($index = 1, $c = count($trace); $index < $c; $index++) {
+  for ($index = 1, $c = count($trace); $index < $c; $index++) {
     $ct   = $trace[$index];
     $loc  = '';
     $func = '';
@@ -87,7 +87,7 @@ function html_trace ($errstr = "")
       $func .= $ct['function'];
     }
     if (isset($ct['type'])) {
-      switch($ct['type']) {
+      switch ($ct['type']) {
         case "::":
           $type = _("static");
           break;
diff --git a/include/simpleplugin/attributes/class_PhoneNumberAttribute.inc b/include/simpleplugin/attributes/class_PhoneNumberAttribute.inc
index 4d725ff85e765e48f7fc66955ac40004fd69e39f..522176c84c96c30bf46df95a352d0ebe7673af37 100644
--- a/include/simpleplugin/attributes/class_PhoneNumberAttribute.inc
+++ b/include/simpleplugin/attributes/class_PhoneNumberAttribute.inc
@@ -77,7 +77,7 @@ class phoneSelectDialog extends GenericDialog
   function __construct ($simplePlugin, $attribute, $type)
   {
     $this->attribute  = $attribute;
-    switch($type) {
+    switch ($type) {
       case 'phone':
         $this->dialog = new phoneSelect();
         break;
diff --git a/include/simpleplugin/class_dialogAttributes.inc b/include/simpleplugin/class_dialogAttributes.inc
index edf64a0a920625207784dbd843f6e77a3896b5db..b305fc146559f13bd5fca92532d62029ad917031 100644
--- a/include/simpleplugin/class_dialogAttributes.inc
+++ b/include/simpleplugin/class_dialogAttributes.inc
@@ -556,7 +556,7 @@ class GroupsAttribute extends GenericDialogAttribute
     if (!in_array($dn, $this->value)) {
       $display = $entry['cn'][0];
       if (isset($entry['description'][0]) && !empty($entry['description'][0])) {
-        $display .= ' ['.preg_replace ('/^Group of user/', _('Group of user'), $entry['description'][0]).']';
+        $display .= ' ['.preg_replace('/^Group of user/', _('Group of user'), $entry['description'][0]).']';
       }
 
       $this->value[]    = $dn;
diff --git a/include/simpleplugin/class_simpleManagement.inc b/include/simpleplugin/class_simpleManagement.inc
index 2d11f86220a703d8dc4b8d27e102ddbe85735cad..98852aeb0a79b4ed35e5e675cbb907af3f40321f 100644
--- a/include/simpleplugin/class_simpleManagement.inc
+++ b/include/simpleplugin/class_simpleManagement.inc
@@ -830,7 +830,7 @@ class simpleManagement
       if (count($msgs)) {
         msg_dialog::displayChecks($msgs);
       } else {
-        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dns, 'Modifications applied!');
+        @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dns, 'Modifications applied!');
         $this->tabObject->re_init();
       }
     }
diff --git a/include/simpleplugin/class_simplePlugin.inc b/include/simpleplugin/class_simplePlugin.inc
index f3cb20b2dd8114e52f661a435017819e97418caf..44a11c05f693b10c20193445985dfed2d0fcf285 100644
--- a/include/simpleplugin/class_simplePlugin.inc
+++ b/include/simpleplugin/class_simplePlugin.inc
@@ -242,7 +242,7 @@ class simplePlugin
 
       /* Set the template flag according to the existence of objectClass fdTemplate */
       if (isset($this->attrs['objectClass'])) {
-        if (in_array_ics ('fdTemplate', $this->attrs['objectClass'])) {
+        if (in_array_ics('fdTemplate', $this->attrs['objectClass'])) {
           @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, 'found', 'Template check');
           $this->setTemplate(TRUE);
           $this->templateLoadAttrs($this->attrs);
@@ -325,7 +325,7 @@ class simplePlugin
       if (preg_match('/^top$/i', $obj)) {
         continue;
       }
-      if (!isset($attrs['objectClass']) || !in_array_ics ($obj, $attrs['objectClass'])) {
+      if (!isset($attrs['objectClass']) || !in_array_ics($obj, $attrs['objectClass'])) {
         $found = FALSE;
         break;
       }
@@ -1369,7 +1369,7 @@ class simplePlugin
    */
   protected function handle_hooks ($when, $mode, array $addAttrs = [])
   {
-    switch($mode) {
+    switch ($mode) {
       case 'add':
         return $this->callHook($when.'CREATE', $addAttrs);
 
@@ -1837,7 +1837,7 @@ class simplePlugin
         $usableAttributes[] = (string)$attr;
       }
     }
-    for($i = 1; $i < count($usableAttributes); $i++) {
+    for ($i = 1; $i < count($usableAttributes); $i++) {
       foreach (new Combinations($usableAttributes, $i) as $attrs) {
         $dn = $attribute.'='.ldap_escape_dn($this->$attribute);
         foreach ($attrs as $attr) {
diff --git a/plugins/admin/acl/class_aclManagement.inc b/plugins/admin/acl/class_aclManagement.inc
index 00c725dc5bd3e7f31c3e84fde787b40b86778620..67337af0bbd90ce997a29db8d5e617439028d938 100644
--- a/plugins/admin/acl/class_aclManagement.inc
+++ b/plugins/admin/acl/class_aclManagement.inc
@@ -207,7 +207,7 @@ class aclManagement extends simpleManagement
     if ($dn == $base) {
       $ou = ' . ';
     } else {
-      for($i = 4;$i < func_num_args();$i++) {
+      for ($i = 4;$i < func_num_args();$i++) {
         $val = func_get_arg($i);
         if (empty($val)) {
           continue;
diff --git a/plugins/admin/groups/class_groupManagement.inc b/plugins/admin/groups/class_groupManagement.inc
index ef9c1dede15138189155a67a17df9cb356722b48..7e5fd118918c3c604c1342fb8aa2f9a37ffd9c50 100644
--- a/plugins/admin/groups/class_groupManagement.inc
+++ b/plugins/admin/groups/class_groupManagement.inc
@@ -286,7 +286,7 @@ class groupManagement extends simpleManagement
                        'alt="'.$infos['plTitle'].'" title="'.$infos['plTitle'].'" '.
                        'name="listing_edit_tab_'.$class.'_'.$row.'" style="padding:1px"/>';
           } else {
-            @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $infos['plShortName']." ($class)", 'No icon for');
+            @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $infos['plShortName']." ($class)", 'No icon for');
           }
         } else {
           $result .= '<img src="images/empty.png" alt=" " class="center optional '.$class.'" style="padding:1px"/>';
@@ -301,7 +301,7 @@ class groupManagement extends simpleManagement
   {
     $types  = preg_replace('/[^a-z]/i', '', $gosaGroupObjects[0]);
     $result = '';
-    for($i = 0; $i < strlen($types); $i++) {
+    for ($i = 0; $i < strlen($types); $i++) {
       if ($types[$i] == 'I') {
         continue;
       }
diff --git a/plugins/admin/groups/class_ogroup.inc b/plugins/admin/groups/class_ogroup.inc
index 3fa4fffe2dabaea1db5cddbdf991a2b36aeda48d..439aaab2d72dc4541aadc8e9200afa78eff4b1c4 100644
--- a/plugins/admin/groups/class_ogroup.inc
+++ b/plugins/admin/groups/class_ogroup.inc
@@ -52,7 +52,7 @@ class ObjectsAttribute extends GenericDialogAttribute
             break;
           }
         } catch (NonExistingObjectTypeException $e) {
-          @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $e->getMessage(), "Objecttype");
+          @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $e->getMessage(), "Objecttype");
           unset(ogroup::$objectTypes[$code]);
         }
       }
diff --git a/plugins/admin/groups/tabs_ogroups.inc b/plugins/admin/groups/tabs_ogroups.inc
index 0a827898eaac2d7512b2ba031d24608d41721cda..662e60055e983996e4bd5cb58ceadc69e6102f5d 100644
--- a/plugins/admin/groups/tabs_ogroups.inc
+++ b/plugins/admin/groups/tabs_ogroups.inc
@@ -47,7 +47,7 @@ class ogrouptabs extends simpleTabs_noSpecial
         $dtabs  = [];
       }
       $tabs   = FALSE;
-      for($i = 0; $i < strlen($objects); $i++) {
+      for ($i = 0; $i < strlen($objects); $i++) {
         if (in_array($objects[$i], ['I','G'])) {
           /* Ignore unknown objects and groups */
           continue;
diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc
index 922cc71c1d3df5b29107c3030ba8715852ac1894..0c5956a5d2d00d1f3f9b8a87e703e839852eafa4 100644
--- a/plugins/admin/users/class_userManagement.inc
+++ b/plugins/admin/users/class_userManagement.inc
@@ -255,7 +255,7 @@ class userManagement extends simpleManagement
                        'alt="'._('User account').'" title="'._('User account information').'" '.
                        'name="listing_edit_tab_user_'.$row.'"/>';
     if (!empty($attrs)) {
-      if (in_array_ics ('fdTemplate', $attrs['objectClass'])) {
+      if (in_array_ics('fdTemplate', $attrs['objectClass'])) {
         $attrs = templateHandling::fieldsFromLDAP($attrs);
       }
       foreach ($usertabs as $class => $usertab) {
@@ -266,7 +266,7 @@ class userManagement extends simpleManagement
                        'alt="'.$infos['plShortName'].'" title="'.$infos['plShortName'].'" '.
                        'name="listing_edit_tab_'.$class.'_'.$row.'"/>';
           } else {
-            @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $infos['plShortName']." ($class)", "No icon for");
+            @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $infos['plShortName']." ($class)", "No icon for");
           }
         } else {
           $result .= '<img src="images/empty.png" alt="" class="center optional '.$class.'"/>';
diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc
index c7a920df336283f20866713e6f30b351764d1244..c35aafa2a20144cfc19477fe85c314a330ebf77c 100644
--- a/plugins/personal/generic/class_user.inc
+++ b/plugins/personal/generic/class_user.inc
@@ -169,7 +169,7 @@ class UserPasswordAttribute extends CompositeAttribute
     if ($this->plugin->is_template) {
       list($value, $password) = explode('|', $value, 2);
     }
-    if (preg_match ('/^{[^}]+}/', $value)) {
+    if (preg_match('/^{[^}]+}/', $value)) {
       $tmp = passwordMethod::get_method($value);
       if (is_object($tmp)) {
         $pw_storage = $tmp->get_hash();
@@ -616,7 +616,7 @@ class user extends simplePlugin
     parent::adapt_from_template($attrs, $skip);
     if (isset($this->attrs['userPassword']) && !in_array('userPassword', $skip)) {
       list($hash,$password) = explode('|', $this->attrs['userPassword'][0], 2);
-      if (preg_match ('/^{[^}]+}/', $hash)) {
+      if (preg_match('/^{[^}]+}/', $hash)) {
         $tmp = passwordMethod::get_method($hash);
         if (is_object($tmp)) {
           $hash = $tmp->generate_hash($password);