removed unused local variables

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2018-03-03 21:26:37 +01:00
parent 0d7afc5c24
commit f30887e3c0
7 changed files with 15 additions and 25 deletions

View File

@@ -103,7 +103,6 @@ class Admins extends ApiCommand implements ResourceEntity
$custom_notes = $this->getParam('custom_notes', true, ''); $custom_notes = $this->getParam('custom_notes', true, '');
$custom_notes_show = $this->getParam('custom_notes_show', true, 0); $custom_notes_show = $this->getParam('custom_notes_show', true, 0);
$password = $this->getParam('admin_password', true, ''); $password = $this->getParam('admin_password', true, '');
$sendpassword = $this->getParam('sendpassword', true, 0);
$loginname = $this->getParam('new_loginname', true, ''); $loginname = $this->getParam('new_loginname', true, '');
$diskspace = $this->getUlParam('diskspace', 'diskspace_ul', true, 0); $diskspace = $this->getUlParam('diskspace', 'diskspace_ul', true, 0);

View File

@@ -710,7 +710,6 @@ class Customers extends ApiCommand implements ResourceEntity
$mysqls = $this->getUlParam('mysqls', 'mysqls_ul', true, $result['mysqls']); $mysqls = $this->getUlParam('mysqls', 'mysqls_ul', true, $result['mysqls']);
$createstdsubdomain = $this->getParam('createstdsubdomain', true, 0); $createstdsubdomain = $this->getParam('createstdsubdomain', true, 0);
$password = $this->getParam('new_customer_password', true, ''); $password = $this->getParam('new_customer_password', true, '');
$sendpassword = $this->getParam('sendpassword', true, 0);
$phpenabled = $this->getParam('phpenabled', true, $result['phpenabled']); $phpenabled = $this->getParam('phpenabled', true, $result['phpenabled']);
$allowed_phpconfigs = $this->getParam('allowed_phpconfigs', true, json_decode($result['allowed_phpconfigs'], true)); $allowed_phpconfigs = $this->getParam('allowed_phpconfigs', true, json_decode($result['allowed_phpconfigs'], true));
$perlenabled = $this->getParam('perlenabled', true, $result['perlenabled']); $perlenabled = $this->getParam('perlenabled', true, $result['perlenabled']);
@@ -1396,7 +1395,7 @@ class Customers extends ApiCommand implements ResourceEntity
if ($tickets !== false && isset($tickets[0])) { if ($tickets !== false && isset($tickets[0])) {
foreach ($tickets as $ticket) { foreach ($tickets as $ticket) {
$now = time(); $now = time();
$mainticket = ticket::getInstanceOf($userinfo, (int) $ticket); $mainticket = ticket::getInstanceOf($result, (int) $ticket);
$mainticket->Set('lastchange', $now, true, true); $mainticket->Set('lastchange', $now, true, true);
$mainticket->Set('lastreplier', '1', true, true); $mainticket->Set('lastreplier', '1', true, true);
$mainticket->Set('status', '3', true, true); $mainticket->Set('status', '3', true, true);

View File

@@ -786,7 +786,6 @@ class Domains extends ApiCommand implements ResourceEntity
$id = $result['id']; $id = $result['id'];
// optional parameters // optional parameters
$p_domain = $this->getParam('domain', true, $result['domain']);
$p_ipandports = $this->getParam('ipandport', true, array()); $p_ipandports = $this->getParam('ipandport', true, array());
$customerid = intval($this->getParam('customerid', true, $result['customerid'])); $customerid = intval($this->getParam('customerid', true, $result['customerid']));
$adminid = intval($this->getParam('adminid', true, $result['adminid'])); $adminid = intval($this->getParam('adminid', true, $result['adminid']));
@@ -1081,15 +1080,12 @@ class Domains extends ApiCommand implements ResourceEntity
Database::pexecute($ipsresult_stmt, array( Database::pexecute($ipsresult_stmt, array(
'id' => $result['id'] 'id' => $result['id']
)); ));
$usedips = array();
while ($ipsresultrow = $ipsresult_stmt->fetch(PDO::FETCH_ASSOC)) { while ($ipsresultrow = $ipsresult_stmt->fetch(PDO::FETCH_ASSOC)) {
$ipandports[] = $ipsresultrow['id_ipandports']; $ipandports[] = $ipsresultrow['id_ipandports'];
} }
} }
if (Settings::Get('system.use_ssl') == '1' && ! empty($p_ssl_ipandports)) { if (Settings::Get('system.use_ssl') == '1' && ! empty($p_ssl_ipandports)) {
$ssl = 1; // if ssl is set and != 0, it can only be 1
$ssl_ipandports = array(); $ssl_ipandports = array();
if (! empty($p_ssl_ipandports) && ! is_array($p_ssl_ipandports)) { if (! empty($p_ssl_ipandports) && ! is_array($p_ssl_ipandports)) {
$p_ssl_ipandports = unserialize($p_ssl_ipandports); $p_ssl_ipandports = unserialize($p_ssl_ipandports);

View File

@@ -63,7 +63,7 @@ class Froxlor extends ApiCommand
// anzeige über version-status mit ggfls. formular // anzeige über version-status mit ggfls. formular
// zum update schritt #1 -> download // zum update schritt #1 -> download
if ($isnewerversion == 1) { if ($isnewerversion == 1) {
$text = 'There is a newer version available: "' . $_version . '" (Your current version is: ' . $this->version . ')'; $text = 'There is a newer version available: "' . $_version . '" (Your current version is: ' . $version_label . ')';
return $this->response(200, "successfull", array( return $this->response(200, "successfull", array(
'message' => $text, 'message' => $text,
'link' => $version_link, 'link' => $version_link,
@@ -217,7 +217,7 @@ class Froxlor extends ApiCommand
// create RecursiveIteratorIterator // create RecursiveIteratorIterator
$its = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path)); $its = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path));
// check every file // check every file
foreach ($its as $fullFileName => $it) { foreach ($its as $it) {
// does it match the Filename pattern? // does it match the Filename pattern?
$matches = array(); $matches = array();
if (preg_match("/^class\.(.+)\.php$/i", $it->getFilename(), $matches)) { if (preg_match("/^class\.(.+)\.php$/i", $it->getFilename(), $matches)) {

View File

@@ -117,7 +117,7 @@ class Ftps extends ApiCommand implements ResourceEntity
), true, true); ), true, true);
if ($ftpdomain_check && $ftpdomain_check['domain'] != $ftpdomain) { if ($ftpdomain_check && $ftpdomain_check['domain'] != $ftpdomain) {
standard_error('maindomainnonexist', $domain, true); standard_error('maindomainnonexist', $ftpdomain, true);
} }
$username = $ftpusername . "@" . $ftpdomain; $username = $ftpusername . "@" . $ftpdomain;
} else { } else {
@@ -152,7 +152,6 @@ class Ftps extends ApiCommand implements ResourceEntity
"shell" => $shell "shell" => $shell
); );
Database::pexecute($stmt, $params, true, true); Database::pexecute($stmt, $params, true, true);
$ftp_userid = Database::lastInsertId();
$result_stmt = Database::prepare(" $result_stmt = Database::prepare("
SELECT `bytes_in_used` FROM `" . TABLE_FTP_QUOTATALLIES . "` WHERE `name` = :name SELECT `bytes_in_used` FROM `" . TABLE_FTP_QUOTATALLIES . "` WHERE `name` = :name
@@ -361,7 +360,6 @@ class Ftps extends ApiCommand implements ResourceEntity
$shell = "/bin/false"; $shell = "/bin/false";
} }
$params = array();
// get needed customer info to reduce the ftp-user-counter by one // get needed customer info to reduce the ftp-user-counter by one
if ($this->isAdmin()) { if ($this->isAdmin()) {
// get customer id // get customer id
@@ -461,7 +459,7 @@ class Ftps extends ApiCommand implements ResourceEntity
$customerid = $this->getParam('customerid', true, 0); $customerid = $this->getParam('customerid', true, 0);
$loginname = $this->getParam('loginname', true, ''); $loginname = $this->getParam('loginname', true, '');
if (! empty($customer_id) || ! empty($loginname)) { if (! empty($customerid) || ! empty($loginname)) {
$json_result = Customers::getLocal($this->getUserData(), array( $json_result = Customers::getLocal($this->getUserData(), array(
'id' => $customerid, 'id' => $customerid,
'loginname' => $loginname 'loginname' => $loginname

View File

@@ -39,8 +39,6 @@ class PhpSettings extends ApiCommand implements ResourceEntity
$phpconfigs = array(); $phpconfigs = array();
while ($row = $result->fetch(PDO::FETCH_ASSOC)) { while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$domainresult = false;
$query_params = array( $query_params = array(
'id' => $row['id'] 'id' => $row['id']
); );

View File

@@ -8,6 +8,7 @@ use PHPUnit\Framework\TestCase;
*/ */
class DomainsTest extends TestCase class DomainsTest extends TestCase
{ {
public function testAdminDomainsAdd() public function testAdminDomainsAdd()
{ {
global $admin_userdata; global $admin_userdata;
@@ -22,7 +23,7 @@ class DomainsTest extends TestCase
]; ];
$json_result = Domains::getLocal($admin_userdata, $data)->add(); $json_result = Domains::getLocal($admin_userdata, $data)->add();
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
$this->assertEquals($customer_userdata['documentroot'].'test.local/', $result['documentroot']); $this->assertEquals($customer_userdata['documentroot'] . 'test.local/', $result['documentroot']);
} }
/** /**
@@ -184,10 +185,10 @@ class DomainsTest extends TestCase
'domainname' => 'test.local', 'domainname' => 'test.local',
'customerid' => $customer_userdata['customerid'] 'customerid' => $customer_userdata['customerid']
]; ];
$json_result =Domains::getLocal($admin_userdata, $data)->update(); $json_result = Domains::getLocal($admin_userdata, $data)->update();
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
$this->assertEquals($customer_userdata['customerid'], $result['customerid']); $this->assertEquals($customer_userdata['customerid'], $result['customerid']);
$this->assertEquals($customer_userdata['documentroot'].'test.local/', $result['documentroot']); $this->assertEquals($customer_userdata['documentroot'] . 'test.local/', $result['documentroot']);
} }
/** /**
@@ -209,5 +210,4 @@ class DomainsTest extends TestCase
'loginname' => 'test3' 'loginname' => 'test3'
))->delete(); ))->delete();
} }
} }