Skip to content

Commit

Permalink
Merge branch 'staging' into cast_int
Browse files Browse the repository at this point in the history
  • Loading branch information
zero-24 committed May 11, 2017
2 parents 355e210 + b3a83cb commit 0baff40
Show file tree
Hide file tree
Showing 239 changed files with 6,605 additions and 5,018 deletions.
4 changes: 2 additions & 2 deletions .appveyor.yml
Expand Up @@ -33,13 +33,13 @@ install:
$VC = "vc14"
$PHPBuild = "x64"
}
- cinst -y sqlite
- appveyor-retry cinst -y sqlite
- cd C:\tools\php
# Get the MSSQL DLL's
- ps: >-
If ($env:PHP -eq "1") {
If ($env:php_ver_target -eq "5.6") {
appveyor-retry appveyor DownloadFile https://files.nette.org/misc/php-sqlsrv.zip
appveyor-retry appveyor DownloadFile https://cdn.joomla.org/ci/php-sqlsrv.zip
7z x -y php-sqlsrv.zip > $null
copy SQLSRV\php_sqlsrv_56_nts.dll ext\php_sqlsrv_nts.dll
copy SQLSRV\php_pdo_sqlsrv_56_nts.dll ext\php_pdo_sqlsrv_nts.dll
Expand Down
3 changes: 3 additions & 0 deletions administrator/components/com_admin/script.php
Expand Up @@ -1764,6 +1764,9 @@ public function deleteUnexistingFiles()
'/administrator/components/com_messages/layouts/toolbar/mysettings.php',
'/media/editors/tinymce/plugins/jdragdrop/plugin.js',
'/media/editors/tinymce/plugins/jdragdrop/plugin.min.js',
// Joomla 3.7.1
'/media/editors/tinymce/langs/uk-UA.js',
'/media/system/js/fields/calendar-locales/zh.js',
);

// TODO There is an issue while deleting folders using the ftp mode
Expand Down
@@ -0,0 +1,3 @@
-- Set integer field default values.
UPDATE `#__extensions` SET `params` = '{"multiple":"0","first":"1","last":"100","step":"1"}' WHERE `name` = 'plg_fields_integer';

Expand Up @@ -66,12 +66,12 @@ CREATE TABLE "#__fields_groups" (
"access" bigint DEFAULT 0 NOT NULL,
PRIMARY KEY ("id")
);
CREATE INDEX "#__fields_idx_checked_out" ON "#__fields_groups" ("checked_out");
CREATE INDEX "#__fields_idx_state" ON "#__fields_groups" ("state");
CREATE INDEX "#__fields_idx_created_by" ON "#__fields_groups" ("created_by");
CREATE INDEX "#__fields_idx_access" ON "#__fields_groups" ("access");
CREATE INDEX "#__fields_idx_context" ON "#__fields_groups" ("context");
CREATE INDEX "#__fields_idx_language" ON "#__fields_groups" ("language");
CREATE INDEX "#__fields_groups_idx_checked_out" ON "#__fields_groups" ("checked_out");
CREATE INDEX "#__fields_groups_idx_state" ON "#__fields_groups" ("state");
CREATE INDEX "#__fields_groups_idx_created_by" ON "#__fields_groups" ("created_by");
CREATE INDEX "#__fields_groups_idx_access" ON "#__fields_groups" ("access");
CREATE INDEX "#__fields_groups_idx_context" ON "#__fields_groups" ("context");
CREATE INDEX "#__fields_groups_idx_language" ON "#__fields_groups" ("language");

--
-- Table: #__fields_values
Expand Down
@@ -0,0 +1,2 @@
-- Set integer field default values.
UPDATE `#__extensions` SET `params` = '{"multiple":"0","first":"1","last":"100","step":"1"}' WHERE `name` = 'plg_fields_integer';
@@ -0,0 +1,3 @@
-- Set integer field default values.
UPDATE [#__extensions] SET [params] = '{"multiple":"0","first":"1","last":"100","step":"1"}' WHERE [name] = 'plg_fields_integer';

Expand Up @@ -31,9 +31,9 @@ class AssociationsControllerAssociation extends JControllerForm
*/
public function edit($key = null, $urlVar = null)
{
list($extensionName, $typeName) = explode('.', $this->input->get('itemtype'));
list($extensionName, $typeName) = explode('.', $this->input->get('itemtype', '', 'string'));

$id = $this->input->get('id', 0);
$id = $this->input->get('id', 0, 'int');

// Check if reference item can be edited.
if (!AssociationsHelper::allowEdit($extensionName, $typeName, $id))
Expand All @@ -60,7 +60,7 @@ public function cancel($key = null)
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));

list($extensionName, $typeName) = explode('.', $this->input->get('itemtype'));
list($extensionName, $typeName) = explode('.', $this->input->get('itemtype', '', 'string'));

// Only check in, if component item type allows to check out.
if (AssociationsHelper::typeSupportsCheckout($extensionName, $typeName))
Expand All @@ -73,7 +73,7 @@ public function cancel($key = null)
$ids = array_unique(explode(',', $targetId));
}

$ids[] = $this->input->get('id', 0);
$ids[] = $this->input->get('id', 0, 'int');

foreach ($ids as $key => $id)
{
Expand Down
Expand Up @@ -68,4 +68,63 @@ public function clean()
$this->getModel('associations')->clean();
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
}

/**
* Method to check in an item from the association item overview.
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function checkin()
{
// Set the redirect so we can just stop processing when we find a condition we can't process
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));

// Figure out if the item supports checking and check it in
$type = null;

list($extensionName, $typeName) = explode('.', $this->input->get('itemtype'));

$extension = AssociationsHelper::getSupportedExtension($extensionName);
$types = $extension->get('types');

if (!array_key_exists($typeName, $types))
{
return;
}

if (AssociationsHelper::typeSupportsCheckout($extensionName, $typeName) === false)
{
// How on earth we came to that point, eject internet
return;
}

$cid = $this->input->get('cid', array(), 'array');

if (empty($cid))
{
// Seems we don't have an id to work with.
return;
}

// We know the first element is the one we need because we don't allow multi selection of rows
$id = $cid[0];

if (AssociationsHelper::canCheckinItem($extensionName, $typeName, $id) === true)
{
$item = AssociationsHelper::getItem($extensionName, $typeName, $id);

$item->checkIn($id);

return;
}

$this->setRedirect(
JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list),
JText::_('COM_ASSOCIATIONS_YOU_ARE_NOT_ALLOWED_TO_CHECKIN_THIS_ITEM')
);

return;
}
}
Expand Up @@ -40,7 +40,7 @@ protected function getOptions()
{
$input = JFactory::getApplication()->input;

list($extensionName, $typeName) = explode('.', $input->get('itemtype'));
list($extensionName, $typeName) = explode('.', $input->get('itemtype', '', 'string'));

// Get the extension specific helper method
$helper = AssociationsHelper::getExtensionHelper($extensionName);
Expand Down
Expand Up @@ -51,7 +51,7 @@
<?php echo $this->form->getInput('itemlanguage'); ?>
</div>
<iframe id="target-association" name="target-association"
src="<?php echo $this->defaultTargetSrc; ?>"
data-url="<?php echo $this->defaultTargetSrc; ?>"
height="400" width="400"
data-action="<?php echo $this->targetAction; ?>"
data-item="<?php echo $this->typeName; ?>"
Expand Down
Expand Up @@ -62,23 +62,22 @@ class AssociationsViewAssociation extends JViewLegacy
* @return void
*
* @since 3.7.0
* @throws Exception
*/
public function display($tpl = null)
{
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);

return false;
}

$this->app = JFactory::getApplication();
$this->form = $this->get('Form');
$input = $this->app->input;
$this->referenceId = $input->get('id', 0, 'int');

list($extensionName, $typeName) = explode('.', $input->get('itemtype'));
list($extensionName, $typeName) = explode('.', $input->get('itemtype', '', 'string'));

$extension = AssociationsHelper::getSupportedExtension($extensionName);
$types = $extension->get('types');
Expand Down Expand Up @@ -135,7 +134,7 @@ public function display($tpl = null)
$this->targetId = $matches[1];
$this->targetLanguage = $matches[0];
$task = $typeName . '.' . $this->targetAction;
$this->defaultTargetSrc = JRoute::_($this->editUri . '&task= ' . $task . ' &id=' . (int) $this->targetId);
$this->defaultTargetSrc = JRoute::_($this->editUri . '&task=' . $task . '&id=' . (int) $this->targetId);
$this->form->setValue('itemlanguage', '', $this->targetLanguage . ':' . $this->targetId . ':' . $this->targetAction);
}

Expand Down
Expand Up @@ -110,7 +110,6 @@
</tfoot>
<tbody>
<?php foreach ($this->items as $i => $item) :
$canCheckin = true;
$canEdit = AssociationsHelper::allowEdit($this->extensionName, $this->typeName, $item->id);
$canCheckin = $canManageCheckin || AssociationsHelper::canCheckinItem($this->extensionName, $this->typeName, $item->id);
$isCheckout = AssociationsHelper::isCheckoutItem($this->extensionName, $this->typeName, $item->id);
Expand All @@ -122,9 +121,13 @@
</td>
<?php endif; ?>
<td class="nowrap has-context">
<span style="display: none"><?php echo JHtml::_('grid.id', $i, $item->id); ?></span>
<?php if (isset($item->level)) : ?>
<?php echo JLayoutHelper::render('joomla.html.treeprefix', array('level' => $item->level)); ?>
<?php endif; ?>
<?php if (!$canCheckin && $isCheckout) : ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'associations.'); ?>
<?php endif; ?>
<?php if ($canCheckin && $isCheckout) : ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'associations.', $canCheckin); ?>
<?php endif; ?>
Expand Down Expand Up @@ -173,6 +176,7 @@
</table>
<?php endif; ?>
<input type="hidden" name="task" value=""/>
<input type="hidden" name="boxchecked" value="0" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
Expand Up @@ -21,10 +21,12 @@
JHtml::_('behavior.multiselect');
JHtml::_('formbehavior.chosen', 'select');

$function = $app->input->getCmd('function', 'jSelectAssociation');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$colSpan = 4;
$function = $app->input->getCmd('function', 'jSelectAssociation');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$canManageCheckin = JFactory::getUser()->authorise('core.manage', 'com_checkin');
$colSpan = 4;

$iconStates = array(
-2 => 'icon-trash',
0 => 'icon-unpublish',
Expand Down Expand Up @@ -102,6 +104,9 @@
</tfoot>
<tbody>
<?php foreach ($this->items as $i => $item) :
$canEdit = AssociationsHelper::allowEdit($this->extensionName, $this->typeName, $item->id);
$canCheckin = $canManageCheckin || AssociationsHelper::canCheckinItem($this->extensionName, $this->typeName, $item->id);
$isCheckout = AssociationsHelper::isCheckoutItem($this->extensionName, $this->typeName, $item->id);
?>
<tr class="row<?php echo $i % 2; ?>">
<?php if (!empty($this->typeSupports['state'])) : ?>
Expand All @@ -113,7 +118,17 @@
<?php if (isset($item->level)) : ?>
<?php echo JLayoutHelper::render('joomla.html.treeprefix', array('level' => $item->level)); ?>
<?php endif; ?>
<a class="select-link" href="javascript:void(0);" data-id="<?php echo $item->id; ?>"><?php echo $this->escape($item->title); ?></a>
<?php if (($canEdit && !$isCheckout) || ($canEdit && $canCheckin && $isCheckout)) : ?>
<a class="select-link" href="javascript:void(0);" data-id="<?php echo $item->id; ?>">
<?php echo $this->escape($item->title); ?></a>
<?php elseif ($canEdit && $isCheckout) : ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'associations.'); ?>
<span title="<?php echo JText::sprintf('JFIELD_ALIAS_LABEL', $this->escape($item->alias)); ?>">
<?php echo $this->escape($item->title); ?></span>
<?php else : ?>
<span title="<?php echo JText::sprintf('JFIELD_ALIAS_LABEL', $this->escape($item->alias)); ?>">
<?php echo $this->escape($item->title); ?></span>
<?php endif; ?>
<?php if (!empty($this->typeFields['alias'])) : ?>
<span class="small">
<?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?>
Expand Down
Expand Up @@ -111,7 +111,7 @@
</span>
<?php if ($canChange && $saveOrder) : ?>
<input type="text" style="display:none" name="order[]" size="5"
value="<?php echo $item->ordering; ?>" class="width-20 text-area-order " />
value="<?php echo $item->ordering; ?>" class="width-20 text-area-order" />
<?php endif; ?>
</td>
<td class="center">
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_config/model/application.php
Expand Up @@ -283,7 +283,7 @@ public function save($data)
* Look for a custom cache_path
* First check if a path is given in the submitted data, then check if a path exists in the previous data, otherwise use the default
*/
if ($data['cache_path'])
if (!empty($data['cache_path']))
{
$path = $data['cache_path'];
}
Expand Down
Expand Up @@ -115,7 +115,7 @@
</span>
<?php if ($canChange && $saveOrder) : ?>
<input type="text" style="display:none" name="order[]" size="5"
value="<?php echo $item->ordering; ?>" class="width-20 text-area-order " />
value="<?php echo $item->ordering; ?>" class="width-20 text-area-order" />
<?php endif; ?>
</td>
<td class="center">
Expand Down
15 changes: 8 additions & 7 deletions administrator/components/com_content/config.xml
Expand Up @@ -350,7 +350,7 @@
type="plugins"
label="COM_CONTENT_FIELD_CAPTCHA_LABEL"
description="COM_CONTENT_FIELD_CAPTCHA_DESC"
default="0"
default=""
folder="captcha"
filter="cmd"
>
Expand Down Expand Up @@ -762,6 +762,7 @@
<fieldset name="list_default_parameters"
label="JGLOBAL_LIST_LAYOUT_OPTIONS"
description="COM_CONTENT_CONFIG_LIST_SETTINGS_DESC"
addfieldpath="/administrator/components/com_content/models/fields"
>

<field name="show_pagination_limit"
Expand Down Expand Up @@ -836,21 +837,21 @@
</field>

<field name="list_show_votes"
type="list"
type="votelist"
default="0"
label="JGLOBAL_LIST_VOTES_LABEL"
description="JGLOBAL_LIST_VOTES_DESC">
<option value="1" requires="vote">JSHOW</option>
<option value="0" requires="vote">JHIDE</option>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>

<field name="list_show_ratings"
type="list"
type="votelist"
default="0"
label="JGLOBAL_LIST_RATINGS_LABEL"
description="JGLOBAL_LIST_RATINGS_DESC">
<option value="1" requires="vote">JSHOW</option>
<option value="0" requires="vote">JHIDE</option>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>

</fieldset>
Expand Down
34 changes: 33 additions & 1 deletion administrator/components/com_content/models/article.php
Expand Up @@ -414,7 +414,7 @@ public function getForm($data = array(), $loadData = true)
protected function loadFormData()
{
// Check the session for previously entered form data.
$app = JFactory::getApplication();
$app = JFactory::getApplication();
$data = $app->getUserState('com_content.edit.article.data', array());

if (empty($data))
Expand Down Expand Up @@ -451,6 +451,38 @@ protected function loadFormData()
return $data;
}

/**
* Method to validate the form data.
*
* @param JForm $form The form to validate against.
* @param array $data The data to validate.
* @param string $group The name of the field group to validate.
*
* @return array|boolean Array of filtered data if valid, false otherwise.
*
* @see JFormRule
* @see JFilterInput
* @since 3.7.0
*/
public function validate($form, $data, $group = null)
{
// Don't allow to change the users if not allowed to access com_users.
if (JFactory::getApplication()->isClient('administrator') && !JFactory::getUser()->authorise('core.manage', 'com_users'))
{
if (isset($data['created_by']))
{
unset($data['created_by']);
}

if (isset($data['modified_by']))
{
unset($data['modified_by']);
}
}

return parent::validate($form, $data, $group);
}

/**
* Method to save the form data.
*
Expand Down

0 comments on commit 0baff40

Please sign in to comment.