diff --git a/libraries/cms/installer/adapter/component.php b/libraries/cms/installer/adapter/component.php index fc18f1da74ed0..8bc698efd0fce 100644 --- a/libraries/cms/installer/adapter/component.php +++ b/libraries/cms/installer/adapter/component.php @@ -593,7 +593,7 @@ protected function storeExtension($deleteExisting = false) // If we are told to delete existing extension entries then do so. if ($deleteExisting) { - $db = $this->parent->getDBO(); + $db = $this->parent->getDbo(); $query = $db->getQuery(true) ->select($db->qn('extension_id')) @@ -633,6 +633,10 @@ protected function storeExtension($deleteExisting = false) } $this->extension->manifest_cache = $this->parent->generateManifestCache(); + if (empty($this->extension->custom_data)) + { + $this->extension->custom_data = '{}'; + } $couldStore = $this->extension->store(); @@ -1128,12 +1132,12 @@ protected function _updateSiteMenus($component_id = null) // Update all menu items which contain 'index.php?option=com_extension' or 'index.php?option=com_extension&...' // to use the new component id. $query = $db->getQuery(true) - ->update('#__menu AS m') - ->set('m.component_id = ' . $db->quote($component_id)) - ->where("m.type = " . $db->quote('component')) - ->where('m.client_id = 0') - ->where('m.link LIKE ' . $db->quote('index.php?option=' . $option) - . " OR m.link LIKE '" . $db->escape('index.php?option=' . $option . '&') . "%'"); + ->update('#__menu') + ->set('component_id = ' . $db->quote($component_id)) + ->where("type = " . $db->quote('component')) + ->where('client_id = 0') + ->where('link LIKE ' . $db->quote('index.php?option=' . $option) + . " OR link LIKE '" . $db->escape('index.php?option=' . $option . '&') . "%'"); $db->setQuery($query); diff --git a/libraries/cms/installer/adapter/file.php b/libraries/cms/installer/adapter/file.php index 8e51a8bec20cb..479e71767d778 100644 --- a/libraries/cms/installer/adapter/file.php +++ b/libraries/cms/installer/adapter/file.php @@ -259,6 +259,7 @@ protected function storeExtension() $this->extension->params = ''; $this->extension->system_data = ''; $this->extension->manifest_cache = $this->parent->generateManifestCache(); + $this->extension->custom_data = '{}'; if (!$this->extension->store()) { @@ -483,7 +484,7 @@ public function uninstall($id) protected function extensionExistsInSystem($extension = null) { // Get a database connector object - $db = $this->parent->getDBO(); + $db = $this->parent->getDbo(); $query = $db->getQuery(true) ->select($db->quoteName('extension_id')) diff --git a/libraries/cms/installer/adapter/package.php b/libraries/cms/installer/adapter/package.php index c9d3916fadd71..546d90960eda1 100644 --- a/libraries/cms/installer/adapter/package.php +++ b/libraries/cms/installer/adapter/package.php @@ -369,6 +369,11 @@ protected function storeExtension() // Update the manifest cache for the entry $this->extension->manifest_cache = $this->parent->generateManifestCache(); + if (empty($this->extension->custom_data)) + { + $this->extension->custom_data = '{}'; + } + if (!$this->extension->store()) { // Install failed, roll back changes @@ -563,7 +568,7 @@ public function uninstall($id) foreach ($manifest->filelist as $extension) { $tmpInstaller = new JInstaller; - $id = $this->_getExtensionID($extension->type, $extension->id, $extension->client, $extension->group); + $id = $this->_getExtensionId($extension->type, $extension->id, $extension->client, $extension->group); $client = JApplicationHelper::getClientInfo($extension->client, true); if ($id) @@ -617,7 +622,7 @@ public function uninstall($id) * * @since 3.1 */ - protected function _getExtensionID($type, $id, $client, $group) + protected function _getExtensionId($type, $id, $client, $group) { $db = $this->parent->getDbo(); diff --git a/libraries/joomla/database/driver/sqlsrv.php b/libraries/joomla/database/driver/sqlsrv.php index 4a6664726b65d..12fca5a15f2e5 100644 --- a/libraries/joomla/database/driver/sqlsrv.php +++ b/libraries/joomla/database/driver/sqlsrv.php @@ -138,7 +138,7 @@ public function connect() } // Set charactersets. - $this->utf = $this->setUTF(); + $this->utf = $this->setUtf(); } /** @@ -362,6 +362,10 @@ public function getTableColumns($table, $typeOnly = true) { foreach ($fields as $field) { + if (stristr(strtolower($field->Type), "nvarchar")) + { + $field->Default = ""; + } $result[$field->Field] = $field; } } @@ -486,6 +490,7 @@ public function insertObject($table, &$object, $key = null) $fields[] = $this->quoteName($k); $values[] = $this->Quote($v); } + // Set the query and execute the insert. $this->setQuery(sprintf($statement, implode(',', $fields), implode(',', $values))); @@ -647,7 +652,7 @@ public function execute() $this->errorMsg = $errors[0]['message'] . 'SQL=' . $query; // Throw the normal query exception. - JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'databasequery'); + JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'database-error'); throw new RuntimeException($this->errorMsg, $this->errorNum); } @@ -663,8 +668,8 @@ public function execute() $this->errorMsg = $errors[0]['message'] . 'SQL=' . $query; // Throw the normal query exception. - JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'databasequery'); - throw new RuntimeException($this->errorMsg, $this->errorNum); + JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'database-error'); + throw new Exception($this->errorMsg, $this->errorNum); } } @@ -807,7 +812,7 @@ public function select($database) * * @since 12.1 */ - public function setUTF() + public function setUtf() { return false; } diff --git a/libraries/joomla/table/asset.php b/libraries/joomla/table/asset.php index 37b8ddca433f5..2901ad763649a 100644 --- a/libraries/joomla/table/asset.php +++ b/libraries/joomla/table/asset.php @@ -98,6 +98,10 @@ public function loadByName($name) public function check() { $this->parent_id = (int) $this->parent_id; + if (empty($this->rules)) + { + $this->rules = '{}'; + } // JTableNested does not allow parent_id = 0, override this. if ($this->parent_id > 0) @@ -116,13 +120,8 @@ public function check() else { $this->setError('Invalid Parent ID'); - return false; } - if (empty($this->rules)) - { - $this->rules = '{}'; - } } return true; diff --git a/libraries/legacy/table/category.php b/libraries/legacy/table/category.php index be8a1e36cb4d1..506a6e0ad9204 100644 --- a/libraries/legacy/table/category.php +++ b/libraries/legacy/table/category.php @@ -227,7 +227,7 @@ public function store($updateNulls = false) // Verify that the alias is unique $table = JTable::getInstance('Category', 'JTable', array('dbo' => $this->getDbo())); - if ($table->load(array('alias' => $this->alias, 'parent_id' => $this->parent_id, 'extension' => $this->extension)) + if ($table->load(array('alias' => $this->alias, 'parent_id' => (int) $this->parent_id, 'extension' => $this->extension)) && ($table->id != $this->id || $this->id == 0)) { $this->setError(JText::_('JLIB_DATABASE_ERROR_CATEGORY_UNIQUE_ALIAS')); diff --git a/libraries/legacy/table/menu.php b/libraries/legacy/table/menu.php index 238cae7e8f3a3..747ca19aeb598 100644 --- a/libraries/legacy/table/menu.php +++ b/libraries/legacy/table/menu.php @@ -111,6 +111,22 @@ public function check() $this->alias = $this->title; } + // Check for a path. + if (trim($this->path) == '') + { + $this->path = $this->alias; + } + // Check for params. + if (trim($this->params) == '') + { + $this->params = '{}'; + } + // Check for img. + if (trim($this->img) == '') + { + $this->img = ' '; + } + // Make the alias URL safe. $this->alias = JApplication::stringURLSafe($this->alias);