Skip to content

Commit

Permalink
Merge remote-tracking branch 'joomla/3.4-dev' into 3.4-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Babker committed Sep 1, 2014
2 parents 78a6576 + 19fef38 commit ad48831
Show file tree
Hide file tree
Showing 53 changed files with 5,004 additions and 462 deletions.
Expand Up @@ -45,6 +45,7 @@ protected function getOptions()

// Let's get the id for the current item, either category or content item.
$jinput = JFactory::getApplication()->input;

// Load the category options for a given extension.

// For categories the old category is the category id or 0 for new category.
Expand All @@ -63,56 +64,57 @@ protected function getOptions()

$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('a.id AS value, a.title AS text, a.level, a.published')
->from('#__categories AS a')
->join('LEFT', $db->quoteName('#__categories') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt');
->select('DISTINCT a.id AS value, a.title AS text, a.level, a.published');
$subQuery = $db->getQuery(true)
->select('DISTINCT id,title,level,published,parent_id,extension,lft,rgt')
->from('#__categories');

// Filter by the extension type
if ($this->element['parent'] == true || $jinput->get('option') == 'com_categories')
{
$query->where('(a.extension = ' . $db->quote($extension) . ' OR a.parent_id = 0)');
$subQuery->where('(extension = ' . $db->quote($extension) . ' OR parent_id = 0)');
}
else
{
$query->where('(a.extension = ' . $db->quote($extension) . ')');
}
// If parent isn't explicitly stated but we are in com_categories assume we want parents
if ($oldCat != 0 && ($this->element['parent'] == true || $jinput->get('option') == 'com_categories'))
{
// Prevent parenting to children of this item.
// To rearrange parents and children move the children up, not the parents down.
$query->join('LEFT', $db->quoteName('#__categories') . ' AS p ON p.id = ' . (int) $oldCat)
->where('NOT(a.lft >= p.lft AND a.rgt <= p.rgt)');

$rowQuery = $db->getQuery(true);
$rowQuery->select('a.id AS value, a.title AS text, a.level, a.parent_id')
->from('#__categories AS a')
->where('a.id = ' . (int) $oldCat);
$db->setQuery($rowQuery);
$row = $db->loadObject();
$subQuery->where('(extension = ' . $db->quote($extension) . ')');
}

// Filter language
if (!empty($this->element['language']))
{

$query->where('a.language = ' . $db->quote($this->element['language']));
$subQuery->where('language = ' . $db->quote($this->element['language']));
}

// Filter on the published state

if (is_numeric($published))
{
$query->where('a.published = ' . (int) $published);
$subQuery->where('published = ' . (int) $published);
}
elseif (is_array($published))
{
JArrayHelper::toInteger($published);
$query->where('a.published IN (' . implode(',', $published) . ')');
$subQuery->where('published IN (' . implode(',', $published) . ')');
}

$query->group('a.id, a.title, a.level, a.lft, a.rgt, a.extension, a.parent_id, a.published')
->order('a.lft ASC');
$subQuery->order('lft ASC');
$query->from('(' . $subQuery->__toString() . ') AS a')
->join('LEFT', $db->quoteName('#__categories') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt');

// If parent isn't explicitly stated but we are in com_categories assume we want parents
if ($oldCat != 0 && ($this->element['parent'] == true || $jinput->get('option') == 'com_categories'))
{
// Prevent parenting to children of this item.
// To rearrange parents and children move the children up, not the parents down.
$query->join('LEFT', $db->quoteName('#__categories') . ' AS p ON p.id = ' . (int) $oldCat)
->where('NOT(a.lft >= p.lft AND a.rgt <= p.rgt)');

$rowQuery = $db->getQuery(true);
$rowQuery->select('a.id AS value, a.title AS text, a.level, a.parent_id')
->from('#__categories AS a')
->where('a.id = ' . (int) $oldCat);
$db->setQuery($rowQuery);
$row = $db->loadObject();
}

// Get the options.
$db->setQuery($query);
Expand All @@ -137,6 +139,7 @@ protected function getOptions()
$options[$i]->text = JText::_('JGLOBAL_ROOT_PARENT');
}
}

if ($options[$i]->published == 1)
{
$options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text;
Expand Down Expand Up @@ -179,46 +182,46 @@ protected function getOptions()
unset($options[$i]);
}
}

if ($user->authorise('core.edit.state', $extension . '.category.' . $oldCat) != true
&& (isset($oldParent))
&& $option->value != $oldParent
)
&& $option->value != $oldParent)
{
unset($options[$i]);
}

// However, if you can edit.state you can also move this to another category for which you have
// create permission and you should also still be able to save in the current category.
if (($user->authorise('core.create', $extension . '.category.' . $option->value) != true)
&& ($option->value != $oldCat && !isset($oldParent))
)
&& ($option->value != $oldCat && !isset($oldParent)))
{
{
unset($options[$i]);
}
}

if (($user->authorise('core.create', $extension . '.category.' . $option->value) != true)
&& (isset($oldParent))
&& $option->value != $oldParent
)
&& $option->value != $oldParent)
{
{
unset($options[$i]);
}
}
}
}

if (($this->element['parent'] == true || $jinput->get('option') == 'com_categories')
&& (isset($row) && !isset($options[0]))
&& isset($this->element['show_root'])
)
&& isset($this->element['show_root']))
{
if ($row->parent_id == '1')
{
$parent = new stdClass;
$parent->text = JText::_('JGLOBAL_ROOT_PARENT');
array_unshift($options, $parent);
}

array_unshift($options, JHtml::_('select.option', '0', JText::_('JGLOBAL_ROOT')));
}

Expand Down
Expand Up @@ -193,7 +193,7 @@
type="databaseconnection"
label="COM_CONFIG_FIELD_DATABASE_TYPE_LABEL"
description="COM_CONFIG_FIELD_DATABASE_TYPE_DESC"
supported="mysql,mysqli,postgresql,sqlsrv,sqlazure"
supported="mysql,mysqli,pdomysql,postgresql,sqlsrv,sqlazure"
filter="string" />

<field
Expand Down
3 changes: 2 additions & 1 deletion administrator/components/com_contact/tables/contact.php
Expand Up @@ -60,10 +60,11 @@ public function store($updateNulls = false)
$date = JFactory::getDate();
$user = JFactory::getUser();

$this->modified = $date->toSql();

if ($this->id)
{
// Existing item
$this->modified = $date->toSql();
$this->modified_by = $user->get('id');
}
else
Expand Down
Expand Up @@ -103,7 +103,7 @@ public static function getInstance()
// Setup the adapter for the indexer.
$format = JFactory::getDbo()->name;

if ($format == 'mysqli')
if ($format == 'mysqli' || $format == 'pdomysql')
{
$format = 'mysql';
}
Expand Down
3 changes: 2 additions & 1 deletion administrator/components/com_finder/tables/filter.php
Expand Up @@ -198,10 +198,11 @@ public function store($updateNulls = false)
$date = JFactory::getDate();
$user = JFactory::getUser();

$this->modified = $date->toSql();

if ($this->filter_id)
{
// Existing item
$this->modified = $date->toSql();
$this->modified_by = $user->get('id');
}
else
Expand Down
4 changes: 3 additions & 1 deletion administrator/components/com_newsfeeds/tables/newsfeed.php
Expand Up @@ -110,10 +110,12 @@ public function store($updateNulls = false)
{
$date = JFactory::getDate();
$user = JFactory::getUser();

$this->modified = $date->toSql();

if ($this->id)
{
// Existing item
$this->modified = $date->toSql();
$this->modified_by = $user->get('id');
}
else
Expand Down
10 changes: 8 additions & 2 deletions administrator/components/com_postinstall/controllers/message.php
Expand Up @@ -20,13 +20,19 @@ class PostinstallControllerMessage extends FOFController
*/
public function reset()
{
/** @var PostinstallModelMessages $model */
$model = $this->getThisModel();

$eid = $this->input->getInt('eid', '700');
$eid = (int) $model->getState('eid', '700', 'int');

if (empty($eid))
{
$eid = 700;
}

$model->resetMessages($eid);

$this->setRedirect('index.php?option=com_postinstall');
$this->setRedirect('index.php?option=com_postinstall&eid=' . $eid);
}

/**
Expand Down

0 comments on commit ad48831

Please sign in to comment.