Skip to content

Commit 30c9689

Browse files
authored
Merge pull request #1535 from mambax7/feature/fix_PathStuffController
fix for PathController, cosmetics
2 parents 5079e29 + 2c4beab commit 30c9689

File tree

28 files changed

+151
-71
lines changed

28 files changed

+151
-71
lines changed

htdocs/banners.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ function bannerstats()
188188
$extension = strtolower(substr($imageurl, strrpos($imageurl, '.')));
189189
if ($extension === '.swf') {
190190
// Inform user that SWF is unsupported
191-
echo "<p>Sorry, Flash (.swf) files are no longer supported. Please use a modern video format.</p>";
191+
echo "<p>" ._BANNERS_NO_FLASH ."</p>";
192192
} elseif (in_array($extension, ['.mp4', '.webm', '.ogg'])) {
193193
// Handle actual video files
194194
echo "<video width='468' height='60' controls>

htdocs/class/module.textsanitizer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -855,11 +855,11 @@ public function addSlashes($text)
855855
*
856856
* @param string $text string being converted
857857
* @param int|null $quote_style
858-
* @param string $charset character set used in conversion
858+
* @param string|null $charset character set used in conversion
859859
* @param bool $double_encode
860860
* @return string
861861
*/
862-
public function htmlSpecialChars($text, $quote_style = null, $charset = null, $double_encode = true)
862+
public function htmlSpecialChars(string $text, ?int $quote_style = null, ?string $charset = null, $double_encode = true)
863863
{
864864
if ($quote_style === null) {
865865
$quote_style = ENT_QUOTES;

htdocs/class/textsanitizer/mp3/mp3.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function encode($textarea_id)
3232
{
3333
$buttonHtml = "<button type='button' class='btn btn-default' onclick='xoopsCodeMp3(\"{$textarea_id}\");' title='"
3434
. _XOOPS_FORM_ALTMP3 . "'>"
35-
. "<span class='fa fa-fw fa-music' aria-hidden='true'></span></button>";
35+
. "<span class='fa-solid fa-music' aria-hidden='true'></span></button>";
3636

3737
$javascript = <<<EOF
3838
function xoopsCodeMp3(id) {

htdocs/class/tree.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ class XoopsObjectTree
4242
* @param array $objectArr Array of {@link XoopsObject}s
4343
* @param string $myId field name of object ID
4444
* @param string $parentId field name of parent object ID
45-
* @param string $rootId field name of root object ID
45+
* @param string|null $rootId field name of root object ID
4646
*/
47-
public function __construct($objectArr, $myId, $parentId, $rootId = null)
47+
public function __construct($objectArr, $myId, $parentId, ?string $rootId = null)
4848
{
4949
$this->objects = $objectArr;
5050
$this->myId = $myId;

htdocs/class/xoopskernel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ public function path($url, $virtual = false)
7474

7575
/**
7676
* Convert a XOOPS path to a URL
77-
* @param $url
77+
* @param string $url
7878
* @return mixed|string
7979
*/
80-
public function url($url)
80+
public function url(?string $url='')
8181
{
8282
return (false !== strpos($url, '://') ? $url : $this->path($url, true));
8383
}

htdocs/include/notification_functions.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ function notificationEnabled($style, $module_id = null)
6767
* return an array of info for all categories.
6868
*
6969
* @param string $category_name
70-
* @param int $module_id ID of the module (default current module)
70+
* @param int|null $module_id ID of the module (default current module)
7171
*
7272
* @internal param string $name Category name (default all categories)
7373
* @return mixed
7474
*/
75-
function &notificationCategoryInfo($category_name = '', $module_id = null)
75+
function &notificationCategoryInfo($category_name = '', ?int $module_id = null)
7676
{
7777
if (!isset($module_id)) {
7878
global $xoopsModule;
@@ -83,7 +83,10 @@ function &notificationCategoryInfo($category_name = '', $module_id = null)
8383
$module_handler = xoops_getHandler('module');
8484
$module = $module_handler->get($module_id);
8585
}
86+
87+
if (null !== $module) {
8688
$not_config = &$module->getInfo('notification');
89+
}
8790
if (empty($category_name)) {
8891
return $not_config['category'];
8992
}
@@ -341,11 +344,11 @@ function &notificationEventInfo($category_name, $event_name, $module_id = null)
341344
* Get an array of associative info arrays for subscribable categories
342345
* for the selected module.
343346
*
344-
* @param int $module_id ID of the module
347+
* @param int|null $module_id ID of the module
345348
* @return mixed
346349
*/
347350

348-
function &notificationSubscribableCategoryInfo($module_id = null)
351+
function &notificationSubscribableCategoryInfo(?int $module_id = null)
349352
{
350353
$all_categories = & notificationCategoryInfo('', $module_id);
351354

htdocs/include/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@
2929
/**
3030
* Define XOOPS version
3131
*/
32-
define('XOOPS_VERSION', 'XOOPS 2.5.12-Beta5');
32+
define('XOOPS_VERSION', 'XOOPS 2.5.12-Beta6');

htdocs/install/class/pathcontroller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* @author Taiwen Jiang <[email protected]>
1515
* @author DuGris (aka L. JEN) <[email protected]>
1616
**/
17-
class PathStuffController
17+
class PathController
1818
{
1919
/**
2020
* @var array

htdocs/install/page_pathsettings.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
$pageHasForm = true;
3737
$pageHasHelp = true;
3838

39-
$pathController = new PathStuffController($wizard->configs['xoopsPathDefault'], $wizard->configs['dataPath']);
39+
$pathController = new PathController($wizard->configs['xoopsPathDefault'], $wizard->configs['dataPath']);
4040

4141
//if ($_SERVER['REQUEST_METHOD'] === 'GET' && @$_GET['var'] && Xmf\Request::getString('action', '', 'GET') === 'checkpath') {
4242
// $path = $_GET['var'];
@@ -318,9 +318,9 @@ function updPath(key, val) {
318318

319319
<div id="libperms" class="x2-note" style="display: none;"></div>
320320
<?php
321-
if (!empty($pathController->getErrorMessage())) {
321+
if (!empty($pathController->errorMessage)) {
322322
echo '<div class="alert alert-danger" role="alert">';
323-
echo $pathController->getErrorMessage();
323+
echo $pathController->errorMessage;
324324
echo '</div>';
325325
}
326326
?>

htdocs/kernel/object.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ public function getValues($keys = null, $format = 's', $maxDepth = 1)
426426
* @param string|null $format format to use for the output
427427
* @return mixed formatted value of the variable
428428
*/
429-
public function getVar($key, $format = null)
429+
public function getVar($key, ?string $format = null)
430430
{
431431
$format = (null === $format) ? 's' : (string) $format;
432432
$ret = null;
@@ -437,7 +437,7 @@ public function getVar($key, $format = null)
437437
$myts = \MyTextSanitizer::getInstance();
438438
switch ($this->vars[$key]['data_type']) {
439439
case XOBJ_DTYPE_INT:
440-
$ret = (null === $ret) ? null : (int) $ret;
440+
$ret = (null === $ret) ? '' : (int) $ret;
441441
break;
442442
case XOBJ_DTYPE_UNICODE_TXTBOX:
443443
case XOBJ_DTYPE_TXTBOX:
@@ -446,13 +446,13 @@ public function getVar($key, $format = null)
446446
case 'show':
447447
case 'e':
448448
case 'edit':
449-
return $myts->htmlSpecialChars($ret);
449+
return $myts->htmlSpecialChars((string)$ret);
450450
break 1;
451451
case 'p':
452452
case 'preview':
453453
case 'f':
454454
case 'formpreview':
455-
return $myts->htmlSpecialChars($ret);
455+
return $myts->htmlSpecialChars((string)$ret);
456456
break 1;
457457
case 'n':
458458
case 'none':
@@ -489,7 +489,7 @@ public function getVar($key, $format = null)
489489
break 1;
490490
case 'f':
491491
case 'formpreview':
492-
return htmlspecialchars($ret, ENT_QUOTES | ENT_HTML5);
492+
return htmlspecialchars((string)$ret, ENT_QUOTES | ENT_HTML5);
493493
break 1;
494494
case 'n':
495495
case 'none':
@@ -541,15 +541,15 @@ public function getVar($key, $format = null)
541541
break 1;
542542
case 'e':
543543
case 'edit':
544-
return htmlspecialchars($ret, ENT_QUOTES | ENT_HTML5);
544+
return htmlspecialchars((string)$ret, ENT_QUOTES | ENT_HTML5);
545545
break 1;
546546
case 'p':
547547
case 'preview':
548548
return $ret;
549549
break 1;
550550
case 'f':
551551
case 'formpreview':
552-
return htmlspecialchars($ret, ENT_QUOTES | ENT_HTML5);
552+
return htmlspecialchars((string)$ret, ENT_QUOTES | ENT_HTML5);
553553
break 1;
554554
case 'n':
555555
case 'none':

0 commit comments

Comments
 (0)