From b6425b9abd1ba820425bb068b71a4f5b7bc9c0c8 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Fri, 13 Mar 2020 20:59:30 +0100 Subject: [PATCH] refactoring --- lam/lib/lists.inc | 1 - lam/lib/modules/inetOrgPerson.inc | 1 - lam/lib/modules/ldapPublicKey.inc | 4 +--- lam/lib/modules/posixAccount.inc | 4 +--- lam/lib/modules/posixGroup.inc | 1 - lam/lib/webauthn.inc | 2 +- lam/templates/config/confmain.php | 3 +-- 7 files changed, 4 insertions(+), 12 deletions(-) diff --git a/lam/lib/lists.inc b/lam/lib/lists.inc index 91ff1b8f..7ad71fc6 100644 --- a/lam/lib/lists.inc +++ b/lam/lib/lists.inc @@ -405,7 +405,6 @@ class lamList { $table->setCSSClasses(array($scope . '-border accountlist')); $table->setOnClickEvents($onClickEvents); $table->setOnDoubleClickEvents($onDoubleClickEvents); - $columnCount = sizeof($titles); parseHtml(null, $table, array(), false, $this->tabindex, $scope); } diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc index 82867d62..cb5aaf09 100644 --- a/lam/lib/modules/inetOrgPerson.inc +++ b/lam/lib/modules/inetOrgPerson.inc @@ -1658,7 +1658,6 @@ class inetOrgPerson extends baseModule implements passwordService { $messages = array(); if ($_FILES['photoFile'] && ($_FILES['photoFile']['size'] > 0)) { $name = $_FILES['photoFile']['name']; - $extension = strtolower(substr($name, strpos($name, '.') + 1)); $handle = fopen($_FILES['photoFile']['tmp_name'], "r"); $data = fread($handle, 100000000); if (!empty($this->moduleSettings['inetOrgPerson_jpegPhoto_maxSize'][0]) && (strlen($data) > (1024 * $this->moduleSettings['inetOrgPerson_jpegPhoto_maxSize'][0]))) { diff --git a/lam/lib/modules/ldapPublicKey.inc b/lam/lib/modules/ldapPublicKey.inc index 04bd364a..9b23c51e 100644 --- a/lam/lib/modules/ldapPublicKey.inc +++ b/lam/lib/modules/ldapPublicKey.inc @@ -5,7 +5,7 @@ use \LAM\PDF\PDFTableRow; /* This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) - Copyright (C) 2005 - 2019 Roland Gruber + Copyright (C) 2005 - 2020 Roland Gruber This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -571,8 +571,6 @@ class ldapPublicKey extends baseModule { * Handles an AJAX file upload and prints the JSON result. */ private function ajaxUpload() { - $x = $_GET; - $y = $_FILES; $result = array('success' => true); if (!isset($_FILES['qqfile']) || ($_FILES['qqfile']['size'] < 10)) { $result = array('error' => _('No file received.')); diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc index b77b0a68..6e6bdd61 100644 --- a/lam/lib/modules/posixAccount.inc +++ b/lam/lib/modules/posixAccount.inc @@ -483,7 +483,6 @@ class posixAccount extends baseModule implements passwordService { function init($base) { // make optional if needed $modules = $_SESSION[$base]->get_type()->getModules(); - $typeId = $_SESSION[$base]->get_type()->getId(); $this->autoAddObjectClasses = !$this->isOptional($modules) && !$this->skipObjectClass(); // call parent init parent::init($base); @@ -2029,7 +2028,6 @@ class posixAccount extends baseModule implements passwordService { // profile mappings in meta data parent::load_profile($profile); $modules = $this->getAccountContainer()->get_type()->getModules(); - $typeId = $this->getAccountContainer()->get_type()->getId(); // cn if ($this->manageCn($modules) && !empty($profile['posixAccount_cn'][0])) { $this->attributes['cn'][0] = $profile['posixAccount_cn'][0]; @@ -2469,7 +2467,7 @@ class posixAccount extends baseModule implements passwordService { if (self::areGroupOfNamesActive()) { $gons = $this->findGroupOfNames(); $gonList = array(); - foreach ($gons as $dn => $attr) { + foreach ($gons as $attr) { $gonList[] = $attr['cn'][0]; } } diff --git a/lam/lib/modules/posixGroup.inc b/lam/lib/modules/posixGroup.inc index d9bc882a..64e4483a 100644 --- a/lam/lib/modules/posixGroup.inc +++ b/lam/lib/modules/posixGroup.inc @@ -1076,7 +1076,6 @@ class posixGroup extends baseModule implements passwordService { return array(); } // auto sync group members - $typeId = $this->getAccountContainer()->get_type()->getId(); if ($this->isBooleanConfigOptionSet('posixGroup_autoSyncGon')) { $this->syncGon(); } diff --git a/lam/lib/webauthn.inc b/lam/lib/webauthn.inc index bcf1e097..8ce4a5c7 100644 --- a/lam/lib/webauthn.inc +++ b/lam/lib/webauthn.inc @@ -592,7 +592,7 @@ class PublicKeyCredentialSourceRepositorySQLite implements PublicKeyCredentialSo logNewMessage(LOG_NOTICE, 'Delete webauthn device ' . $credentialId . ' of ' . $dn); $pdo = $this->getPDO(); $statement = $pdo->prepare('delete from ' . self::TABLE_NAME . ' where userId = :userId and credentialId = :credentialId'); - $result = $statement->execute(array( + $statement->execute(array( ':userId' => $dn, ':credentialId' => $credentialId )); diff --git a/lam/templates/config/confmain.php b/lam/templates/config/confmain.php index b80d5296..efe087b6 100644 --- a/lam/templates/config/confmain.php +++ b/lam/templates/config/confmain.php @@ -22,7 +22,7 @@ use \htmlGroup; /* This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) - Copyright (C) 2003 - 2019 Roland Gruber + Copyright (C) 2003 - 2020 Roland Gruber This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -556,7 +556,6 @@ parseHtml(null, $buttonContainer, array(), false, $tabindex, 'user'); */ function checkInput() { $conf = &$_SESSION['conf_config']; - $types = $conf->get_ActiveTypes(); // check new preferences $errors = array();