Skip to content

Commit 065022f

Browse files
authored
Merge pull request #157 from ggoffy/master
code improvements
2 parents 4f3f093 + 6d54d45 commit 065022f

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

class/Files/Classes/ClassFiles.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,8 @@ private function getFunctionForm($module, $table, $fieldId, $fieldInForm, $field
297297
$xUser = $this->pc->getPhpCodeGlobals('xoopsUser');
298298
$xModule = $this->pc->getPhpCodeGlobals('xoopsModule');
299299
$getForm .= $this->pc->getPhpCodeTernaryOperator('isAdmin', '\is_object(' . $xUser . ')', $xUser . '->isAdmin(' . $xModule . '->mid())', 'false', "\t\t");
300+
$getForm .= $this->xc->getXcEqualsOperator('$isAdmin', "\is_object(\$GLOBALS['xoopsUser']) && \$GLOBALS['xoopsUser']->isAdmin(\$GLOBALS['xoopsModule']->mid())", null, "\t\t");
301+
300302
if ($fieldUpload) {
301303
$permString = 'upload_groups';
302304
$getForm .= $this->pc->getPhpCodeCommentLine('Permissions for', 'uploader', "\t\t");

class/Files/Classes/ClassHandlerFiles.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ private function getClassCreate()
147147
*/
148148
private function getClassGet()
149149
{
150-
$ret = $this->pc->getPhpCodeCommentMultiLine(['retrieve a' => 'field', '' => '', '@param int' => '$i field id', '@param null' => 'fields', '@return \XoopsObject|null reference to the' => '{@link Get} object'], "\t");
151-
$cClhg = $this->getSimpleString('return parent::get($i, $fields);', "\t\t");
150+
$ret = $this->pc->getPhpCodeCommentMultiLine(['retrieve a' => 'field', '' => '', '@param int' => '$id field id', '@param null' => 'fields', '@return \XoopsObject|null reference to the' => '{@link Get} object'], "\t");
151+
$cClhg = $this->getSimpleString('return parent::get($id, $fields);', "\t\t");
152152

153-
$ret .= $this->pc->getPhpCodeFunction('get', '$i = null, $fields = null', $cClhg, 'public ', false, "\t");
153+
$ret .= $this->pc->getPhpCodeFunction('get', '$id = null, $fields = null', $cClhg, 'public ', false, "\t");
154154

155155
return $ret;
156156
}

docs/changelog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
- module update to php8 (mamba)
2222
- fix bug in type cast (liomj/goffy)
2323
- removed unnecessary sprintf (goffy)
24+
- replace ternary expression by condition (goffy)
25+
- using same param name during inheritance (goffy)
2426

2527
<h5>3.5.1 Beta 1 [NOT RELEASED]</h5> Dev: XOOPS 2.5.11, PHP 7.4.25, PHP 8.0.12, PHP 8.1.0 Beta 4
2628
- semantic versioning (mamba)

0 commit comments

Comments
 (0)