diff --git a/administrator/components/com_contenthistory/models/history.php b/administrator/components/com_contenthistory/models/history.php index cdf85f017f34d..79d9d8045649f 100644 --- a/administrator/components/com_contenthistory/models/history.php +++ b/administrator/components/com_contenthistory/models/history.php @@ -269,8 +269,8 @@ protected function getListQuery() ) ) ->from($db->quoteName('#__ucm_history') . ' AS h') - ->where($db->quoteName('h.ucm_item_id') . ' = ' . $this->getState('item_id')) - ->where($db->quoteName('h.ucm_type_id') . ' = ' . $this->getState('type_id')) + ->where($db->quoteName('h.ucm_item_id') . ' = ' . (int) $this->getState('item_id')) + ->where($db->quoteName('h.ucm_type_id') . ' = ' . (int) $this->getState('type_id')) // Join over the users for the editor ->select('uc.name AS editor') diff --git a/libraries/cms/table/contenthistory.php b/libraries/cms/table/contenthistory.php index 75cc60dcf1d2f..7c82c47bb86ec 100644 --- a/libraries/cms/table/contenthistory.php +++ b/libraries/cms/table/contenthistory.php @@ -162,8 +162,8 @@ public function getHashMatch() $query = $db->getQuery(true); $query->select('*') ->from($db->quoteName('#__ucm_history')) - ->where($db->quoteName('ucm_item_id') . ' = ' . $this->get('ucm_item_id')) - ->where($db->quoteName('ucm_type_id') . ' = ' . $this->get('ucm_type_id')) + ->where($db->quoteName('ucm_item_id') . ' = ' . (int) $this->get('ucm_item_id')) + ->where($db->quoteName('ucm_type_id') . ' = ' . (int) $this->get('ucm_type_id')) ->where($db->quoteName('sha1_hash') . ' = ' . $db->quote($this->get('sha1_hash'))); $db->setQuery($query, 0, 1); @@ -188,8 +188,8 @@ public function deleteOldVersions($maxVersions) $query = $db->getQuery(true); $query->select($db->quoteName('version_id')) ->from($db->quoteName('#__ucm_history')) - ->where($db->quoteName('ucm_item_id') . ' = ' . (int) $this->ucm_item_id) - ->where($db->quoteName('ucm_type_id') . ' = ' . (int) $this->ucm_type_id) + ->where($db->quoteName('ucm_item_id') . ' = ' . (int) $this->get('ucm_item_id')) + ->where($db->quoteName('ucm_type_id') . ' = ' . (int) $this->get('ucm_type_id')) ->where($db->quoteName('keep_forever') . ' != 1') ->order($db->quoteName('save_date') . ' DESC '); $db->setQuery($query, 0, (int) $maxVersions); @@ -201,8 +201,8 @@ public function deleteOldVersions($maxVersions) // Delete any rows not in our list and and not flagged to keep forever. $query = $db->getQuery(true); $query->delete($db->quoteName('#__ucm_history')) - ->where($db->quoteName('ucm_item_id') . ' = ' . (int) $this->ucm_item_id) - ->where($db->quoteName('ucm_type_id') . ' = ' . (int) $this->ucm_type_id) + ->where($db->quoteName('ucm_item_id') . ' = ' . (int) $this->get('ucm_item_id')) + ->where($db->quoteName('ucm_type_id') . ' = ' . (int) $this->get('ucm_type_id')) ->where($db->quoteName('version_id') . ' NOT IN (' . implode(',', $idsToSave) . ')') ->where($db->quoteName('keep_forever') . ' != 1'); $db->setQuery($query);