Skip to content

Commit be917c6

Browse files
committed
corrections coderabbigtai 1
1 parent 647babf commit be917c6

34 files changed

Lines changed: 102 additions & 103 deletions

class/Building.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ public static function getInstance()
4646
}
4747

4848
/**
49-
* @param bool $action
49+
* @param string|bool $action
5050
*
5151
* @return \XoopsThemeForm
5252
*/
53-
public function getForm(bool $action = false)
53+
public function getForm(string|bool $action = false)
5454
{
5555
$helper = Modulebuilder\Helper::getInstance();
5656
if (false === $action) {

class/Common/DirectoryChecker.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,11 @@ public static function dirExists($dir_path)
134134
$op = Request::getString('op', '', 'POST');
135135
switch ($op) {
136136
case 'createdir':
137-
if (\Xmf\Request::hasVar('path', 'POST')) {
138-
$path = $_POST['path'];
139-
}
140-
if (\Xmf\Request::hasVar('redirect', 'POST')) {
141-
$redirect = $_POST['redirect'];
137+
if (!\Xmf\Request::hasVar('path', 'POST') || !\Xmf\Request::hasVar('redirect', 'POST')) {
138+
break;
142139
}
140+
$path = $_POST['path'];
141+
$redirect = $_POST['redirect'];
143142
$msg = DirectoryChecker::createDirectory($path) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_DIRCREATED') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_DIRNOTCREATED');
144143
\redirect_header($redirect, 2, $msg . ': ' . $path);
145144
break;
@@ -153,7 +152,7 @@ public static function dirExists($dir_path)
153152
if (\Xmf\Request::hasVar('mode', 'POST')) {
154153
$mode = $_POST['mode'];
155154
}
156-
$msg = DirectoryChecker::setDirectoryPermissions($path, $mode) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMSET') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMNOTSET');
155+
$msg = DirectoryChecker::setDirectoryPermissions($path, (int)$mode) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMSET') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMNOTSET');
157156
\redirect_header($redirect, 2, $msg . ': ' . $path);
158157
break;
159158
}

class/Common/FileChecker.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@ class FileChecker
3838
{
3939
/**
4040
* @param string $file_path
41-
* @param string|null $original_file_path
4241
* @param string $redirectFile
42+
* @param string|null $original_file_path
43+
*
4344
* @return bool|string
4445
*/
45-
public static function getFileStatus(string $file_path, string $original_file_path = null, string $redirectFile)
46+
public static function getFileStatus(string $file_path, string $redirectFile, string $original_file_path = null)
4647
{
4748
$pathIcon16 = \Xmf\Module\Admin::iconUrl('', '16');
4849

@@ -145,15 +146,14 @@ public static function setFilePermissions($target, int $mode = 0777)
145146

146147
$op = Request::getString('op', '', 'POST');
147148
if ($op == 'copyfile') {
148-
if (\Xmf\Request::hasVar('original_file_path', 'POST')) {
149-
$original_file_path = $_POST['original_file_path'];
150-
}
151-
if (\Xmf\Request::hasVar('file_path', 'POST')) {
152-
$file_path = $_POST['file_path'];
153-
}
154-
if (\Xmf\Request::hasVar('redirect', 'POST')) {
155-
$redirect = $_POST['redirect'];
156-
}
149+
if (!\Xmf\Request::hasVar('original_file_path', 'POST')
150+
|| !\Xmf\Request::hasVar('file_path', 'POST')
151+
|| !\Xmf\Request::hasVar('redirect', 'POST')) {
152+
return;
153+
}
154+
$original_file_path = $_POST['original_file_path'];
155+
$file_path = $_POST['file_path'];
156+
$redirect = $_POST['redirect'];
157157
$msg = FileChecker::copyFile($original_file_path, $file_path) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILECOPIED') : \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILENOTCOPIED');
158158
\redirect_header($redirect, 2, $msg . ': ' . $file_path);
159159
}

class/Common/Migrate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private function changePrefix(): void
5858
* @param string $tableName table to convert
5959
* @param string $columnName column with IP address
6060
*/
61-
private function convertIPAddresses(string $tableName, string $columnName): void
61+
protected function convertIPAddresses(string $tableName, string $columnName): void
6262
{
6363
if ($this->tableHandler->useTable($tableName)) {
6464
$attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName);

class/Common/TableChecker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function processSQL()
7171
if ($numRows) {
7272
//table exist
7373
$this->result[] = 'Table exist:' . $table;
74-
//$ret = $this->checkTableFields($table, $tabledef['fields']);
74+
$this->checkTableFields($table, $tabledef['fields']);
7575
} else {
7676
if ($this::CHECKTYPE_UPDATE == $this->checktype || $this::CHECKTYPE_UPDATE_REPORT == $this->checktype) {
7777
// create new table

class/Common/VersionChecks.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer =
4444
}
4545
$success = true;
4646

47-
if ($module->versionCompare($currentVer, $requiredVer)) {
47+
if ($module->versionCompare($currentVer, $requiredVer, '<')) {
4848
$success = false;
4949
$module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer));
5050
}

class/Devtools.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -498,10 +498,10 @@ private static function cloneFile($src_file, $dst_file, array $patKeys, array $p
498498

499499
/**
500500
* get form with all existing modules
501-
* @param bool $action
501+
* @param string|false $action
502502
* @return \XoopsSimpleForm
503503
*/
504-
public static function getFormModulesFq(bool $action = false)
504+
public static function getFormModulesFq(string|false $action = false)
505505
{
506506
if (!$action) {
507507
$action = $_SERVER['REQUEST_URI'];
@@ -527,10 +527,10 @@ public static function getFormModulesFq(bool $action = false)
527527

528528
/**
529529
* get form with all existing modules
530-
* @param bool $action
530+
* @param string|false $action
531531
* @return \XoopsSimpleForm
532532
*/
533-
public static function getFormModulesCl(bool $action = false)
533+
public static function getFormModulesCl(string|false $action = false)
534534
{
535535
if (!$action) {
536536
$action = $_SERVER['REQUEST_URI'];
@@ -556,10 +556,10 @@ public static function getFormModulesCl(bool $action = false)
556556

557557
/**
558558
* get form with all existing modules
559-
* @param bool $action
559+
* @param string|false $action
560560
* @return \XoopsSimpleForm
561561
*/
562-
public static function getFormModulesTab(bool $action = false)
562+
public static function getFormModulesTab(string|false $action = false)
563563
{
564564
if (!$action) {
565565
$action = $_SERVER['REQUEST_URI'];
@@ -585,10 +585,11 @@ public static function getFormModulesTab(bool $action = false)
585585

586586
/**
587587
* get form with all existing modules
588-
* @param bool $action
588+
* @param string $dst_path
589+
* @param string|false $action
589590
* @return \XoopsSimpleForm
590591
*/
591-
public static function getFormModulesRemovePrefix($dst_path, bool $action = false)
592+
public static function getFormModulesRemovePrefix(string $dst_path, string|false $action = false)
592593
{
593594
if (!$action) {
594595
$action = $_SERVER['REQUEST_URI'];

class/Files/Admin/AdminBroken.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ private function getAdminBrokenList($tables, string $language)
122122
$ucfTableName = \ucfirst($tableName);
123123
$ret .= $this->pc->getPhpCodeBlankLine();
124124
$ret .= $this->pc->getPhpCodeCommentLine('Check table', $tableName, '');
125-
$ret .= $this->xc->getXcXoopsRequest('start', 'start' . $ucfTableName, '', 'Int', false, '');
125+
$ret .= $this->xc->getXcXoopsRequest('start', 'start' . $ucfTableName, '', 'Int', '');
126126
$adminpager = $this->xc->getXcGetConfig('adminpager');
127-
$ret .= $this->xc->getXcXoopsRequest('limit', 'limit' . $ucfTableName, $adminpager, 'Int', false, '');
127+
$ret .= $this->xc->getXcXoopsRequest('limit', 'limit' . $ucfTableName, $adminpager, 'Int', '');
128128
$critName = 'cr' . $ucfTableName;
129129

130130
$fields = $this->getTableFields($tables[$i]->getVar('table_mid'), $tables[$i]->getVar('table_id'));

class/Files/Admin/AdminPermissions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ private function getPermissionsSwitch($module, $language)
182182
];
183183
}
184184
}
185-
$contentSwitch = $this->pc->getPhpCodeCaseSwitch($cases, true, false, "\t");
185+
$contentSwitch = $this->pc->getPhpCodeCaseSwitch($cases, true,"\t");
186186

187187
return $this->pc->getPhpCodeSwitch('op', $contentSwitch);
188188
}

class/Files/Blocks/BlocksFiles.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ private function getBlocksShow($moduleDirname, $tableName, $tableFieldname, $tab
206206
'top' => $case4,
207207
'random' => $case5,
208208
];
209-
$contSwitch = $this->pc->getPhpCodeCaseSwitch($cases, true, false, "\t\t");
209+
$contSwitch = $this->pc->getPhpCodeCaseSwitch($cases, true, "\t\t");
210210
$contElse = $this->pc->getPhpCodeSwitch('typeBlock', $contSwitch, "\t");
211211
//end: content else: parent
212212
if (1 == $fieldParent) {

0 commit comments

Comments
 (0)