From 5dc2c162365dbd4c7cb3514e68de1d369cae7a37 Mon Sep 17 00:00:00 2001 From: "cam.lafit" Date: Thu, 14 Nov 2024 10:59:33 +0100 Subject: [PATCH] [enh] Apply PER CS 2.0 * Some fix to follow PER CS 2.0 coding rules * More information at https://www.php-fig.org/per/coding-style/ --- src/usr/share/alternc/panel/class/m_nss.php | 39 ++++++++++----------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/usr/share/alternc/panel/class/m_nss.php b/src/usr/share/alternc/panel/class/m_nss.php index 1bee081..60a6429 100644 --- a/src/usr/share/alternc/panel/class/m_nss.php +++ b/src/usr/share/alternc/panel/class/m_nss.php @@ -32,9 +32,9 @@ protected function define_group_file() { global $db; $db->query("SELECT login,uid FROM `membres`"); - $lines=array(); + $lines = []; while ($db->next_record()) { - $lines[] = $db->f('login').":x:".$db->f('uid').":"; + $lines[] = $db->f('login') . ":x:" . $db->f('uid') . ":"; } $this->group_file = implode("\n", $lines); @@ -44,9 +44,9 @@ protected function define_passwd_file() { global $db; $db->query("SELECT login,uid FROM `membres`"); - $lines=array(); + $lines = []; while ($db->next_record()) { - $lines[] = $db->f('login').":x:".$db->f('uid').":".$db->f('uid')."::".getuserpath($db->f('login')).":/bin/false"; + $lines[] = $db->f('login') . ":x:" . $db->f('uid') . ":" . $db->f('uid') . "::" . getuserpath($db->f('login')) . ":/bin/false"; } $this->passwd_file = implode("\n", $lines); @@ -56,19 +56,19 @@ protected function define_shadow_file() { global $db; $db->query("SELECT login FROM `membres`"); - $lines=array(); + $lines = []; while ($db->next_record()) { - // shadow fields (9) : - // 1. login - // 2. encrypted password or * to prevent login - // 3. date of last password change or '' meaning that password aging features are disabled - // 4. minimum password age or '' or 0 meaning no minimum age - // 5. maximum password age or '' meaning no maximum password age, no password warning period, and no password inactivity period - // 6. password warning period or '' or 0 meaning there are no password warning period - // 7. password inactivity period or '' for no enforcement - // 8. account expiration date or '' for no expiration - // 9. reserved - $fields = array($db->f('login'), '*', '', '', '', '', '', '', ''); + // shadow fields (9) : + // 1. login + // 2. encrypted password or * to prevent login + // 3. date of last password change or '' meaning that password aging features are disabled + // 4. minimum password age or '' or 0 meaning no minimum age + // 5. maximum password age or '' meaning no maximum password age, no password warning period, and no password inactivity period + // 6. password warning period or '' or 0 meaning there are no password warning period + // 7. password inactivity period or '' for no enforcement + // 8. account expiration date or '' for no expiration + // 9. reserved + $fields = [$db->f('login'), '*', '', '', '', '', '', '', '']; $lines[] = implode(':', $fields); } @@ -88,21 +88,21 @@ protected function update_group_file() { $file = "/var/lib/extrausers/group"; $content = $this->group_file; - return file_put_contents($file, $content."\n", LOCK_EX); + return file_put_contents($file, $content . "\n", LOCK_EX); } protected function update_passwd_file() { $file = "/var/lib/extrausers/passwd"; $content = $this->passwd_file; - return file_put_contents($file, $content."\n", LOCK_EX); + return file_put_contents($file, $content . "\n", LOCK_EX); } protected function update_shadow_file() { $file = "/var/lib/extrausers/shadow"; $content = $this->shadow_file; - return file_put_contents($file, $content."\n", LOCK_EX); + return file_put_contents($file, $content . "\n", LOCK_EX); } protected function hook_alternc_add_member() @@ -111,4 +111,3 @@ protected function hook_alternc_add_member() return true; } } -