Skip to content

Commit 1d11ee3

Browse files
authored
Merge pull request #1489 from mambax7/feature/various2
Various changes
2 parents 63d1c00 + b43bc3c commit 1d11ee3

File tree

13 files changed

+71
-87
lines changed

13 files changed

+71
-87
lines changed

htdocs/class/template.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public function __construct()
5555
$this->registerPlugin('modifier', 'count', 'count');
5656
// Register the strstr function
5757
$this->registerPlugin('modifier', 'strstr', 'strstr');
58+
// Register the trim function
59+
$this->registerPlugin('modifier', 'trim', 'trim');
5860

5961
if ($xoopsConfig['debug_mode']) {
6062
$this->debugging_ctrl = 'URL';

htdocs/class/theme.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,9 +455,9 @@ public function checkCache()
455455
$this->template->caching = 2;
456456
$this->template->cache_lifetime = $this->contentCacheLifetime;
457457
$uri = str_replace(XOOPS_URL, '', $_SERVER['REQUEST_URI']);
458-
// Clean uri by removing session id
459-
if (defined('SID') && SID && strpos($uri, SID)) {
460-
$uri = preg_replace("/([\?&])(" . SID . "$|" . SID . '&)/', "\\1", $uri);
458+
459+
if (session_id() && strpos($uri, session_id())) {
460+
$uri = preg_replace("/([\?&])(" . session_id() . "$|" . session_id() . '&)/', "\\1", $uri);
461461
}
462462
$this->contentCacheId = $this->generateCacheId('page_' . substr(md5($uri), 0, 8));
463463
if ($this->template->isCached($template, $this->contentCacheId)) {

htdocs/include/checklogin.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@
3636
include_once $GLOBALS['xoops']->path('class/auth/authfactory.php');
3737

3838
xoops_loadLanguage('auth');
39-
40-
$xoopsAuth = XoopsAuthFactory::getAuthConnection($myts->addSlashes($uname));
39+
/** @var XoopsMySQLDatabase $xoopsDB */
40+
$xoopsDB = XoopsDatabaseFactory::getDatabaseConnection();
41+
$xoopsAuth = XoopsAuthFactory::getAuthConnection($xoopsDB->escape($uname));
4142
$user = $xoopsAuth->authenticate($uname, $pass);
4243

4344
if (false !== $user) {

htdocs/modules/profile/templates/profile_userinfo.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<input type="button" value="<{$lang_logout}>" onclick="location='<{$xoops_url}>/modules/<{$xoops_dirname}>/user.php?op=logout'"/>
4040
</form>
4141
</div>
42-
<{elseif $xoops_isadmin != false}>
42+
<{elseif isset($xoops_isadmin) && $xoops_isadmin != false}>
4343
<div class="floatleft pad5">
4444
<form method="post" action="<{$xoops_url}>/modules/<{$xoops_dirname}>/admin/deactivate.php">
4545
<input type="button" value="<{$lang_editprofile}>"

htdocs/modules/system/admin/modulesadmin/modulesadmin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ function xoops_module_install($dirname)
265265
$tplfile->setVar('tpl_file', $block['template']);
266266
$tplfile->setVar('tpl_module', $dirname);
267267
$tplfile->setVar('tpl_type', 'block');
268-
$tplfile->setVar('tpl_desc', $block['description'], true);
268+
$tplfile->setVar('tpl_desc', $block['description']??'', true);
269269
$tplfile->setVar('tpl_lastimported', 0);
270270
$tplfile->setVar('tpl_lastmodified', time());
271271
if (!$tplfile_handler->insert($tplfile)) {

htdocs/modules/system/blocks/system_blocks.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,9 @@ function b_system_waiting_show()
313313
$block['modules'][10]['lang_linkname'] = _MB_SYSTEM_SMARTSECTION;
314314
}
315315
}
316+
if (count($block) > 0) {
316317
$GLOBALS['xoopsLogger']->addDeprecated("Block 'Waiting Contents' is deprecated since XOOPS 2.5.11, please use Waiting module");
318+
}
317319
return $block;
318320
}
319321

htdocs/themes/xbootstrap/modules/newbb/newbb_viewtopic.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
<div class="col-sm-6 col-md-6">
8888
<a href="<{$xoops_url}>/modules/<{$xoops_dirname}>/reply.php?topic_id=<{$topic_id}>" title="<{$smarty.const.THEME_FORUM_REPLY}>" class="btn btn-primary"><{$smarty.const.THEME_FORUM_REPLY}></a>
8989

90-
<{if if isset($viewer_level) && $viewer_level > 1}>
90+
<{if isset($viewer_level) && $viewer_level > 1}>
9191
<a href="<{$xoops_url}>/modules/<{$xoops_dirname}>/newtopic.php?forum=<{$forum_id}>" title="<{$smarty.const.THEME_FORUM_NEWTOPIC}>" class="btn btn-primary"><{$smarty.const.THEME_FORUM_NEWTOPIC}></a>
9292
<{else}>
9393
<a href="<{$xoops_url}>/user.php" title="<{$smarty.const.THEME_FORUM_REGISTER}>" class="btn btn-success"><{$smarty.const.THEME_FORUM_REGISTER}></a>

htdocs/themes/xswatch4/modules/newbb/blocks/newbb_block_author.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<table class="table table-hover" cellspacing="1">
22

3-
<{if isset($block.disp_mode) && $block.disp_mod == 0}>
3+
<{if isset($block.disp_mode) && $block.disp_mode == 0}>
44
<tr>
55
<th><{$smarty.const._MB_NEWBB_AUTHOR}></th>
66
<th><{$smarty.const._MB_NEWBB_COUNT}></th>

htdocs/xoops_lib/modules/protector/admin/admin_header.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,21 @@
5757
$xoopsTpl->assign('pathIcon16', $pathIcon16);
5858

5959
// Load language files
60-
// Attempt to include the language-specific admin file, fallback to English if not found
61-
$languageFile = XOOPS_TRUST_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/admin.php';
62-
if (!file_exists($languageFile) || !include_once $languageFile) {
63-
include_once XOOPS_TRUST_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/admin.php';
64-
}
6560

66-
// Attempt to include the language-specific modinfo file, fallback to English if not found
67-
$languageFile = XOOPS_TRUST_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php';
68-
if (!file_exists($languageFile) || !include_once $languageFile) {
69-
include_once XOOPS_TRUST_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/modinfo.php';
70-
}
61+
$moduleDir = $xoopsModule->getVar('dirname');
62+
$language = $xoopsConfig['language'];
63+
64+
// List of language files to include
65+
$languageFiles = ['admin.php', 'modinfo.php', 'main.php'];
7166

72-
// Attempt to include the language-specific main file, fallback to English if not found
73-
$languageFile = XOOPS_TRUST_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/main.php';
74-
if (!file_exists($languageFile) || !include_once $languageFile) {
75-
include_once XOOPS_TRUST_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/english/main.php';
67+
foreach ($languageFiles as $file) {
68+
$languageFile = XOOPS_TRUST_PATH . "/modules/{$moduleDir}/language/{$language}/{$file}";
69+
$englishFile = XOOPS_TRUST_PATH . "/modules/{$moduleDir}/language/english/{$file}";
70+
71+
// Attempt to include the language-specific file, fallback to English if not found
72+
if (file_exists($languageFile)) {
73+
include_once $languageFile;
74+
} else {
75+
include_once $englishFile;
76+
}
7677
}

htdocs/xoops_lib/modules/protector/admin/advisory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@
109109
$db = XoopsDatabaseFactory::getDatabaseConnection();
110110
// Check if XOOPS_VERSION is defined and has a valid value
111111
$xoopsVersion = defined('XOOPS_VERSION') ? XOOPS_VERSION : '';
112-
$versionSubstring = substr($xoopsVersion, 6, 3);
113-
112+
$versionSubstring = is_string($xoopsVersion) ? substr($xoopsVersion, 6, 3) : '';
113+
$dbClass = strtolower(get_class($db));
114114
// Check if the version is valid and the database class is not 'protectormysqldatabase'
115-
if ($versionSubstring !== false && $versionSubstring < 2.4 && strtolower(get_class($db)) !== 'protectormysqldatabase') {
115+
if ($versionSubstring && version_compare($versionSubstring, '2.4', '<') && $dbClass !== 'protectormysqldatabase') {
116116
echo "<span style='color:red;font-weight:bold;'>" . _AM_ADV_DBFACTORYUNPATCHED . "</span></dt>\n";
117117
} else {
118118
echo _AM_ADV_DBFACTORYPATCHED . "<span style='color:green;font-weight:bold;'> OK</span></dt>\n";

0 commit comments

Comments
 (0)