Skip to content

Commit

Permalink
5.0 Final
Browse files Browse the repository at this point in the history
  • Loading branch information
mambax7 committed May 8, 2019
1 parent 3d673b5 commit fe7ae8b
Show file tree
Hide file tree
Showing 40 changed files with 75 additions and 61 deletions.
2 changes: 1 addition & 1 deletion action.post.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
$uid = Request::getInt('uid', 0, 'GET');

$op = Request::getCmd('op', Request::getCmd('op', '', 'POST'), 'GET');
$op = in_array($op, ['approve', 'delete', 'restore', 'split'], true) ? $op : '';
$op = in_array($op, ['approve', 'delete', 'restore', 'split']) ? $op : '';
$mode = Request::getInt('mode', 1, 'GET');

if (0 === count($post_id) || 0 === count($op)) {
Expand Down
2 changes: 1 addition & 1 deletion action.topic.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
$topic_id = Request::getArray('topic_id', null, 'POST');

$op = Request::getString('op', '', 'POST');
$op = in_array($op, ['approve', 'delete', 'restore', 'move'], true) ? $op : '';
$op = in_array($op, ['approve', 'delete', 'restore', 'move']) ? $op : '';

if (0 === count($topic_id) || 0 === count($op)) {
// irmtfan - issue with javascript:history.go(-1)
Expand Down
2 changes: 1 addition & 1 deletion admin/admin_forum_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
foreach (array_keys($glist) as $group) {
foreach ($perms as $perm) {
$ids = $permHandler->getItemIds($perm, $group, $xoopsModule->getVar('mid'));
if (!in_array($forumObject->getVar('forum_id'), $ids, true)) {
if (!in_array($forumObject->getVar('forum_id'), $ids)) {
if (empty($perm_template[$group][$perm])) {
$permHandler->deleteRight($perm, $forumObject->getVar('forum_id'), $group, $xoopsModule->getVar('mid'));
} else {
Expand Down
2 changes: 1 addition & 1 deletion admin/admin_forum_prune.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
// ARCHIVING POSTS
if (1 == $archive) {
$result = $GLOBALS['xoopsDB']->query('SELECT p.topic_id, p.post_id, t.post_text FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' p, ' . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') . " t WHERE p.post_id IN ($post_list) AND p.post_id=t.post_id");
while (false !== (list($topic_id, $post_id, $post_text) = $GLOBALS['xoopsDB']->fetchRow($result))) {
while (list($topic_id, $post_id, $post_text) = $GLOBALS['xoopsDB']->fetchRow($result)) {
$sql = $GLOBALS['xoopsDB']->query('INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_archive') . " (topic_id, post_id, post_text) VALUES ($topic_id, $post_id, $post_text)");
}
}
Expand Down
2 changes: 1 addition & 1 deletion admin/admin_groupmod.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
foreach ($fgroups as $k) {
$gg = $memberHandler->getUsersByGroup($k, false);
foreach ($gg as $f) {
if (!in_array($f, $fuser, true)) {
if (!in_array($f, $fuser)) {
$fuser[] = $f;
}
}
Expand Down
2 changes: 1 addition & 1 deletion admin/admin_permissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
if (0 == $ii % 5) {
$ret_ele .= '</tr><tr>';
}
$checked = in_array('forum_' . $perm, $selected, true) ? ' checked' : '';
$checked = in_array('forum_' . $perm, $selected) ? ' checked' : '';
$option_id = $perm . '_' . $i;
$option_ids[] = $option_id;
$ret_ele .= '<td><input name="perms[' . $i . '][' . 'forum_' . $perm . ']" id="' . $option_id . '" onclick="" value="1" type="checkbox"' . $checked . '>' . constant('_AM_NEWBB_CAN_' . mb_strtoupper($perm)) . '<br></td>';
Expand Down
2 changes: 1 addition & 1 deletion admin/admin_synchronization.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
}
$sql = ' SELECT uid' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('users');
$result = $GLOBALS['xoopsDB']->query($sql, $limit, $start);
while (false !== (list($uid) = $GLOBALS['xoopsDB']->fetchRow($result))) {
while (list($uid) = $GLOBALS['xoopsDB']->fetchRow($result)) {
// irmtfan approved=1 AND
$sql = ' SELECT count(*)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " WHERE topic_poster = {$uid}";
$ret = $GLOBALS['xoopsDB']->query($sql);
Expand Down
2 changes: 1 addition & 1 deletion admin/admin_type_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
'save_forum',
'add',
];
if (!in_array($op, $validOps, true)) {
if (!in_array($op, $validOps)) {
$op = '';
}

Expand Down
6 changes: 3 additions & 3 deletions admin/admin_votedata.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
$voteresult = $GLOBALS['xoopsDB']->query($query);
$votesDB = $GLOBALS['xoopsDB']->getRowsNum($voteresult);
$totalrating = 0;
while (false !== (list($rating) = $GLOBALS['xoopsDB']->fetchRow($voteresult))) {
while (list($rating) = $GLOBALS['xoopsDB']->fetchRow($voteresult)) {
$totalrating += $rating;
}
$finalrating = $totalrating / $votesDB;
Expand All @@ -71,7 +71,7 @@
$uservotes = $GLOBALS['xoopsDB']->getRowsNum($result2);
$useravgrating = 0;

while (false !== (list($rating2) = $GLOBALS['xoopsDB']->fetchRow($result2))) {
while (list($rating2) = $GLOBALS['xoopsDB']->fetchRow($result2)) {
// $useravgrating = $useravgrating + $rating2;
$useravgrating += $rating2;
}
Expand Down Expand Up @@ -105,7 +105,7 @@
if (0 == $votes) {
echo "<tr><td align='center' colspan='7' class='head'>" . _AM_NEWBB_VOTE_NOVOTES . '</td></tr>';
}
while (false !== (list($ratingid, $topic_id, $ratinguser, $rating, $ratinghostname, $ratingtimestamp) = $GLOBALS['xoopsDB']->fetchRow($results))) {
while (list($ratingid, $topic_id, $ratinguser, $rating, $ratinghostname, $ratingtimestamp) = $GLOBALS['xoopsDB']->fetchRow($results)) {
$sql = 'SELECT topic_title FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' WHERE topic_id=' . $topic_id . ' ';
$down_array = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql));

Expand Down
6 changes: 6 additions & 0 deletions class/Common/VersionChecks.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer =
$module = \XoopsModule::getByDirname($moduleDirName);
}
xoops_loadLanguage('admin', $moduleDirName);
xoops_loadLanguage('common', $moduleDirName);


//check for minimum XOOPS version
$currentVer = mb_substr(XOOPS_VERSION, 6); // get the numeric part of string
Expand Down Expand Up @@ -66,6 +68,8 @@ public static function checkVerPhp(\XoopsModule $module = null)
$module = \XoopsModule::getByDirname($moduleDirName);
}
xoops_loadLanguage('admin', $moduleDirName);
xoops_loadLanguage('common', $moduleDirName);

// check for minimum PHP version
$success = true;

Expand Down Expand Up @@ -111,6 +115,8 @@ public static function checkVerModule($helper, $source = 'github', $default = 'm
$curlReturn = curl_exec($curlHandle);
if (false === $curlReturn) {
trigger_error(curl_error($curlHandle));
} elseif (false !== strpos($curlReturn, 'Not Found')) {
trigger_error('Repository Not Found: ' . $infoReleasesUrl);
} else {
$file = json_decode($curlReturn, false);
$latestVersionLink = sprintf("https://github.com/$repository/archive/%s.zip", $file ? reset($file)->tag_name : $default);
Expand Down
2 changes: 1 addition & 1 deletion class/ForumHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ public function getAllTopics(&$forum, $criteria = null)
if (count($topics) > 0) {
$sql = ' SELECT DISTINCT topic_id FROM ' . $this->db->prefix('newbb_posts') . " WHERE attachment != ''" . ' AND topic_id IN (' . implode(',', array_keys($topics)) . ')';
if ($result = $this->db->query($sql)) {
while (false !== (list($topic_id) = $this->db->fetchRow($result))) {
while (list($topic_id) = $this->db->fetchRow($result)) {
$topics[$topic_id]['attachment'] = '&nbsp;' . newbbDisplayImage('attachment', _MD_NEWBB_TOPICSHASATT);
}
}
Expand Down
2 changes: 1 addition & 1 deletion class/GroupFormCheckBox.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = [])
$tree .= "var ele = xoopsGetElementById('" . $child_ele . "'); if (this.checked !== true) {ele.checked = false;}";
}
$tree .= '" value="1"';
if (in_array($option['id'], $this->_value, true)) {
if (in_array($option['id'], $this->_value)) {
$tree .= ' checked';
}
$tree .= ' >'
Expand Down
2 changes: 1 addition & 1 deletion class/IconHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public function assignImage($image, $alt = '', $extra = '')
$this->setImage($image, $alt, $extra);
// START hacked by irmtfan - improve function to CSS3 buttons - add alt and title attributes - use span instead of button to support IE7&8
$tag = 'span';
if ("class='forum_icon'" === $extra && in_array(mb_substr($image, 0, 2), ['t_', 'p_', 'up'], true)) {
if ("class='forum_icon'" === $extra && in_array(mb_substr($image, 0, 2), ['t_', 'p_', 'up'])) {
$extra = "class='forum_icon forum_button'";
}

Expand Down
8 changes: 4 additions & 4 deletions class/OnlineHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ public function showOnline()
}

foreach ($users_online as $uid => $user) {
if (in_array($uid, $administrator_list, true)) {
if (in_array($uid, $administrator_list)) {
$user['level'] = 2;
} elseif (in_array($uid, $moderator_list, true)) {
} elseif (in_array($uid, $moderator_list)) {
$user['level'] = 1;
} else {
$user['level'] = 0;
Expand Down Expand Up @@ -342,12 +342,12 @@ public function checkStatus($uids)
if (!$result) {
return $ret;
}
while (false !== (list($uid) = $this->db->fetchRow($result))) {
while (list($uid) = $this->db->fetchRow($result)) {
$online_users[] = $uid;
}
}
foreach ($uids as $uid) {
if (in_array($uid, $online_users, true)) {
if (in_array($uid, $online_users)) {
$ret[$uid] = 1;
}
}
Expand Down
2 changes: 1 addition & 1 deletion class/PermissionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public function createPermData($perm_name = 'forum_all')
unset($module);
}

if (in_array($perm_name, ['forum_all', 'category_all'], true)) {
if (in_array($perm_name, ['forum_all', 'category_all'])) {
/** @var \XoopsMemberHandler $memberHandler */
$memberHandler = xoops_getHandler('member');
$groups = array_keys($memberHandler->getGroupList());
Expand Down
6 changes: 3 additions & 3 deletions class/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function deleteAttachment($attachArray = null)
}

foreach ($attachOld as $key => $attach) {
if (in_array($key, $attachArray, true)) {
if (in_array($key, $attachArray)) {
$file = $GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attach['name_saved']);
@unlink($file);
$file = ($GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/thumbs/' . $attach['name_saved'])); // delete thumbnails
Expand Down Expand Up @@ -226,7 +226,7 @@ public function displayAttachment($asSource = false)
}
$file_size = @filesize($GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $att['name_saved']));
$file_size = number_format($file_size / 1024, 2) . ' KB';
if (in_array(mb_strtolower($file_extension), $image_extensions, true)
if (in_array(mb_strtolower($file_extension), $image_extensions)
&& $GLOBALS['xoopsModuleConfig']['media_allowed']) {
$post_attachment .= '<br><img src="' . $icon_filetype . '" alt="' . $filetype . '" ><strong>&nbsp; ' . $att['nameDisplay'] . '</strong> <small>(' . $file_size . ')</small>';
$post_attachment .= '<br>' . newbbAttachmentImage($att['name_saved']);
Expand Down Expand Up @@ -521,7 +521,7 @@ public function showPost($isAdmin)
$post_text = "<div class='karma'>" . sprintf(_MD_NEWBB_KARMA_REQUIREMENT, $user_karma, $this->getVar('post_karma')) . '</div>';
$post_attachment = '';
} elseif ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $this->getVar('require_reply')
&& (!$uid || !in_array($uid, $viewtopic_posters, true))) {
&& (!$uid || !in_array($uid, $viewtopic_posters))) {
$post_text = "<div class='karma'>" . _MD_NEWBB_REPLY_REQUIREMENT . '</div>';
$post_attachment = '';
} else {
Expand Down
2 changes: 1 addition & 1 deletion class/StatsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public function reset()

$sql = ' SELECT forum_id' . ' FROM ' . $this->db->prefix('newbb_forums');
$ret = $this->db->query($sql);
while (false !== (list($forum_id) = $this->db->fetchRow($ret))) {
while (list($forum_id) = $this->db->fetchRow($ret)) {
$sql = ' SELECT COUNT(*), SUM(topic_views)' . ' FROM ' . $this->db->prefix('newbb_topics') . " WHERE approved=1 AND forum_id = {$forum_id}";
$result = $this->db->query($sql);
list($topics, $views) = $this->db->fetchRow($result);
Expand Down
8 changes: 4 additions & 4 deletions class/TopicRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function setVars(array $vars = [])
$this->init();

foreach ($vars as $var => $val) {
if (!in_array($var, $this->args, true)) {
if (!in_array($var, $this->args)) {
continue;
}
$this->vars[$var] = $this->setVar($var, $val);
Expand Down Expand Up @@ -353,12 +353,12 @@ public function parseVar($var, $val)
if (!empty($val)) {
// START irmtfan if unread && read_mode = 1 and last_visit > startdate do not add where query | to accept multiple status
$startdate = time() - newbbGetSinceTime($val);
if (in_array('unread', explode(',', $this->vars['status'], true), true) && 1 == $this->config['read_mode']
if (in_array('unread', explode(',', $this->vars['status'])) && 1 == $this->config['read_mode']
&& $GLOBALS['last_visit'] > $startdate) {
break;
}
// irmtfan digest_time | to accept multiple status
if (in_array('digest', explode(',', $this->vars['status'], true), true)) {
if (in_array('digest', explode(',', $this->vars['status']))) {
$this->query['where'][] = 't.digest_time > ' . $startdate;
}
// irmtfan - should be >= instead of =
Expand Down Expand Up @@ -1088,7 +1088,7 @@ public function renderTopics(\Smarty $xoopsTpl = null)
if (count($topics) > 0) {
$sql = ' SELECT DISTINCT topic_id FROM ' . $this->handler->db->prefix('newbb_posts') . " WHERE attachment != ''" . ' AND topic_id IN (' . implode(',', array_keys($topics)) . ')';
if ($result = $this->handler->db->query($sql)) {
while (false !== (list($topic_id) = $this->handler->db->fetchRow($result))) {
while (list($topic_id) = $this->handler->db->fetchRow($result)) {
$topics[$topic_id]['attachment'] = '&nbsp;' . newbbDisplayImage('attachment', _MD_NEWBB_TOPICSHASATT);
}
}
Expand Down
6 changes: 6 additions & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<h5>5.00 Final (XOOPS 2.5.10) [2019-04-30]</h5> Dev: Xoops 2.5.10, PHP 7.3.4
<hr>
- reversed to while (list()) (mamba)
- reversed strict in_array (mamba)
-

<h5>5.00 RC1 (XOOPS 2.5.10) [2019-02-09]</h5> Dev: Xoops 2.5.10, PHP 7.3.2
<hr>
- fix for Criteria('1', 1) (geekwright/mamba)
Expand Down
2 changes: 1 addition & 1 deletion header.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
if (true === mb_strpos(getenv('REQUEST_URI'), 'mark_read=') || true === mb_strpos(getenv('REQUEST_URI'), 'mark=')) {
// Mark Forums
} else {
if (in_array(basename(getenv('SCRIPT_NAME')), $toseo_url, true)) {
if (in_array(basename(getenv('SCRIPT_NAME')), $toseo_url)) {
//rewrite only for files

if ('' !== trim(getenv('SCRIPT_NAME'))) {
Expand Down
2 changes: 2 additions & 0 deletions include/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@
'1' => "<img src='" . $pathIcon16 . "/1.png' alt='" . 1 . "' align='middle'>",
];

//when debugging, change to true
$debug = false;
//$debug = true;

// MyTextSanitizer object
$myts = \MyTextSanitizer::getInstance();
Expand Down
2 changes: 1 addition & 1 deletion include/form.post.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
}
}
if (count(@$GLOBALS['xoopsModuleConfig']['editor_allowed']) > 0) {
if (!in_array($editor, $GLOBALS['xoopsModuleConfig']['editor_allowed'], true)) {
if (!in_array($editor, $GLOBALS['xoopsModuleConfig']['editor_allowed'])) {
$editor = $GLOBALS['xoopsModuleConfig']['editor_allowed'][0];
newbbSetCookie('editor', $editor);
}
Expand Down
4 changes: 2 additions & 2 deletions include/functions.forum.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ function newbbForumSelectBox($value = null, $permission = 'access', $categoryDel
continue;
}
foreach ($forums[$key] as $f => $forum) {
if ($see && in_array($f, $value, true)) {
if ($see && in_array($f, $value)) {
continue;
}
$box .= "<option value='{$f}' " . (in_array($f, $value, true) ? ' selected' : '') . '>' . $forum['prefix'] . $forum['forum_name'] . "</option>\n";
$box .= "<option value='{$f}' " . (in_array($f, $value) ? ' selected' : '') . '>' . $forum['prefix'] . $forum['forum_name'] . "</option>\n";
}
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion include/functions.image.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function newbbCreateThumbnail($source, $thumb_width)

$imageCreateFunction = function_exists('imagecreatetruecolor') ? 'imagecreatetruecolor' : 'imagecreate';

if (in_array($type, $supported_types, true)) {
if (in_array($type, $supported_types)) {
switch ($type) {
case 1:
if (!function_exists('imagecreatefromgif')) {
Expand Down
4 changes: 2 additions & 2 deletions include/functions.user.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function newbbIsModerator(&$forum, $user = -1)
}
$uid = is_object($user) ? $user->getVar('uid', 'n') : (int)$user;

return in_array($uid, $forum->getVar('forum_moderator'), true);
return in_array($uid, $forum->getVar('forum_moderator'));
}

/**
Expand Down Expand Up @@ -155,7 +155,7 @@ function newbbIsAdmin($forum = 0)
$_cachedModerators[$cache_id] = $forum->getVar('forum_moderator');
}

return in_array($GLOBALS['xoopsUser']->getVar('uid'), $_cachedModerators[$cache_id], true);
return in_array($GLOBALS['xoopsUser']->getVar('uid'), $_cachedModerators[$cache_id]);
}

/* use hardcoded DB query to save queries */
Expand Down
2 changes: 1 addition & 1 deletion include/functions.welcome.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

// Add dynamic fields
foreach (array_keys($fields) as $i) {
if (in_array($fields[$i]->getVar('fieldid'), $fieldids, true)) {
if (in_array($fields[$i]->getVar('fieldid'), $fieldids)) {
$catid = isset($fieldcats[$fields[$i]->getVar('fieldid')]) ? $fieldcats[$fields[$i]->getVar('fieldid')]['catid'] : 0;
$value = $fields[$i]->getOutputValue($GLOBALS['xoopsUser']);
if (is_array($value)) {
Expand Down
6 changes: 3 additions & 3 deletions include/oninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

/**
* Prepares system prior to attempting to install module
* @param XoopsModule $module {@link XoopsModule}
* @param \XoopsModule $module {@link XoopsModule}
*
* @return bool true if ready to install, false if not
*/
Expand All @@ -47,7 +47,7 @@ function xoops_module_pre_install_newbb(\XoopsModule $module)

/**
* Performs tasks required during installation of the module
* @param XoopsModule $module {@link XoopsModule}
* @param \XoopsModule $module {@link XoopsModule}
*
* @return bool true if installation successful, false if not
*/
Expand All @@ -69,7 +69,7 @@ function xoops_module_install_newbb(\XoopsModule $module)
// default Permission Settings ----------------------
global $xoopsModule, $xoopsDB;
$moduleId = $xoopsModule->getVar('mid');
$moduleId2 = $helper->getModule()->mid();
// $moduleId2 = $helper->getModule()->mid();
$grouppermHandler = xoops_getHandler('groupperm');
// access rights ------------------------------------------
$grouppermHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId);
Expand Down
4 changes: 2 additions & 2 deletions include/onuninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

/**
* Prepares system prior to attempting to uninstall module
* @param XoopsModule $module {@link XoopsModule}
* @param \XoopsModule $module {@link XoopsModule}
*
* @return bool true if ready to uninstall, false if not
*/
Expand All @@ -24,7 +24,7 @@ function xoops_module_pre_uninstall_newbb(\XoopsModule $module)

/**
* Performs tasks required during uninstallation of the module
* @param XoopsModule $module {@link XoopsModule}
* @param \XoopsModule $module {@link XoopsModule}
*
* @return bool true if uninstallation successful, false if not
*/
Expand Down
Loading

0 comments on commit fe7ae8b

Please sign in to comment.