Skip to content

Commit 364432d

Browse files
committed
Cleaned up and formatted code - some adjustments to selected files
The following adjustments were made: - Formate source code - Permissions revised - Sections of code should not be commented out (PHP:S125) - Mergeable "if" statements should be combined (PHP:S1066) - Unused local variables should be removed (PHP:S1481) - Local variables should not be declared and then immediately returned or thrown (PHP:1488) - Identical expressions should not be used on both sides of a binary operator (PHP:S1764) - Attributes deprecated in HTML5 should not be used (PHP:S1827) - Unused assignments should be removed (PHP:S1854) - "default" clauses should be first or last (PHP:4524)
1 parent dccc884 commit 364432d

52 files changed

Lines changed: 455 additions & 518 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

install/installNewDB.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,21 +162,21 @@
162162
</head>
163163

164164
<body>
165-
<table border="0" cellpadding="0" cellspacing="0" class="mainTable">
165+
<table border="0" class="mainTable">
166166
<tr class="fancyRow">
167167
<td><span class="headers">&nbsp;<img src="./img/dot.gif" alt="" style="margin-top: 1px;" />&nbsp;<?php
168168

169-
echo $tl_and_version?></span></td>
170-
<td align="right"><span class="headers"><?php
169+
echo $tl_and_version?></span></td>
170+
<td><span class="headers"><?php
171171

172-
echo $the_title?> </span></td>
172+
echo $the_title?> </span></td>
173173
</tr>
174174
<tr class="fancyRow2">
175-
<td colspan="2" class="border-top-bottom smallText" align="right">&nbsp;</td>
175+
<td colspan="2" class="border-top-bottom smallText" >&nbsp;</td>
176176
</tr>
177-
<tr align="left" valign="top">
178-
<td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="1">
179-
<tr align="left" valign="top">
177+
<tr >
178+
<td colspan="2"><table border="0" >
179+
<tr>
180180
<td class="pad" id="content" colspan="2">
181181

182182
<?php
@@ -600,8 +600,8 @@ function write_config_db($filename, $data)
600600

601601
// write config.inc.php
602602
$configString = "<?php" . "\n" .
603-
"// Automatically Generated by TestLink Installer - " . date(
604-
DATE_RFC822) . "\n";
603+
"// Automatically Generated by TestLink Installer - " .
604+
date(DATE_RFC822) . "\n";
605605
$configString .= "define('DB_TYPE', '" . $db_type . "');\n";
606606
$configString .= "define('DB_USER', '" . $db_login . "');\n";
607607
$configString .= "define('DB_PASS', '" . $db_passwd . "');\n";

lib/api/rest/v3/RestApi.class.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232

3333
use Psr\Http\Message\ServerRequestInterface as Request;
3434
use Psr\Http\Server\RequestHandlerInterface as RequestHandler;
35-
36-
use Psr\Http\Message\ResponseInterface;
3735
use Slim\Psr7\Response;
3836

3937
/**

lib/api/xmlrpc/v1/sample_clients/php/clientCreateTestProjectWithITS.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
$debug = true;
4040
$client = new IXR_Client($server_url);
4141
$client->debug = $debug;
42-
// runTest($client,$method,$args);
4342

4443
$test_num ++;
4544
$unitTestDescription = "Test {$test_num} - {$method}() ::: ";

lib/api/xmlrpc/v1/test/TestlinkXMLRPCServerTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,6 @@ private function testGetLastTestResult()
497497
$this->client->getErrorCode() . $this->client->getErrorMessage();
498498
}
499499

500-
$response = $this->client->getResponse();
501-
502500
// Now Building our get last test result
503501
$data = array();
504502
$data["devKey"] = TestlinkXMLRPCServerTestData::testDevKey;

lib/codetrackerintegration/codeTrackerInterface.class.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@ public function __construct($type, $config, $name)
8181

8282
/**
8383
*/
84-
private function getCfg()
84+
public function getCfg()
8585
{
8686
return $this->cfg;
8787
}
8888

8989
/**
9090
*/
91-
private function setCfg($xmlString)
91+
public function setCfg($xmlString)
9292
{
9393
$msg = null;
9494
$signature = 'Source:' . __METHOD__;
@@ -156,7 +156,7 @@ public function getMyInterface()
156156
* db could be selected, false else
157157
*
158158
*/
159-
private function connect()
159+
public function connect()
160160
{
161161
if (is_null($this->cfg->dbhost) || is_null($this->cfg->dbuser)) {
162162
return false;
@@ -215,7 +215,7 @@ public function isConnected()
215215
/**
216216
* Closes the db connection (if any)
217217
*/
218-
private function disconnect()
218+
public function disconnect()
219219
{
220220
if ($this->isConnected() && $this->interfaceViaDB) {
221221
$this->dbConnection->close();

lib/execute/execExport.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,7 @@ function contextAsXML(&$dbHandler, $contextSet, &$tplanMgr)
180180
$mm = array(
181181
$contextInfo
182182
);
183-
return exportDataToXML($mm, $xml_root, $xml_template, $xml_mapping,
184-
('noXMLHeader' == 'noXMLHeader'));
183+
return exportDataToXML($mm, $xml_root, $xml_template, $xml_mapping, true);
185184
}
186185

187186
/**

lib/functions/ckeditor.class.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public function Create()
4040
*/
4141
public function CreateHtml($config = [])
4242
{
43-
$html = $this->Editor->editor($this->InstanceName, $this->Value, $config);
44-
return $html;
43+
return $this->Editor->editor($this->InstanceName, $this->Value, $config);
4544
}
4645
}

lib/functions/date_api.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,5 @@ function locateDateToISO($localeDateString, $dateFormat)
289289
}
290290

291291
$pieces = explode($sepa, $localeDateString);
292-
$iso = $pieces[$y] . $pieces[$m] . $pieces[$d];
293-
return $iso;
292+
return $pieces[$y] . $pieces[$m] . $pieces[$d];
294293
}

lib/functions/files.inc.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
*/
2222
function getUniqueFileName($fExt)
2323
{
24-
$destFName = md5(uniqid(rand(), true)) . "." . $fExt;
25-
26-
return $destFName;
24+
return md5(uniqid(rand(), true)) . "." . $fExt;
2725
}
2826

2927
/**

lib/functions/no_editor.class.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,9 @@ public function CreateHtml($rows = null, $cols = null)
4444
$my_cols = $this->cols;
4545
}
4646

47-
$html = ' <textarea style="resize:both;" ' .
47+
return ' <textarea style="resize:both;" ' .
4848
" name=\"{$this->InstanceName}\" " .
4949
" id=\"{$this->InstanceName}\" rows=\"{$my_rows}\" cols=\"{$my_cols}\" >" .
5050
"{$htmlValue}</textarea>";
51-
52-
return $html;
5351
}
5452
}

0 commit comments

Comments
 (0)