Skip to content
Merged
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
19 changes: 7 additions & 12 deletions htdocs/class/model/write.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,6 @@ public function insert($object, $force = true)

return $object->getVar($this->handler->keyName);
}
$queryFunc = empty($force) ? 'query' : 'exec';

if ($object->isNew()) {
$sql = 'INSERT INTO `' . $this->handler->table . '`';
if (!empty($object->cleanVars)) {
Expand All @@ -263,7 +261,7 @@ public function insert($object, $force = true)

return $object->getVar($this->handler->keyName);
}
if (!$result = $this->handler->db->{$queryFunc}($sql)) {
if (!$this->handler->db->exec($sql)) {
return false;
}
if (!$object->getVar($this->handler->keyName) && $object_id = $this->handler->db->getInsertId()) {
Expand All @@ -275,7 +273,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));
if (!$result = $this->handler->db->{$queryFunc}($sql)) {
if (!$this->handler->db->exec($sql)) {
return false;
}
}
Expand All @@ -302,9 +300,8 @@ public function delete($object, $force = false)
} else {
$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';
$result = $this->handler->db->{$queryFunc}($sql);
$sql = 'DELETE FROM `' . $this->handler->table . '` WHERE ' . $whereclause;
$result = $this->handler->db->exec($sql);

return empty($result) ? false : true;
}
Expand All @@ -329,16 +326,15 @@ public function deleteAll(?CriteriaElement $criteria = null, $force = true, $asO

return $num;
}
$queryFunc = empty($force) ? 'query' : 'exec';
$sql = 'DELETE FROM ' . $this->handler->table;
$sql = 'DELETE FROM ' . $this->handler->table;
if (!empty($criteria)) {
if (is_subclass_of($criteria, 'CriteriaElement')) {
$sql .= ' ' . $criteria->renderWhere();
} else {
return false;
}
}
if (!$this->handler->db->{$queryFunc}($sql)) {
if (!$this->handler->db->exec($sql)) {
return false;
}

Expand Down Expand Up @@ -368,8 +364,7 @@ public function updateAll($fieldname, $fieldvalue, ?CriteriaElement $criteria =
if (isset($criteria) && \method_exists($criteria, 'renderWhere')) {
$sql .= ' ' . $criteria->renderWhere();
}
$queryFunc = empty($force) ? 'query' : 'exec';
$result = $this->handler->db->{$queryFunc}($sql);
$result = $this->handler->db->exec($sql);

return empty($result) ? false : true;
}
Expand Down
4 changes: 2 additions & 2 deletions 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,
Comment thread
coderabbitai[bot] marked this conversation as resolved.
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 Expand Up @@ -193,7 +193,7 @@ CREATE TABLE configoption (
confop_id mediumint(8) unsigned NOT NULL auto_increment,
confop_name varchar(255) NOT NULL default '',
confop_value varchar(255) NOT NULL default '',
conf_id smallint(5) unsigned NOT NULL default '0',
conf_id int(10) unsigned NOT NULL default '0',
PRIMARY KEY (confop_id),
KEY conf_id (conf_id)
) ENGINE=MyISAM;
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.0';
$modversion['min_xoops'] = '2.5.12';

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