Merge pull request #455 from joomdonation/master

CS
This commit is contained in:
Tuan Pham Ngoc 2021-08-29 12:36:14 +07:00 committed by GitHub
commit 17fb02680e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 42 additions and 21 deletions

View File

@ -146,14 +146,17 @@ class WeblinksHelper extends JHelperContent
{
$item->count_published = $weblink->count;
}
if ($weblink->state == 0)
{
$item->count_unpublished = $weblink->count;
}
if ($weblink->state == 2)
{
$item->count_archived = $weblink->count;
}
if ($weblink->state == -2)
{
$item->count_trashed = $weblink->count;

View File

@ -65,7 +65,8 @@ class JFormFieldModal_Weblink extends JFormField
function jSelectWeblink_" . $this->id . "(id, title, catid, object, url, language) {
window.processModalSelect('Weblink', '" . $this->id . "', id, title, catid, object, url, language);
}
");
"
);
$scriptSelect[$this->id] = true;
}
}
@ -94,6 +95,7 @@ class JFormFieldModal_Weblink extends JFormField
->from($db->quoteName('#__weblinks'))
->where($db->quoteName('id') . ' = ' . (int) $value);
$db->setQuery($query);
try
{
$title = $db->loadResult();
@ -103,6 +105,7 @@ class JFormFieldModal_Weblink extends JFormField
JError::raiseWarning(500, $e->getMessage());
}
}
$title = empty($title) ? JText::_('COM_WEBLINKS_SELECT_A_WEBLINK') : htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
// The current weblink display field.
@ -122,6 +125,7 @@ class JFormFieldModal_Weblink extends JFormField
. '<span class="icon-file" aria-hidden="true"></span> ' . JText::_('JSELECT')
. '</a>';
}
// New weblink button
if ($allowNew)
{
@ -135,6 +139,7 @@ class JFormFieldModal_Weblink extends JFormField
. '<span class="icon-new" aria-hidden="true"></span> ' . JText::_('JACTION_CREATE')
. '</a>';
}
// Edit weblink button
if ($allowEdit)
{
@ -148,6 +153,7 @@ class JFormFieldModal_Weblink extends JFormField
. '<span class="icon-edit" aria-hidden="true"></span> ' . JText::_('JACTION_EDIT')
. '</a>';
}
// Clear weblink button
if ($allowClear)
{
@ -159,6 +165,7 @@ class JFormFieldModal_Weblink extends JFormField
. '<span class="icon-remove" aria-hidden="true"></span>' . JText::_('JCLEAR')
. '</a>';
}
$html .= '</span>';
// Select weblink modal
@ -236,10 +243,12 @@ class JFormFieldModal_Weblink extends JFormField
)
);
}
// Note: class='required' for client side validation.
$class = $this->required ? ' class="required modal-value"' : '';
$html .= '<input type="hidden" id="' . $this->id . '_id" ' . $class . ' data-required="' . (int) $this->required . '" name="' . $this->name
. '" data-text="' . htmlspecialchars(JText::_('COM_WEBLINKS_SELECT_A_WEBLINK', true), ENT_COMPAT, 'UTF-8') . '" value="' . $value . '" />';
return $html;
}

View File

@ -153,7 +153,8 @@ class Com_WeblinksInstallerScript
. $db->quote('com_weblinks.weblink') . ', '
. $db->quote(
'{"special":{"dbtable":"#__weblinks","key":"id","type":"Weblink","prefix":"WeblinksTable","config":"array()"},
"common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Corecontent","prefix":"JTable","config":"array()"}}') . ', '
"common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Corecontent","prefix":"JTable","config":"array()"}}'
) . ', '
. $db->quote('') . ', '
. $db->quote(
'{"common":{"core_content_item_id":"id","core_title":"title","core_state":"state","core_alias":"alias",
@ -161,7 +162,8 @@ class Com_WeblinksInstallerScript
"core_publish_up":"publish_up","core_publish_down":"publish_down","core_access":"access", "core_params":"params",
"core_featured":"featured", "core_metadata":"metadata", "core_language":"language", "core_images":"images", "core_urls":"url",
"core_version":"version", "core_ordering":"ordering", "core_metakey":"metakey", "core_metadesc":"metadesc",
"core_catid":"catid", "core_xreference":"xreference", "asset_id":"null"}, "special":{}}') . ', '
"core_catid":"catid", "core_xreference":"xreference", "asset_id":"null"}, "special":{}}'
) . ', '
. $db->quote('WeblinksHelperRoute::getWeblinkRoute') . ', '
. $db->quote(
'{"formFile":"administrator\\/components\\/com_weblinks\\/models\\/forms\\/weblink.xml",
@ -170,7 +172,8 @@ class Com_WeblinksInstallerScript
"ordering"], "displayLookup":[{"sourceColumn":"catid","targetTable":"#__categories","targetColumn":"id","displayColumn":"title"},
{"sourceColumn":"created_by","targetTable":"#__users","targetColumn":"id","displayColumn":"name"},
{"sourceColumn":"access","targetTable":"#__viewlevels","targetColumn":"id","displayColumn":"title"},
{"sourceColumn":"modified_by","targetTable":"#__users","targetColumn":"id","displayColumn":"name"} ]}')
{"sourceColumn":"modified_by","targetTable":"#__users","targetColumn":"id","displayColumn":"name"} ]}'
)
);
$db->setQuery($query);
@ -189,7 +192,8 @@ class Com_WeblinksInstallerScript
. $db->quote('com_weblinks.category') . ', '
. $db->quote('
{"special":{"dbtable":"#__categories","key":"id","type":"Category","prefix":"JTable","config":"array()"},
"common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Corecontent","prefix":"JTable","config":"array()"}}') . ', '
"common":{"dbtable":"#__ucm_content","key":"ucm_id","type":"Corecontent","prefix":"JTable","config":"array()"}}'
) . ', '
. $db->quote('') . ', '
. $db->quote('
{"common":{"core_content_item_id":"id","core_title":"title","core_state":"published","core_alias":"alias",
@ -198,7 +202,8 @@ class Com_WeblinksInstallerScript
"core_params":"params", "core_featured":"null", "core_metadata":"metadata", "core_language":"language",
"core_images":"null", "core_urls":"null", "core_version":"version", "core_ordering":"null", "core_metakey":"metakey",
"core_metadesc":"metadesc", "core_catid":"parent_id", "core_xreference":"null", "asset_id":"asset_id"},
"special":{"parent_id":"parent_id","lft":"lft","rgt":"rgt","level":"level","path":"path","extension":"extension","note":"note"}}') . ', '
"special":{"parent_id":"parent_id","lft":"lft","rgt":"rgt","level":"level","path":"path","extension":"extension","note":"note"}}'
) . ', '
. $db->quote('WeblinksHelperRoute::getCategoryRoute') . ', '
. $db->quote('
{"formFile":"administrator\\/components\\/com_categories\\/models\\/forms\\/category.xml",
@ -209,7 +214,8 @@ class Com_WeblinksInstallerScript
"displayColumn":"name"},{"sourceColumn":"access","targetTable":"#__viewlevels","targetColumn":"id",
"displayColumn":"title"},{"sourceColumn":"modified_user_id","targetTable":"#__users","targetColumn":"id",
"displayColumn":"name"},{"sourceColumn":"parent_id","targetTable":"#__categories","targetColumn":"id",
"displayColumn":"title"}]}')
"displayColumn":"title"}]}'
)
);
$db->setQuery($query);

View File

@ -38,7 +38,7 @@ class WeblinksTableWeblink extends JTable
// Set the published column alias
$this->setColumnAlias('published', 'state');
if (version_compare(JVERSION, '4.0', '<' ) == 1)
if (version_compare(JVERSION, '4.0', '<') == 1)
{
JTableObserverTags::createObserver($this, array('typeAlias' => 'com_weblinks.weblink'));
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_weblinks.weblink'));
@ -130,6 +130,7 @@ class WeblinksTableWeblink extends JTable
if (trim($this->title) == '')
{
$this->setError(JText::_('COM_WEBLINKS_ERR_TABLES_TITLE'));
return false;
}

View File

@ -47,6 +47,7 @@ class WeblinksViewWeblinks extends JViewLegacy
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode("\n", $errors));
return false;
}

View File

@ -186,7 +186,7 @@ class WeblinksModelCategory extends JModelList
$search = $db->quote('%' . $db->escape($search, true) . '%');
$query->where('(a.title LIKE ' . $search . ')');
}
// If grouping by subcategory, add the subcategory list ordering clause.
if ($this->getState('category.group', 0))
{

View File

@ -65,7 +65,7 @@ class WeblinksRouter extends JComponentRouterBase
}
// Are we dealing with an weblink that is attached to a menu item?
if (isset($query['view']) && ($mView == $query['view']) and (isset($query['id'])) and ($mId == (int) $query['id']))
if (isset($query['view']) && ($mView == $query['view']) && isset($query['id']) && ($mId == (int) $query['id']))
{
unset($query['view']);
unset($query['catid']);
@ -74,7 +74,7 @@ class WeblinksRouter extends JComponentRouterBase
return $segments;
}
if (isset($view) and ($view == 'category' or $view == 'weblink'))
if (isset($view) && ($view == 'category' || $view == 'weblink'))
{
if ($mId != (int) $query['id'] || $mView != $view)
{

View File

@ -53,6 +53,7 @@ class WeblinksViewCategories extends JViewCategories
if (count($errors = $this->get('Errors')))
{
JError::raiseWarning(500, implode("\n", $errors));
return false;
}

View File

@ -33,9 +33,9 @@ if (count($this->children[$this->category->id]) > 0 && $this->maxLevel != 0) :
<?php echo JHtml::_('content.prepare', $child->description, '', 'com_weblinks.category'); ?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<?php if ($this->params->get('show_cat_num_links') == 1) :?>
<?php if ($this->params->get('show_cat_num_links') == 1) :?>
<dl class="weblink-count"><dt>
<?php echo JText::_('COM_WEBLINKS_NUM'); ?></dt>
<dd><?php echo $child->numitems; ?></dd>

View File

@ -44,7 +44,7 @@ class WeblinksViewCategory extends JViewCategory
$temp = new JRegistry;
$temp->loadString($item->params);
$item->params = clone($this->params);
$item->params = clone $this->params;
$item->params->merge($temp);
}

View File

@ -139,7 +139,7 @@ class PlgFinderWeblinks extends FinderIndexerAdapter
public function onFinderAfterSave($context, $row, $isNew)
{
// We only want to handle web links here. We need to handle front end and back end editing.
if ($context == 'com_weblinks.weblink' || $context == 'com_weblinks.form' )
if ($context == 'com_weblinks.weblink' || $context == 'com_weblinks.form')
{
// Check if the access levels are different.
if (!$isNew && $this->old_access != $row->access)

View File

@ -175,12 +175,12 @@ class PlgSearchWeblinks extends JPlugin
$case_when1 .= $c_id . ' END as catslug';
$query->select('a.title AS title, a.created AS created, a.url, a.description AS text, ' . $case_when . "," . $case_when1)
->select($query->concatenate(array($db->quote($searchWeblinks), 'c.title'), " / ") . ' AS section')
->select('\'1\' AS browsernav')
->from('#__weblinks AS a')
->join('INNER', '#__categories as c ON c.id = a.catid')
->where('(' . $where . ') AND a.state IN (' . implode(',', $state) . ') AND c.published = 1 AND c.access IN (' . $groups . ')')
->order($order);
->select($query->concatenate(array($db->quote($searchWeblinks), 'c.title'), " / ") . ' AS section')
->select('\'1\' AS browsernav')
->from('#__weblinks AS a')
->join('INNER', '#__categories as c ON c.id = a.catid')
->where('(' . $where . ') AND a.state IN (' . implode(',', $state) . ') AND c.published = 1 AND c.access IN (' . $groups . ')')
->order($order);
// Filter by language.
if (JFactory::getApplication()->isClient('site') && JLanguageMultilang::isEnabled())