Skip to content

Commit

Permalink
Merge branch 'staging' into improveReinstall
Browse files Browse the repository at this point in the history
  • Loading branch information
zero-24 committed Aug 13, 2016
2 parents fc725b3 + cf26a2e commit 7c1513b
Show file tree
Hide file tree
Showing 259 changed files with 1,722 additions and 844 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -15,6 +15,7 @@
/configuration.php
/.htaccess
/web.config
/.php_cs.cache

# Test Related Files #
/phpunit.xml
Expand Down
65 changes: 65 additions & 0 deletions .php_cs
@@ -0,0 +1,65 @@
<?php

$topFilesFinder = Symfony\CS\Finder\DefaultFinder::create()
->in(array(__DIR__ . '/libraries'))
->files()
->depth(0);

$mainFinder = Symfony\CS\Finder\DefaultFinder::create()
->in(
array(
__DIR__ . '/libraries/cms',
__DIR__ . '/libraries/joomla',
__DIR__ . '/libraries/legacy',
)
)
->append($topFilesFinder);

return Symfony\CS\Config\Config::create()
->setUsingLinter(false)
->setUsingCache(true)
->level(Symfony\CS\FixerInterface::NONE_LEVEL)
->fixers(
array(
// psr-1
'encoding',
// psr-2
'elseif',
'eof_ending',
'function_call_space',
'line_after_namespace',
'linefeed',
'lowercase_constants',
'lowercase_keywords',
'method_argument_space',
'multiple_use',
'parenthesis',
'single_line_after_imports',
'trailing_spaces',
'visibility',
// symfony
'array_element_no_space_before_comma',
'array_element_white_space_after_comma',
'duplicate_semicolon',
'empty_return',
'extra_empty_lines',
'function_typehint_space',
'include',
'join_function',
'list_commas',
'multiline_array_trailing_comma',
'no_blank_lines_after_class_opening',
'phpdoc_trim',
'return',
'single_array_no_trailing_comma',
'single_blank_line_before_namespace',
'spaces_cast',
'unneeded_control_parentheses',
'unused_use',
'whitespacy_lines',
// contrib
'concat_with_spaces',
'long_array_syntax',
)
)
->finder($mainFinder);
8 changes: 4 additions & 4 deletions administrator/components/com_admin/script.php
Expand Up @@ -250,8 +250,8 @@ protected function updateManifestCaches()
array('library', 'fof', '', 0),
array('library', 'phpass', '', 0),

// Modules site
// Site
// Modules
// - Site
array('module', 'mod_articles_archive', '', 0),
array('module', 'mod_articles_latest', '', 0),
array('module', 'mod_articles_popular', '', 0),
Expand All @@ -277,7 +277,7 @@ protected function updateManifestCaches()
array('module', 'mod_tags_popular', '', 0),
array('module', 'mod_tags_similar', '', 0),

// Administrator
// - Administrator
array('module', 'mod_custom', '', 1),
array('module', 'mod_feed', '', 1),
array('module', 'mod_latest', '', 1),
Expand All @@ -293,7 +293,7 @@ protected function updateManifestCaches()
array('module', 'mod_toolbar', '', 1),
array('module', 'mod_multilangstatus', '', 1),

// Plug-ins
// Plugins
array('plugin', 'gmail', 'authentication', 0),
array('plugin', 'joomla', 'authentication', 0),
array('plugin', 'ldap', 'authentication', 0),
Expand Down
16 changes: 11 additions & 5 deletions administrator/components/com_cache/controller.php
Expand Up @@ -111,15 +111,21 @@ public function deleteAll()

$app = JFactory::getApplication();
$model = $this->getModel('cache');
$data = $model->getCache()->getAll();
$allCleared = true;
$clients = array(1, 0);

foreach ($data as $cache)
foreach ($clients as $client)
{
if ((int) $model->clean($cache->group) !== 1)
$mCache = $model->getCache($client);
$clientStr = JText::_($client ? 'JADMINISTRATOR' : 'JSITE') .' > ';

foreach ($mCache->getAll() as $cache)
{
$app->enqueueMessage(JText::sprintf('COM_CACHE_EXPIRED_ITEMS_DELETE_ERROR', $cache->group), 'error');
$allCleared = false;
if ((int) $mCache->clean($cache->group) !== 1)
{
$app->enqueueMessage(JText::sprintf('COM_CACHE_EXPIRED_ITEMS_DELETE_ERROR', $clientStr . $cache->group), 'error');
$allCleared = false;
}
}
}

Expand Down
9 changes: 7 additions & 2 deletions administrator/components/com_cache/models/cache.php
Expand Up @@ -165,15 +165,20 @@ public function getData()
*
* @return object
*/
public function getCache()
public function getCache($client_id = null)
{
$conf = JFactory::getConfig();

if (is_null($client_id))
{
$client_id = $this->getState('client_id');
}

$options = array(
'defaultgroup' => '',
'storage' => $conf->get('cache_handler', ''),
'caching' => true,
'cachebase' => ($this->getState('client_id') === 1) ? JPATH_ADMINISTRATOR . '/cache' : $conf->get('cache_path', JPATH_SITE . '/cache')
'cachebase' => (int) $client_id === 1 ? JPATH_ADMINISTRATOR . '/cache' : $conf->get('cache_path', JPATH_SITE . '/cache')
);

$cache = JCache::getInstance('', $options);
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_categories/models/categories.php
Expand Up @@ -294,7 +294,7 @@ protected function getListQuery()
uc.name,
ag.title,
ua.name'
);
);

return $query;
}
Expand Down Expand Up @@ -360,7 +360,7 @@ public function getItems()

/**
* Method to load the countItems method from the extensions
*
*
* @param stdClass[] &$items The category items
* @param string $extension The category extension
*
Expand Down
16 changes: 8 additions & 8 deletions administrator/components/com_categories/models/category.php
Expand Up @@ -69,15 +69,12 @@ public function __construct($config = array())
*/
protected function canDelete($record)
{
if (!empty($record->id))
if (empty($record->id) || $record->published != -2)
{
if ($record->published != -2)
{
return;
}

return JFactory::getUser()->authorise('core.delete', $record->extension . '.category.' . (int) $record->id);
return false;
}

return JFactory::getUser()->authorise('core.delete', $record->extension . '.category.' . (int) $record->id);
}

/**
Expand Down Expand Up @@ -338,7 +335,10 @@ protected function loadFormData()
)
);
$data->set('language', $app->input->getString('language', (!empty($filters['language']) ? $filters['language'] : null)));
$data->set('access', $app->input->getInt('access', (!empty($filters['access']) ? $filters['access'] : JFactory::getConfig()->get('access'))));
$data->set(
'access',
$app->input->getInt('access', (!empty($filters['access']) ? $filters['access'] : JFactory::getConfig()->get('access')))
);
}
}

Expand Down
Expand Up @@ -23,7 +23,7 @@ class JFormFieldCategoryEdit extends JFormFieldList
/**
* To allow creation of new categories.
*
* @var int
* @var integer
* @since 3.6
*/
protected $allowAdd;
Expand Down Expand Up @@ -251,8 +251,8 @@ protected function getOptions()
{
foreach ($options as $i => $option)
{
/* To take save or create in a category you need to have create rights for that category
* unless the item is already in that category.
/*
* To take save or create in a category you need to have create rights for that category unless the item is already in that category.
* Unset the option if the user isn't authorised for it. In this field assets are always categories.
*/
if ($user->authorise('core.create', $extension . '.category.' . $option->value) != true && $option->level != 0)
Expand All @@ -264,7 +264,8 @@ protected function getOptions()
// If you have an existing category id things are more complex.
else
{
/* If you are only allowed to edit in this category but not edit.state, you should not get any
/*
* If you are only allowed to edit in this category but not edit.state, you should not get any
* option to change the category parent for a category or the category for a content item,
* but you should be able to save in that category.
*/
Expand All @@ -285,8 +286,10 @@ protected function getOptions()
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.
/*
* 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)))
{
Expand Down Expand Up @@ -362,7 +365,10 @@ protected function getInput()
$attr .= $this->autofocus ? ' autofocus' : '';

// To avoid user's confusion, readonly="true" should imply disabled="true".
if ((string) $this->readonly == '1' || (string) $this->readonly == 'true' || (string) $this->disabled == '1'|| (string) $this->disabled == 'true')
if ((string) $this->readonly == '1'
|| (string) $this->readonly == 'true'
|| (string) $this->disabled == '1'
|| (string) $this->disabled == 'true')
{
$attr .= ' disabled="disabled"';
}
Expand Down
Expand Up @@ -133,8 +133,8 @@ protected function getOptions()
{
foreach ($options as $i => $option)
{
/* To take save or create in a category you need to have create rights for that category
* unless the item is already in that category.
/*
* To take save or create in a category you need to have create rights for that category unless the item is already in that category.
* Unset the option if the user isn't authorised for it. In this field assets are always categories.
*/
if ($user->authorise('core.create', $extension . '.category.' . $option->value) != true)
Expand All @@ -148,7 +148,8 @@ protected function getOptions()
{
foreach ($options as $i => $option)
{
/* If you are only allowed to edit in this category but not edit.state, you should not get any
/*
* If you are only allowed to edit in this category but not edit.state, you should not get any
* option to change the category parent for a category or the category for a content item,
* but you should be able to save in that category.
*/
Expand All @@ -160,8 +161,10 @@ protected function getOptions()
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.
/*
* 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.
*/
elseif (($user->authorise('core.create', $extension . '.category.' . $option->value) != true)
&& $option->value != $oldCat
)
Expand Down
Expand Up @@ -142,7 +142,9 @@ protected function addToolbar()
// Else if the component section string exits, let's use it
elseif ($lang->hasKey($component_section_key = $component . ($section ? "_$section" : '')))
{
$title = JText::sprintf('COM_CATEGORIES_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE', $this->escape(JText::_($component_section_key)));
$title = JText::sprintf('COM_CATEGORIES_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT')
. '_TITLE', $this->escape(JText::_($component_section_key))
);
}
// Else use the base title
else
Expand Down Expand Up @@ -204,13 +206,19 @@ protected function addToolbar()

JToolbarHelper::divider();

// Compute the ref_key if it does exist in the component
if (!$lang->hasKey($ref_key = strtoupper($component . ($section ? "_$section" : '')) . '_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT') . '_HELP_KEY'))
// Compute the ref_key
$ref_key = strtoupper($component . ($section ? "_$section" : '')) . '_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT') . '_HELP_KEY';

// Check if thr computed ref_key does exist in the component
if (!$lang->hasKey($ref_key))
{
$ref_key = 'JHELP_COMPONENTS_' . strtoupper(substr($component, 4) . ($section ? "_$section" : '')) . '_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT');
$ref_key = 'JHELP_COMPONENTS_'
. strtoupper(substr($component, 4) . ($section ? "_$section" : ''))
. '_CATEGORY_' . ($isNew ? 'ADD' : 'EDIT');
}

/* Get help for the category/section view for the component by
/*
* Get help for the category/section view for the component by
* -remotely searching in a language defined dedicated URL: *component*_HELP_URL
* -locally searching in a component help file if helpURL param exists in the component and is set to ''
* -remotely searching in a component URL if helpURL param exists in the component and is NOT set to ''
Expand Down
7 changes: 4 additions & 3 deletions administrator/components/com_menus/models/forms/item.xml
Expand Up @@ -3,13 +3,14 @@
<fieldset>
<field
name="id"
type="text"
class="readonly"
type="hidden"
label="JGLOBAL_FIELD_ID_LABEL"
description="JGLOBAL_FIELD_ID_DESC"
class="readonly"
default="0"
filter="int"
readonly="true"/>
readonly="true"
/>

<field
name="title"
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_menus/views/item/tmpl/edit.php
Expand Up @@ -118,15 +118,15 @@
<?php
// Set main fields.
$this->fields = array(
'id',
'menutype',
'parent_id',
'menuordering',
'published',
'home',
'access',
'language',
'note'

'note',
);

if ($this->item->type != 'component')
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_tags/models/forms/tag.xml
Expand Up @@ -264,7 +264,7 @@
label="COM_TAGS_FLOAT_LABEL"
description="COM_TAGS_FLOAT_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="">JGLOBAL_SELECT_AN_OPTION</option>
<option value="right">COM_TAGS_RIGHT</option>
<option value="left">COM_TAGS_LEFT</option>
<option value="none">COM_TAGS_NONE</option>
Expand Down Expand Up @@ -309,7 +309,7 @@
label="COM_TAGS_FLOAT_LABEL"
description="COM_TAGS_FLOAT_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="">JGLOBAL_SELECT_AN_OPTION</option>
<option value="right">COM_TAGS_RIGHT</option>
<option value="left">COM_TAGS_LEFT</option>
<option value="none">COM_TAGS_NONE</option>
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_templates/models/template.php
Expand Up @@ -706,7 +706,7 @@ public function createTemplateOverride($overridePath, $htmlPath)
{
$return = false;

if (empty($htmlPath) || empty($htmlPath))
if (empty($overridePath) || empty($htmlPath))
{
return $return;
}
Expand Down
Expand Up @@ -180,7 +180,7 @@ protected function addToolbar()
$explodeArray = explode('.', $this->fileName);
$ext = end($explodeArray);

JToolbarHelper::title(JText::_('COM_TEMPLATES_MANAGER_VIEW_TEMPLATE'), 'eye thememanager');
JToolbarHelper::title(JText::sprintf('COM_TEMPLATES_MANAGER_VIEW_TEMPLATE', ucfirst($this->template->name)), 'eye thememanager');

// Only show file edit buttons for global SuperUser
if ($isSuperUser)
Expand Down

0 comments on commit 7c1513b

Please sign in to comment.