diff --git a/htdocs/class/model/write.php b/htdocs/class/model/write.php index 8b306e782..18adf3fe8 100644 --- a/htdocs/class/model/write.php +++ b/htdocs/class/model/write.php @@ -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)) { @@ -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()) { @@ -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; } } @@ -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; } @@ -329,8 +326,7 @@ 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(); @@ -338,7 +334,7 @@ public function deleteAll(?CriteriaElement $criteria = null, $force = true, $asO return false; } } - if (!$this->handler->db->{$queryFunc}($sql)) { + if (!$this->handler->db->exec($sql)) { return false; } @@ -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; } diff --git a/htdocs/install/sql/mysql.structure.sql b/htdocs/install/sql/mysql.structure.sql index 7c298dabb..b17bd2b8c 100644 --- a/htdocs/install/sql/mysql.structure.sql +++ b/htdocs/install/sql/mysql.structure.sql @@ -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 '', @@ -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; diff --git a/htdocs/modules/profile/include/install.php b/htdocs/modules/profile/include/install.php index 7d6900b93..7026cd9ab 100644 --- a/htdocs/modules/profile/include/install.php +++ b/htdocs/modules/profile/include/install.php @@ -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})"); } /** @@ -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})"); } diff --git a/htdocs/modules/system/admin/modulesadmin/modulesadmin.php b/htdocs/modules/system/admin/modulesadmin/modulesadmin.php index 0ef2aa442..660f4ce6c 100644 --- a/htdocs/modules/system/admin/modulesadmin/modulesadmin.php +++ b/htdocs/modules/system/admin/modulesadmin/modulesadmin.php @@ -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; diff --git a/htdocs/xoops_lib/modules/protector/oninstall.php b/htdocs/xoops_lib/modules/protector/oninstall.php index 136c85f01..8115fd5f7 100644 --- a/htdocs/xoops_lib/modules/protector/oninstall.php +++ b/htdocs/xoops_lib/modules/protector/oninstall.php @@ -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[] = '' . htmlspecialchars($db->error(), ENT_QUOTES | ENT_HTML5) . '
'; //var_dump( $db->error() ) ; diff --git a/htdocs/xoops_lib/modules/protector/onuninstall.php b/htdocs/xoops_lib/modules/protector/onuninstall.php index ac227344b..bb54b59d8 100644 --- a/htdocs/xoops_lib/modules/protector/onuninstall.php +++ b/htdocs/xoops_lib/modules/protector/onuninstall.php @@ -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[] = 'ERROR: Could not drop table ' . htmlspecialchars($prefix_mod . '_' . $regs[1], ENT_QUOTES | ENT_HTML5) . '.
'; } else { $ret[] = 'Table ' . htmlspecialchars($prefix_mod . '_' . $regs[1], ENT_QUOTES | ENT_HTML5) . ' dropped.
'; diff --git a/htdocs/xoops_lib/modules/protector/xoops_version.php b/htdocs/xoops_lib/modules/protector/xoops_version.php index f26109051..87b26089b 100644 --- a/htdocs/xoops_lib/modules/protector/xoops_version.php +++ b/htdocs/xoops_lib/modules/protector/xoops_version.php @@ -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;