Skip to content

Commit 7fae2e7

Browse files
committed
Scrutinizer
1 parent 0b36b95 commit 7fae2e7

4 files changed

Lines changed: 27 additions & 24 deletions

File tree

class/Common/FilesManagement.php

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -92,31 +92,33 @@ public static function deleteDirectory($src)
9292
return false;
9393
}
9494

95-
$success = true;
95+
$success = false;
9696
// remove old files
9797
$dirInfo = new \SplFileInfo($src);
9898
// validate is a directory
9999
if ($dirInfo->isDir()) {
100100
$dirScan = scandir($src, SCANDIR_SORT_NONE);
101-
$fileList = array_diff($dirScan, ['..', '.']);
102-
foreach ($fileList as $k => $v) {
103-
$fileInfo = new \SplFileInfo("{$src}/{$v}");
104-
if ($fileInfo->isDir()) {
105-
// recursively handle subdirectories
106-
if (!$success = self::deleteDirectory($fileInfo->getRealPath())) {
107-
break;
108-
}
109-
} elseif (!($success = unlink($fileInfo->getRealPath()))) {
101+
if (false !== $dirScan) {
102+
$fileList = array_diff($dirScan, ['..', '.']);
103+
foreach ($fileList as $k => $v) {
104+
$fileInfo = new \SplFileInfo("{$src}/{$v}");
105+
if ($fileInfo->isDir()) {
106+
// recursively handle subdirectories
107+
if (!$success = self::deleteDirectory($fileInfo->getRealPath())) {
108+
break;
109+
}
110+
} elseif (!($success = unlink($fileInfo->getRealPath()))) {
110111
break; // delete the file
111112
}
113+
}
114+
// now delete this (sub)directory if all the files are gone
115+
if ($success) {
116+
$success = rmdir($dirInfo->getRealPath());
117+
}
112118
}
113-
// now delete this (sub)directory if all the files are gone
114-
if ($success) {
115-
$success = rmdir($dirInfo->getRealPath());
116-
}
117-
} else {
118-
// input is not a valid directory
119-
$success = false;
119+
// } else {
120+
// // input is not a valid directory
121+
// $success = false;
120122
}
121123

122124
return $success;

class/LanguageHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public function create($isNew = true, $isBase = true)
202202

203203
/**
204204
* @param Blanguage|Language $object
205-
* @return bool|string
205+
* @return bool|string|array
206206
* @internal param object $lang
207207
*/
208208
public function insert(\XoopsObject $object)//insert(&$lang)

docs/changelog.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
<h5>3.1 RC 1 [2019-12-22]</h5>
1+
<h5>3.1 RC 1 [2019-12-22]</h5> Dev: XOOPS 2.5.11, PHP 7.4.1
22
<hr>
33
- __NAMESPACE__ in Helper.php (mamba)
44
- renamed 'PHP_SELF' to 'SCRIPT_NAME' (mamba)
55
- cosmetics, PSR12 (mamba)
66
- decreased index key length (mamba) (MySQL error #1071)
77
- added few \Xmf\Request checks (mamba)
8+
- Scrutinizer suggestions (mamba)
89

910

1011
<h5>3.1 Beta 1 [NOT RELEASED]</h5>

include/oninstall.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ function xoops_module_install_xlanguage(\XoopsModule $module)
7272
/** @var \XoopsGroupPermHandler $grouppermHandler */
7373
$grouppermHandler = xoops_getHandler('groupperm');
7474
// access rights ------------------------------------------
75-
$grouppermHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId);
76-
$grouppermHandler->addRight($moduleDirName . '_submit', 1, XOOPS_GROUP_ADMIN, $moduleId);
77-
$grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ADMIN, $moduleId);
78-
$grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_USERS, $moduleId);
79-
$grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId);
75+
$grouppermHandler->addRight($moduleDirName . '_approve', 1, (int)XOOPS_GROUP_ADMIN, $moduleId);
76+
$grouppermHandler->addRight($moduleDirName . '_submit', 1, (int)XOOPS_GROUP_ADMIN, $moduleId);
77+
$grouppermHandler->addRight($moduleDirName . '_view', 1, (int)XOOPS_GROUP_ADMIN, $moduleId);
78+
$grouppermHandler->addRight($moduleDirName . '_view', 1, (int)XOOPS_GROUP_USERS, $moduleId);
79+
$grouppermHandler->addRight($moduleDirName . '_view', 1, (int)XOOPS_GROUP_ANONYMOUS, $moduleId);
8080

8181
// --- CREATE FOLDERS ---------------
8282
if (count($configurator->uploadFolders) > 0) {

0 commit comments

Comments
 (0)