From bddf73faa11d74629c37e579ae012a4445ffc20e Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Tue, 9 Feb 2016 12:24:06 +0000 Subject: [PATCH 01/42] com_installer languages - jlayout searchtools and other UX improvments --- .../models/forms/filter_languages.xml | 37 +++++++++++++++ .../com_installer/models/languages.php | 19 +++----- .../views/languages/tmpl/default.php | 46 +++++++++---------- .../views/languages/tmpl/default_filter.php | 27 ----------- .../views/languages/view.html.php | 6 +++ 5 files changed, 70 insertions(+), 65 deletions(-) create mode 100644 administrator/components/com_installer/models/forms/filter_languages.xml delete mode 100644 administrator/components/com_installer/views/languages/tmpl/default_filter.php diff --git a/administrator/components/com_installer/models/forms/filter_languages.xml b/administrator/components/com_installer/models/forms/filter_languages.xml new file mode 100644 index 0000000000000..dfe99e8e9d099 --- /dev/null +++ b/administrator/components/com_installer/models/forms/filter_languages.xml @@ -0,0 +1,37 @@ + +
+ + + + + + + + + + + + + +
diff --git a/administrator/components/com_installer/models/languages.php b/administrator/components/com_installer/models/languages.php index 6b0b827afba02..4268dad26dc7b 100644 --- a/administrator/components/com_installer/models/languages.php +++ b/administrator/components/com_installer/models/languages.php @@ -41,8 +41,8 @@ public function __construct($config = array()) if (empty($config['filter_fields'])) { $config['filter_fields'] = array( - 'update_id', 'update_id', - 'name', 'name', + 'update_id', + 'name', ); } @@ -122,17 +122,13 @@ protected function _getListQuery() // Filter by search in title $search = $this->getState('filter.search'); - if (!empty($search)) { - $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); - $query->where('(name LIKE ' . $search . ')'); + $query->where('(name LIKE ' . $db->quote('%' . str_replace(' ', '%', $db->escape(trim($this->getState('filter.search')), true) . '%')) . ')'); } // Add the list ordering clause. - $listOrder = $this->state->get('list.ordering'); - $orderDirn = $this->state->get('list.direction'); - $query->order($db->escape($listOrder) . ' ' . $db->escape($orderDirn)); + $query->order($db->escape($this->getState('list.ordering')) . ' ' . $db->escape($this->getState('list.direction'))); return $query; } @@ -168,12 +164,9 @@ protected function getStoreId($id = '') */ protected function populateState($ordering = 'name', $direction = 'asc') { - $app = JFactory::getApplication(); - - $value = $app->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $value); + $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search')); - $this->setState('extension_message', $app->getUserState('com_installer.extension_message')); + $this->setState('extension_message', JFactory::getApplication()->getUserState('com_installer.extension_message')); parent::populateState($ordering, $direction); } diff --git a/administrator/components/com_installer/views/languages/tmpl/default.php b/administrator/components/com_installer/views/languages/tmpl/default.php index b1f445d96faef..961488d5ffc98 100644 --- a/administrator/components/com_installer/views/languages/tmpl/default.php +++ b/administrator/components/com_installer/views/languages/tmpl/default.php @@ -29,21 +29,22 @@
- items) || $this->escape($this->state->get('filter.search'))) : ?> - loadTemplate('filter'); ?> - items)) : ?> -
- -
- + items) : ?> + $this, 'options' => array('filterButton' => false))); ?> +
+ items)) : ?> +
+ +
+ - - @@ -75,22 +76,21 @@
+ - + @@ -54,8 +55,8 @@ - + +
- version; ?> + + version, 0, 3) != $version::RELEASE || substr($language->version, 0, 5) != $version->getShortVersion()) : ?> + version; ?> + + version; ?> + type)); ?> - detailsurl; ?> + detailsurl; ?> update_id; ?> @@ -99,15 +99,11 @@
+ +
- -
- - - -
diff --git a/administrator/components/com_installer/views/languages/tmpl/default_filter.php b/administrator/components/com_installer/views/languages/tmpl/default_filter.php deleted file mode 100644 index 7e3a989fd97eb..0000000000000 --- a/administrator/components/com_installer/views/languages/tmpl/default_filter.php +++ /dev/null @@ -1,27 +0,0 @@ - -
-
- - pagination->getLimitBox(); ?> -
- -
- - -
-
-
diff --git a/administrator/components/com_installer/views/languages/view.html.php b/administrator/components/com_installer/views/languages/view.html.php index 00d439925fed3..37c0ad72483e6 100644 --- a/administrator/components/com_installer/views/languages/view.html.php +++ b/administrator/components/com_installer/views/languages/view.html.php @@ -51,6 +51,12 @@ public function display($tpl = null) $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); + if ($this->getLayout() == 'default') + { + $this->filterForm = $this->get('FilterForm'); + $this->activeFilters = $this->get('ActiveFilters'); + } + // Check for errors. if (count($errors = $this->get('Errors'))) { From a274a7781b88964010484dbce444022722584e5e Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Tue, 9 Feb 2016 12:31:51 +0000 Subject: [PATCH 02/42] missing ) --- .../components/com_installer/views/languages/tmpl/default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_installer/views/languages/tmpl/default.php b/administrator/components/com_installer/views/languages/tmpl/default.php index 961488d5ffc98..66e8e2cc8e07f 100644 --- a/administrator/components/com_installer/views/languages/tmpl/default.php +++ b/administrator/components/com_installer/views/languages/tmpl/default.php @@ -29,7 +29,7 @@
- items) : ?> + items)) : ?> $this, 'options' => array('filterButton' => false))); ?>
items)) : ?> From a26b96ea97e1d7f53dee8b05afe49ebc6ace97d0 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Tue, 9 Feb 2016 12:39:48 +0000 Subject: [PATCH 03/42] code and ux improvements --- .../views/languages/tmpl/default.php | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/administrator/components/com_installer/views/languages/tmpl/default.php b/administrator/components/com_installer/views/languages/tmpl/default.php index 66e8e2cc8e07f..76daa88efa0dd 100644 --- a/administrator/components/com_installer/views/languages/tmpl/default.php +++ b/administrator/components/com_installer/views/languages/tmpl/default.php @@ -16,8 +16,6 @@ $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); -$version = new JVersion; - ?>
@@ -28,14 +26,14 @@
- - items)) : ?> - $this, 'options' => array('filterButton' => false))); ?> -
+ + items)) : ?> + $this, 'options' => array('filterButton' => false))); ?> +
items)) : ?> -
- -
+
+ +
@@ -49,10 +47,10 @@ - - + items as $i => $language) : ?>
+ + @@ -68,6 +66,7 @@
@@ -99,6 +98,7 @@
+
From ab1e607d0366b5baaaba1972635c388d3076e613 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Tue, 9 Feb 2016 16:36:17 +0000 Subject: [PATCH 04/42] flags for nn_no and ug_cn --- media/mod_languages/images/nn_no.gif | Bin 0 -> 74 bytes media/mod_languages/images/ug_cn.gif | Bin 0 -> 161 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 media/mod_languages/images/nn_no.gif create mode 100644 media/mod_languages/images/ug_cn.gif diff --git a/media/mod_languages/images/nn_no.gif b/media/mod_languages/images/nn_no.gif new file mode 100644 index 0000000000000000000000000000000000000000..51295cdf76540bca88ba4d5d778242e894598699 GIT binary patch literal 74 zcmZ?wbh9u|6k_0E_{hNU|Nnmh`L6fcx(o~qIzY?-5_e!yp28|v@OIj@>;++|#mg$> bSlg0Lc+L|xOkY{`SUYRRvW=^2#TcvsGz=J& literal 0 HcmV?d00001 diff --git a/media/mod_languages/images/ug_cn.gif b/media/mod_languages/images/ug_cn.gif new file mode 100644 index 0000000000000000000000000000000000000000..384522b664c3ecb8124b2a095564c21bd4cc3f60 GIT binary patch literal 161 zcmZ?wbh9u|6k_0E_#(papPk`<5ySsdhW}*@|4kVF^D_MBX88Y~;r|1M|4a=3*E0NX zWcaVm@V}7ZzaPVYDTe>%4FBsH{wFc~XJGg*%0Lk4fK-6&a$r?^pwgF;Iq$_0iwh|% iFEtbe1566ny?<;R*mU>N0uLXKJ@*w(=2$s1SOWk Date: Tue, 9 Feb 2016 16:38:51 +0000 Subject: [PATCH 05/42] now with flags and language code --- .../models/forms/filter_languages.xml | 4 +++- .../com_installer/models/languages.php | 3 ++- .../views/languages/tmpl/default.php | 22 ++++++++++++++----- .../language/en-GB/en-GB.com_installer.ini | 3 +++ 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/administrator/components/com_installer/models/forms/filter_languages.xml b/administrator/components/com_installer/models/forms/filter_languages.xml index dfe99e8e9d099..d5eeec1fd34e3 100644 --- a/administrator/components/com_installer/models/forms/filter_languages.xml +++ b/administrator/components/com_installer/models/forms/filter_languages.xml @@ -16,13 +16,15 @@ label="JGLOBAL_SORT_BY" description="JGLOBAL_SORT_BY" onchange="this.form.submit();" - default="name DESC" + default="name ASC" > + + getQuery(true); // Select the required fields from the updates table. - $query->select($db->quoteName(array('update_id', 'name', 'version', 'detailsurl', 'type'))) + $query->select($db->quoteName(array('update_id', 'name', 'element', 'version', 'detailsurl', 'type'))) ->from($db->quoteName('#__updates')); /* diff --git a/administrator/components/com_installer/views/languages/tmpl/default.php b/administrator/components/com_installer/views/languages/tmpl/default.php index 76daa88efa0dd..9dc9e05525ffe 100644 --- a/administrator/components/com_installer/views/languages/tmpl/default.php +++ b/administrator/components/com_installer/views/languages/tmpl/default.php @@ -44,10 +44,13 @@ - + + + + - + @@ -68,16 +71,25 @@ items as $i => $language) : ?> + element, $element); + $language->code = $element[1]; + $language->image = strtolower(str_replace('-', '_', $language->code)); + ?> update_id, false, 'cid'); ?> - + + code; ?> + + version, 0, 3) != $version::RELEASE || substr($language->version, 0, 5) != $version->getShortVersion()) : ?> version; ?> @@ -85,7 +97,7 @@ version; ?> - + type)); ?> diff --git a/administrator/language/en-GB/en-GB.com_installer.ini b/administrator/language/en-GB/en-GB.com_installer.ini index 3aaa71a514ea5..5d3be82efa01b 100644 --- a/administrator/language/en-GB/en-GB.com_installer.ini +++ b/administrator/language/en-GB/en-GB.com_installer.ini @@ -40,6 +40,9 @@ COM_INSTALLER_HEADING_DETAILSURL="URL Details" COM_INSTALLER_HEADING_FOLDER="Folder" COM_INSTALLER_HEADING_ID="ID" COM_INSTALLER_HEADING_INSTALLTYPE="Install Type" +COM_INSTALLER_HEADING_LANGUAGECODE="Language Code" +COM_INSTALLER_HEADING_LANGUAGECODE_ASC="Language Code ascending" +COM_INSTALLER_HEADING_LANGUAGECODE_DESC="Language Code descending" COM_INSTALLER_HEADING_LOCATION="Location" COM_INSTALLER_HEADING_NAME="Name" COM_INSTALLER_HEADING_TYPE="Type" From d58155557bc2d8fbe98376d45427e7d270342304 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Tue, 9 Feb 2016 17:10:21 +0000 Subject: [PATCH 06/42] cs --- .../components/com_installer/views/languages/tmpl/default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_installer/views/languages/tmpl/default.php b/administrator/components/com_installer/views/languages/tmpl/default.php index 9dc9e05525ffe..60d20b6880285 100644 --- a/administrator/components/com_installer/views/languages/tmpl/default.php +++ b/administrator/components/com_installer/views/languages/tmpl/default.php @@ -83,7 +83,7 @@ From 24207bf6dced2a53fca4bf23fb91c82fefbca3cf Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Tue, 9 Feb 2016 17:18:34 +0000 Subject: [PATCH 07/42] add old filter box to delete files list --- administrator/components/com_admin/script.php | 1 + 1 file changed, 1 insertion(+) diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index 07e2dac05d356..27e55d20a4260 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -1407,6 +1407,7 @@ public function deleteUnexistingFiles() '/libraries/joomla/document/opensearch/opensearch.php', '/libraries/joomla/document/raw/raw.php', '/libraries/joomla/document/xml/xml.php', + '/administrator/components/com_installer/views/languages/tmpl/default_filter.php', ); // TODO There is an issue while deleting folders using the ftp mode From d4e73aaa29be5ce41a1d42bbe725ccdf09e4cca2 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Tue, 9 Feb 2016 17:29:52 +0000 Subject: [PATCH 08/42] use the same order as columns --- .../com_installer/models/forms/filter_languages.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/administrator/components/com_installer/models/forms/filter_languages.xml b/administrator/components/com_installer/models/forms/filter_languages.xml index d5eeec1fd34e3..ace450fcbb383 100644 --- a/administrator/components/com_installer/models/forms/filter_languages.xml +++ b/administrator/components/com_installer/models/forms/filter_languages.xml @@ -21,10 +21,10 @@ - - + + Date: Tue, 9 Feb 2016 17:51:53 +0000 Subject: [PATCH 09/42] always show searchtools --- .../components/com_installer/views/languages/tmpl/default.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/administrator/components/com_installer/views/languages/tmpl/default.php b/administrator/components/com_installer/views/languages/tmpl/default.php index 60d20b6880285..6ac26c0f1be2b 100644 --- a/administrator/components/com_installer/views/languages/tmpl/default.php +++ b/administrator/components/com_installer/views/languages/tmpl/default.php @@ -27,7 +27,6 @@
- items)) : ?> $this, 'options' => array('filterButton' => false))); ?>
items)) : ?> @@ -111,9 +110,6 @@ - -
- From 1e62347bc32ebea218c99b9e58afb3c0bec85c73 Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Tue, 9 Feb 2016 19:52:40 +0100 Subject: [PATCH 10/42] Delete si_LK.gif --- media/mod_languages/images/si_LK.gif | Bin 206 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 media/mod_languages/images/si_LK.gif diff --git a/media/mod_languages/images/si_LK.gif b/media/mod_languages/images/si_LK.gif deleted file mode 100644 index 3c0c873f0d6c04c3282a3df954b22a223abf75a0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 206 zcmZ?wbhEHb6k_0EIKsfNe*OCU_wV=j_t)3g@87@w{Q2|p^78NBzjttOFf}zzPEO9x z&ySCf*Votg_xGPaf4;rF{r~^}8HfgoKUu(PbwDJ@P6k%*1eLy&%y}8BtOS%-q$nwz z`eDHBBE$5>g{8UqB7=z-kB4$WilH3;fyD>9926RlKG0$iVLQWigt0+Kj_=xAM#Db| Q6B$+)Hr#&yLx8~=02Z-54gdfE From 43fc9a815927567e86abccd68bfec4222af90432 Mon Sep 17 00:00:00 2001 From: richard67 Date: Tue, 9 Feb 2016 19:55:42 +0100 Subject: [PATCH 11/42] Renamed language flag image si_LK.gif to si_lk.gif --- media/mod_languages/images/si_lk.gif | Bin 0 -> 206 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 media/mod_languages/images/si_lk.gif diff --git a/media/mod_languages/images/si_lk.gif b/media/mod_languages/images/si_lk.gif new file mode 100644 index 0000000000000000000000000000000000000000..3c0c873f0d6c04c3282a3df954b22a223abf75a0 GIT binary patch literal 206 zcmZ?wbhEHb6k_0EIKsfNe*OCU_wV=j_t)3g@87@w{Q2|p^78NBzjttOFf}zzPEO9x z&ySCf*Votg_xGPaf4;rF{r~^}8HfgoKUu(PbwDJ@P6k%*1eLy&%y}8BtOS%-q$nwz z`eDHBBE$5>g{8UqB7=z-kB4$WilH3;fyD>9926RlKG0$iVLQWigt0+Kj_=xAM#Db| Q6B$+)Hr#&yLx8~=02Z-54gdfE literal 0 HcmV?d00001 From 1a86bc7be4f52ce70eb3a6abd52edceda68b7124 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Tue, 9 Feb 2016 22:10:23 +0000 Subject: [PATCH 12/42] adds default language --- administrator/components/com_installer/models/languages.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_installer/models/languages.php b/administrator/components/com_installer/models/languages.php index cea0e24930760..91cc67aec3f00 100644 --- a/administrator/components/com_installer/models/languages.php +++ b/administrator/components/com_installer/models/languages.php @@ -129,7 +129,7 @@ protected function _getListQuery() } // Add the list ordering clause. - $query->order($db->escape($this->getState('list.ordering')) . ' ' . $db->escape($this->getState('list.direction'))); + $query->order($db->escape($this->getState('list.ordering', 'name')) . ' ' . $db->escape($this->getState('list.direction', 'ASC'))); return $query; } From df771588a32445c37379305e8d303b0a60c92489 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Wed, 10 Feb 2016 20:25:53 +0000 Subject: [PATCH 13/42] remove language flags from default --- .../components/com_installer/views/languages/tmpl/default.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/administrator/components/com_installer/views/languages/tmpl/default.php b/administrator/components/com_installer/views/languages/tmpl/default.php index 6ac26c0f1be2b..742dd966808d8 100644 --- a/administrator/components/com_installer/views/languages/tmpl/default.php +++ b/administrator/components/com_installer/views/languages/tmpl/default.php @@ -74,7 +74,6 @@ // Get language code and language image. preg_match('#^pkg_([a-z]{2,3}-[A-Z]{2})$#', $language->element, $element); $language->code = $element[1]; - $language->image = strtolower(str_replace('-', '_', $language->code)); ?> @@ -82,7 +81,7 @@ From 73b4aedad3a4ca1b8f7fc3c16090321cd8da16bd Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Wed, 10 Feb 2016 20:28:30 +0000 Subject: [PATCH 14/42] code improvements --- .../com_installer/views/languages/tmpl/default.php | 9 +++++---- .../com_installer/views/languages/view.html.php | 14 +++++--------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/administrator/components/com_installer/views/languages/tmpl/default.php b/administrator/components/com_installer/views/languages/tmpl/default.php index 742dd966808d8..13f8d9163332d 100644 --- a/administrator/components/com_installer/views/languages/tmpl/default.php +++ b/administrator/components/com_installer/views/languages/tmpl/default.php @@ -68,9 +68,10 @@ - - items as $i => $language) : ?> - getShortVersion()); + foreach ($this->items as $i => $language) : // Get language code and language image. preg_match('#^pkg_([a-z]{2,3}-[A-Z]{2})$#', $language->element, $element); $language->code = $element[1]; @@ -89,7 +90,7 @@ - version, 0, 3) != $version::RELEASE || substr($language->version, 0, 5) != $version->getShortVersion()) : ?> + version, 0, 3) != $version::RELEASE || substr($language->version, 0, 5) != $currentShortVersion) : ?> version; ?> version; ?> diff --git a/administrator/components/com_installer/views/languages/view.html.php b/administrator/components/com_installer/views/languages/view.html.php index 37c0ad72483e6..0ffb1b9e836c8 100644 --- a/administrator/components/com_installer/views/languages/view.html.php +++ b/administrator/components/com_installer/views/languages/view.html.php @@ -47,15 +47,11 @@ public function display($tpl = null) $this->model->findLanguages(); // Get data from the model. - $this->state = $this->get('State'); - $this->items = $this->get('Items'); - $this->pagination = $this->get('Pagination'); - - if ($this->getLayout() == 'default') - { - $this->filterForm = $this->get('FilterForm'); - $this->activeFilters = $this->get('ActiveFilters'); - } + $this->state = $this->get('State'); + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->filterForm = $this->get('FilterForm'); + $this->activeFilters = $this->get('ActiveFilters'); // Check for errors. if (count($errors = $this->get('Errors'))) From 3b1f7f7322073120a69a4c1332bed716cd5264d1 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Wed, 10 Feb 2016 21:23:43 +0000 Subject: [PATCH 15/42] minor improvement --- administrator/components/com_installer/models/languages.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_installer/models/languages.php b/administrator/components/com_installer/models/languages.php index 91cc67aec3f00..3ed0e06e97e9d 100644 --- a/administrator/components/com_installer/models/languages.php +++ b/administrator/components/com_installer/models/languages.php @@ -125,7 +125,7 @@ protected function _getListQuery() $search = $this->getState('filter.search'); if (!empty($search)) { - $query->where('(name LIKE ' . $db->quote('%' . str_replace(' ', '%', $db->escape(trim($this->getState('filter.search')), true) . '%')) . ')'); + $query->where('(name LIKE ' . $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')) . ')'); } // Add the list ordering clause. From 6fc60cf4ad2f927fcdd0bea81792e0696c3dd5de Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Wed, 10 Feb 2016 21:26:21 +0000 Subject: [PATCH 16/42] don't replace ug_cn lang image --- media/mod_languages/images/ug_cn.gif | Bin 161 -> 544 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/media/mod_languages/images/ug_cn.gif b/media/mod_languages/images/ug_cn.gif index 384522b664c3ecb8124b2a095564c21bd4cc3f60..a4834d53d5f13e219af342a7d260f90796ff2aee 100644 GIT binary patch literal 544 zcmZ?wbhEHb6k_0Ec*el+|NnnqU*E2-uD-s$^78T3#kB_1m{^+qZA$=H@OeEL^c-MO0MOuV26B&YgSm zgsZHbJwg{ z^Xb#4;^N|xl9IoF|IV2+XVt1zFJ8Q8Zf>46Yu5Sm=PzEoIC0{{1q&9qySq=AFyZ<0 z=S!C^{qyHfW@ct+Xy}tCPmUZpGHKGJ=;-L$+S+&T-nqKE+S%EOii*0pxG)TQp!kyo z>_#0B35pX2_Sy!9rskH`w)Tz|Ci8ZFJqAwI7A=`3aqDI&6$T#07NI6dLv{uoF0LkN zHU?HF23ZLPU3U!z8w&%4FBsH{wFc~XJGg*%0Lk4fK-6&a$r?^pwgF;Iq$_0iwh|% iFEtbe1566ny?<;R*mU>N0uLXKJ@*w(=2$s1SOWk Date: Wed, 10 Feb 2016 22:37:07 +0000 Subject: [PATCH 17/42] language code left aligned --- .../components/com_installer/views/languages/tmpl/default.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/administrator/components/com_installer/views/languages/tmpl/default.php b/administrator/components/com_installer/views/languages/tmpl/default.php index 13f8d9163332d..3b7439d799371 100644 --- a/administrator/components/com_installer/views/languages/tmpl/default.php +++ b/administrator/components/com_installer/views/languages/tmpl/default.php @@ -43,7 +43,7 @@ - + @@ -85,7 +85,7 @@ name; ?> - + code; ?> From fe2e15da299a12e53c85d82c438cec6c4aaa02b9 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Thu, 11 Feb 2016 22:08:11 +0000 Subject: [PATCH 18/42] removed type, nowrap and mobile friendly --- .../com_installer/models/languages.php | 2 +- .../views/languages/tmpl/default.php | 18 ++++++------------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/administrator/components/com_installer/models/languages.php b/administrator/components/com_installer/models/languages.php index 3ed0e06e97e9d..8c7e5dbc1be5d 100644 --- a/administrator/components/com_installer/models/languages.php +++ b/administrator/components/com_installer/models/languages.php @@ -165,7 +165,7 @@ protected function getStoreId($id = '') */ protected function populateState($ordering = 'name', $direction = 'asc') { - $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search')); + $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); $this->setState('extension_message', JFactory::getApplication()->getUserState('com_installer.extension_message')); diff --git a/administrator/components/com_installer/views/languages/tmpl/default.php b/administrator/components/com_installer/views/languages/tmpl/default.php index 3b7439d799371..a35b3541c577c 100644 --- a/administrator/components/com_installer/views/languages/tmpl/default.php +++ b/administrator/components/com_installer/views/languages/tmpl/default.php @@ -18,7 +18,7 @@ ?>
- + sidebar)) : ?>
sidebar; ?> @@ -43,15 +43,12 @@ - + - - - @@ -62,7 +59,7 @@ - + pagination->getListFooter(); ?> @@ -85,10 +82,10 @@ name; ?> - + code; ?> - + version, 0, 3) != $version::RELEASE || substr($language->version, 0, 5) != $currentShortVersion) : ?> version; ?> @@ -96,13 +93,10 @@ version; ?> - - type)); ?> - detailsurl; ?> - + update_id; ?> From e984017446b86781ddde51a5b7a4a52cfa540963 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Thu, 11 Feb 2016 22:37:09 +0000 Subject: [PATCH 19/42] Language Tag, not Code! --- .../com_installer/models/forms/filter_languages.xml | 4 ++-- .../components/com_installer/views/languages/tmpl/default.php | 2 +- administrator/language/en-GB/en-GB.com_installer.ini | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/administrator/components/com_installer/models/forms/filter_languages.xml b/administrator/components/com_installer/models/forms/filter_languages.xml index ace450fcbb383..63f91444fc926 100644 --- a/administrator/components/com_installer/models/forms/filter_languages.xml +++ b/administrator/components/com_installer/models/forms/filter_languages.xml @@ -21,8 +21,8 @@ - - + + diff --git a/administrator/components/com_installer/views/languages/tmpl/default.php b/administrator/components/com_installer/views/languages/tmpl/default.php index a35b3541c577c..42348f945197b 100644 --- a/administrator/components/com_installer/views/languages/tmpl/default.php +++ b/administrator/components/com_installer/views/languages/tmpl/default.php @@ -44,7 +44,7 @@ - + diff --git a/administrator/language/en-GB/en-GB.com_installer.ini b/administrator/language/en-GB/en-GB.com_installer.ini index 5d3be82efa01b..0ea692c9f6818 100644 --- a/administrator/language/en-GB/en-GB.com_installer.ini +++ b/administrator/language/en-GB/en-GB.com_installer.ini @@ -43,6 +43,9 @@ COM_INSTALLER_HEADING_INSTALLTYPE="Install Type" COM_INSTALLER_HEADING_LANGUAGECODE="Language Code" COM_INSTALLER_HEADING_LANGUAGECODE_ASC="Language Code ascending" COM_INSTALLER_HEADING_LANGUAGECODE_DESC="Language Code descending" +COM_INSTALLER_HEADING_LANGUAGE_TAG="Language Tag" +COM_INSTALLER_HEADING_LANGUAGE_TAG_ASC="Language Tag ascending" +COM_INSTALLER_HEADING_LANGUAGE_TAG_DESC="Language Tag descending" COM_INSTALLER_HEADING_LOCATION="Location" COM_INSTALLER_HEADING_NAME="Name" COM_INSTALLER_HEADING_TYPE="Type" From 1f55d334c78a8a2ba7b2b9ef55aaa6b362087382 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Fri, 12 Feb 2016 14:12:07 +0000 Subject: [PATCH 20/42] remove language code language variable --- administrator/language/en-GB/en-GB.com_installer.ini | 3 --- 1 file changed, 3 deletions(-) diff --git a/administrator/language/en-GB/en-GB.com_installer.ini b/administrator/language/en-GB/en-GB.com_installer.ini index 0ea692c9f6818..398d29b2fcddb 100644 --- a/administrator/language/en-GB/en-GB.com_installer.ini +++ b/administrator/language/en-GB/en-GB.com_installer.ini @@ -40,9 +40,6 @@ COM_INSTALLER_HEADING_DETAILSURL="URL Details" COM_INSTALLER_HEADING_FOLDER="Folder" COM_INSTALLER_HEADING_ID="ID" COM_INSTALLER_HEADING_INSTALLTYPE="Install Type" -COM_INSTALLER_HEADING_LANGUAGECODE="Language Code" -COM_INSTALLER_HEADING_LANGUAGECODE_ASC="Language Code ascending" -COM_INSTALLER_HEADING_LANGUAGECODE_DESC="Language Code descending" COM_INSTALLER_HEADING_LANGUAGE_TAG="Language Tag" COM_INSTALLER_HEADING_LANGUAGE_TAG_ASC="Language Tag ascending" COM_INSTALLER_HEADING_LANGUAGE_TAG_DESC="Language Tag descending" From b02b0a0f25ef2998dfc65609b289344bb71ea03a Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Fri, 12 Feb 2016 14:13:02 +0000 Subject: [PATCH 21/42] colspan should be 6 --- .../components/com_installer/views/languages/tmpl/default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_installer/views/languages/tmpl/default.php b/administrator/components/com_installer/views/languages/tmpl/default.php index 42348f945197b..6693d9cf16a36 100644 --- a/administrator/components/com_installer/views/languages/tmpl/default.php +++ b/administrator/components/com_installer/views/languages/tmpl/default.php @@ -59,7 +59,7 @@ - + pagination->getListFooter(); ?> From 28eeb62d30f861fc550ba63b82d2fd2866b5b604 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Fri, 11 Mar 2016 18:04:11 +0100 Subject: [PATCH 22/42] Module Popular Tags is not working properly #9351 https://github.com/joomla/joomla-cms/issues/9351#issuecomment-194477650 --- modules/mod_tags_popular/helper.php | 41 ++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/modules/mod_tags_popular/helper.php b/modules/mod_tags_popular/helper.php index a0f334778d6d4..98f5ba1ec70a2 100644 --- a/modules/mod_tags_popular/helper.php +++ b/modules/mod_tags_popular/helper.php @@ -73,6 +73,16 @@ public static function getList(&$params) $query->join('INNER', $db->quoteName('#__tags', 't') . ' ON ' . $db->quoteName('tag_id') . ' = t.id') ->join('INNER', $db->qn('#__ucm_content', 'c') . ' ON ' . $db->qn('m.core_content_id') . ' = ' . $db->qn('c.core_content_id')); + $query->where($db->quoteName('m.type_alias') . ' = ' . $db->quoteName('c.core_type_alias')); + + // Only return tags connected to published articles + $query->where($db->quoteName('c.core_state') . ' = 1') + ->where('(' . $db->quoteName('c.core_publish_up') . ' = ' . $nullDate + . ' OR ' . $db->quoteName('c.core_publish_up') . ' <= ' . $db->quote($nowDate) . ')') + ->where('(' . $db->quoteName('c.core_publish_down') . ' = ' . $nullDate + . ' OR ' . $db->quoteName('c.core_publish_down') . ' >= ' . $db->quote($nowDate) . ')'); + + // Set query depending on order_value param if ($order_value == 'rand()') { $query->order($query->Rand()); @@ -81,17 +91,30 @@ public static function getList(&$params) { $order_value = $db->quoteName($order_value); $order_direction = $params->get('order_direction', 1) ? 'DESC' : 'ASC'; - $query->order($order_value . ' ' . $order_direction); - } - $query->where($db->quoteName('m.type_alias') . ' = ' . $db->quoteName('c.core_type_alias')); + if ($params->get('order_value', 'title') == 'title') + { + $query->setLimit($maximum); + $query->order('count DESC'); + $equery = $db->getQuery(true) + ->select( + array( + 'a.tag_id', + 'a.count', + 'a.title', + 'a.access', + 'a.alias') + ) + ->from('(' . (string) $query . ') AS a') + ->order('a.title' . ' ' . $order_direction); + $query = $equery; + } + else + { + $query->order($order_value . ' ' . $order_direction); + } + } - // Only return tags connected to published articles - $query->where($db->quoteName('c.core_state') . ' = 1') - ->where('(' . $db->quoteName('c.core_publish_up') . ' = ' . $nullDate - . ' OR ' . $db->quoteName('c.core_publish_up') . ' <= ' . $db->quote($nowDate) . ')') - ->where('(' . $db->quoteName('c.core_publish_down') . ' = ' . $nullDate - . ' OR ' . $db->quoteName('c.core_publish_down') . ' >= ' . $db->quote($nowDate) . ')'); $db->setQuery($query, 0, $maximum); try From a12f6273a188fcd054c042f004ee67ea1b192771 Mon Sep 17 00:00:00 2001 From: sapphireweb Date: Sat, 12 Mar 2016 09:01:44 -0800 Subject: [PATCH 23/42] Changing line 230 on cms.php The current code, if (!strlen($msg)) still allows blank messages to be added to the messageQue. Changing line 230 to, if (!strlen(trim($msg))) removes whitespace before checking the length, insuring that a message full just spaces won't be added, --- libraries/cms/application/cms.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/cms/application/cms.php b/libraries/cms/application/cms.php index ad46c24904b58..8e50ee6f282c2 100644 --- a/libraries/cms/application/cms.php +++ b/libraries/cms/application/cms.php @@ -227,7 +227,7 @@ public function checkSession() public function enqueueMessage($msg, $type = 'message') { // Don't add empty messages. - if (!strlen($msg)) + if (!strlen(trim($msg))) { return; } From 6a32170b2e1f02ca28ac693b9e0e4707f0eae62e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyril=20Rez=C3=A9?= Date: Sat, 12 Mar 2016 20:39:30 +0100 Subject: [PATCH 24/42] FIX "Hide Sidebar" tooltip when already hidden Fix the "Hide Sidebar" tooltip text, after changing page with sidebar already hidden. The tooltip text Show or Hide sidebar is already set by toggleSidebar function. --- layouts/joomla/sidebars/toggle.php | 1 - 1 file changed, 1 deletion(-) diff --git a/layouts/joomla/sidebars/toggle.php b/layouts/joomla/sidebars/toggle.php index 4692618d7a06d..ff2bab50fac24 100644 --- a/layouts/joomla/sidebars/toggle.php +++ b/layouts/joomla/sidebars/toggle.php @@ -16,7 +16,6 @@
From d3cc11ccc0817fe7bda8eb991065855703a5260a Mon Sep 17 00:00:00 2001 From: zero-24 Date: Sun, 13 Mar 2016 10:58:48 +0100 Subject: [PATCH 25/42] Some CS Fixes for #9376 @alikon this here are some things to make the code more readable. --- modules/mod_tags_popular/helper.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/modules/mod_tags_popular/helper.php b/modules/mod_tags_popular/helper.php index 98f5ba1ec70a2..79a3faef8f7ba 100644 --- a/modules/mod_tags_popular/helper.php +++ b/modules/mod_tags_popular/helper.php @@ -97,16 +97,18 @@ public static function getList(&$params) $query->setLimit($maximum); $query->order('count DESC'); $equery = $db->getQuery(true) - ->select( - array( - 'a.tag_id', - 'a.count', - 'a.title', - 'a.access', - 'a.alias') + ->select( + array( + 'a.tag_id', + 'a.count', + 'a.title', + 'a.access', + 'a.alias', ) - ->from('(' . (string) $query . ') AS a') - ->order('a.title' . ' ' . $order_direction); + ) + ->from('(' . (string) $query . ') AS a') + ->order('a.title' . ' ' . $order_direction); + $query = $equery; } else From 34d5f36fe65a4ac575e0741fdb4bf290a97321f5 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Sun, 13 Mar 2016 11:55:26 +0000 Subject: [PATCH 26/42] https in atom and a comment --- libraries/joomla/cache/storage/file.php | 2 +- libraries/joomla/document/renderer/feed/atom.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/joomla/cache/storage/file.php b/libraries/joomla/cache/storage/file.php index 94bf0a2ad17c9..2779db4fc83e9 100644 --- a/libraries/joomla/cache/storage/file.php +++ b/libraries/joomla/cache/storage/file.php @@ -334,7 +334,7 @@ public function unlock($id, $group = null) } else { - // Expect true if $_fileopen is false. Ref: http://issues.joomla.org/tracker/joomla-cms/2535 + // Expect true if $_fileopen is false. Ref: https://issues.joomla.org/tracker/joomla-cms/2535 $ret = true; } diff --git a/libraries/joomla/document/renderer/feed/atom.php b/libraries/joomla/document/renderer/feed/atom.php index 14cf3cb737c58..a4c925283dc59 100644 --- a/libraries/joomla/document/renderer/feed/atom.php +++ b/libraries/joomla/document/renderer/feed/atom.php @@ -120,7 +120,7 @@ public function render($name = '', $params = null, $content = null) $versionHtmlEscaped = ' version="' . htmlspecialchars(JVersion::RELEASE, ENT_COMPAT, 'UTF-8') . '"'; } - $feed .= " " . $data->getGenerator() . "\n"; + $feed .= " " . $data->getGenerator() . "\n"; $feed .= ' \n"; for ($i = 0, $count = count($data->items); $i < $count; $i++) From 16ae6d9303a25b798b3b654c61cef51017f6f33d Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Tue, 12 Apr 2016 16:56:16 +0100 Subject: [PATCH 27/42] add message states field type --- .../models/fields/messagestates.php | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 administrator/components/com_messages/models/fields/messagestates.php diff --git a/administrator/components/com_messages/models/fields/messagestates.php b/administrator/components/com_messages/models/fields/messagestates.php new file mode 100644 index 0000000000000..bf3acd6299677 --- /dev/null +++ b/administrator/components/com_messages/models/fields/messagestates.php @@ -0,0 +1,46 @@ + Date: Tue, 12 Apr 2016 16:56:50 +0100 Subject: [PATCH 28/42] Add searchtools filters xml --- .../models/forms/filter_messages.xml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 administrator/components/com_messages/models/forms/filter_messages.xml diff --git a/administrator/components/com_messages/models/forms/filter_messages.xml b/administrator/components/com_messages/models/forms/filter_messages.xml new file mode 100644 index 0000000000000..77753c310eadd --- /dev/null +++ b/administrator/components/com_messages/models/forms/filter_messages.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + From 0f535e5ab53b8aea1de4ee627016ade9dc546125 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Tue, 12 Apr 2016 16:58:41 +0100 Subject: [PATCH 29/42] add changes to the the messages model --- .../components/com_messages/models/messages.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/administrator/components/com_messages/models/messages.php b/administrator/components/com_messages/models/messages.php index 56a22b7c4eb7a..2fb63d8adb21a 100644 --- a/administrator/components/com_messages/models/messages.php +++ b/administrator/components/com_messages/models/messages.php @@ -58,17 +58,15 @@ public function __construct($config = array()) * * @since 1.6 */ - protected function populateState($ordering = null, $direction = null) + protected function populateState($ordering = 'a.date_time', $direction = 'desc') { // Load the filter state. - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); + $this->setState('filter.search', $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '', 'string')); - $state = $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'string'); - $this->setState('filter.state', $state); + $this->setState('filter.state', $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'cmd')); // List state information. - parent::populateState('a.date_time', 'desc'); + parent::populateState($ordering, $direction); } /** @@ -128,7 +126,7 @@ protected function getListQuery() { $query->where('a.state = ' . (int) $state); } - elseif ($state === '') + else if ($state !== '*') { $query->where('(a.state IN (0, 1))'); } From a5475d9fdd770c20f2071164381277ada8eefa7f Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Tue, 12 Apr 2016 16:59:20 +0100 Subject: [PATCH 30/42] add changes to the messages view html file --- .../components/com_messages/views/messages/view.html.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/administrator/components/com_messages/views/messages/view.html.php b/administrator/components/com_messages/views/messages/view.html.php index 9ff87f4dca158..21f11321af087 100644 --- a/administrator/components/com_messages/views/messages/view.html.php +++ b/administrator/components/com_messages/views/messages/view.html.php @@ -33,9 +33,11 @@ class MessagesViewMessages extends JViewLegacy */ public function display($tpl = null) { - $this->items = $this->get('Items'); - $this->pagination = $this->get('Pagination'); - $this->state = $this->get('State'); + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); + $this->filterForm = $this->get('FilterForm'); + $this->activeFilters = $this->get('ActiveFilters'); // Check for errors. if (count($errors = $this->get('Errors'))) From 6060851560c43d84147da22432abe5d84557f633 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Tue, 12 Apr 2016 16:59:52 +0100 Subject: [PATCH 31/42] add searchtools to com_messages messages template --- .../views/messages/tmpl/default.php | 46 ++++++------------- 1 file changed, 15 insertions(+), 31 deletions(-) diff --git a/administrator/components/com_messages/views/messages/tmpl/default.php b/administrator/components/com_messages/views/messages/tmpl/default.php index 71d503b3fe178..18d364221941e 100644 --- a/administrator/components/com_messages/views/messages/tmpl/default.php +++ b/administrator/components/com_messages/views/messages/tmpl/default.php @@ -40,23 +40,9 @@
- -
- -
- - -
-
- -
-
-
+ + $this)); ?> +
items)) : ?>
@@ -65,26 +51,26 @@ - - - - - - @@ -94,7 +80,7 @@ $canChange = $user->authorise('core.edit.state', 'com_messages'); ?> - - @@ -118,8 +104,6 @@
- -
From 39616d605791f9f22fe82950f01ae80cfe82eaa4 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Tue, 12 Apr 2016 17:10:53 +0100 Subject: [PATCH 32/42] add new language strings --- administrator/language/en-GB/en-GB.com_messages.ini | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/administrator/language/en-GB/en-GB.com_messages.ini b/administrator/language/en-GB/en-GB.com_messages.ini index 256189ec90ad6..f987e093f25f0 100644 --- a/administrator/language/en-GB/en-GB.com_messages.ini +++ b/administrator/language/en-GB/en-GB.com_messages.ini @@ -27,9 +27,17 @@ COM_MESSAGES_FIELD_SUBJECT_LABEL="Subject" COM_MESSAGES_FIELD_USER_ID_FROM_LABEL="From" COM_MESSAGES_FIELD_USER_ID_TO_DESC="You must select a recipient." COM_MESSAGES_FIELD_USER_ID_TO_LABEL="Recipient" +COM_MESSAGES_FILTER_STATES_DESC="Filter by message state" +COM_MESSAGES_FILTER_STATES_LABEL="State" COM_MESSAGES_HEADING_FROM="From" +COM_MESSAGES_HEADING_FROM_ASC="From ascending" +COM_MESSAGES_HEADING_FROM_DESC="From descending" COM_MESSAGES_HEADING_READ="Read" +COM_MESSAGES_HEADING_READ_ASC="Read ascending" +COM_MESSAGES_HEADING_READ_DESC="Read descending" COM_MESSAGES_HEADING_SUBJECT="Subject" +COM_MESSAGES_HEADING_SUBJECT_ASC="Subject ascending" +COM_MESSAGES_HEADING_SUBJECT_DESC="Subject descending" COM_MESSAGES_INVALID_REPLY_ID="Invalid recipient" COM_MESSAGES_MANAGER_MESSAGES="Private Messages" COM_MESSAGES_MARK_AS_READ="Mark As Read" @@ -61,4 +69,4 @@ COM_MESSAGES_VIEW_PRIVATE_MESSAGE="Private Messages: View" COM_MESSAGES_WRITE_PRIVATE_MESSAGE="Private Messages: Write" COM_MESSAGES_XML_DESCRIPTION="Component for private messaging support in Backend." JLIB_APPLICATION_SAVE_SUCCESS="Message successfully sent." -JLIB_RULES_SETTING_NOTES="1. Changes apply to this component only.
Inherited - a Global Configuration setting or higher level setting is applied.
Denied always wins - whatever is set at the Global or higher level and applies to all child elements.
Allowed will enable the action for this component unless it is overruled by a Global Configuration setting.

2. Select Save to refresh the calculated settings." \ No newline at end of file +JLIB_RULES_SETTING_NOTES="1. Changes apply to this component only.
Inherited - a Global Configuration setting or higher level setting is applied.
Denied always wins - whatever is set at the Global or higher level and applies to all child elements.
Allowed will enable the action for this component unless it is overruled by a Global Configuration setting.

2. Select Save to refresh the calculated settings." From 65cb116ad3d0924af8a19809a2b9583f2b105353 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Tue, 12 Apr 2016 17:32:02 +0100 Subject: [PATCH 33/42] travis --- administrator/components/com_messages/models/messages.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_messages/models/messages.php b/administrator/components/com_messages/models/messages.php index 2fb63d8adb21a..87f433cbacbc8 100644 --- a/administrator/components/com_messages/models/messages.php +++ b/administrator/components/com_messages/models/messages.php @@ -126,7 +126,7 @@ protected function getListQuery() { $query->where('a.state = ' . (int) $state); } - else if ($state !== '*') + elseif ($state !== '*') { $query->where('(a.state IN (0, 1))'); } From 652d87b806848d3e59de7a0f9295acf9f0476f2a Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Tue, 12 Apr 2016 17:44:51 +0100 Subject: [PATCH 34/42] optimizations --- .../com_messages/models/fields/messagestates.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/administrator/components/com_messages/models/fields/messagestates.php b/administrator/components/com_messages/models/fields/messagestates.php index bf3acd6299677..83a498458e127 100644 --- a/administrator/components/com_messages/models/fields/messagestates.php +++ b/administrator/components/com_messages/models/fields/messagestates.php @@ -15,7 +15,7 @@ /** * Form Field class for the Joomla Framework. * - * @since 1.6 + * @since 3.5.2 */ class JFormFieldMessageStates extends JFormFieldList { @@ -36,11 +36,7 @@ class JFormFieldMessageStates extends JFormFieldList */ protected function getOptions() { - $options = MessagesHelper::getStateOptions(); - - // Merge any additional options in the XML definition. - $options = array_merge(parent::getOptions(), $options); - - return $options; + // Merge state options with any additional options in the XML definition. + return array_merge(parent::getOptions(), MessagesHelper::getStateOptions()); } } From b36274af48db0464ab5ffc3183ba35708934ca85 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Tue, 12 Apr 2016 17:45:31 +0100 Subject: [PATCH 35/42] better code comment --- .../components/com_messages/models/fields/messagestates.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/administrator/components/com_messages/models/fields/messagestates.php b/administrator/components/com_messages/models/fields/messagestates.php index 83a498458e127..fc944700ae6aa 100644 --- a/administrator/components/com_messages/models/fields/messagestates.php +++ b/administrator/components/com_messages/models/fields/messagestates.php @@ -12,6 +12,7 @@ JFormHelper::loadFieldClass('list'); JLoader::register('MessagesHelper', JPATH_ADMINISTRATOR . '/components/com_messages/helpers/messages.php'); + /** * Form Field class for the Joomla Framework. * @@ -22,7 +23,7 @@ class JFormFieldMessageStates extends JFormFieldList /** * The form field type. * - * @var string + * @var string * @since 3.5.2 */ protected $type = 'MessageStates'; From 2980df6de8aeb675ca7c23de3ae103175fdfb38b Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Tue, 12 Apr 2016 17:45:52 +0100 Subject: [PATCH 36/42] add a dot --- administrator/language/en-GB/en-GB.com_messages.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/language/en-GB/en-GB.com_messages.ini b/administrator/language/en-GB/en-GB.com_messages.ini index f987e093f25f0..394e0b5b8abef 100644 --- a/administrator/language/en-GB/en-GB.com_messages.ini +++ b/administrator/language/en-GB/en-GB.com_messages.ini @@ -27,7 +27,7 @@ COM_MESSAGES_FIELD_SUBJECT_LABEL="Subject" COM_MESSAGES_FIELD_USER_ID_FROM_LABEL="From" COM_MESSAGES_FIELD_USER_ID_TO_DESC="You must select a recipient." COM_MESSAGES_FIELD_USER_ID_TO_LABEL="Recipient" -COM_MESSAGES_FILTER_STATES_DESC="Filter by message state" +COM_MESSAGES_FILTER_STATES_DESC="Filter by message state." COM_MESSAGES_FILTER_STATES_LABEL="State" COM_MESSAGES_HEADING_FROM="From" COM_MESSAGES_HEADING_FROM_ASC="From ascending" From dbafbcbb35f521b3778d775826943b4042fe4ca0 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Tue, 12 Apr 2016 17:46:40 +0100 Subject: [PATCH 37/42] com_messages not com_newsfeeds ... copy/paste error --- .../components/com_messages/models/fields/messagestates.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_messages/models/fields/messagestates.php b/administrator/components/com_messages/models/fields/messagestates.php index fc944700ae6aa..fb0601ea934d1 100644 --- a/administrator/components/com_messages/models/fields/messagestates.php +++ b/administrator/components/com_messages/models/fields/messagestates.php @@ -1,7 +1,7 @@ Date: Tue, 12 Apr 2016 22:52:41 +0100 Subject: [PATCH 38/42] Rename JCacheStorageXCacheTest.php to JCacheStorageXcacheTest.php --- .../{JCacheStorageXCacheTest.php => JCacheStorageXcacheTest.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/suites/libraries/joomla/cache/storage/{JCacheStorageXCacheTest.php => JCacheStorageXcacheTest.php} (100%) diff --git a/tests/unit/suites/libraries/joomla/cache/storage/JCacheStorageXCacheTest.php b/tests/unit/suites/libraries/joomla/cache/storage/JCacheStorageXcacheTest.php similarity index 100% rename from tests/unit/suites/libraries/joomla/cache/storage/JCacheStorageXCacheTest.php rename to tests/unit/suites/libraries/joomla/cache/storage/JCacheStorageXcacheTest.php From 933080008e8518fc14a3c46b9e717813e1a62906 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Tue, 12 Apr 2016 23:00:06 +0100 Subject: [PATCH 39/42] again?!? revert filename change --- .../{JCacheStorageXCacheTest.php => JCacheStorageXcacheTest.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/suites/libraries/joomla/cache/storage/{JCacheStorageXCacheTest.php => JCacheStorageXcacheTest.php} (100%) diff --git a/tests/unit/suites/libraries/joomla/cache/storage/JCacheStorageXCacheTest.php b/tests/unit/suites/libraries/joomla/cache/storage/JCacheStorageXcacheTest.php similarity index 100% rename from tests/unit/suites/libraries/joomla/cache/storage/JCacheStorageXCacheTest.php rename to tests/unit/suites/libraries/joomla/cache/storage/JCacheStorageXcacheTest.php From 9d85b263ee7244563746bfd5e68b986b33424c90 Mon Sep 17 00:00:00 2001 From: andrepereiradasilva Date: Wed, 13 Apr 2016 01:51:37 +0100 Subject: [PATCH 40/42] fix conflicts --- libraries/joomla/cache/storage/file.php | 158 ++++++++++-------------- 1 file changed, 65 insertions(+), 93 deletions(-) diff --git a/libraries/joomla/cache/storage/file.php b/libraries/joomla/cache/storage/file.php index 2779db4fc83e9..5d5d5719dd7a5 100644 --- a/libraries/joomla/cache/storage/file.php +++ b/libraries/joomla/cache/storage/file.php @@ -13,6 +13,7 @@ * File cache storage handler * * @since 11.1 + * @note For performance reasons this class does not use the Filesystem package's API */ class JCacheStorageFile extends JCacheStorage { @@ -37,16 +38,14 @@ public function __construct($options = array()) $this->_root = $options['cachebase']; } - // NOTE: raw php calls are up to 100 times faster than JFile or JFolder - /** - * Get cached data from a file by id and group + * Get cached data by ID and group * - * @param string $id The cache data id + * @param string $id The cache data ID * @param string $group The cache data group * @param boolean $checkTime True to verify cache time expiration threshold * - * @return mixed Boolean false on failure or a cached data string + * @return mixed Boolean false on failure or a cached data object * * @since 11.1 */ @@ -70,23 +69,19 @@ public function get($id, $group, $checkTime = true) return $data; } - else - { - return false; - } + + return false; } /** * Get all cached data * - * @return array The cached data + * @return mixed Boolean false on failure or a cached data object * * @since 11.1 */ public function getAll() { - parent::getAll(); - $path = $this->_root; $folders = $this->_folders($path); $data = array(); @@ -108,13 +103,13 @@ public function getAll() } /** - * Store the data to a file by id and group + * Store the data to cache by ID and group * - * @param string $id The cache data id + * @param string $id The cache data ID * @param string $group The cache data group * @param string $data The data to store in cache * - * @return boolean True on success, false otherwise + * @return boolean * * @since 11.1 */ @@ -137,23 +132,16 @@ public function store($id, $group, $data) } // Data integrity check - if ($written && ($data == file_get_contents($path))) - { - return true; - } - else - { - return false; - } + return $written && ($data == file_get_contents($path)); } /** - * Remove a cached data file by id and group + * Remove a cached data entry by ID and group * - * @param string $id The cache data id + * @param string $id The cache data ID * @param string $group The cache data group * - * @return boolean True on success, false otherwise + * @return boolean * * @since 11.1 */ @@ -172,12 +160,13 @@ public function remove($id, $group) /** * Clean cache for a group given a mode. * + * group mode : cleans all cache in the group + * notgroup mode : cleans all cache not in the group + * * @param string $group The cache data group * @param string $mode The mode for cleaning cache [group|notgroup] - * group mode : cleans all cache in the group - * notgroup mode : cleans all cache not in the group * - * @return boolean True on success, false otherwise + * @return boolean * * @since 11.1 */ @@ -203,23 +192,26 @@ public function clean($group, $mode = null) $return |= $this->_deleteFolder($this->_root . '/' . $folders[$i]); } } + break; + case 'group' : default : if (is_dir($this->_root . '/' . $folder)) { $return = $this->_deleteFolder($this->_root . '/' . $folder); } + break; } - return $return; + return (bool) $return; } /** * Garbage collect expired cache data * - * @return boolean True on success, false otherwise. + * @return boolean * * @since 11.1 */ @@ -240,37 +232,35 @@ public function gc() } } - return $result; + return (bool) $result; } /** - * Test to see if the cache storage is available. + * Test to see if the storage handler is available. * - * @return boolean True on success, false otherwise. + * @return boolean * * @since 12.1 */ public static function isSupported() { - $conf = JFactory::getConfig(); - - return is_writable($conf->get('cache_path', JPATH_CACHE)); + return is_writable(JFactory::getConfig()->get('cache_path', JPATH_CACHE)); } /** * Lock cached item * - * @param string $id The cache data id + * @param string $id The cache data ID * @param string $group The cache data group * @param integer $locktime Cached item max lock time * - * @return boolean True on success, false otherwise. + * @return mixed Boolean false if locking failed or an object containing properties lock and locklooped * * @since 11.1 */ public function lock($id, $group, $locktime) { - $returning = new stdClass; + $returning = new stdClass; $returning->locklooped = false; $looptime = $locktime * 10; @@ -315,10 +305,10 @@ public function lock($id, $group, $locktime) /** * Unlock cached item * - * @param string $id The cache data id + * @param string $id The cache data ID * @param string $group The cache data group * - * @return boolean True on success, false otherwise. + * @return boolean * * @since 11.1 */ @@ -331,23 +321,20 @@ public function unlock($id, $group = null) { $ret = @flock($_fileopen, LOCK_UN); @fclose($_fileopen); - } - else - { - // Expect true if $_fileopen is false. Ref: https://issues.joomla.org/tracker/joomla-cms/2535 - $ret = true; + + return $ret; } - return $ret; + return true; } /** - * Check to make sure cache is still valid, if not, delete it. + * Check if a cache object has expired * - * @param string $id Cache key to expire. - * @param string $group The cache data group. + * @param string $id Cache ID to check + * @param string $group The cache data group * - * @return boolean False if not valid + * @return boolean True if the cache ID is valid * * @since 11.1 */ @@ -374,12 +361,12 @@ protected function _checkExpire($id, $group) } /** - * Get a cache file path from an id/group pair + * Get a cache file path from an ID/group pair * - * @param string $id The cache data id + * @param string $id The cache data ID * @param string $group The cache data group * - * @return string The cache file path + * @return boolean|string The path to the data object or boolean false if the cache directory does not exist * * @since 11.1 */ @@ -410,7 +397,7 @@ protected function _getFilePath($id, $group) * * @param string $path The path to the folder to delete. * - * @return boolean True on success. + * @return boolean * * @since 11.1 */ @@ -420,7 +407,7 @@ protected function _deleteFolder($path) if (!$path || !is_dir($path) || empty($this->_root)) { // Bad programmer! Bad, bad programmer! - JLog::add('JCacheStorageFile::_deleteFolder ' . JText::_('JLIB_FILESYSTEM_ERROR_DELETE_BASE_DIRECTORY'), JLog::WARNING, 'jerror'); + JLog::add(__METHOD__ . ' ' . JText::_('JLIB_FILESYSTEM_ERROR_DELETE_BASE_DIRECTORY'), JLog::WARNING, 'jerror'); return false; } @@ -432,7 +419,7 @@ protected function _deleteFolder($path) if ($pos === false || $pos > 0) { - JLog::add('JCacheStorageFile::_deleteFolder' . JText::sprintf('JLIB_FILESYSTEM_ERROR_PATH_IS_NOT_A_FOLDER', $path), JLog::WARNING, 'jerror'); + JLog::add(__METHOD__ . ' ' . JText::sprintf('JLIB_FILESYSTEM_ERROR_PATH_IS_NOT_A_FOLDER', $path), JLog::WARNING, 'jerror'); return false; } @@ -453,16 +440,10 @@ protected function _deleteFolder($path) { $file = $this->_cleanPath($file); - // In case of restricted permissions we zap it one way or the other - // as long as the owner is either the webserver or the ftp - if (@unlink($file)) + // In case of restricted permissions we zap it one way or the other as long as the owner is either the webserver or the ftp + if (@unlink($file) !== true) { - // Do nothing - } - else - { - $filename = basename($file); - JLog::add('JCacheStorageFile::_deleteFolder' . JText::sprintf('JLIB_FILESYSTEM_DELETE_FAILED', $filename), JLog::WARNING, 'jerror'); + JLog::add(__METHOD__ . ' ' . JText::sprintf('JLIB_FILESYSTEM_DELETE_FAILED', basename($file)), JLog::WARNING, 'jerror'); return false; } @@ -488,20 +469,15 @@ protected function _deleteFolder($path) } } - // In case of restricted permissions we zap it one way or the other - // as long as the owner is either the webserver or the ftp + // In case of restricted permissions we zap it one way or the other as long as the owner is either the webserver or the ftp if (@rmdir($path)) { - $ret = true; + return true; } - else - { - JLog::add('JCacheStorageFile::_deleteFolder' . JText::sprintf('JLIB_FILESYSTEM_ERROR_FOLDER_DELETE', $path), JLog::WARNING, 'jerror'); - $ret = false; - } + JLog::add(__METHOD__ . ' ' . JText::sprintf('JLIB_FILESYSTEM_ERROR_FOLDER_DELETE', $path), JLog::WARNING, 'jerror'); - return $ret; + return false; } /** @@ -520,14 +496,12 @@ protected function _cleanPath($path, $ds = DIRECTORY_SEPARATOR) if (empty($path)) { - $path = $this->_root; - } - else - { - // Remove double slashes and backslahses and convert all slashes and backslashes to DIRECTORY_SEPARATOR - $path = preg_replace('#[/\\\\]+#', $ds, $path); + return $this->_root; } + // Remove double slashes and backslahses and convert all slashes and backslashes to DIRECTORY_SEPARATOR + $path = preg_replace('#[/\\\\]+#', $ds, $path); + return $path; } @@ -536,19 +510,17 @@ protected function _cleanPath($path, $ds = DIRECTORY_SEPARATOR) * * @param string $path The path of the folder to read. * @param string $filter A filter for file names. - * @param mixed $recurse True to recursively search into sub-folders, or an - * integer to specify the maximum depth. + * @param mixed $recurse True to recursively search into sub-folders, or an integer to specify the maximum depth. * @param boolean $fullpath True to return the full path to the file. - * @param array $exclude Array with names of files which should not be shown in - * the result. + * @param array $exclude Array with names of files which should not be shown in the result. * @param array $excludefilter Array of folder names to exclude * - * @return array Files in the given folder. + * @return array Files in the given folder. * * @since 11.1 */ - protected function _filesInFolder($path, $filter = '.', $recurse = false, $fullpath = false - , $exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX'), $excludefilter = array('^\..*', '.*~')) + protected function _filesInFolder($path, $filter = '.', $recurse = false, $fullpath = false, + $exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX'), $excludefilter = array('^\..*', '.*~')) { $arr = array(); @@ -558,7 +530,7 @@ protected function _filesInFolder($path, $filter = '.', $recurse = false, $fullp // Is the path a folder? if (!is_dir($path)) { - JLog::add('JCacheStorageFile::_filesInFolder' . JText::sprintf('JLIB_FILESYSTEM_ERROR_PATH_IS_NOT_A_FOLDER', $path), JLog::WARNING, 'jerror'); + JLog::add(__METHOD__ . ' ' . JText::sprintf('JLIB_FILESYSTEM_ERROR_PATH_IS_NOT_A_FOLDER', $path), JLog::WARNING, 'jerror'); return false; } @@ -637,8 +609,8 @@ protected function _filesInFolder($path, $filter = '.', $recurse = false, $fullp * * @since 11.1 */ - protected function _folders($path, $filter = '.', $recurse = false, $fullpath = false - , $exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX'), $excludefilter = array('^\..*')) + protected function _folders($path, $filter = '.', $recurse = false, $fullpath = false, $exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX'), + $excludefilter = array('^\..*')) { $arr = array(); @@ -648,7 +620,7 @@ protected function _folders($path, $filter = '.', $recurse = false, $fullpath = // Is the path a folder? if (!is_dir($path)) { - JLog::add('JCacheStorageFile::_folders' . JText::sprintf('JLIB_FILESYSTEM_ERROR_PATH_IS_NOT_A_FOLDER', $path), JLog::WARNING, 'jerror'); + JLog::add(__METHOD__ . ' ' . JText::sprintf('JLIB_FILESYSTEM_ERROR_PATH_IS_NOT_A_FOLDER', $path), JLog::WARNING, 'jerror'); return false; } From d4cff516b30c20f82dd773adebc041261740d63f Mon Sep 17 00:00:00 2001 From: photodude Date: Mon, 29 Feb 2016 19:52:49 -0700 Subject: [PATCH 41/42] Remove duplicate code and extend JFilters from Framework --- libraries/joomla/filter/input.php | 397 ++++++----------------------- libraries/joomla/filter/output.php | 154 +---------- 2 files changed, 77 insertions(+), 474 deletions(-) diff --git a/libraries/joomla/filter/input.php b/libraries/joomla/filter/input.php index c3f09edb7768c..09b4fba9fbf17 100644 --- a/libraries/joomla/filter/input.php +++ b/libraries/joomla/filter/input.php @@ -9,6 +9,7 @@ defined('JPATH_PLATFORM') or die; +use Joomla\Filter\InputFilter; use Joomla\String\StringHelper; /** @@ -19,108 +20,16 @@ * * @since 11.1 */ -class JFilterInput +class JFilterInput extends InputFilter { - /** - * A container for JFilterInput instances. - * - * @var array - * @since 11.3 - */ - protected static $instances = array(); - - /** - * The array of permitted tags (white list). - * - * @var array - * @since 11.1 - */ - public $tagsArray; - - /** - * The array of permitted tag attributes (white list). - * - * @var array - * @since 11.1 - */ - public $attrArray; - - /** - * The method for sanitising tags: WhiteList method = 0 (default), BlackList method = 1 - * - * @var integer - * @since 11.1 - */ - public $tagsMethod; - - /** - * The method for sanitising attributes: WhiteList method = 0 (default), BlackList method = 1 - * - * @var integer - * @since 11.1 - */ - public $attrMethod; - - /** - * A flag for XSS checks. Only auto clean essentials = 0, Allow clean blacklisted tags/attr = 1 - * - * @var integer - * @since 11.1 - */ - public $xssAuto; - /** * A flag for Unicode Supplementary Characters (4-byte Unicode character) stripping. * * @var integer - * @since CMS 3.5.0 - */ - public $stripUSC = 0; - - /** - * The list of the default blacklisted tags. * - * @var array - * @since 11.1 - */ - public $tagBlacklist = array( - 'applet', - 'body', - 'bgsound', - 'base', - 'basefont', - 'embed', - 'frame', - 'frameset', - 'head', - 'html', - 'id', - 'iframe', - 'ilayer', - 'layer', - 'link', - 'meta', - 'name', - 'object', - 'script', - 'style', - 'title', - 'xml', - ); - - /** - * The list of the default blacklisted tag attributes. All event handlers implicit. - * - * @var array - * @since 11.1 + * @since 3.5 */ - public $attrBlacklist = array( - 'action', - 'background', - 'codebase', - 'dynsrc', - 'lowsrc', - ); + public $stripUSC = 0; /** * Constructor for inputFilter class. Only first parameter is required. @@ -147,7 +56,6 @@ public function __construct($tagsArray = array(), $attrArray = array(), $tagsMet $this->attrMethod = $attrMethod; $this->xssAuto = $xssAuto; $this->stripUSC = $stripUSC; - /** * If Unicode Supplementary Characters stripping is not set we have to check with the database driver. If the * driver does not support USCs (i.e. there is no utf8mb4 support) we will enable USC stripping. @@ -261,7 +169,6 @@ public function clean($source, $type = 'string') } break; - case 'UINT': $pattern = '/[-+]?[0-9]+/'; @@ -283,7 +190,6 @@ public function clean($source, $type = 'string') } break; - case 'FLOAT': case 'DOUBLE': $pattern = '/[-+]?[0-9]+(\.[0-9]+)?([eE][-+]?[0-9]+)?/'; @@ -306,9 +212,9 @@ public function clean($source, $type = 'string') } break; - case 'BOOL': case 'BOOLEAN': + if (is_array($source)) { $result = array(); @@ -325,7 +231,6 @@ public function clean($source, $type = 'string') } break; - case 'WORD': $pattern = '/[^A-Z_]/i'; @@ -345,7 +250,6 @@ public function clean($source, $type = 'string') } break; - case 'ALNUM': $pattern = '/[^A-Z0-9]/i'; @@ -365,7 +269,6 @@ public function clean($source, $type = 'string') } break; - case 'CMD': $pattern = '/[^A-Z0-9_\.-]/i'; @@ -387,7 +290,6 @@ public function clean($source, $type = 'string') } break; - case 'BASE64': $pattern = '/[^A-Z0-9\/+=]/i'; @@ -407,7 +309,6 @@ public function clean($source, $type = 'string') } break; - case 'STRING': if (is_array($source)) @@ -426,7 +327,6 @@ public function clean($source, $type = 'string') } break; - case 'HTML': if (is_array($source)) @@ -445,11 +345,10 @@ public function clean($source, $type = 'string') } break; - case 'ARRAY': $result = (array) $source; - break; + break; case 'PATH': $pattern = '/^[A-Za-z0-9_\/-]+[A-Za-z0-9_\.-]*([\\\\\/][A-Za-z0-9_-]+[A-Za-z0-9_\.-]*)*$/'; @@ -471,7 +370,6 @@ public function clean($source, $type = 'string') } break; - case 'TRIM': if (is_array($source)) @@ -494,7 +392,6 @@ public function clean($source, $type = 'string') } break; - case 'USERNAME': $pattern = '/[\x00-\x1F\x7F<>"\'%&]/'; @@ -514,12 +411,12 @@ public function clean($source, $type = 'string') } break; - case 'RAW': $result = $source; - break; + break; default: + // Are we dealing with an array? if (is_array($source)) { @@ -531,7 +428,6 @@ public function clean($source, $type = 'string') $source[$key] = $this->_remove($this->_decode($value)); } } - $result = $source; } else @@ -548,6 +444,7 @@ public function clean($source, $type = 'string') $result = $source; } } + break; } @@ -579,36 +476,14 @@ public function emailToPunycode($text) return $text; } - /** - * Function to determine if contents of an attribute are safe - * - * @param array $attrSubSet A 2 element array for attribute's name, value - * - * @return boolean True if bad code is detected - * - * @since 11.1 - */ - public static function checkAttribute($attrSubSet) - { - $attrSubSet[0] = strtolower($attrSubSet[0]); - $attrSubSet[1] = strtolower($attrSubSet[1]); - - return (((strpos($attrSubSet[1], 'expression') !== false) && ($attrSubSet[0]) == 'style') - || (strpos($attrSubSet[1], 'javascript:') !== false) - || (strpos($attrSubSet[1], 'behaviour:') !== false) - || (strpos($attrSubSet[1], 'vbscript:') !== false) - || (strpos($attrSubSet[1], 'mocha:') !== false) - || (strpos($attrSubSet[1], 'livescript:') !== false)); - } - /** * Checks an uploaded for suspicious naming and potential PHP contents which could indicate a hacking attempt. * * The options you can define are: * null_byte Prevent files with a null byte in their name (buffer overflow attack) * forbidden_extensions Do not allow these strings anywhere in the file's extension - * php_tag_in_content Do not allow ` true, + // Forbidden string in extension (e.g. php matched .php, .xxx.php, .php.xxx and so on) 'forbidden_extensions' => array( 'php', 'phps', 'php5', 'php3', 'php4', 'inc', 'pl', 'cgi', 'fcgi', 'java', 'jar', 'py' ), + // true, + // true, + // Which file extensions to scan for short tags 'shorttag_extensions' => array( 'inc', 'phps', 'class', 'php3', 'php4', 'php5', 'txt', 'dat', 'tpl', 'tmpl' ), + // Forbidden extensions anywhere in the content 'fobidden_ext_in_content' => true, + // Which file extensions to scan for .php in the content 'php_ext_content_extensions' => array('zip', 'rar', 'tar', 'gz', 'tgz', 'bz2', 'tbz', 'jpa'), ); @@ -882,8 +764,8 @@ protected static function decodeFileData(array $data) * * @return string 'Cleaned' version of input parameter * - * @since 11.1 - * @deprecated 4.0 Use JFilterInput::remove() instead + * @since 11.1 + * @deprecated 4.0 Use JFilterInput::remove() instead */ protected function _remove($source) { @@ -919,8 +801,8 @@ protected function remove($source) * * @return string 'Cleaned' version of input parameter * - * @since 11.1 - * @deprecated 4.0 Use JFilterInput::cleanTags() instead + * @since 11.1 + * @deprecated 4.0 Use JFilterInput::cleanTags() instead */ protected function _cleanTags($source) { @@ -1039,7 +921,6 @@ protected function cleanTags($source) $nextSpace = strpos($fromSpace, ' '); $openQuotes = strpos($fromSpace, '"'); $closeQuotes = strpos(substr($fromSpace, ($openQuotes + 1)), '"') + $openQuotes + 1; - $startAtt = ''; $startAttPosition = 0; @@ -1065,6 +946,7 @@ protected function cleanTags($source) { $attribEnd = $nextSpace - 1; } + // If there is an ending, use this, if not, do not worry. if ($attribEnd > 0) { @@ -1074,8 +956,10 @@ protected function cleanTags($source) if (strpos($fromSpace, '=') !== false) { - // If the attribute value is wrapped in quotes we need to grab the substring from - // the closing quote, otherwise grab until the next space. + /* + * If the attribute value is wrapped in quotes we need to grab the substring from + * the closing quote, otherwise grab until the next space. + */ if (($openQuotes !== false) && (strpos(substr($fromSpace, ($openQuotes + 1)), '"') !== false)) { $attr = substr($fromSpace, 0, ($closeQuotes + 1)); @@ -1085,6 +969,7 @@ protected function cleanTags($source) $attr = substr($fromSpace, 0, $nextSpace); } } + // No more equal signs so add any extra text in the tag into the attribute array [eg. checked] else { @@ -1120,7 +1005,6 @@ protected function cleanTags($source) // Open or single tag $attrSet = $this->_cleanAttributes($attrSet); $preTag .= '<' . $tagName; - for ($i = 0, $count = count($attrSet); $i < $count; $i++) { $preTag .= ' ' . $attrSet[$i]; @@ -1136,6 +1020,7 @@ protected function cleanTags($source) $preTag .= ' />'; } } + // Closing tag else { @@ -1164,8 +1049,8 @@ protected function cleanTags($source) * * @return array Filtered array of attribute pairs * - * @since 11.1 - * @deprecated 4.0 Use JFilterInput::cleanAttributes() instead + * @since 11.1 + * @deprecated 4.0 Use JFilterInput::cleanAttributes() instead */ protected function _cleanAttributes($attrSet) { @@ -1173,106 +1058,62 @@ protected function _cleanAttributes($attrSet) } /** - * Internal method to strip a tag of certain attributes + * Escape < > and " inside attribute values * - * @param array $attrSet Array of attribute pairs to filter + * @param string $source The source string. * - * @return array Filtered array of attribute pairs + * @return string Filtered string * - * @since 3.5 + * @since 3.5 */ - protected function cleanAttributes($attrSet) + protected function escapeAttributeValues($source) { - $newSet = array(); - - $count = count($attrSet); + $alreadyFiltered = ''; + $remainder = $source; + $badChars = array('<', '"', '>'); + $escapedChars = array('<', '"', '>'); - // Iterate through attribute pairs - for ($i = 0; $i < $count; $i++) + /* + * Process each portion based on presence of =" and ", "/>, or "> + * See if there are any more attributes to process + */ + while (preg_match('#<[^>]*?=\s*?(\"|\')#s', $remainder, $matches, PREG_OFFSET_CAPTURE)) { - // Skip blank spaces - if (!$attrSet[$i]) - { - continue; - } - - // Split into name/value pairs - $attrSubSet = explode('=', trim($attrSet[$i]), 2); - - // Take the last attribute in case there is an attribute with no value - $attrSubSet_0 = explode(' ', trim($attrSubSet[0])); - $attrSubSet[0] = array_pop($attrSubSet_0); - - // Remove all "non-regular" attribute names - // AND blacklisted attributes + // Get the portion before the attribute value + $quotePosition = $matches[0][1]; + $nextBefore = $quotePosition + strlen($matches[0][0]); - if ((!preg_match('/[a-z]*$/i', $attrSubSet[0])) - || (($this->xssAuto) && ((in_array(strtolower($attrSubSet[0]), $this->attrBlacklist)) - || (substr($attrSubSet[0], 0, 2) == 'on')))) - { - continue; - } + /* + * Figure out if we have a single or double quote and look for the matching closing quote + * Closing quote should be "/>, ">, ", or " at the end of the string + */ + $quote = substr($matches[0][0], -1); + $pregMatch = ($quote == '"') ? '#(\"\s*/\s*>|\"\s*>|\"\s+|\"$)#' : "#(\'\s*/\s*>|\'\s*>|\'\s+|\'$)#"; - // XSS attribute value filtering - if (isset($attrSubSet[1])) + // Get the portion after attribute value + if (preg_match($pregMatch, substr($remainder, $nextBefore), $matches, PREG_OFFSET_CAPTURE)) { - // Trim leading and trailing spaces - $attrSubSet[1] = trim($attrSubSet[1]); - - // Strips unicode, hex, etc - $attrSubSet[1] = str_replace('&#', '', $attrSubSet[1]); - - // Strip normal newline within attr value - $attrSubSet[1] = preg_replace('/[\n\r]/', '', $attrSubSet[1]); - - // Strip double quotes - $attrSubSet[1] = str_replace('"', '', $attrSubSet[1]); - - // Convert single quotes from either side to doubles (Single quotes shouldn't be used to pad attr values) - if ((substr($attrSubSet[1], 0, 1) == "'") && (substr($attrSubSet[1], (strlen($attrSubSet[1]) - 1), 1) == "'")) - { - $attrSubSet[1] = substr($attrSubSet[1], 1, (strlen($attrSubSet[1]) - 2)); - } - // Strip slashes - $attrSubSet[1] = stripslashes($attrSubSet[1]); + // We have a closing quote + $nextAfter = $nextBefore + $matches[0][1]; } else { - continue; - } - - // Autostrip script tags - if (self::checkAttribute($attrSubSet)) - { - continue; + // No closing quote + $nextAfter = strlen($remainder); } - // Is our attribute in the user input array? - $attrFound = in_array(strtolower($attrSubSet[0]), $this->attrArray); + // Get the actual attribute value + $attributeValue = substr($remainder, $nextBefore, $nextAfter - $nextBefore); - // If the tag is allowed lets keep it - if ((!$attrFound && $this->attrMethod) || ($attrFound && !$this->attrMethod)) - { - // Does the attribute have a value? - if (empty($attrSubSet[1]) === false) - { - $newSet[] = $attrSubSet[0] . '="' . $attrSubSet[1] . '"'; - } - elseif ($attrSubSet[1] === "0") - { - // Special Case - // Is the value 0? - $newSet[] = $attrSubSet[0] . '="0"'; - } - else - { - // Leave empty attributes alone - $newSet[] = $attrSubSet[0] . '=""'; - } - } + // Escape bad chars + $attributeValue = str_replace($badChars, $escapedChars, $attributeValue); + $attributeValue = $this->_stripCSSExpressions($attributeValue); + $alreadyFiltered .= substr($remainder, 0, $nextBefore) . $attributeValue . $quote; + $remainder = substr($remainder, $nextAfter + 1); } - return $newSet; + // At this point, we just have to return the $alreadyFiltered and the $remainder + return $alreadyFiltered . $remainder; } /** @@ -1282,8 +1123,8 @@ protected function cleanAttributes($attrSet) * * @return string Plaintext string * - * @since 11.1 - * @deprecated 4.0 Use JFilterInput::decode() instead + * @since 11.1 + * @deprecated 4.0 Use JFilterInput::decode() instead */ protected function _decode($source) { @@ -1340,69 +1181,14 @@ protected function decode($source) * * @return string Filtered string * - * @since 11.1 - * @deprecated 4.0 Use JFilterInput::escapeAttributeValues() instead + * @since 11.1 + * @deprecated 4.0 Use JFilterInput::escapeAttributeValues() instead */ protected function _escapeAttributeValues($source) { return $this->escapeAttributeValues($source); } - /** - * Escape < > and " inside attribute values - * - * @param string $source The source string. - * - * @return string Filtered string - * - * @since 3.5 - */ - protected function escapeAttributeValues($source) - { - $alreadyFiltered = ''; - $remainder = $source; - $badChars = array('<', '"', '>'); - $escapedChars = array('<', '"', '>'); - - // Process each portion based on presence of =" and ", "/>, or "> - // See if there are any more attributes to process - while (preg_match('#<[^>]*?=\s*?(\"|\')#s', $remainder, $matches, PREG_OFFSET_CAPTURE)) - { - // Get the portion before the attribute value - $quotePosition = $matches[0][1]; - $nextBefore = $quotePosition + strlen($matches[0][0]); - - // Figure out if we have a single or double quote and look for the matching closing quote - // Closing quote should be "/>, ">, ", or " at the end of the string - $quote = substr($matches[0][0], -1); - $pregMatch = ($quote == '"') ? '#(\"\s*/\s*>|\"\s*>|\"\s+|\"$)#' : "#(\'\s*/\s*>|\'\s*>|\'\s+|\'$)#"; - - // Get the portion after attribute value - if (preg_match($pregMatch, substr($remainder, $nextBefore), $matches, PREG_OFFSET_CAPTURE)) - { - // We have a closing quote - $nextAfter = $nextBefore + $matches[0][1]; - } - else - { - // No closing quote - $nextAfter = strlen($remainder); - } - - // Get the actual attribute value - $attributeValue = substr($remainder, $nextBefore, $nextAfter - $nextBefore); - - // Escape bad chars - $attributeValue = str_replace($badChars, $escapedChars, $attributeValue); - $attributeValue = $this->_stripCSSExpressions($attributeValue); - $alreadyFiltered .= substr($remainder, 0, $nextBefore) . $attributeValue . $quote; - $remainder = substr($remainder, $nextAfter + 1); - } - - // At this point, we just have to return the $alreadyFiltered and the $remainder - return $alreadyFiltered . $remainder; - } - /** * Remove CSS Expressions in the form of `:expression(...)` * @@ -1418,41 +1204,6 @@ protected function _stripCSSExpressions($source) return $this->stripCSSExpressions($source); } - /** - * Remove CSS Expressions in the form of :expression(...) - * - * @param string $source The source string. - * - * @return string Filtered string - * - * @since 3.5 - */ - protected function stripCSSExpressions($source) - { - // Strip any comments out (in the form of /*...*/) - $test = preg_replace('#\/\*.*\*\/#U', '', $source); - - // Test for :expression - if (!stripos($test, ':expression')) - { - // Not found, so we are done - $return = $source; - } - else - { - // At this point, we have stripped out the comments and have found :expression - // Test stripped string for :expression followed by a '(' - if (preg_match_all('#:expression\s*\(#', $test, $matches)) - { - // If found, remove :expression - $test = str_ireplace(':expression', '', $test); - $return = $test; - } - } - - return $return; - } - /** * Recursively strip Unicode Supplementary Characters from the source. Not: objects cannot be filtered. * @@ -1460,7 +1211,7 @@ protected function stripCSSExpressions($source) * * @return mixed The filtered result * - * @since 3.5 + * @since 3.5 */ protected function stripUSC($source) { diff --git a/libraries/joomla/filter/output.php b/libraries/joomla/filter/output.php index 79e0b8be83cdc..4f19f2a2aada9 100644 --- a/libraries/joomla/filter/output.php +++ b/libraries/joomla/filter/output.php @@ -9,53 +9,15 @@ defined('JPATH_PLATFORM') or die; +use Joomla\Filter\OutputFilter; + /** * JFilterOutput * * @since 11.1 */ -class JFilterOutput +class JFilterOutput extends OutputFilter { - /** - * Makes an object safe to display in forms - * - * Object parameters that are non-string, array, object or start with underscore - * will be converted - * - * @param object &$mixed An object to be parsed - * @param integer $quote_style The optional quote style for the htmlspecialchars function - * @param mixed $exclude_keys An optional string single field name or array of field names not - * to be parsed (eg, for a textarea) - * - * @return void - * - * @since 11.1 - */ - public static function objectHTMLSafe(&$mixed, $quote_style = ENT_QUOTES, $exclude_keys = '') - { - if (is_object($mixed)) - { - foreach (get_object_vars($mixed) as $k => $v) - { - if (is_array($v) || is_object($v) || $v == null || substr($k, 1, 1) == '_') - { - continue; - } - - if (is_string($exclude_keys) && $k == $exclude_keys) - { - continue; - } - elseif (is_array($exclude_keys) && in_array($k, $exclude_keys)) - { - continue; - } - - $mixed->$k = htmlspecialchars($v, $quote_style, 'UTF-8'); - } - } - } - /** * This method processes a string and replaces all instances of & with & in links only. * @@ -102,7 +64,6 @@ public static function stringURLSafe($string) { // Remove any '-' from the string since they will be used as concatenaters $str = str_replace('-', ' ', $string); - $lang = JFactory::getLanguage(); $str = $lang->transliterate($str); @@ -118,63 +79,6 @@ public static function stringURLSafe($string) return $str; } - /** - * This method implements unicode slugs instead of transliteration. - * - * @param string $string String to process - * - * @return string Processed string - * - * @since 11.1 - */ - public static function stringURLUnicodeSlug($string) - { - // Replace double byte whitespaces by single byte (East Asian languages) - $str = preg_replace('/\xE3\x80\x80/', ' ', $string); - - // Remove any '-' from the string as they will be used as concatenator. - // Would be great to let the spaces in but only Firefox is friendly with this - - $str = str_replace('-', ' ', $str); - - // Replace forbidden characters by whitespaces - $str = preg_replace('#[:\#\*"@+=;!><&\.%()\]\/\'\\\\|\[]#', "\x20", $str); - - // Delete all '?' - $str = str_replace('?', '', $str); - - // Trim white spaces at beginning and end of alias and make lowercase - $str = trim(JString::strtolower($str)); - - // Remove any duplicate whitespace and replace whitespaces by hyphens - $str = preg_replace('#\x20+#', '-', $str); - - return $str; - } - - /** - * Replaces & with & for XHTML compliance - * - * @param string $text Text to process - * - * @return string Processed string. - * - * @since 11.1 - * - * @todo There must be a better way??? - */ - public static function ampReplace($text) - { - $text = str_replace('&&', '*--*', $text); - $text = str_replace('&#', '*-*', $text); - $text = str_replace('&', '&', $text); - $text = preg_replace('|&(?![\w]+;)|', '&', $text); - $text = str_replace('*-*', '&#', $text); - $text = str_replace('*--*', '&&', $text); - - return $text; - } - /** * Callback method for replacing & with & in a string * @@ -205,56 +109,4 @@ public static function _ampReplaceCallback($m) { return static::ampReplaceCallback($m); } - - /** - * Cleans text of all formatting and scripting code - * - * @param string &$text Text to clean - * - * @return string Cleaned text. - * - * @since 11.1 - */ - public static function cleanText(&$text) - { - $text = preg_replace("']*>.*?'si", '', $text); - $text = preg_replace('/]*>([^<]+)<\/a>/is', '\2 (\1)', $text); - $text = preg_replace('//', '', $text); - $text = preg_replace('/{.+?}/', '', $text); - $text = preg_replace('/ /', ' ', $text); - $text = preg_replace('/&/', ' ', $text); - $text = preg_replace('/"/', ' ', $text); - $text = strip_tags($text); - $text = htmlspecialchars($text, ENT_COMPAT, 'UTF-8'); - - return $text; - } - - /** - * Strip img-tags from string - * - * @param string $string Sting to be cleaned. - * - * @return string Cleaned string - * - * @since 11.1 - */ - public static function stripImages($string) - { - return preg_replace('#(<[/]?img.*>)#U', '', $string); - } - - /** - * Strip iframe-tags from string - * - * @param string $string Sting to be cleaned. - * - * @return string Cleaned string - * - * @since 12.2 - */ - public static function stripIframes($string) - { - return preg_replace('#(<[/]?iframe.*>)#U', '', $string); - } } From a6570a2f0c9f4c661f7b1cfad661d73c340da38f Mon Sep 17 00:00:00 2001 From: photodude Date: Tue, 12 Apr 2016 23:37:36 -0600 Subject: [PATCH 42/42] Fix missing DocBlock change --- libraries/joomla/filter/input.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/joomla/filter/input.php b/libraries/joomla/filter/input.php index 09b4fba9fbf17..b1b8f38341962 100644 --- a/libraries/joomla/filter/input.php +++ b/libraries/joomla/filter/input.php @@ -482,8 +482,8 @@ public function emailToPunycode($text) * The options you can define are: * null_byte Prevent files with a null byte in their name (buffer overflow attack) * forbidden_extensions Do not allow these strings anywhere in the file's extension - * php_tag_in_content Do not allow
+ - + + - + + - + + - + +
+ pagination->getListFooter(); ?>
+ message_id); ?> @@ -107,7 +93,7 @@ user_from; ?> + date_time, JText::_('DATE_FORMAT_LC2')); ?>