Skip to content

Commit

Permalink
Merge pull request #115 from mambax7/master
Browse files Browse the repository at this point in the history
5.01 Beta 3
  • Loading branch information
mambax7 authored Feb 15, 2021
2 parents 7f7149f + 4b4f872 commit 6c616ec
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
6 changes: 1 addition & 5 deletions blocks/newbb_block.php
Original file line number Diff line number Diff line change
Expand Up @@ -929,11 +929,7 @@ function b_newbb_author_edit($options)
function b_newbb_custom($options)
{
// if no newbb module block set, we have to include the language file
if (is_readable($GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php'))) {
require_once $GLOBALS['xoops']->path('modules/newbb/language/' . $GLOBALS['xoopsConfig']['language'] . '/blocks.php');
} else {
require_once $GLOBALS['xoops']->path('modules/newbb/language/english/blocks.php');
}
xoops_loadLanguage('blocks', 'newbb');

$options = explode('|', $options);
$block = b_newbb_show($options);
Expand Down
2 changes: 1 addition & 1 deletion class/ForumHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct(\XoopsDatabase $db = null)
/**
* @param \XoopsObject $object
* @param bool $force
* @return bool
* @return bool|int
* @internal param \XoopsObject $forum
*/
public function insert(\XoopsObject $object, $force = true) //insert($forum)
Expand Down
8 changes: 5 additions & 3 deletions class/OnlineHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ public function write($uid, $uname, $time, $forum_id, $ip, $topic_id)
return false;
}

/** @var \XoopsOnlineHandler $xoopsOnlineHandler */
$xoopsOnlineHandler = \xoops_getHandler('online');
$xoopsOnlineTable = $xoopsOnlineHandler->table;

Expand Down Expand Up @@ -295,22 +296,23 @@ public function gc($expire)
$sql = 'DELETE FROM ' . $this->db->prefix('newbb_online') . ' WHERE online_updated < ' . (\time() - (int)$expire);
$this->db->queryF($sql);

/** @var \XoopsOnlineHandler $xoopsOnlineHandler */
$xoopsOnlineHandler = \xoops_getHandler('online');
$xoopsOnlineHandler->gc($expire);
}

/**
* Get an array of online information
*
* @param \CriteriaElement|\CriteriaCompo|null $criteria {@link \CriteriaElement}
* @param \CriteriaElement|null $criteria {@link \CriteriaElement}
* @return array Array of associative arrays of online information
*/
public function getAll($criteria = null)
{
$ret = [];
$limit = $start = 0;
$sql = 'SELECT * FROM ' . $this->db->prefix('newbb_online');
if (\is_object($criteria) && $criteria instanceof CriteriaElement) {
if (\is_object($criteria) && ($criteria instanceof \CriteriaCompo || $criteria instanceof \Criteria)) {
$sql .= ' ' . $criteria->renderWhere();
$limit = $criteria->getLimit();
$start = $criteria->getStart();
Expand Down Expand Up @@ -371,7 +373,7 @@ public function checkStatus($uids)
public function getCount($criteria = null)
{
$sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('newbb_online');
if (\is_object($criteria) && $criteria instanceof CriteriaElement) {
if (\is_object($criteria) && ($criteria instanceof \CriteriaCompo || $criteria instanceof \Criteria)) {
$sql .= ' ' . $criteria->renderWhere();
}
if (!$result = $this->db->query($sql)) {
Expand Down
4 changes: 2 additions & 2 deletions class/PostHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ public function getPostCount($criteria = null, $join = null)
// LEFT JOIN
$sql .= $join;
// WHERE
if (null !== $criteria && $criteria instanceof \CriteriaElement) {
if (\is_object($criteria) && is_subclass_of($criteria, \CriteriaElement::class)) {
$sql .= ' ' . $criteria->renderWhere();
}
if (!$result = $this->db->query($sql)) {
Expand Down Expand Up @@ -515,7 +515,7 @@ public function getPostsByLimit($criteria = null, $limit = 1, $start = 0, $join
if (!empty($join)) {
$sql .= $join;
}
if (null !== $criteria && $criteria instanceof \CriteriaElement) {
if (\is_object($criteria) && is_subclass_of($criteria, \CriteriaElement::class)) {
$sql .= ' ' . $criteria->renderWhere();
if ('' !== $criteria->getSort()) {
$sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
Expand Down
2 changes: 1 addition & 1 deletion docs/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h5>5.01 Beta 3 [NOT RELEASED]</h5> Dev: XOOPS 2.5.11, PHP 7.4.14, PHP 8.0.1
<h5>5.01 Beta 3 [2021-02-14]</h5> Dev: XOOPS 2.5.11, PHP 7.4.14, PHP 8.0.2
<hr>
- 'isset' replaced with coalesce (mamba)
- rename $newbbpermHandler (mamba)
Expand Down
2 changes: 1 addition & 1 deletion xoops_version.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
$modversion = [
'version' => 5.01,
'module_status' => 'Beta 3',
'release_date' => '2021/01/31',
'release_date' => '2021/02/14',
'name' => _MI_NEWBB_NAME,
'description' => _MI_NEWBB_DESC,
'help' => 'page=help',
Expand Down

0 comments on commit 6c616ec

Please sign in to comment.