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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions htdocs/class/model/write.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ public function insert($object, $force = true)

if ($object->isNew()) {
$sql = 'INSERT INTO `' . $this->handler->table . '`';
$queryFunc = 'exec';
if (!empty($object->cleanVars)) {
$keys = array_keys($object->cleanVars);
$vals = array_values($object->cleanVars);
Expand All @@ -275,6 +276,7 @@ public function insert($object, $force = true)
$keys[] = " `{$k}` = {$v}";
}
$sql = 'UPDATE `' . $this->handler->table . '` SET ' . implode(',', $keys) . ' WHERE `' . $this->handler->keyName . '` = ' . $this->handler->db->quote($object->getVar($this->handler->keyName));
$queryFunc = 'exec';
if (!$result = $this->handler->db->{$queryFunc}($sql)) {
return false;
}
Expand Down Expand Up @@ -303,7 +305,8 @@ public function delete($object, $force = false)
$whereclause = '`' . $this->handler->keyName . '` = ' . $this->handler->db->quote($object->getVar($this->handler->keyName));
}
$sql = 'DELETE FROM `' . $this->handler->table . '` WHERE ' . $whereclause;
$queryFunc = empty($force) ? 'query' : 'exec';
// $queryFunc = empty($force) ? 'query' : 'exec';
$queryFunc = 'exec';
Comment on lines +308 to +309
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

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

These commented-out lines should be removed rather than kept as comments. The old logic that conditionally chose between 'query' and 'exec' based on the $force parameter has been replaced with always using 'exec', which is the correct approach for DELETE operations. Leaving commented code reduces maintainability.

Copilot uses AI. Check for mistakes.
$result = $this->handler->db->{$queryFunc}($sql);

return empty($result) ? false : true;
Expand All @@ -329,7 +332,8 @@ public function deleteAll(?CriteriaElement $criteria = null, $force = true, $asO

return $num;
}
$queryFunc = empty($force) ? 'query' : 'exec';
// $queryFunc = empty($force) ? 'query' : 'exec';
$queryFunc = 'exec';
Comment on lines +335 to +336
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

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

These commented-out lines should be removed rather than kept as comments. The old logic that conditionally chose between 'query' and 'exec' based on the $force parameter has been replaced with always using 'exec', which is the correct approach for DELETE operations. Leaving commented code reduces maintainability.

Copilot uses AI. Check for mistakes.
$sql = 'DELETE FROM ' . $this->handler->table;
if (!empty($criteria)) {
if (is_subclass_of($criteria, 'CriteriaElement')) {
Expand Down Expand Up @@ -368,7 +372,8 @@ public function updateAll($fieldname, $fieldvalue, ?CriteriaElement $criteria =
if (isset($criteria) && \method_exists($criteria, 'renderWhere')) {
$sql .= ' ' . $criteria->renderWhere();
}
$queryFunc = empty($force) ? 'query' : 'exec';
// $queryFunc = empty($force) ? 'query' : 'exec';
$queryFunc = 'exec';
Comment on lines +375 to +376
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

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

These commented-out lines should be removed rather than kept as comments. The old logic that conditionally chose between 'query' and 'exec' based on the $force parameter has been replaced with always using 'exec', which is the correct approach for UPDATE operations. Leaving commented code reduces maintainability.

Copilot uses AI. Check for mistakes.
$result = $this->handler->db->{$queryFunc}($sql);

return empty($result) ? false : true;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/install/sql/mysql.structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ CREATE TABLE xoopsnotifications (
#

CREATE TABLE config (
conf_id smallint(5) unsigned NOT NULL auto_increment,
conf_id int(10) unsigned NOT NULL auto_increment,
conf_modid smallint(5) unsigned NOT NULL default '0',
conf_catid smallint(5) unsigned NOT NULL default '0',
conf_name varchar(25) NOT NULL default '',
Expand Down
4 changes: 2 additions & 2 deletions htdocs/modules/profile/include/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ function profile_install_setPermissions($field_id, $module_id, $canedit, $visibl
*/
function profile_install_addCategory($name, $weight)
{
$GLOBALS['xoopsDB']->query('INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('profile_category') . ' VALUES (0, ' . $GLOBALS['xoopsDB']->quote($name) . ", '', {$weight})");
$GLOBALS['xoopsDB']->exec('INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('profile_category') . ' VALUES (0, ' . $GLOBALS['xoopsDB']->quote($name) . ", '', {$weight})");
}

/**
Expand All @@ -223,5 +223,5 @@ function profile_install_addCategory($name, $weight)
*/
function profile_install_addStep($name, $desc, $order, $save)
{
$GLOBALS['xoopsDB']->query('INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('profile_regstep') . ' VALUES (0, ' . $GLOBALS['xoopsDB']->quote($name) . ', ' . $GLOBALS['xoopsDB']->quote($desc) . ", {$order}, {$save})");
$GLOBALS['xoopsDB']->exec('INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('profile_regstep') . ' VALUES (0, ' . $GLOBALS['xoopsDB']->quote($name) . ', ' . $GLOBALS['xoopsDB']->quote($desc) . ", {$order}, {$save})");
}
2 changes: 1 addition & 1 deletion htdocs/modules/system/admin/modulesadmin/modulesadmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function xoops_module_install($dirname)
// check if the table name is reserved
if (!in_array($prefixed_query[4], $reservedTables)) {
// not reserved, so try to create one
if (!$db->query($prefixed_query[0])) {
if (!$db->exec($prefixed_query[0])) {
$errs[] = $db->error();
$error = true;
break;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/xoops_lib/modules/protector/oninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function protector_oninstall_base($module, $mydirname)

return false;
}
if (!$db->query($prefixed_query[0])) {
if (!$db->exec($prefixed_query[0])) {
$ret[] = '<b>' . htmlspecialchars($db->error(), ENT_QUOTES | ENT_HTML5) . '</b><br>';

//var_dump( $db->error() ) ;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/xoops_lib/modules/protector/onuninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function protector_onuninstall_base($module, $mydirname)
foreach ($sql_lines as $sql_line) {
if (preg_match('/^CREATE TABLE \`?([a-zA-Z0-9_-]+)\`? /i', $sql_line, $regs)) {
$sql = 'DROP TABLE ' . addslashes($prefix_mod . '_' . $regs[1]);
if (!$db->query($sql)) {
if (!$db->exec($sql)) {
$ret[] = '<span style="color:#ff0000;">ERROR: Could not drop table <b>' . htmlspecialchars($prefix_mod . '_' . $regs[1], ENT_QUOTES | ENT_HTML5) . '<b>.</span><br>';
} else {
$ret[] = 'Table <b>' . htmlspecialchars($prefix_mod . '_' . $regs[1], ENT_QUOTES | ENT_HTML5) . '</b> dropped.<br>';
Expand Down
4 changes: 2 additions & 2 deletions htdocs/xoops_lib/modules/protector/xoops_version.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
$modversion['release_date'] = '2019/02/18';
$modversion['module_website_url'] = 'https://xoops.org/';
$modversion['module_website_name'] = 'XOOPS';
$modversion['min_php'] = '5.6.0';
$modversion['min_xoops'] = '2.5.11';
$modversion['min_php'] = '7.4';
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

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

The version string '7.4' is inconsistent with the previous format '5.6.0' and other modules in the codebase that use three-component version strings (e.g., '5.6.0' in pm/xoops_version.php and profile/xoops_version.php). While functionally equivalent in version_compare(), it's better to maintain consistency with the established format. Consider using '7.4.0' instead.

Suggested change
$modversion['min_php'] = '7.4';
$modversion['min_php'] = '7.4.0';

Copilot uses AI. Check for mistakes.
$modversion['min_xoops'] = '2.5.12';

// Any tables can't be touched by modulesadmin.
$modversion['sqlfile'] = false;
Expand Down