Skip to content

Commit

Permalink
Merge branch 'staging' into jroute-workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
infograf768 committed Aug 8, 2019
2 parents 955c92a + c372ec3 commit 4b6e9f1
Show file tree
Hide file tree
Showing 116 changed files with 956 additions and 702 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
custom: https://community.joomla.org/sponsorship-campaigns.html
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ Desktop.ini
/libraries/vendor/simplepie/simplepie/idn/ReadMe.txt
/libraries/vendor/simplepie/simplepie/composer.json
/libraries/vendor/typo3/phar-stream-wrapper/tests
/libraries/vendor/typo3/phar-stream-wrapper/.appveyor.yml
/libraries/vendor/typo3/phar-stream-wrapper/.gitattributes
/libraries/vendor/typo3/phar-stream-wrapper/.gitignore
/libraries/vendor/typo3/phar-stream-wrapper/.travis.yml
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Build Status
---------------------
| Travis-CI | Drone-CI | AppVeyor |
| ------------- | ------------- | ------------- |
| [![Build Status](https://travis-ci.org/joomla/joomla-cms.svg?branch=staging)](https://travis-ci.org/joomla/joomla-cms) | [![Build Status](http://213.160.72.75/api/badges/joomla/joomla-cms/status.svg)](http://213.160.72.75/joomla/joomla-cms) | [![Build status](https://ci.appveyor.com/api/projects/status/bpcxulw6nnxlv8kb/branch/staging?svg=true)](https://ci.appveyor.com/project/joomla/joomla-cms) |
| [![Build Status](https://travis-ci.org/joomla/joomla-cms.svg?branch=staging)](https://travis-ci.org/joomla/joomla-cms) | [![Build Status](https://ci.joomla.org/api/badges/joomla/joomla-cms/status.svg)](https://ci.joomla.org/joomla/joomla-cms) | [![Build status](https://ci.appveyor.com/api/projects/status/ru6sxal8jmfckvjc/branch/staging?svg=true)](https://ci.appveyor.com/project/release-joomla/joomla-cms) |

What is this?
---------------------
Expand Down Expand Up @@ -87,6 +87,5 @@ Do you want to improve Joomla?
Copyright
---------------------
* Copyright (C) 2005 - 2019 Open Source Matters. All rights reserved.
* [Special Thanks](https://docs.joomla.org/Special:MyLanguage/Joomla!_Credits_and_Thanks)
* Distributed under the GNU General Public License version 2 or later
* See [License details](https://docs.joomla.org/Special:MyLanguage/Joomla_Licenses)
3 changes: 1 addition & 2 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,5 @@

Copyright:
* Copyright (C) 2005 - 2019 Open Source Matters. All rights reserved.
* Special Thanks: https://docs.joomla.org/Special:MyLanguage/Joomla!_Credits_and_Thanks
* Distributed under the GNU General Public License version 2 or later
* See Licenses details at https://docs.joomla.org/Special:MyLanguage/Joomla_Licenses
* See License details at https://docs.joomla.org/Special:MyLanguage/Joomla_Licenses
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ protected function getOptions()
// Construct the query
$query = $db->getQuery(true)
->select($db->quoteName('u.id', 'value'))
->select($db->quoteName('u.name', 'text'))
->select($db->quoteName('u.username', 'text'))
->from($db->quoteName('#__users', 'u'))
->join('INNER', $db->quoteName('#__action_logs', 'c') . ' ON ' . $db->quoteName('c.user_id') . ' = ' . $db->quoteName('u.id'))
->group($db->quoteName('u.id'))
->group($db->quoteName('u.name'))
->order($db->quoteName('u.name'));
->group($db->quoteName('u.username'))
->order($db->quoteName('u.username'));

// Setup the query
$db->setQuery($query);
Expand Down
10 changes: 5 additions & 5 deletions administrator/components/com_admin/models/sysinfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ public function getDirectory($public = false)

foreach ($admin_langs as $folder)
{
if (!$folder->isDir() || $folder->isDot())
if ($folder->isDot() || !$folder->isDir())
{
continue;
}
Expand All @@ -546,7 +546,7 @@ public function getDirectory($public = false)

foreach ($manifests as $folder)
{
if (!$folder->isDir() || $folder->isDot())
if ($folder->isDot() || !$folder->isDir())
{
continue;
}
Expand All @@ -569,7 +569,7 @@ public function getDirectory($public = false)

foreach ($image_folders as $folder)
{
if (!$folder->isDir() || $folder->isDot())
if ($folder->isDot() || !$folder->isDir())
{
continue;
}
Expand All @@ -587,7 +587,7 @@ public function getDirectory($public = false)

foreach ($site_langs as $folder)
{
if (!$folder->isDir() || $folder->isDot())
if ($folder->isDot() || !$folder->isDir())
{
continue;
}
Expand All @@ -605,7 +605,7 @@ public function getDirectory($public = false)

foreach ($plugin_groups as $folder)
{
if (!$folder->isDir() || $folder->isDot())
if ($folder->isDot() || !$folder->isDir())
{
continue;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `#__template_styles` MODIFY `home` char(7) NOT NULL DEFAULT '0';
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ALTER TABLE `#__template_styles` DROP INDEX `idx_home`;
# Query removed, see https://github.com/joomla/joomla-cms/pull/25484
ALTER TABLE `#__template_styles` ADD INDEX `idx_client_id` (`client_id`);
ALTER TABLE `#__template_styles` ADD INDEX `idx_client_id_home` (`client_id`, `home`);
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE "#__template_styles" ALTER COLUMN "home" TYPE character varying(7);
ALTER TABLE "#__template_styles" ALTER COLUMN "home" SET DEFAULT '0';
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DROP INDEX IF EXISTS "#__template_styles_idx_home";
# Queries removed, see https://github.com/joomla/joomla-cms/pull/25484
CREATE INDEX "#__template_styles_idx_client_id" ON "#__template_styles" ("client_id");
CREATE INDEX "#__template_styles_idx_client_id_home" ON "#__template_styles" ("client_id", "home");
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE [#__template_styles] ALTER COLUMN [home] nvarchar(7) NOT NULL;
ALTER TABLE [#__template_styles] ADD DEFAULT ('0') FOR [home];
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
DROP INDEX [idx_home] ON [#__template_styles];
# Query removed, see https://github.com/joomla/joomla-cms/pull/25484
CREATE NONCLUSTERED INDEX [idx_client_id] ON [#__template_styles]
(
[client_id] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF);
CREATE NONCLUSTERED INDEX [idx_client_id_home] ON [#__template_styles]
(
[client_id] ASC,
[home] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF);
ALTER TABLE [#__template_styles] ADD DEFAULT (0) FOR [home];
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
data-item="<?php echo $this->typeName; ?>"
data-id="<?php echo $this->referenceId; ?>"
data-title="<?php echo $this->referenceTitle; ?>"
data-title-value="<?php echo $this->referenceTitleValue; ?>"
data-language="<?php echo $this->referenceLanguage; ?>"
data-editurl="<?php echo JRoute::_($this->editUri); ?>">
</iframe>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ public function display($tpl = null)
$referenceId = $input->get('id', 0, 'int');
$reference = ArrayHelper::fromObject(AssociationsHelper::getItem($extensionName, $typeName, $referenceId));

$this->referenceLanguage = $reference[$languageField];
$this->referenceTitle = AssociationsHelper::getTypeFieldName($extensionName, $typeName, 'title');
$this->referenceLanguage = $reference[$languageField];
$this->referenceTitle = AssociationsHelper::getTypeFieldName($extensionName, $typeName, 'title');
$this->referenceTitleValue = $reference[$this->referenceTitle];

$options = array(
'option' => $typeName === 'category' ? 'com_categories' : $extensionName,
Expand Down
38 changes: 20 additions & 18 deletions administrator/components/com_banners/models/banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,17 @@ protected function batchClient($value, $pks, $contexts)
*/
protected function canDelete($record)
{
if (!empty($record->id))
if (empty($record->id) || $record->state != -2)
{
if ($record->state != -2)
{
return false;
}

if (!empty($record->catid))
{
return JFactory::getUser()->authorise('core.delete', 'com_banners.category.' . (int) $record->catid);
}
return false;
}

return parent::canDelete($record);
if (!empty($record->catid))
{
return JFactory::getUser()->authorise('core.delete', 'com_banners.category.' . (int) $record->catid);
}

return parent::canDelete($record);
}

/**
Expand Down Expand Up @@ -383,6 +380,9 @@ protected function preprocessForm(JForm $form, $data, $group = 'content')
if ($this->canCreateCategory())
{
$form->setFieldAttribute('catid', 'allowAdd', 'true');

// Add a prefix for categories created on the fly.
$form->setFieldAttribute('catid', 'customPrefix', '#new#');
}

parent::preprocessForm($form, $data, $group);
Expand All @@ -403,20 +403,22 @@ public function save($data)

JLoader::register('CategoriesHelper', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/categories.php');

// Cast catid to integer for comparison
$catid = (int) $data['catid'];
// Create new category, if needed.
$createCategory = true;

// Check if New Category exists
if ($catid > 0)
// If category ID is provided, check if it's valid.
if (is_numeric($data['catid']) && $data['catid'])
{
$catid = CategoriesHelper::validateCategoryId($data['catid'], 'com_banners');
$createCategory = !CategoriesHelper::validateCategoryId($data['catid'], 'com_banners');
}

// Save New Category
if ($catid == 0 && $this->canCreateCategory())
if ($createCategory && $this->canCreateCategory())
{
$table = array();
$table['title'] = $data['catid'];

// Remove #new# prefix, if exists.
$table['title'] = strpos($data['catid'], '#new#') === 0 ? substr($data['catid'], 5) : $data['catid'];
$table['parent_id'] = 1;
$table['extension'] = 'com_banners';
$table['language'] = $data['language'];
Expand Down
21 changes: 8 additions & 13 deletions administrator/components/com_banners/models/client.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,17 @@ class BannersModelClient extends JModelAdmin
*/
protected function canDelete($record)
{
if (!empty($record->id))
if (empty($record->id) || $record->state != -2)
{
if ($record->state != -2)
{
return false;
}

$user = JFactory::getUser();

if (!empty($record->catid))
{
return $user->authorise('core.delete', 'com_banners.category.' . (int) $record->catid);
}
return false;
}

return $user->authorise('core.delete', 'com_banners');
if (!empty($record->catid))
{
return JFactory::getUser()->authorise('core.delete', 'com_banners.category.' . (int) $record->catid);
}

return parent::canDelete($record);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@ protected function batchCopy($value, $pks, $contexts)

// Add the new ID to the array
$newIds[$pk] = $newId;

// Copy rules
$query->clear()
->update($db->quoteName('#__assets', 't'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ class JFormFieldCategoryEdit extends JFormFieldList
*/
protected $allowAdd;

/**
* Optional prefix for new categories.
*
* @var string
* @since __DEPLOY_VERSION__
*/
protected $customPrefix;

/**
* A flexible category list that respects access controls
*
Expand Down Expand Up @@ -57,6 +65,7 @@ public function setup(SimpleXMLElement $element, $value, $group = null)
if ($return)
{
$this->allowAdd = isset($this->element['allowAdd']) ? $this->element['allowAdd'] : '';
$this->customPrefix = (string) $this->element['customPrefix'];
}

return $return;
Expand All @@ -76,6 +85,7 @@ public function __get($name)
switch ($name)
{
case 'allowAdd':
case 'customPrefix':
return $this->$name;
}

Expand All @@ -102,6 +112,9 @@ public function __set($name, $value)
$value = (string) $value;
$this->$name = ($value === 'true' || $value === $name || $value === '1');
break;
case 'customPrefix':
$this->$name = (string) $value;
break;
default:
parent::__set($name, $value);
}
Expand Down Expand Up @@ -349,6 +362,11 @@ protected function getInput()
$attr .= ' data-custom_group_text="' . $customGroupText . '" '
. 'data-no_results_text="' . JText::_('JGLOBAL_ADD_CUSTOM_CATEGORY') . '" '
. 'data-placeholder="' . JText::_('JGLOBAL_TYPE_OR_SELECT_CATEGORY') . '" ';

if ($this->customPrefix !== '')
{
$attr .= 'data-custom_value_prefix="' . $this->customPrefix . '" ';
}
}

if ($class)
Expand Down

0 comments on commit 4b6e9f1

Please sign in to comment.