Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions htdocs/banners.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ function bannerstats()
);
}
$i = 0;
while (false !== ([$bid, $imptotal, $impmade, $clicks, $date] = $xoopsDB->fetchRow($result))) {
while (false !== ($row = $xoopsDB->fetchRow($result))) {
[$bid, $imptotal, $impmade, $clicks, $date] = $row;
if ($impmade == 0) {
$percent = 0;
} else {
Expand Down Expand Up @@ -177,7 +178,8 @@ function bannerstats()
E_USER_ERROR,
);
}
while (false !== ([$bid, $imageurl, $clickurl, $htmlbanner, $htmlcode] = $xoopsDB->fetchRow($result))) {
while (false !== ($row = $xoopsDB->fetchRow($result))) {
[$bid, $imageurl, $clickurl, $htmlbanner, $htmlcode] = $row;
$numrows = $xoopsDB->getRowsNum($result);
if ($numrows > 1) {
echo '<br>';
Expand Down Expand Up @@ -230,7 +232,8 @@ function bannerstats()
<tfoot><tr><td colspan='6'></td></tr></tfoot>";

$i = 0;
while (false !== ([$bid, $impressions, $clicks, $datestart, $dateend] = $xoopsDB->fetchRow($result))) {
while (false !== ($row = $xoopsDB->fetchRow($result))) {
[$bid, $impressions, $clicks, $datestart, $dateend] = $row;
if ($impressions == 0) {
$percent = 0;
} else {
Expand Down
3 changes: 2 additions & 1 deletion htdocs/class/model/joint.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ public function getCountsByLink(?CriteriaElement $criteria = null)
return false;
}
$ret = [];
while (false !== ([$id, $count] = $this->handler->db->fetchRow($result))) {
while (false !== ($row = $this->handler->db->fetchRow($result))) {
[$id, $count] = $row;
$ret[$id] = $count;
}

Expand Down
6 changes: 4 additions & 2 deletions htdocs/class/model/stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public function getCount(?CriteriaElement $criteria = null)
return (int) $count;
} else {
$ret = [];
while (false !== ([$id, $count] = $this->handler->db->fetchRow($result))) {
while (false !== ($row = $this->handler->db->fetchRow($result))) {
[$id, $count] = $row;
$ret[$id] = (int) $count;
}

Expand Down Expand Up @@ -92,7 +93,8 @@ public function getCounts(?CriteriaElement $criteria = null)
if (!$this->handler->db->isResultSet($result)) {
return $ret;
}
while (false !== ([$id, $count] = $this->handler->db->fetchRow($result))) {
while (false !== ($row = $this->handler->db->fetchRow($result))) {
[$id, $count] = $row;
$ret[$id] = (int) $count;
}

Expand Down
9 changes: 6 additions & 3 deletions htdocs/class/xoopstree.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ public function getFirstChildId($sel_id)
if ($count == 0) {
return $idarray;
}
while (false !== ([$id] = $this->db->fetchRow($result))) {
while (false !== ($row = $this->db->fetchRow($result))) {
[$id] = $row;
$idarray[] = $id;
}

Expand Down Expand Up @@ -144,7 +145,8 @@ public function getAllChildId($sel_id, $order = '', $idarray = [])
if ($count == 0) {
return $idarray;
}
while (false !== ([$r_id] = $this->db->fetchRow($result))) {
while (false !== ($row = $this->db->fetchRow($result))) {
[$r_id] = $row;
$idarray[] = $r_id;
$idarray = $this->getAllChildId($r_id, $order, $idarray);
}
Expand Down Expand Up @@ -258,7 +260,8 @@ public function makeMySelBox($title, $order = '', $preset_id = 0, $none = 0, $se
if ($none) {
echo "<option value='0'>----</option>\n";
}
while (false !== ([$catid, $name] = $this->db->fetchRow($result))) {
while (false !== ($row = $this->db->fetchRow($result))) {
[$catid, $name] = $row;
$sel = '';
if ($catid == $preset_id) {
$sel = " selected";
Expand Down
4 changes: 3 additions & 1 deletion htdocs/kernel/session.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ public function read($sessionId): string

$result = $this->db->queryF($sql);
if ($this->db->isResultSet($result)) {
if ([$sess_data, $sess_ip] = $this->db->fetchRow($result)) {
$row = $this->db->fetchRow($result);
if (false !== $row) {
[$sess_data, $sess_ip] = $row;
if ($this->securityLevel > 1) {
if (false === $ip->sameSubnet(
$sess_ip,
Expand Down
3 changes: 2 additions & 1 deletion htdocs/modules/profile/class/visibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public function getVisibleFields($profile_groups, $user_groups = null)
$field_ids = [];
$result = $this->db->query($sql);
if ($this->db->isResultSet($result)) {
while (false !== ([$field_id] = $this->db->fetchRow($result))) {
while (false !== ($row = $this->db->fetchRow($result))) {
[$field_id] = $row;
$field_ids[] = $field_id;
}
}
Expand Down
2 changes: 1 addition & 1 deletion htdocs/modules/system/class/maintenance.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ public function dump_table_datas($ret, $table)

$ret[0] .= 'INSERT INTO `' . $table . "` values\n";
$index = 0;
while ($row = $this->db->fetchRow($result)) {
while (false !== ($row = $this->db->fetchRow($result))) {
++$count;
$ret[0] .= '(';
for ($i = 0; $i < $num_fields; ++$i) {
Expand Down
3 changes: 2 additions & 1 deletion htdocs/modules/system/include/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ function update_system_v211($module)
);
}
$tplids = [];
while (false !== ([$tplid] = $xoopsDB->fetchRow($result))) {
while (false !== ($row = $xoopsDB->fetchRow($result))) {
[$tplid] = $row;
$tplids[] = $tplid;
}
if (count($tplids) > 0) {
Expand Down
3 changes: 2 additions & 1 deletion htdocs/pda.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
echo "<img src='images/logo.gif' alt='" . htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES | ENT_HTML5) . "' border='0' /><br>";
echo '<h2>' . htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES | ENT_HTML5) . '</h2>';
echo '<div>';
while (false !== ([$storyid, $title] = $xoopsDB->fetchRow($result))) {
while (false !== ($row = $xoopsDB->fetchRow($result))) {
[$storyid, $title] = $row;
echo "<a href='" . XOOPS_URL . "/modules/news/print.php?storyid=$storyid'>" . htmlspecialchars($title, ENT_QUOTES | ENT_HTML5) . '</a><br>';
}
echo '</div>';
Expand Down
17 changes: 10 additions & 7 deletions htdocs/xoops_lib/modules/protector/admin/center.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,13 @@ class FileWriteException extends RuntimeException {}
$lid = (int) $lid;
$sql = "SELECT `ip` FROM $log_table WHERE lid='$lid'";
$result = $db->query($sql);

if (!$db->isResultSet($result)) {
[$ip] = $db->fetchRow($result);
$protector->register_bad_ips(0, $ip);
if ($db->isResultSet($result)) {
$row = $db->fetchRow($result);
if (false !== $row) {
[$ip] = $row;
Comment on lines +120 to +123
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic is inverted. The condition should check !$db->isResultSet($result) as in the original code. isResultSet() returns true for valid result sets, but you want to process the data when you have a valid result set, not when you don't.

Copilot uses AI. Check for mistakes.
$protector->register_bad_ips(0, $ip);
}
}

if ($db->isResultSet($result)) {
$db->freeRecordSet($result);
}
Expand All @@ -147,7 +148,8 @@ class FileWriteException extends RuntimeException {}
}
$buf = [];
$ids = [];
while (false !== ([$lid, $ip, $type] = $db->fetchRow($result))) {
while (false !== ($row = $db->fetchRow($result))) {
[$lid, $ip, $type] = $row;
if (isset($buf[$ip . $type])) {
$ids[] = $lid;
} else {
Expand Down Expand Up @@ -294,7 +296,8 @@ class FileWriteException extends RuntimeException {}

// body of log listing
$oddeven = 'odd';
while (false !== ([$lid, $uid, $ip, $agent, $type, $description, $timestamp, $uname] = $db->fetchRow($result))) {
while (false !== ($row = $db->fetchRow($result))) {
[$lid, $uid, $ip, $agent, $type, $description, $timestamp, $uname] = $row;
$oddeven = ($oddeven === 'odd' ? 'even' : 'odd');
$style = '';

Expand Down