Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/staging' into autosuggester
Browse files Browse the repository at this point in the history
  • Loading branch information
tkempf committed Aug 25, 2015
2 parents b8002e8 + 4cf9f06 commit 5f2085e
Show file tree
Hide file tree
Showing 93 changed files with 453 additions and 510 deletions.
2 changes: 1 addition & 1 deletion administrator/components/com_media/controllers/folder.php
Expand Up @@ -165,7 +165,7 @@ public function create()
if (!$user->authorise('core.create', 'com_media'))
{
// User is not authorised to create
JError::raiseWarning(403, JText::_('JLIB_APPLICATION_ERROR_CREATE_NOT_PERMITTED'));
JError::raiseWarning(403, JText::_('COM_MEDIA_ERROR_CREATE_NOT_PERMITTED'));

return false;
}
Expand Down
1 change: 1 addition & 0 deletions administrator/language/en-GB/en-GB.ini
Expand Up @@ -154,6 +154,7 @@ JBROWSERTARGET_POPUP="Open in popup"
JERROR_ALERTNOAUTHOR="You are not authorised to view this resource."
JERROR_ALERTNOTEMPLATE="The template for this display is not available."
JERROR_AN_ERROR_HAS_OCCURRED="An error has occurred."
JERROR_CORE_CREATE_NOT_PERMITTED="Create not permitted."
JERROR_CORE_DELETE_NOT_PERMITTED="Delete not permitted."
JERROR_COULD_NOT_FIND_TEMPLATE="Could not find template "_QQ_"%s"_QQ_"."
JERROR_INVALID_CONTROLLER="Invalid controller"
Expand Down
2 changes: 1 addition & 1 deletion components/com_banners/banners.php
Expand Up @@ -9,6 +9,6 @@

defined('_JEXEC') or die;

$controller = JControllerLegacy::getInstance('Banners');
$controller = JControllerLegacy::getInstance('Banners');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
10 changes: 5 additions & 5 deletions components/com_config/model/templates.php
Expand Up @@ -30,7 +30,7 @@ protected function populateState()
$state = $this->loadState();

// Load the parameters.
$params = JComponentHelper::getParams('com_templates');
$params = JComponentHelper::getParams('com_templates');
$state->set('params', $params);

$this->setState($state);
Expand All @@ -42,7 +42,7 @@ protected function populateState()
* @param array $data An optional array of data for the form to interogate.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
*
* @return JForm A JForm object on success, false on failure
* @return JForm A JForm object on success, false on failure
*
* @since 3.2
*/
Expand Down Expand Up @@ -97,15 +97,15 @@ protected function preprocessForm(JForm $form, $data, $group = 'content')

// Load the core and/or local language file(s).
$lang->load('tpl_' . $template, JPATH_BASE, null, false, true)
|| $lang->load('tpl_' . $template, JPATH_BASE . '/templates/' . $template, null, false, true);
|| $lang->load('tpl_' . $template, JPATH_BASE . '/templates/' . $template, null, false, true);

// Look for com_config.xml, which contains fileds to display
$formFile = JPath::clean(JPATH_BASE . '/templates/' . $template . '/com_config.xml');
$formFile = JPath::clean(JPATH_BASE . '/templates/' . $template . '/com_config.xml');

if (!file_exists($formFile))
{
// If com_config.xml not found, fall back to templateDetails.xml
$formFile = JPath::clean(JPATH_BASE . '/templates/' . $template . '/templateDetails.xml');
$formFile = JPath::clean(JPATH_BASE . '/templates/' . $template . '/templateDetails.xml');
}

if (file_exists($formFile))
Expand Down
4 changes: 2 additions & 2 deletions components/com_contact/controllers/contact.php
Expand Up @@ -92,7 +92,7 @@ public function submit()
if ($validate === false)
{
// Get the validation messages.
$errors = $model->getErrors();
$errors = $model->getErrors();

// Push up to three validation messages out to the user.
for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++)
Expand Down Expand Up @@ -196,7 +196,7 @@ private function _sendEmail($data, $contact, $copy_email_activated)

// Prepare email body
$prefix = JText::sprintf('COM_CONTACT_ENQUIRY_TEXT', JUri::base());
$body = $prefix . "\n" . $name . ' <' . $email . '>' . "\r\n\r\n" . stripslashes($body);
$body = $prefix . "\n" . $name . ' <' . $email . '>' . "\r\n\r\n" . stripslashes($body);

$mail = JFactory::getMailer();
$mail->addRecipient($contact->email_to);
Expand Down
6 changes: 3 additions & 3 deletions components/com_contact/helpers/route.php
Expand Up @@ -43,12 +43,12 @@ public static function getContactRoute($id, $catid, $language = 0)

if ($catid > 1)
{
$categories = JCategories::getInstance('Contact');
$category = $categories->get($catid);
$categories = JCategories::getInstance('Contact');
$category = $categories->get($catid);

if ($category)
{
$needles['category'] = array_reverse($category->getPath());
$needles['category'] = array_reverse($category->getPath());
$needles['categories'] = $needles['category'];
$link .= '&catid=' . $catid;
}
Expand Down
29 changes: 15 additions & 14 deletions components/com_contact/models/contact.php
Expand Up @@ -273,41 +273,42 @@ public function &getItem($pk = null)
protected function getContactQuery($pk = null)
{
// @todo Cache on the fingerprint of the arguments
$db = $this->getDbo();
$db = $this->getDbo();
$nullDate = $db->quote($db->getNullDate());
$nowDate = $db->quote(JFactory::getDate()->toSql());
$user = JFactory::getUser();
$pk = (!empty($pk)) ? $pk : (int) $this->getState('contact.id');
$query = $db->getQuery(true);
$nowDate = $db->quote(JFactory::getDate()->toSql());
$user = JFactory::getUser();
$pk = (!empty($pk)) ? $pk : (int) $this->getState('contact.id');
$query = $db->getQuery(true);

if ($pk)
{
// Sqlsrv changes
$case_when = ' CASE WHEN ';
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('a.alias', '!=', '0');
$case_when .= ' THEN ';
$a_id = $query->castAsChar('a.id');

$a_id = $query->castAsChar('a.id');
$case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
$case_when .= ' ELSE ';
$case_when .= $a_id . ' END as slug';

$case_when1 = ' CASE WHEN ';
$case_when1 = ' CASE WHEN ';
$case_when1 .= $query->charLength('cc.alias', '!=', '0');
$case_when1 .= ' THEN ';
$c_id = $query->castAsChar('cc.id');

$c_id = $query->castAsChar('cc.id');
$case_when1 .= $query->concatenate(array($c_id, 'cc.alias'), ':');
$case_when1 .= ' ELSE ';
$case_when1 .= $c_id . ' END as catslug';

$query->select(
'a.*, cc.access as category_access, cc.title as category_name, '
. $case_when . ',' . $case_when1
)

->from('#__contact_details AS a')

->join('INNER', '#__categories AS cc on cc.id = a.catid')

->where('a.id = ' . (int) $pk);

$published = $this->getState('filter.published');

if (is_numeric($published))
Expand Down Expand Up @@ -353,7 +354,7 @@ protected function getContactQuery($pk = null)
if ((int) $result->user_id && $this->getState('params')->get('show_articles'))
{

$query = $db->getQuery(true)
$query = $db->getQuery(true)
->select('a.id')
->select('a.title')
->select('a.state')
Expand Down Expand Up @@ -433,7 +434,7 @@ protected function getContactQuery($pk = null)
$form = new JForm('com_users.profile');

// Get the dispatcher.
$dispatcher = JEventDispatcher::getInstance();
$dispatcher = JEventDispatcher::getInstance();

// Trigger the form preparation event.
$dispatcher->trigger('onContentPrepareForm', array($form, $data));
Expand Down
4 changes: 2 additions & 2 deletions components/com_contact/views/category/tmpl/default_items.php
Expand Up @@ -11,8 +11,8 @@

JHtml::_('behavior.core');

$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
?>
<?php if (empty($this->items)) : ?>
<p> <?php echo JText::_('COM_CONTACT_NO_CONTACTS'); ?> </p>
Expand Down
4 changes: 2 additions & 2 deletions components/com_contact/views/category/view.html.php
Expand Up @@ -51,8 +51,8 @@ public function display($tpl = null)
// Compute the contact slug.
foreach ($this->items as $item)
{
$item->slug = $item->alias ? ($item->id . ':' . $item->alias) : $item->id;
$temp = new Registry;
$item->slug = $item->alias ? ($item->id . ':' . $item->alias) : $item->id;
$temp = new Registry;
$temp->loadString($item->params);
$item->params = clone($this->params);
$item->params->merge($temp);
Expand Down
4 changes: 4 additions & 0 deletions components/com_contact/views/contact/tmpl/default_profile.php
Expand Up @@ -29,6 +29,10 @@
endif;
break;

case "profile_dob":
echo '<dd>' . JHtml::_('date', $profile->text, JText::_('DATE_FORMAT_LC4'), false) . '</dd>';
break;

default:
echo '<dd>' . $profile->text . '</dd>';
break;
Expand Down
17 changes: 9 additions & 8 deletions components/com_contact/views/contact/view.html.php
Expand Up @@ -93,7 +93,7 @@ public function display($tpl = null)
}

// Check if access is not public
$groups = $user->getAuthorisedViewLevels();
$groups = $user->getAuthorisedViewLevels();

$return = '';

Expand All @@ -103,8 +103,8 @@ public function display($tpl = null)
return;
}

$options['category_id'] = $item->catid;
$options['order by'] = 'a.default_con DESC, a.ordering ASC';
$options['category_id'] = $item->catid;
$options['order by'] = 'a.default_con DESC, a.ordering ASC';

// Handle email cloaking
if ($item->email_to && $params->get('show_email'))
Expand Down Expand Up @@ -245,7 +245,8 @@ public function display($tpl = null)

// Override the layout only if this is not the active menu item
// If it is the active menu item, then the view and item id will match
$active = $app->getMenu()->getActive();
$active = $app->getMenu()->getActive();

if ((!$active) || ((strpos($active->link, 'view=contact') === false) || (strpos($active->link, '&id=' . (string) $this->item->id) === false)))
{
if ($layout = $params->get('contact_layout'))
Expand Down Expand Up @@ -273,10 +274,10 @@ public function display($tpl = null)
*/
protected function _prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$pathway = $app->getPathway();
$title = null;
$app = JFactory::getApplication();
$menus = $app->getMenu();
$pathway = $app->getPathway();
$title = null;

// Because the application sets a default page title,
// we need to get it from the menu item itself
Expand Down
4 changes: 2 additions & 2 deletions components/com_contact/views/featured/tmpl/default_items.php
Expand Up @@ -10,8 +10,8 @@
defined('_JEXEC') or die;
JHtml::_('behavior.core');

$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));

// Create a shortcut for params.
$params = &$this->item->params;
Expand Down
6 changes: 3 additions & 3 deletions components/com_content/controllers/article.php
Expand Up @@ -74,7 +74,7 @@ protected function allowAdd($data = array())
if ($categoryId)
{
// If the category has been passed in the data or URL check it.
$allow = $user->authorise('core.create', 'com_content.category.' . $categoryId);
$allow = $user->authorise('core.create', 'com_content.category.' . $categoryId);
}

if ($allow === null)
Expand Down Expand Up @@ -238,8 +238,8 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'a_id')
$append .= '&' . $urlVar . '=' . $recordId;
}

$itemId = $this->input->getInt('Itemid');
$return = $this->getReturnPage();
$itemId = $this->input->getInt('Itemid');
$return = $this->getReturnPage();
$catId = $this->input->getInt('catid', null, 'get');

if ($itemId)
Expand Down
4 changes: 2 additions & 2 deletions components/com_content/models/archive.php
Expand Up @@ -143,8 +143,8 @@ public function getData()
$params = $app->getParams();

// Get the pagination request variables
$limit = $app->input->get('limit', $params->get('display_num', 20), 'uint');
$limitstart = $app->input->get('limitstart', 0, 'uint');
$limit = $app->input->get('limit', $params->get('display_num', 20), 'uint');
$limitstart = $app->input->get('limitstart', 0, 'uint');

$query = $this->_buildQuery();

Expand Down
2 changes: 1 addition & 1 deletion components/com_content/models/article.php
Expand Up @@ -70,7 +70,7 @@ protected function populateState()
*/
public function getItem($pk = null)
{
$user = JFactory::getUser();
$user = JFactory::getUser();

$pk = (!empty($pk)) ? $pk : (int) $this->getState('article.id');

Expand Down
6 changes: 3 additions & 3 deletions components/com_content/models/articles.php
Expand Up @@ -171,7 +171,7 @@ protected function getStoreId($id = '')
protected function getListQuery()
{
// Get the current user for authorisation checks
$user = JFactory::getUser();
$user = JFactory::getUser();

// Create a new query object.
$db = $this->getDbo();
Expand Down Expand Up @@ -442,8 +442,8 @@ protected function getListQuery()
}

// Define null and now dates
$nullDate = $db->quote($db->getNullDate());
$nowDate = $db->quote(JFactory::getDate()->toSql());
$nullDate = $db->quote($db->getNullDate());
$nowDate = $db->quote(JFactory::getDate()->toSql());

// Filter by start and end dates.
if ((!$user->authorise('core.edit.state', 'com_content')) && (!$user->authorise('core.edit', 'com_content')))
Expand Down
28 changes: 14 additions & 14 deletions components/com_content/models/category.php
Expand Up @@ -280,13 +280,13 @@ public function getItems()
*/
protected function _buildContentOrderBy()
{
$app = JFactory::getApplication('site');
$db = $this->getDbo();
$params = $this->state->params;
$itemid = $app->input->get('id', 0, 'int') . ':' . $app->input->get('Itemid', 0, 'int');
$orderCol = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order', 'filter_order', '', 'string');
$orderDirn = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', '', 'cmd');
$orderby = ' ';
$app = JFactory::getApplication('site');
$db = $this->getDbo();
$params = $this->state->params;
$itemid = $app->input->get('id', 0, 'int') . ':' . $app->input->get('Itemid', 0, 'int');
$orderCol = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order', 'filter_order', '', 'string');
$orderDirn = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', '', 'cmd');
$orderby = ' ';

if (!in_array($orderCol, $this->filter_fields))
{
Expand All @@ -303,11 +303,11 @@ protected function _buildContentOrderBy()
$orderby .= $db->escape($orderCol) . ' ' . $db->escape($orderDirn) . ', ';
}

$articleOrderby = $params->get('orderby_sec', 'rdate');
$articleOrderDate = $params->get('order_date');
$categoryOrderby = $params->def('orderby_pri', '');
$secondary = ContentHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate) . ', ';
$primary = ContentHelperQuery::orderbyPrimary($categoryOrderby);
$articleOrderby = $params->get('orderby_sec', 'rdate');
$articleOrderDate = $params->get('order_date');
$categoryOrderby = $params->def('orderby_pri', '');
$secondary = ContentHelperQuery::orderbySecondary($articleOrderby, $articleOrderDate) . ', ';
$primary = ContentHelperQuery::orderbyPrimary($categoryOrderby);

$orderby .= $primary . ' ' . $secondary . ' a.created ';

Expand Down Expand Up @@ -359,8 +359,8 @@ public function getCategory()
// Compute selected asset permissions.
if (is_object($this->_item))
{
$user = JFactory::getUser();
$asset = 'com_content.category.' . $this->_item->id;
$user = JFactory::getUser();
$asset = 'com_content.category.' . $this->_item->id;

// Check general create permission.
if ($user->authorise('core.create', $asset))
Expand Down
8 changes: 4 additions & 4 deletions components/com_content/models/form.php
Expand Up @@ -51,7 +51,7 @@ protected function populateState()
$this->setState('return_page', base64_decode($return));

// Load the parameters.
$params = $app->getParams();
$params = $app->getParams();
$this->setState('params', $params);

$this->setState('layout', $app->input->getString('layout'));
Expand Down Expand Up @@ -90,9 +90,9 @@ public function getItem($itemId = null)
$value->params->loadString($value->attribs);

// Compute selected asset permissions.
$user = JFactory::getUser();
$userId = $user->get('id');
$asset = 'com_content.article.' . $value->id;
$user = JFactory::getUser();
$userId = $user->get('id');
$asset = 'com_content.article.' . $value->id;

// Check general edit permission first.
if ($user->authorise('core.edit', $asset))
Expand Down

0 comments on commit 5f2085e

Please sign in to comment.