diff --git a/administrator/components/com_admin/controller.php b/administrator/components/com_admin/controller.php index 76ac053769e4c..c8a4ea86bd5b2 100644 --- a/administrator/components/com_admin/controller.php +++ b/administrator/components/com_admin/controller.php @@ -12,9 +12,7 @@ /** * Admin Controller * - * @package Joomla.Administrator - * @subpackage com_admin - * @since 1.6 + * @since 1.6 */ class AdminController extends JControllerLegacy { diff --git a/administrator/components/com_admin/controllers/profile.php b/administrator/components/com_admin/controllers/profile.php index 984c459cfd7cd..4884ef27a86b6 100644 --- a/administrator/components/com_admin/controllers/profile.php +++ b/administrator/components/com_admin/controllers/profile.php @@ -12,9 +12,7 @@ /** * User profile controller class. * - * @package Joomla.Administrator - * @subpackage com_admin - * @since 1.6 + * @since 1.6 */ class AdminControllerProfile extends JControllerForm { diff --git a/administrator/components/com_admin/helpers/html/directory.php b/administrator/components/com_admin/helpers/html/directory.php index 9ea9a8b45887a..5346819242767 100644 --- a/administrator/components/com_admin/helpers/html/directory.php +++ b/administrator/components/com_admin/helpers/html/directory.php @@ -12,9 +12,7 @@ /** * Utility class working with directory * - * @package Joomla.Administrator - * @subpackage com_admin - * @since 1.6 + * @since 1.6 */ abstract class JHtmlDirectory { diff --git a/administrator/components/com_admin/helpers/html/phpsetting.php b/administrator/components/com_admin/helpers/html/phpsetting.php index 3577eeb11dd37..717ac6407d207 100644 --- a/administrator/components/com_admin/helpers/html/phpsetting.php +++ b/administrator/components/com_admin/helpers/html/phpsetting.php @@ -12,9 +12,7 @@ /** * Utility class working with phpsetting * - * @package Joomla.Administrator - * @subpackage com_admin - * @since 1.6 + * @since 1.6 */ abstract class JHtmlPhpSetting { diff --git a/administrator/components/com_admin/helpers/html/system.php b/administrator/components/com_admin/helpers/html/system.php index c4fa369fae817..2c5150e73fde0 100644 --- a/administrator/components/com_admin/helpers/html/system.php +++ b/administrator/components/com_admin/helpers/html/system.php @@ -12,9 +12,7 @@ /** * Utility class working with system * - * @package Joomla.Administrator - * @subpackage com_admin - * @since 1.6 + * @since 1.6 */ abstract class JHtmlSystem { diff --git a/administrator/components/com_admin/models/help.php b/administrator/components/com_admin/models/help.php index 9e6139c8a3fee..1898b1b148d34 100644 --- a/administrator/components/com_admin/models/help.php +++ b/administrator/components/com_admin/models/help.php @@ -12,9 +12,7 @@ /** * Admin Component Help Model * - * @package Joomla.Administrator - * @subpackage com_admin - * @since 1.6 + * @since 1.6 */ class AdminModelHelp extends JModelLegacy { diff --git a/administrator/components/com_admin/models/profile.php b/administrator/components/com_admin/models/profile.php index 8d1935caeda59..e404b22270e49 100644 --- a/administrator/components/com_admin/models/profile.php +++ b/administrator/components/com_admin/models/profile.php @@ -14,9 +14,7 @@ /** * User model. * - * @package Joomla.Administrator - * @subpackage com_admin - * @since 1.6 + * @since 1.6 */ class AdminModelProfile extends UsersModelUser { diff --git a/administrator/components/com_admin/models/sysinfo.php b/administrator/components/com_admin/models/sysinfo.php index 0936ec6faa01f..9956e0709ac9c 100644 --- a/administrator/components/com_admin/models/sysinfo.php +++ b/administrator/components/com_admin/models/sysinfo.php @@ -12,9 +12,7 @@ /** * Model for the display of system information. * - * @package Joomla.Administrator - * @subpackage com_admin - * @since 1.6 + * @since 1.6 */ class AdminModelSysInfo extends JModelLegacy { diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index fa8495e779a68..2a741e209e6bd 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -12,9 +12,7 @@ /** * Script file of Joomla CMS * - * @package Joomla.Administrator - * @subpackage com_admin - * @since 1.6.4 + * @since 1.6.4 */ class JoomlaInstallerScript { diff --git a/administrator/components/com_admin/views/help/view.html.php b/administrator/components/com_admin/views/help/view.html.php index 01d6290d9c585..7793937fb46ff 100644 --- a/administrator/components/com_admin/views/help/view.html.php +++ b/administrator/components/com_admin/views/help/view.html.php @@ -12,9 +12,7 @@ /** * HTML View class for the Admin component * - * @package Joomla.Administrator - * @subpackage com_admin - * @since 1.6 + * @since 1.6 */ class AdminViewHelp extends JViewLegacy { @@ -49,7 +47,11 @@ class AdminViewHelp extends JViewLegacy protected $start_here = null; /** - * Display the view + * Execute and display a template script. + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return mixed A string if successful, otherwise a Error object. */ public function display($tpl = null) { @@ -66,6 +68,8 @@ public function display($tpl = null) /** * Setup the Toolbar * + * @return void + * * @since 1.6 */ protected function addToolbar() diff --git a/administrator/components/com_admin/views/profile/view.html.php b/administrator/components/com_admin/views/profile/view.html.php index ed8f3be531886..d2d2a11016f20 100644 --- a/administrator/components/com_admin/views/profile/view.html.php +++ b/administrator/components/com_admin/views/profile/view.html.php @@ -12,9 +12,7 @@ /** * View class to allow users edit their own profile. * - * @package Joomla.Administrator - * @subpackage com_admin - * @since 1.6 + * @since 1.6 */ class AdminViewProfile extends JViewLegacy { @@ -25,7 +23,11 @@ class AdminViewProfile extends JViewLegacy protected $state; /** - * Display the view + * Execute and display a template script. + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return mixed A string if successful, otherwise a Error object. */ public function display($tpl = null) { @@ -37,6 +39,7 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); + return false; } @@ -50,6 +53,8 @@ public function display($tpl = null) /** * Add the page title and toolbar. * + * @return void + * * @since 1.6 */ protected function addToolbar() diff --git a/administrator/components/com_admin/views/sysinfo/view.html.php b/administrator/components/com_admin/views/sysinfo/view.html.php index 331a6cf86318e..74eb722eedfc9 100644 --- a/administrator/components/com_admin/views/sysinfo/view.html.php +++ b/administrator/components/com_admin/views/sysinfo/view.html.php @@ -12,9 +12,7 @@ /** * Sysinfo View class for the Admin component * - * @package Joomla.Administrator - * @subpackage com_admin - * @since 1.6 + * @since 1.6 */ class AdminViewSysinfo extends JViewLegacy { @@ -44,7 +42,11 @@ class AdminViewSysinfo extends JViewLegacy protected $directory = null; /** - * Display the view + * Execute and display a template script. + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return mixed A string if successful, otherwise a Error object. */ public function display($tpl = null) { @@ -89,6 +91,8 @@ protected function _setSubMenu() /** * Setup the Toolbar * + * @return void + * * @since 1.6 */ protected function addToolbar() diff --git a/administrator/components/com_banners/controller.php b/administrator/components/com_banners/controller.php index a1fac03d7915b..dc1997b28c92f 100644 --- a/administrator/components/com_banners/controller.php +++ b/administrator/components/com_banners/controller.php @@ -12,9 +12,7 @@ /** * Banners master display controller. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class BannersController extends JControllerLegacy { diff --git a/administrator/components/com_banners/controllers/banner.php b/administrator/components/com_banners/controllers/banner.php index 4b32be74abc33..033ca79e87f1e 100644 --- a/administrator/components/com_banners/controllers/banner.php +++ b/administrator/components/com_banners/controllers/banner.php @@ -12,9 +12,7 @@ /** * Banner controller class. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class BannersControllerBanner extends JControllerForm { diff --git a/administrator/components/com_banners/controllers/banners.php b/administrator/components/com_banners/controllers/banners.php index bb147df43fd2b..e1232d59defb7 100644 --- a/administrator/components/com_banners/controllers/banners.php +++ b/administrator/components/com_banners/controllers/banners.php @@ -12,9 +12,7 @@ /** * Banners list controller class. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class BannersControllerBanners extends JControllerAdmin { diff --git a/administrator/components/com_banners/controllers/client.php b/administrator/components/com_banners/controllers/client.php index 1554db24ceabf..6c397f3c15f44 100644 --- a/administrator/components/com_banners/controllers/client.php +++ b/administrator/components/com_banners/controllers/client.php @@ -12,9 +12,7 @@ /** * Client controller class. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class BannersControllerClient extends JControllerForm { diff --git a/administrator/components/com_banners/controllers/clients.php b/administrator/components/com_banners/controllers/clients.php index cd53ddf570e19..b7ad9fbdefa8a 100644 --- a/administrator/components/com_banners/controllers/clients.php +++ b/administrator/components/com_banners/controllers/clients.php @@ -12,9 +12,7 @@ /** * Clients list controller class. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class BannersControllerClients extends JControllerAdmin { diff --git a/administrator/components/com_banners/controllers/tracks.php b/administrator/components/com_banners/controllers/tracks.php index 0c2905bc8aa4d..d6bdfc5bf01aa 100644 --- a/administrator/components/com_banners/controllers/tracks.php +++ b/administrator/components/com_banners/controllers/tracks.php @@ -12,9 +12,7 @@ /** * Tracks list controller class. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class BannersControllerTracks extends JControllerLegacy { diff --git a/administrator/components/com_banners/controllers/tracks.raw.php b/administrator/components/com_banners/controllers/tracks.raw.php index 6b9db7052efd4..b144c1161c1f0 100644 --- a/administrator/components/com_banners/controllers/tracks.raw.php +++ b/administrator/components/com_banners/controllers/tracks.raw.php @@ -12,9 +12,7 @@ /** * Tracks list controller class. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class BannersControllerTracks extends JControllerLegacy { diff --git a/administrator/components/com_banners/helpers/banners.php b/administrator/components/com_banners/helpers/banners.php index f127522b81c34..41e2ad9a695f7 100644 --- a/administrator/components/com_banners/helpers/banners.php +++ b/administrator/components/com_banners/helpers/banners.php @@ -12,9 +12,7 @@ /** * Banners component helper. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class BannersHelper extends JHelperContent { diff --git a/administrator/components/com_banners/helpers/html/banner.php b/administrator/components/com_banners/helpers/html/banner.php index f3e942ece6a51..1eda74bbe43e6 100644 --- a/administrator/components/com_banners/helpers/html/banner.php +++ b/administrator/components/com_banners/helpers/html/banner.php @@ -12,9 +12,7 @@ /** * Banner HTML class. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 2.5 + * @since 2.5 */ abstract class JHtmlBanner { diff --git a/administrator/components/com_banners/models/banner.php b/administrator/components/com_banners/models/banner.php index 54948fc3422d7..e5039c2999e12 100644 --- a/administrator/components/com_banners/models/banner.php +++ b/administrator/components/com_banners/models/banner.php @@ -12,9 +12,7 @@ /** * Banner model. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class BannersModelBanner extends JModelAdmin { diff --git a/administrator/components/com_banners/models/banners.php b/administrator/components/com_banners/models/banners.php index 75b4809e76816..4633c880f9bdc 100644 --- a/administrator/components/com_banners/models/banners.php +++ b/administrator/components/com_banners/models/banners.php @@ -12,9 +12,7 @@ /** * Methods supporting a list of banner records. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class BannersModelBanners extends JModelList { diff --git a/administrator/components/com_banners/models/client.php b/administrator/components/com_banners/models/client.php index 69a46619a8594..cc97865cab594 100644 --- a/administrator/components/com_banners/models/client.php +++ b/administrator/components/com_banners/models/client.php @@ -12,9 +12,7 @@ /** * Client model. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class BannersModelClient extends JModelAdmin { diff --git a/administrator/components/com_banners/models/clients.php b/administrator/components/com_banners/models/clients.php index 511b831ae57c5..e59354f415efd 100644 --- a/administrator/components/com_banners/models/clients.php +++ b/administrator/components/com_banners/models/clients.php @@ -12,9 +12,7 @@ /** * Methods supporting a list of banner records. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class BannersModelClients extends JModelList { diff --git a/administrator/components/com_banners/models/download.php b/administrator/components/com_banners/models/download.php index 81cb8038a6b4b..6ef59dd4b7bd7 100644 --- a/administrator/components/com_banners/models/download.php +++ b/administrator/components/com_banners/models/download.php @@ -12,9 +12,7 @@ /** * Download model. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.5 + * @since 1.5 */ class BannersModelDownload extends JModelForm { diff --git a/administrator/components/com_banners/models/fields/bannerclient.php b/administrator/components/com_banners/models/fields/bannerclient.php index 8f0b257b99b05..45a8979ff2f9a 100644 --- a/administrator/components/com_banners/models/fields/bannerclient.php +++ b/administrator/components/com_banners/models/fields/bannerclient.php @@ -16,9 +16,7 @@ /** * Bannerclient Field class for the Joomla Framework. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class JFormFieldBannerClient extends JFormFieldList { diff --git a/administrator/components/com_banners/models/fields/clicks.php b/administrator/components/com_banners/models/fields/clicks.php index 1ac80289d9039..71c20ee0df7e8 100644 --- a/administrator/components/com_banners/models/fields/clicks.php +++ b/administrator/components/com_banners/models/fields/clicks.php @@ -12,9 +12,7 @@ /** * Clicks Field class for the Joomla Framework. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class JFormFieldClicks extends JFormField { diff --git a/administrator/components/com_banners/models/fields/impmade.php b/administrator/components/com_banners/models/fields/impmade.php index 908b888943a0c..37bf6ba9110e3 100644 --- a/administrator/components/com_banners/models/fields/impmade.php +++ b/administrator/components/com_banners/models/fields/impmade.php @@ -12,9 +12,7 @@ /** * Clicks Field class for the Joomla Framework. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class JFormFieldImpMade extends JFormField { diff --git a/administrator/components/com_banners/models/fields/imptotal.php b/administrator/components/com_banners/models/fields/imptotal.php index 8f42f5c2fb2ac..0809509a53ce1 100644 --- a/administrator/components/com_banners/models/fields/imptotal.php +++ b/administrator/components/com_banners/models/fields/imptotal.php @@ -12,9 +12,7 @@ /** * Impressions Field class for the Joomla Framework. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class JFormFieldImpTotal extends JFormField { diff --git a/administrator/components/com_banners/models/tracks.php b/administrator/components/com_banners/models/tracks.php index 13b58efc07758..188b0be213628 100644 --- a/administrator/components/com_banners/models/tracks.php +++ b/administrator/components/com_banners/models/tracks.php @@ -12,9 +12,7 @@ /** * Methods supporting a list of tracks. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class BannersModelTracks extends JModelList { diff --git a/administrator/components/com_banners/tables/banner.php b/administrator/components/com_banners/tables/banner.php index 4fb4efc57f7a4..53593139a3bfd 100644 --- a/administrator/components/com_banners/tables/banner.php +++ b/administrator/components/com_banners/tables/banner.php @@ -12,9 +12,7 @@ /** * Banner table * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.5 + * @since 1.5 */ class BannersTableBanner extends JTable { diff --git a/administrator/components/com_banners/tables/client.php b/administrator/components/com_banners/tables/client.php index 98a40692b2a5c..fb2a0efeefc7f 100644 --- a/administrator/components/com_banners/tables/client.php +++ b/administrator/components/com_banners/tables/client.php @@ -12,9 +12,7 @@ /** * Client table * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class BannersTableClient extends JTable { diff --git a/administrator/components/com_banners/views/banner/view.html.php b/administrator/components/com_banners/views/banner/view.html.php index 1055ee7c95547..50c96fa687202 100644 --- a/administrator/components/com_banners/views/banner/view.html.php +++ b/administrator/components/com_banners/views/banner/view.html.php @@ -14,9 +14,7 @@ /** * View to edit a banner. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.5 + * @since 1.5 */ class BannersViewBanner extends JViewLegacy { diff --git a/administrator/components/com_banners/views/banners/view.html.php b/administrator/components/com_banners/views/banners/view.html.php index 575a26136f133..150e3b3882e3c 100644 --- a/administrator/components/com_banners/views/banners/view.html.php +++ b/administrator/components/com_banners/views/banners/view.html.php @@ -12,9 +12,7 @@ /** * View class for a list of banners. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class BannersViewBanners extends JViewLegacy { diff --git a/administrator/components/com_banners/views/client/view.html.php b/administrator/components/com_banners/views/client/view.html.php index a60fb7217e071..9778da3fa0729 100644 --- a/administrator/components/com_banners/views/client/view.html.php +++ b/administrator/components/com_banners/views/client/view.html.php @@ -14,9 +14,7 @@ /** * View to edit a client. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.5 + * @since 1.5 */ class BannersViewClient extends JViewLegacy { diff --git a/administrator/components/com_banners/views/clients/view.html.php b/administrator/components/com_banners/views/clients/view.html.php index 5c114f3a06a3b..5d7489e5721cc 100644 --- a/administrator/components/com_banners/views/clients/view.html.php +++ b/administrator/components/com_banners/views/clients/view.html.php @@ -12,9 +12,7 @@ /** * View class for a list of clients. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class BannersViewClients extends JViewLegacy { diff --git a/administrator/components/com_banners/views/download/view.html.php b/administrator/components/com_banners/views/download/view.html.php index 7a56a70746435..b041116b017bf 100644 --- a/administrator/components/com_banners/views/download/view.html.php +++ b/administrator/components/com_banners/views/download/view.html.php @@ -12,9 +12,7 @@ /** * View class for download a list of tracks. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class BannersViewDownload extends JViewLegacy { diff --git a/administrator/components/com_banners/views/tracks/view.html.php b/administrator/components/com_banners/views/tracks/view.html.php index 6f5dda26ec81d..7ac2377d32e61 100644 --- a/administrator/components/com_banners/views/tracks/view.html.php +++ b/administrator/components/com_banners/views/tracks/view.html.php @@ -12,9 +12,7 @@ /** * View class for a list of tracks. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class BannersViewTracks extends JViewLegacy { diff --git a/administrator/components/com_banners/views/tracks/view.raw.php b/administrator/components/com_banners/views/tracks/view.raw.php index 169905570cf76..e4510498b1c26 100644 --- a/administrator/components/com_banners/views/tracks/view.raw.php +++ b/administrator/components/com_banners/views/tracks/view.raw.php @@ -12,9 +12,7 @@ /** * View class for a list of tracks. * - * @package Joomla.Administrator - * @subpackage com_banners - * @since 1.6 + * @since 1.6 */ class BannersViewTracks extends JViewLegacy { diff --git a/administrator/components/com_cache/controller.php b/administrator/components/com_cache/controller.php index 4b75100ec1a3f..3d2ca6abb8fe4 100644 --- a/administrator/components/com_cache/controller.php +++ b/administrator/components/com_cache/controller.php @@ -12,14 +12,12 @@ /** * Cache Controller * - * @package Joomla.Administrator - * @subpackage com_cache - * @since 1.6 + * @since 1.6 */ class CacheController extends JControllerLegacy { /** - * Method to display a view. + * Display a view. * * @param boolean $cachable If true, the view output will be cached * @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. @@ -67,7 +65,7 @@ public function display($cachable = false, $urlparams = false) } /** - * Purge an array of cache groups. + * Method to delete a list of cache groups. * * @return void */ diff --git a/administrator/components/com_cache/helpers/cache.php b/administrator/components/com_cache/helpers/cache.php index dc674acbb81d3..9c3d7c1223807 100644 --- a/administrator/components/com_cache/helpers/cache.php +++ b/administrator/components/com_cache/helpers/cache.php @@ -12,9 +12,7 @@ /** * Cache component helper. * - * @package Joomla.Administrator - * @subpackage com_cache - * @since 1.6 + * @since 1.6 */ class CacheHelper { diff --git a/administrator/components/com_cache/models/cache.php b/administrator/components/com_cache/models/cache.php index 9bb5d99d902be..f1480b99c9ec6 100644 --- a/administrator/components/com_cache/models/cache.php +++ b/administrator/components/com_cache/models/cache.php @@ -12,9 +12,7 @@ /** * Cache Model * - * @package Joomla.Administrator - * @subpackage com_cache - * @since 1.6 + * @since 1.6 */ class CacheModelCache extends JModelList { @@ -44,8 +42,8 @@ class CacheModelCache extends JModelList * * Note. Calling getState in this method will result in recursion. * - * @param string $ordering An optional ordering field. - * @param string $direction An optional direction (asc|desc). + * @param string $ordering Field for ordering. + * @param string $direction Direction of ordering. * * @return void * @@ -81,14 +79,14 @@ public function getData() if ($this->_total) { - // Apply custom ordering + // Apply custom ordering. $ordering = $this->getState('list.ordering'); - $direction = ($this->getState('list.direction') == 'asc') ? 1 : -1; + $direction = ($this->getState('list.direction') == 'asc') ? 1 : (-1); jimport('joomla.utilities.arrayhelper'); $this->_data = JArrayHelper::sortObjects($data, $ordering, $direction); - // Apply custom pagination + // Apply custom pagination. if ($this->_total > $this->getState('list.limit') && $this->getState('list.limit')) { $this->_data = array_slice($this->_data, $this->getState('list.start'), $this->getState('list.limit')); @@ -105,7 +103,7 @@ public function getData() } /** - * Method to get cache instance + * Method to get cache instance. * * @return object */ @@ -126,7 +124,7 @@ public function getCache() } /** - * Method to get client data + * Method to get client data. * * @return array */ @@ -136,7 +134,7 @@ public function getClient() } /** - * Get the number of current Cache Groups + * Get the number of current Cache Groups. * * @return int */ @@ -151,7 +149,7 @@ public function getTotal() } /** - * Method to get a pagination object for the cache + * Method to get a pagination object for the cache. * * @return integer */ @@ -180,7 +178,7 @@ public function clean($group = '') } /** - * Clean a list of cache groups. + * Purge an array of cache groups. * * @param array $array Array of cache group names. * @@ -195,9 +193,9 @@ public function cleanlist($array) } /** - * Purge the cache. + * Purge all cache items. * - * @return boolean True on success, false otherwise. + * @return boolean True if successful; false otherwise. */ public function purge() { diff --git a/administrator/components/com_cache/views/cache/view.html.php b/administrator/components/com_cache/views/cache/view.html.php index 902b98e55cec0..e0e8676932fba 100644 --- a/administrator/components/com_cache/views/cache/view.html.php +++ b/administrator/components/com_cache/views/cache/view.html.php @@ -12,9 +12,7 @@ /** * HTML View class for the Cache component * - * @package Joomla.Administrator - * @subpackage com_cache - * @since 1.6 + * @since 1.6 */ class CacheViewCache extends JViewLegacy { @@ -27,11 +25,11 @@ class CacheViewCache extends JViewLegacy protected $state; /** - * Display the view + * Display a view. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return void + * @return mixed A string if successful, otherwise a Error object. */ public function display($tpl = null) { @@ -77,7 +75,7 @@ protected function addToolbar() JHtmlSidebar::setAction('index.php?option=com_cache'); JHtmlSidebar::addFilter( - // @todo We need an actual label here + // @todo We need an actual label here. '', 'filter_client_id', JHtml::_('select.options', CacheHelper::getClientOptions(), 'value', 'text', $this->state->get('clientId')) diff --git a/administrator/components/com_cache/views/purge/view.html.php b/administrator/components/com_cache/views/purge/view.html.php index 07bd2aaabe756..bfc7df6e05b8e 100644 --- a/administrator/components/com_cache/views/purge/view.html.php +++ b/administrator/components/com_cache/views/purge/view.html.php @@ -12,18 +12,16 @@ /** * HTML View class for the Cache component * - * @package Joomla.Administrator - * @subpackage com_cache - * @since 1.6 + * @since 1.6 */ class CacheViewPurge extends JViewLegacy { /** - * Display the view + * Display a view. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * - * @return void + * @return mixed A string if successful, otherwise a Error object. */ public function display($tpl = null) { diff --git a/administrator/components/com_categories/controller.php b/administrator/components/com_categories/controller.php index 2be8b456876a4..4134879fbe7b0 100644 --- a/administrator/components/com_categories/controller.php +++ b/administrator/components/com_categories/controller.php @@ -12,9 +12,7 @@ /** * Categories view class for the Category package. * - * @package Joomla.Administrator - * @subpackage com_categories - * @since 1.6 + * @since 1.6 */ class CategoriesController extends JControllerLegacy { diff --git a/administrator/components/com_categories/controllers/categories.php b/administrator/components/com_categories/controllers/categories.php index 35e3377cc4a0f..06b58c45c2146 100644 --- a/administrator/components/com_categories/controllers/categories.php +++ b/administrator/components/com_categories/controllers/categories.php @@ -12,9 +12,7 @@ /** * The Categories List Controller * - * @package Joomla.Administrator - * @subpackage com_categories - * @since 1.6 + * @since 1.6 */ class CategoriesControllerCategories extends JControllerAdmin { diff --git a/administrator/components/com_categories/controllers/category.php b/administrator/components/com_categories/controllers/category.php index 08a906d7b5e25..071bba6edc563 100644 --- a/administrator/components/com_categories/controllers/category.php +++ b/administrator/components/com_categories/controllers/category.php @@ -12,9 +12,7 @@ /** * The Category Controller * - * @package Joomla.Administrator - * @subpackage com_categories - * @since 1.6 + * @since 1.6 */ class CategoriesControllerCategory extends JControllerForm { diff --git a/administrator/components/com_categories/helpers/association.php b/administrator/components/com_categories/helpers/association.php index fb833dfdff753..cb418ecb9fbf4 100644 --- a/administrator/components/com_categories/helpers/association.php +++ b/administrator/components/com_categories/helpers/association.php @@ -14,9 +14,7 @@ /** * Category Component Association Helper * - * @package Joomla.Site - * @subpackage com_categories - * @since 3.0 + * @since 3.0 */ abstract class CategoryHelperAssociation { diff --git a/administrator/components/com_categories/helpers/categories.php b/administrator/components/com_categories/helpers/categories.php index 8b5b7b7992e63..99d6572c7715e 100644 --- a/administrator/components/com_categories/helpers/categories.php +++ b/administrator/components/com_categories/helpers/categories.php @@ -12,9 +12,7 @@ /** * Categories helper. * - * @package Joomla.Administrator - * @subpackage com_categories - * @since 1.6 + * @since 1.6 */ class CategoriesHelper { diff --git a/administrator/components/com_categories/helpers/html/categoriesadministrator.php b/administrator/components/com_categories/helpers/html/categoriesadministrator.php index 7a6e8970bed7f..8683b4dffbc40 100644 --- a/administrator/components/com_categories/helpers/html/categoriesadministrator.php +++ b/administrator/components/com_categories/helpers/html/categoriesadministrator.php @@ -14,10 +14,7 @@ /** * Administrator category HTML * - * @package Joomla.Administrator - * @subpackage com_categories - * - * @since 3.2 + * @since 3.2 */ abstract class JHtmlCategoriesAdministrator { diff --git a/administrator/components/com_categories/models/categories.php b/administrator/components/com_categories/models/categories.php index 5eab7c5345c79..2e951eaad8279 100644 --- a/administrator/components/com_categories/models/categories.php +++ b/administrator/components/com_categories/models/categories.php @@ -12,9 +12,7 @@ /** * Categories Component Categories Model * - * @package Joomla.Administrator - * @subpackage com_categories - * @since 1.6 + * @since 1.6 */ class CategoriesModelCategories extends JModelList { diff --git a/administrator/components/com_categories/models/category.php b/administrator/components/com_categories/models/category.php index 79c467ff6cac0..5711f1940b812 100644 --- a/administrator/components/com_categories/models/category.php +++ b/administrator/components/com_categories/models/category.php @@ -12,9 +12,7 @@ /** * Categories Component Category Model * - * @package Joomla.Administrator - * @subpackage com_categories - * @since 1.6 + * @since 1.6 */ class CategoriesModelCategory extends JModelAdmin { diff --git a/administrator/components/com_categories/models/fields/categoryedit.php b/administrator/components/com_categories/models/fields/categoryedit.php index 8b8b5d4792df0..e06ba8cab86de 100644 --- a/administrator/components/com_categories/models/fields/categoryedit.php +++ b/administrator/components/com_categories/models/fields/categoryedit.php @@ -14,9 +14,7 @@ /** * Form Field class for the Joomla Framework. * - * @package Joomla.Administrator - * @subpackage com_categories - * @since 1.6 + * @since 1.6 */ class JFormFieldCategoryEdit extends JFormFieldList { diff --git a/administrator/components/com_categories/models/fields/categoryparent.php b/administrator/components/com_categories/models/fields/categoryparent.php index 07978ce179c3f..35490066610ee 100644 --- a/administrator/components/com_categories/models/fields/categoryparent.php +++ b/administrator/components/com_categories/models/fields/categoryparent.php @@ -14,9 +14,7 @@ /** * Form Field class for the Joomla Framework. * - * @package Joomla.Administrator - * @subpackage com_categories - * @since 1.6 + * @since 1.6 */ class JFormFieldCategoryParent extends JFormFieldList { diff --git a/administrator/components/com_categories/models/fields/modal/category.php b/administrator/components/com_categories/models/fields/modal/category.php index 2b53c5e495ea8..6ac1d02c46622 100644 --- a/administrator/components/com_categories/models/fields/modal/category.php +++ b/administrator/components/com_categories/models/fields/modal/category.php @@ -12,9 +12,7 @@ /** * Supports a modal article picker. * - * @package Joomla.Administrator - * @subpackage com_categories - * @since 3.1 + * @since 3.1 */ class JFormFieldModal_Category extends JFormField { diff --git a/administrator/components/com_categories/tables/category.php b/administrator/components/com_categories/tables/category.php index b6b168e1a1f89..8733f0c1d2326 100644 --- a/administrator/components/com_categories/tables/category.php +++ b/administrator/components/com_categories/tables/category.php @@ -12,9 +12,7 @@ /** * Category table * - * @package Joomla.Administrator - * @subpackage com_categories - * @since 1.6 + * @since 1.6 */ class CategoriesTableCategory extends JTableCategory { diff --git a/administrator/components/com_categories/views/categories/view.html.php b/administrator/components/com_categories/views/categories/view.html.php index 529780a3ebb35..83ddeff2618e1 100644 --- a/administrator/components/com_categories/views/categories/view.html.php +++ b/administrator/components/com_categories/views/categories/view.html.php @@ -12,9 +12,7 @@ /** * Categories view class for the Category package. * - * @package Joomla.Administrator - * @subpackage com_categories - * @since 1.6 + * @since 1.6 */ class CategoriesViewCategories extends JViewLegacy { diff --git a/administrator/components/com_categories/views/category/view.html.php b/administrator/components/com_categories/views/category/view.html.php index d18da27a27c2a..3c18aeda04fb9 100644 --- a/administrator/components/com_categories/views/category/view.html.php +++ b/administrator/components/com_categories/views/category/view.html.php @@ -12,9 +12,7 @@ /** * HTML View class for the Categories component * - * @package Joomla.Administrator - * @subpackage com_categories - * @since 1.6 + * @since 1.6 */ class CategoriesViewCategory extends JViewLegacy { diff --git a/administrator/components/com_checkin/controller.php b/administrator/components/com_checkin/controller.php index 9924571b35009..9c7c0873d8861 100644 --- a/administrator/components/com_checkin/controller.php +++ b/administrator/components/com_checkin/controller.php @@ -12,9 +12,7 @@ /** * Checkin Controller * - * @package Joomla.Administrator - * @subpackage com_checkin - * @since 1.6 + * @since 1.6 */ class CheckinController extends JControllerLegacy { diff --git a/administrator/components/com_checkin/models/checkin.php b/administrator/components/com_checkin/models/checkin.php index 27eb0e23152ec..37a3f5f1b496e 100644 --- a/administrator/components/com_checkin/models/checkin.php +++ b/administrator/components/com_checkin/models/checkin.php @@ -12,9 +12,7 @@ /** * Checkin Model * - * @package Joomla.Administrator - * @subpackage com_checkin - * @since 1.6 + * @since 1.6 */ class CheckinModelCheckin extends JModelList { diff --git a/administrator/components/com_checkin/views/checkin/view.html.php b/administrator/components/com_checkin/views/checkin/view.html.php index 37d62441cc602..b530af020bf3e 100644 --- a/administrator/components/com_checkin/views/checkin/view.html.php +++ b/administrator/components/com_checkin/views/checkin/view.html.php @@ -12,9 +12,7 @@ /** * HTML View class for the Checkin component * - * @package Joomla.Administrator - * @subpackage com_checkin - * @since 1.0 + * @since 1.0 */ class CheckinViewCheckin extends JViewLegacy { diff --git a/administrator/components/com_config/controller.php b/administrator/components/com_config/controller.php index 62819326c7e2b..9183f3cc6acdb 100644 --- a/administrator/components/com_config/controller.php +++ b/administrator/components/com_config/controller.php @@ -12,9 +12,7 @@ /** * Config Component Controller * - * @package Joomla.Administrator - * @subpackage com_config - * @since 1.5 + * @since 1.5 */ class ConfigController extends JControllerLegacy { diff --git a/administrator/components/com_config/controller/application/cancel.php b/administrator/components/com_config/controller/application/cancel.php index 5a80c1801b940..dce035d0063bd 100644 --- a/administrator/components/com_config/controller/application/cancel.php +++ b/administrator/components/com_config/controller/application/cancel.php @@ -12,9 +12,7 @@ /** * Cancel Controller for global configuration * - * @package Joomla.Administrator - * @subpackage com_config - * @since 3.2 + * @since 3.2 */ class ConfigControllerApplicationCancel extends ConfigControllerCanceladmin { diff --git a/administrator/components/com_config/controller/application/display.php b/administrator/components/com_config/controller/application/display.php index 5cce21e15d9c3..68c7e602c6386 100644 --- a/administrator/components/com_config/controller/application/display.php +++ b/administrator/components/com_config/controller/application/display.php @@ -12,10 +12,8 @@ /** * Base Display Controller * - * @package Joomla.Administrator - * @subpackage com_config - * @since 3.2 - * @note Needed for front end view + * @since 3.2 + * @note Needed for front end view */ class ConfigControllerApplicationDisplay extends ConfigControllerDisplay { diff --git a/administrator/components/com_config/controller/application/refreshhelp.php b/administrator/components/com_config/controller/application/refreshhelp.php index 0063b03750080..e1ec55868298c 100644 --- a/administrator/components/com_config/controller/application/refreshhelp.php +++ b/administrator/components/com_config/controller/application/refreshhelp.php @@ -12,9 +12,7 @@ /** * Refresh Help Controller for global configuration * - * @package Joomla.Administrator - * @subpackage com_config - * @since 3.2 + * @since 3.2 */ class ConfigControllerApplicationRefreshhelp extends JControllerBase { diff --git a/administrator/components/com_config/controller/application/removeroot.php b/administrator/components/com_config/controller/application/removeroot.php index 66cb9b21d3b05..a390bfbd82679 100644 --- a/administrator/components/com_config/controller/application/removeroot.php +++ b/administrator/components/com_config/controller/application/removeroot.php @@ -11,9 +11,7 @@ /** * Remove Root Controller for global configuration * - * @package Joomla.Administrator - * @subpackage com_config - * @since 3.2 + * @since 3.2 */ class ConfigControllerApplicationRemoveroot extends JControllerBase { diff --git a/administrator/components/com_config/controller/application/save.php b/administrator/components/com_config/controller/application/save.php index 39bf2a7861fd0..001a14e79f76c 100644 --- a/administrator/components/com_config/controller/application/save.php +++ b/administrator/components/com_config/controller/application/save.php @@ -11,9 +11,7 @@ /** * Save Controller for global configuration * - * @package Joomla.Administrator - * @subpackage com_config - * @since 3.2 + * @since 3.2 */ class ConfigControllerApplicationSave extends JControllerBase { diff --git a/administrator/components/com_config/controller/component/cancel.php b/administrator/components/com_config/controller/component/cancel.php index f11c05a93f8f1..1d78d03c8d1ea 100644 --- a/administrator/components/com_config/controller/component/cancel.php +++ b/administrator/components/com_config/controller/component/cancel.php @@ -12,9 +12,7 @@ /** * Cancel Controller for global configuration components * - * @package Joomla.Administrator - * @subpackage com_config - * @since 3.2 + * @since 3.2 */ class ConfigControllerComponentCancel extends ConfigControllerCanceladmin { diff --git a/administrator/components/com_config/controller/component/display.php b/administrator/components/com_config/controller/component/display.php index 860ddfbbf43b7..eaef905e0c178 100644 --- a/administrator/components/com_config/controller/component/display.php +++ b/administrator/components/com_config/controller/component/display.php @@ -12,10 +12,8 @@ /** * Base Display Controller * - * @package Joomla.Administrator - * @subpackage com_config - * @since 3.2 - * @note Needed for front end view + * @since 3.2 + * @note Needed for front end view */ class ConfigControllerComponentDisplay extends ConfigControllerDisplay { diff --git a/administrator/components/com_config/controller/component/save.php b/administrator/components/com_config/controller/component/save.php index 82bc02678d1ab..085996d86d37a 100644 --- a/administrator/components/com_config/controller/component/save.php +++ b/administrator/components/com_config/controller/component/save.php @@ -12,9 +12,7 @@ /** * Save Controller for global configuration * - * @package Joomla.Administrator - * @subpackage com_config - * @since 3.2 + * @since 3.2 */ class ConfigControllerComponentSave extends JControllerBase { diff --git a/administrator/components/com_config/controllers/application.php b/administrator/components/com_config/controllers/application.php index acecf73461804..d1a08075c7bea 100644 --- a/administrator/components/com_config/controllers/application.php +++ b/administrator/components/com_config/controllers/application.php @@ -12,8 +12,6 @@ /** * Controller for global configuration * - * @package Joomla.Administrator - * @subpackage com_config * @since 1.5 * @deprecated 4.0 */ diff --git a/administrator/components/com_config/controllers/component.php b/administrator/components/com_config/controllers/component.php index 1f359c374a890..904954f763edb 100644 --- a/administrator/components/com_config/controllers/component.php +++ b/administrator/components/com_config/controllers/component.php @@ -12,8 +12,6 @@ /** * Note: this view is intended only to be opened in a popup * - * @package Joomla.Administrator - * @subpackage com_config * @since 1.5 * @deprecated 4.0 */ diff --git a/administrator/components/com_config/helper/config.php b/administrator/components/com_config/helper/config.php index c5eeb0e58cd37..54c8096eb2b9f 100644 --- a/administrator/components/com_config/helper/config.php +++ b/administrator/components/com_config/helper/config.php @@ -12,9 +12,7 @@ /** * Components helper for com_config * - * @package Joomla.Administrator - * @subpackage com_config - * @since 3.0 + * @since 3.0 */ class ConfigHelperConfig extends JHelperContent { diff --git a/administrator/components/com_config/model/application.php b/administrator/components/com_config/model/application.php index efc377157a954..c05e12f2dadc7 100644 --- a/administrator/components/com_config/model/application.php +++ b/administrator/components/com_config/model/application.php @@ -12,9 +12,7 @@ /** * Model for the global configuration * - * @package Joomla.Administrator - * @subpackage com_config - * @since 3.2 + * @since 3.2 */ class ConfigModelApplication extends ConfigModelForm { diff --git a/administrator/components/com_config/model/component.php b/administrator/components/com_config/model/component.php index 788ed1d25f52b..bf5835a1fa83d 100644 --- a/administrator/components/com_config/model/component.php +++ b/administrator/components/com_config/model/component.php @@ -12,9 +12,7 @@ /** * Model for component configuration * - * @package Joomla.Administrator - * @subpackage com_config - * @since 3.2 + * @since 3.2 */ class ConfigModelComponent extends ConfigModelForm { diff --git a/administrator/components/com_config/model/field/filters.php b/administrator/components/com_config/model/field/filters.php index d624184bcb72b..468bdb78d8d07 100644 --- a/administrator/components/com_config/model/field/filters.php +++ b/administrator/components/com_config/model/field/filters.php @@ -12,9 +12,7 @@ /** * Text Filters form field. * - * @package Joomla.Administrator - * @subpackage com_config - * @since 1.6 + * @since 1.6 */ class JFormFieldFilters extends JFormField { diff --git a/administrator/components/com_config/view/application/html.php b/administrator/components/com_config/view/application/html.php index fdf1efcf5e124..5040f9d79156f 100644 --- a/administrator/components/com_config/view/application/html.php +++ b/administrator/components/com_config/view/application/html.php @@ -12,9 +12,7 @@ /** * View for the global configuration * - * @package Joomla.Administrator - * @subpackage com_config - * @since 3.2 + * @since 3.2 */ class ConfigViewApplicationHtml extends ConfigViewCmsHtml { diff --git a/administrator/components/com_config/view/application/json.php b/administrator/components/com_config/view/application/json.php index 5965d90933926..2c2737668bdbc 100644 --- a/administrator/components/com_config/view/application/json.php +++ b/administrator/components/com_config/view/application/json.php @@ -12,9 +12,7 @@ /** * View for the component configuration * - * @package Joomla.Administrator - * @subpackage com_config - * @since 3.2 + * @since 3.2 */ class ConfigViewApplicationJson extends ConfigViewCmsJson { diff --git a/administrator/components/com_config/view/component/html.php b/administrator/components/com_config/view/component/html.php index a35113a7d149a..d05f8980f7a36 100644 --- a/administrator/components/com_config/view/component/html.php +++ b/administrator/components/com_config/view/component/html.php @@ -12,9 +12,7 @@ /** * View for the component configuration * - * @package Joomla.Administrator - * @subpackage com_config - * @since 3.2 + * @since 3.2 */ class ConfigViewComponentHtml extends ConfigViewCmsHtml { diff --git a/administrator/components/com_contact/controller.php b/administrator/components/com_contact/controller.php index d9cb6d91e3a91..f32f61f3cfa82 100644 --- a/administrator/components/com_contact/controller.php +++ b/administrator/components/com_contact/controller.php @@ -12,8 +12,7 @@ /** * Component Controller * - * @package Joomla.Administrator - * @subpackage com_contact + * @since 1.5 */ class ContactController extends JControllerLegacy { @@ -26,23 +25,24 @@ class ContactController extends JControllerLegacy /** * Method to display a view. * - * @param boolean If true, the view output will be cached - * @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. + * @param boolean $cachable If true, the view output will be cached + * @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * * @return JController This object to support chaining. + * * @since 1.5 */ public function display($cachable = false, $urlparams = false) { - require_once JPATH_COMPONENT.'/helpers/contact.php'; + require_once JPATH_COMPONENT . '/helpers/contact.php'; $view = $this->input->get('view', 'contacts'); $layout = $this->input->get('layout', 'default'); $id = $this->input->getInt('id'); // Check for edit form. - if ($view == 'contact' && $layout == 'edit' && !$this->checkEditId('com_contact.edit.contact', $id)) { - + if ($view == 'contact' && $layout == 'edit' && !$this->checkEditId('com_contact.edit.contact', $id)) + { // Somehow the person just went to the form - we don't allow that. $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); $this->setMessage($this->getError(), 'error'); diff --git a/administrator/components/com_contact/controllers/contact.php b/administrator/components/com_contact/controllers/contact.php index db4605ba454ce..bd461b9d7bb5a 100644 --- a/administrator/components/com_contact/controllers/contact.php +++ b/administrator/components/com_contact/controllers/contact.php @@ -12,9 +12,7 @@ /** * Controller for a single contact * - * @package Joomla.Administrator - * @subpackage com_contact - * @since 1.6 + * @since 1.6 */ class ContactControllerContact extends JControllerForm { @@ -111,6 +109,7 @@ public function batch($model = null) * @param array $validData The validated data. * * @return void + * * @since 3.1 */ protected function postSaveHook(JModelLegacy $model, $validData = array()) diff --git a/administrator/components/com_contact/controllers/contacts.php b/administrator/components/com_contact/controllers/contacts.php index 9bce87d5ff44e..9b53f1cfab603 100644 --- a/administrator/components/com_contact/controllers/contacts.php +++ b/administrator/components/com_contact/controllers/contacts.php @@ -10,20 +10,17 @@ defined('_JEXEC') or die; /** - * Articles list controller class. + * Contacts list controller class. * - * @package Joomla.Administrator - * @subpackage com_contact - * @since 1.6 + * @since 1.6 */ class ContactControllerContacts extends JControllerAdmin { /** * Constructor. * - * @param array $config An optional associative array of configuration settings. + * @param array $config An optional associative array of configuration settings. * - * @return ContactControllerContacts * @see JController * @since 1.6 */ @@ -38,6 +35,7 @@ public function __construct($config = array()) * Method to toggle the featured setting of a list of contacts. * * @return void + * * @since 1.6 */ public function featured() @@ -58,7 +56,8 @@ public function featured() foreach ($ids as $i => $id) { $item = $model->getItem($id); - if (!$user->authorise('core.edit.state', 'com_contact.category.'.(int) $item->catid)) + + if (!$user->authorise('core.edit.state', 'com_contact.category.' . (int) $item->catid)) { // Prune items that you can't change. unset($ids[$i]); @@ -85,10 +84,12 @@ public function featured() /** * Proxy for getModel. * - * @param string $name The name of the model. - * @param string $prefix The prefix for the PHP class name. + * @param string $name The name of the model. + * @param string $prefix The prefix for the PHP class name. + * @param array $config Array of configuration parameters. * * @return JModel + * * @since 1.6 */ public function getModel($name = 'Contact', $prefix = 'ContactModel', $config = array('ignore_request' => true)) @@ -112,5 +113,4 @@ public function getModel($name = 'Contact', $prefix = 'ContactModel', $config = protected function postDeleteHook(JModelLegacy $model, $ids = null) { } - } diff --git a/administrator/components/com_contact/helpers/contact.php b/administrator/components/com_contact/helpers/contact.php index 3ae9c78f2747a..1f1d3cb33ebea 100644 --- a/administrator/components/com_contact/helpers/contact.php +++ b/administrator/components/com_contact/helpers/contact.php @@ -12,9 +12,7 @@ /** * Contact component helper. * - * @package Joomla.Administrator - * @subpackage com_contact - * @since 1.6 + * @since 1.6 */ class ContactHelper extends JHelperContent { @@ -41,5 +39,4 @@ public static function addSubmenu($vName) $vName == 'categories' ); } - } diff --git a/administrator/components/com_contact/helpers/html/contact.php b/administrator/components/com_contact/helpers/html/contact.php index 3f576dea02874..971a5372d9cb9 100644 --- a/administrator/components/com_contact/helpers/html/contact.php +++ b/administrator/components/com_contact/helpers/html/contact.php @@ -12,8 +12,11 @@ JLoader::register('ContactHelper', JPATH_ADMINISTRATOR . '/components/com_contact/helpers/contact.php'); /** + * Contact HTML helper class. + * * @package Joomla.Administrator * @subpackage com_contact + * @since 1.6 */ abstract class JHtmlContact { @@ -78,7 +81,16 @@ public static function association($contactid) '(' . $item->category_title . ')' ); - $item->link = JHtml::_('tooltip', implode(' ', $tooltipParts), null, null, $text, $url, null, 'hasTooltip label label-association label-' . $item->lang_sef); + $item->link = JHtml::_( + 'tooltip', + implode(' ', $tooltipParts), + null, + null, + $text, + $url, + null, + 'hasTooltip label label-association label-' . $item->lang_sef + ); } } @@ -89,11 +101,14 @@ public static function association($contactid) } /** - * @param int $value The featured value - * @param int $i - * @param bool $canChange Whether the value can be changed or not + * Show the featured/not-featured icon. + * + * @param int $value The featured value. + * @param int $i Id of the item. + * @param bool $canChange Whether the value can be changed or not. * * @return string The anchor tag to toggle featured/unfeatured contacts. + * * @since 1.6 */ public static function featured($value = 0, $i, $canChange = true) @@ -104,11 +119,12 @@ public static function featured($value = 0, $i, $canChange = true) 1 => array('featured.png', 'contacts.unfeatured', 'JFEATURED', 'COM_CONTACT_TOGGLE_TO_UNFEATURE'), ); $state = JArrayHelper::getValue($states, (int) $value, $states[1]); - $html = JHtml::_('image', 'admin/'.$state[0], JText::_($state[2]), null, true); + $html = JHtml::_('image', 'admin/' . $state[0], JText::_($state[2]), null, true); + if ($canChange) { - $html = '' - . $html .''; + $html = '' + . $html . ''; } return $html; diff --git a/administrator/components/com_contact/models/contact.php b/administrator/components/com_contact/models/contact.php index 9e2d9aff4859d..da160bf4534b3 100644 --- a/administrator/components/com_contact/models/contact.php +++ b/administrator/components/com_contact/models/contact.php @@ -14,9 +14,7 @@ /** * Item Model for a Contact. * - * @package Joomla.Administrator - * @subpackage com_contact - * @since 1.6 + * @since 1.6 */ class ContactModelContact extends JModelAdmin { @@ -197,6 +195,7 @@ protected function batchCopy($value, $pks, $contexts) { // Fatal error $this->setError($error); + return false; } else @@ -219,12 +218,12 @@ protected function batchCopy($value, $pks, $contexts) $this->table->catid = $categoryId; // TODO: Deal with ordering? - //$this->table->ordering = 1; // Check the row. if (!$this->table->check()) { $this->setError($this->table->getError()); + return false; } @@ -234,6 +233,7 @@ protected function batchCopy($value, $pks, $contexts) if (!$this->table->store()) { $this->setError($this->table->getError()); + return false; } @@ -264,7 +264,6 @@ protected function batchCopy($value, $pks, $contexts) */ protected function batchUser($value, $pks, $contexts) { - foreach ($pks as $pk) { if ($this->user->authorise('core.edit', $contexts[$pk])) @@ -285,6 +284,7 @@ protected function batchUser($value, $pks, $contexts) else { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; } } @@ -312,7 +312,9 @@ protected function canDelete($record) { return; } + $user = JFactory::getUser(); + return $user->authorise('core.delete', 'com_contact.category.' . (int) $record->catid); } } @@ -374,6 +376,7 @@ public function getForm($data = array(), $loadData = true) // Get the form. $form = $this->loadForm('com_contact.contact', 'contact', array('control' => 'jform', 'load_data' => $loadData)); + if (empty($form)) { return false; @@ -477,7 +480,7 @@ protected function loadFormData() /** * Method to save the form data. * - * @param array The form data. + * @param array $data The form data. * * @return boolean True on success. * @@ -508,8 +511,8 @@ public function save($data) if (parent::save($data)) { - $assoc = JLanguageAssociations::isEnabled(); + if ($assoc) { $id = (int) $this->getState($this->getName() . '.id'); @@ -548,6 +551,7 @@ public function save($data) if ($error = $db->getErrorMsg()) { $this->setError($error); + return false; } @@ -569,6 +573,7 @@ public function save($data) if ($error = $db->getErrorMsg()) { $this->setError($error); + return false; } } @@ -643,11 +648,21 @@ protected function getReorderConditions($table) return $condition; } + /** + * Preprocess the form. + * + * @param JForm $form Form object. + * @param object $data Data object. + * @param string $group Group name. + * + * @return void + */ protected function preprocessForm(JForm $form, $data, $group = 'content') { // Association content items $app = JFactory::getApplication(); $assoc = JLanguageAssociations::isEnabled(); + if ($assoc) { $languages = JLanguageHelper::getLanguages('lang_code'); @@ -658,6 +673,7 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') $fieldset->addAttribute('name', 'item_associations'); $fieldset->addAttribute('description', 'COM_CONTACT_ITEM_ASSOCIATIONS_FIELDSET_DESC'); $add = false; + foreach ($languages as $tag => $language) { if (empty($data->language) || $tag != $data->language) @@ -673,6 +689,7 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') $field->addAttribute('clear', 'true'); } } + if ($add) { $form->load($addform, false); @@ -701,6 +718,7 @@ public function featured($pks, $value = 0) if (empty($pks)) { $this->setError(JText::_('COM_CONTACT_NO_ITEM_SELECTED')); + return false; } @@ -721,6 +739,7 @@ public function featured($pks, $value = 0) catch (Exception $e) { $this->setError($e->getMessage()); + return false; } @@ -735,9 +754,9 @@ public function featured($pks, $value = 0) /** * Method to change the title & alias. * - * @param integer $parent_id The id of the parent. - * @param string $alias The alias. - * @param string $title The title. + * @param integer $category_id The id of the parent. + * @param string $alias The alias. + * @param string $name The title. * * @return array Contains the modified title and alias. * @@ -747,6 +766,7 @@ protected function generateNewTitle($category_id, $alias, $name) { // Alter the title & alias $table = $this->getTable(); + while ($table->load(array('alias' => $alias, 'catid' => $category_id))) { if ($name == $table->name) diff --git a/administrator/components/com_contact/models/contacts.php b/administrator/components/com_contact/models/contacts.php index bb48414577661..4ef321c4be00f 100644 --- a/administrator/components/com_contact/models/contacts.php +++ b/administrator/components/com_contact/models/contacts.php @@ -12,8 +12,7 @@ /** * Methods supporting a list of contact records. * - * @package Joomla.Administrator - * @subpackage com_contact + * @since 1.6 */ class ContactModelContacts extends JModelList { @@ -51,6 +50,7 @@ public function __construct($config = array()) $app = JFactory::getApplication(); $assoc = JLanguageAssociations::isEnabled(); + if ($assoc) { $config['filter_fields'][] = 'association'; @@ -97,8 +97,9 @@ protected function populateState($ordering = null, $direction = null) $language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', ''); $this->setState('filter.language', $language); - // force a language + // Force a language. $forcedLanguage = $app->input->get('forcedLanguage'); + if (!empty($forcedLanguage)) { $this->setState('filter.language', $forcedLanguage); @@ -119,9 +120,10 @@ protected function populateState($ordering = null, $direction = null) * different modules that might need different sets of data or different * ordering requirements. * - * @param string $id A prefix for the store id. + * @param string $id A prefix for the store id. * * @return string A store id. + * * @since 1.6 */ protected function getStoreId($id = '') @@ -140,6 +142,7 @@ protected function getStoreId($id = '') * Build an SQL query to load the list data. * * @return JDatabaseQuery + * * @since 1.6 */ protected function getListQuery() @@ -183,6 +186,7 @@ protected function getListQuery() // Join over the associations. $assoc = JLanguageAssociations::isEnabled(); + if ($assoc) { $query->select('COUNT(asso2.id)>1 as association') @@ -206,6 +210,7 @@ protected function getListQuery() // Filter by published state $published = $this->getState('filter.published'); + if (is_numeric($published)) { $query->where('a.published = ' . (int) $published); @@ -217,6 +222,7 @@ protected function getListQuery() // Filter by a single or group of categories. $categoryId = $this->getState('filter.category_id'); + if (is_numeric($categoryId)) { $query->where('a.catid = ' . (int) $categoryId); @@ -230,6 +236,7 @@ protected function getListQuery() // Filter by search in name. $search = $this->getState('filter.search'); + if (!empty($search)) { if (stripos($search, 'id:') === 0) @@ -256,6 +263,7 @@ protected function getListQuery() // Filter by a single tag. $tagId = $this->getState('filter.tag'); + if (is_numeric($tagId)) { $query->where($db->quoteName('tagmap.tag_id') . ' = ' . (int) $tagId) @@ -269,13 +277,14 @@ protected function getListQuery() // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.name'); $orderDirn = $this->state->get('list.direction', 'asc'); + if ($orderCol == 'a.ordering' || $orderCol == 'category_title') { $orderCol = 'c.title ' . $orderDirn . ', a.ordering'; } + $query->order($db->escape($orderCol . ' ' . $orderDirn)); - //echo nl2br(str_replace('#__','jos_',$query)); return $query; } } diff --git a/administrator/components/com_contact/models/fields/modal/contact.php b/administrator/components/com_contact/models/fields/modal/contact.php index 357f574959502..6672fb0be5ad8 100644 --- a/administrator/components/com_contact/models/fields/modal/contact.php +++ b/administrator/components/com_contact/models/fields/modal/contact.php @@ -12,9 +12,7 @@ /** * Supports a modal contact picker. * - * @package Joomla.Administrator - * @subpackage com_contact - * @since 1.6 + * @since 1.6 */ class JFormFieldModal_Contact extends JFormField { @@ -76,7 +74,8 @@ protected function getInput() $script[] = ' function jClearContact(id) {'; $script[] = ' document.getElementById(id + "_id").value = "";'; - $script[] = ' document.getElementById(id + "_name").value = "'.htmlspecialchars(JText::_('COM_CONTACT_SELECT_A_CONTACT', true), ENT_COMPAT, 'UTF-8').'";'; + $script[] = ' document.getElementById(id + "_name").value = "' + . htmlspecialchars(JText::_('COM_CONTACT_SELECT_A_CONTACT', true), ENT_COMPAT, 'UTF-8') . '";'; $script[] = ' jQuery("#"+id + "_clear").addClass("hidden");'; $script[] = ' if (document.getElementById(id + "_edit")) {'; $script[] = ' jQuery("#"+id + "_edit").addClass("hidden");'; @@ -137,23 +136,40 @@ protected function getInput() // The current contact display field. $html[] = ''; $html[] = ''; - $html[] = ' ' . JText::_('JSELECT') . ''; - - // Edit article button + $html[] = '' + . ' ' . JText::_('JSELECT') + . ''; + + // Edit contact button. if ($allowEdit) { - $html[] = ' ' . JText::_('JACTION_EDIT') . ''; + $html[] = '' + . ' ' . JText::_('JACTION_EDIT') + . ''; } // Clear contact button if ($allowClear) { - $html[] = ''; + $html[] = '' + . ' ' . JText::_('JCLEAR') + . ''; } $html[] = ''; - // class='required' for client side validation + // Note: class='required' for client side validation. $class = ''; if ($this->required) diff --git a/administrator/components/com_contact/sql/install.mysql.utf8.sql b/administrator/components/com_contact/sql/install.mysql.utf8.sql index fa7c2f5d93375..a431e9c933698 100644 --- a/administrator/components/com_contact/sql/install.mysql.utf8.sql +++ b/administrator/components/com_contact/sql/install.mysql.utf8.sql @@ -37,7 +37,7 @@ CREATE TABLE `#__contact_details` ( `metakey` text NOT NULL, `metadesc` text NOT NULL, `metadata` text NOT NULL, - `featured` tinyint(3) unsigned NOT NULL default '0' COMMENT 'Set if article is featured.', + `featured` tinyint(3) unsigned NOT NULL default '0' COMMENT 'Set if contact is featured.', `xreference` varchar(50) NOT NULL COMMENT 'A reference to enable linkages to external data sets.', `publish_up` datetime NOT NULL default '0000-00-00 00:00:00', `publish_down` datetime NOT NULL default '0000-00-00 00:00:00', diff --git a/administrator/components/com_contact/tables/contact.php b/administrator/components/com_contact/tables/contact.php index 140b7b09221a2..c5e4dc1432d07 100644 --- a/administrator/components/com_contact/tables/contact.php +++ b/administrator/components/com_contact/tables/contact.php @@ -10,8 +10,9 @@ defined('_JEXEC') or die; /** - * @package Joomla.Administrator - * @subpackage com_contact + * Contact Table class. + * + * @since 1.0 */ class ContactTableContact extends JTable { @@ -39,9 +40,9 @@ public function __construct(&$db) } /** - * Stores a contact + * Stores a contact. * - * @param boolean True to update fields even if they are null. + * @param boolean $updateNulls True to update fields even if they are null. * * @return boolean True on success, false on failure. * @@ -74,6 +75,7 @@ public function store($updateNulls = false) { $this->created = $date->toSql(); } + if (empty($this->created_by)) { $this->created_by = $user->get('id'); @@ -106,6 +108,7 @@ public function store($updateNulls = false) // Verify that the alias is unique $table = JTable::getInstance('Contact', 'ContactTable'); + if ($table->load(array('alias' => $this->alias, 'catid' => $this->catid)) && ($table->id != $this->id || $this->id == 0)) { $this->setError(JText::_('COM_CONTACT_ERROR_UNIQUE_ALIAS')); @@ -162,23 +165,34 @@ public function check() return false; } - // Clean up keywords -- eliminate extra spaces between phrases - // and cr (\r) and lf (\n) characters from string + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ if (!empty($this->metakey)) { - // Only process if not empty - $bad_characters = array("\n", "\r", "\"", "<", ">"); // array of characters to remove - $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); // remove bad characters - $keys = explode(',', $after_clean); // create array using commas as delimiter + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); $clean_keys = array(); - foreach($keys as $key) + foreach ($keys as $key) { - if (trim($key)) { // ignore blank keywords + // Ignore blank keywords. + if (trim($key)) + { $clean_keys[] = trim($key); } } - $this->metakey = implode(", ", $clean_keys); // put array back together delimited by ", " + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); } // Clean up description -- eliminate quotes and <> brackets diff --git a/administrator/components/com_contact/views/contact/view.html.php b/administrator/components/com_contact/views/contact/view.html.php index cbcc5f987cefb..d5173b9b0a8b2 100644 --- a/administrator/components/com_contact/views/contact/view.html.php +++ b/administrator/components/com_contact/views/contact/view.html.php @@ -12,9 +12,7 @@ /** * View to edit a contact. * - * @package Joomla.Administrator - * @subpackage com_contact - * @since 1.6 + * @since 1.6 */ class ContactViewContact extends JViewLegacy { @@ -25,7 +23,11 @@ class ContactViewContact extends JViewLegacy protected $state; /** - * Display the view + * Display the view. + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { @@ -38,6 +40,7 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); + return false; } @@ -54,6 +57,8 @@ public function display($tpl = null) /** * Add the page title and toolbar. * + * @return void + * * @since 1.6 */ protected function addToolbar() diff --git a/administrator/components/com_contact/views/contacts/view.html.php b/administrator/components/com_contact/views/contacts/view.html.php index 9fb24ff4e4410..ab1f46a34cd74 100644 --- a/administrator/components/com_contact/views/contacts/view.html.php +++ b/administrator/components/com_contact/views/contacts/view.html.php @@ -12,9 +12,7 @@ /** * View class for a list of contacts. * - * @package Joomla.Administrator - * @subpackage com_contact - * @since 1.6 + * @since 1.6 */ class ContactViewContacts extends JViewLegacy { @@ -25,9 +23,11 @@ class ContactViewContacts extends JViewLegacy protected $state; /** - * Display the view + * Display the view. * - * @return void + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { @@ -41,6 +41,7 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); + return false; } @@ -60,6 +61,8 @@ public function display($tpl = null) /** * Add the page title and toolbar. * + * @return void + * * @since 1.6 */ protected function addToolbar() @@ -100,7 +103,9 @@ protected function addToolbar() } // Add a batch button - if ($user->authorise('core.create', 'com_contacts') && $user->authorise('core.edit', 'com_contacts') && $user->authorise('core.edit.state', 'com_contacts')) + if ($user->authorise('core.create', 'com_contacts') + && $user->authorise('core.edit', 'com_contacts') + && $user->authorise('core.edit.state', 'com_contacts')) { JHtml::_('bootstrap.modal', 'collapseModal'); $title = JText::_('JTOOLBAR_BATCH'); @@ -146,11 +151,10 @@ protected function addToolbar() ); JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_TAG'), - 'filter_tag', - JHtml::_('select.options', JHtml::_('tag.options', true, true), 'value', 'text', $this->state->get('filter.tag')) + JText::_('JOPTION_SELECT_TAG'), + 'filter_tag', + JHtml::_('select.options', JHtml::_('tag.options', true, true), 'value', 'text', $this->state->get('filter.tag')) ); - } /** diff --git a/administrator/components/com_content/controller.php b/administrator/components/com_content/controller.php index d121baf432050..eec413d5e808d 100644 --- a/administrator/components/com_content/controller.php +++ b/administrator/components/com_content/controller.php @@ -12,9 +12,7 @@ /** * Component Controller * - * @package Joomla.Administrator - * @subpackage com_content - * @since 1.5 + * @since 1.5 */ class ContentController extends JControllerLegacy { diff --git a/administrator/components/com_content/controllers/articles.php b/administrator/components/com_content/controllers/articles.php index de2728ca5b2dc..d4c53ab036e02 100644 --- a/administrator/components/com_content/controllers/articles.php +++ b/administrator/components/com_content/controllers/articles.php @@ -12,9 +12,7 @@ /** * Articles list controller class. * - * @package Joomla.Administrator - * @subpackage com_content - * @since 1.6 + * @since 1.6 */ class ContentControllerArticles extends JControllerAdmin { diff --git a/administrator/components/com_content/controllers/featured.php b/administrator/components/com_content/controllers/featured.php index a3e6ce4bb53bd..7af444e8701ae 100644 --- a/administrator/components/com_content/controllers/featured.php +++ b/administrator/components/com_content/controllers/featured.php @@ -12,8 +12,7 @@ require_once __DIR__ . '/articles.php'; /** - * @package Joomla.Administrator - * @subpackage com_content + * Featured content controller class. */ class ContentControllerFeatured extends ContentControllerArticles { diff --git a/administrator/components/com_content/helpers/content.php b/administrator/components/com_content/helpers/content.php index c9ccfea4bbcee..5d368345c7f22 100644 --- a/administrator/components/com_content/helpers/content.php +++ b/administrator/components/com_content/helpers/content.php @@ -12,9 +12,7 @@ /** * Content component helper. * - * @package Joomla.Administrator - * @subpackage com_content - * @since 1.6 + * @since 1.6 */ class ContentHelper extends JHelperContent { diff --git a/administrator/components/com_content/helpers/html/contentadministrator.php b/administrator/components/com_content/helpers/html/contentadministrator.php index b98534a045563..d0a892d2b809d 100644 --- a/administrator/components/com_content/helpers/html/contentadministrator.php +++ b/administrator/components/com_content/helpers/html/contentadministrator.php @@ -14,10 +14,7 @@ /** * Content HTML helper * - * @package Joomla.Administrator - * @subpackage com_content - * - * @since 3.0 + * @since 3.0 */ abstract class JHtmlContentAdministrator { diff --git a/administrator/components/com_content/models/article.php b/administrator/components/com_content/models/article.php index fb30aadb9eb84..488b2612605e5 100644 --- a/administrator/components/com_content/models/article.php +++ b/administrator/components/com_content/models/article.php @@ -14,9 +14,7 @@ /** * Item Model for an Article. * - * @package Joomla.Administrator - * @subpackage com_content - * @since 1.6 + * @since 1.6 */ class ContentModelArticle extends JModelAdmin { diff --git a/administrator/components/com_content/models/articles.php b/administrator/components/com_content/models/articles.php index f49fc5632501b..a0e8916ed8872 100644 --- a/administrator/components/com_content/models/articles.php +++ b/administrator/components/com_content/models/articles.php @@ -12,10 +12,7 @@ /** * Methods supporting a list of article records. * - * @package Joomla.Administrator - * @subpackage com_content - * - * @since 1.6 + * @since 1.6 */ class ContentModelArticles extends JModelList { diff --git a/administrator/components/com_content/models/feature.php b/administrator/components/com_content/models/feature.php index 9c7a1ebfad222..259463fe4990d 100644 --- a/administrator/components/com_content/models/feature.php +++ b/administrator/components/com_content/models/feature.php @@ -13,9 +13,6 @@ /** * Feature model. - * - * @package Joomla.Administrator - * @subpackage com_content */ class ContentModelFeature extends ContentModelArticle { diff --git a/administrator/components/com_content/models/featured.php b/administrator/components/com_content/models/featured.php index 621f3c89b0dee..3c3fb4bd02e69 100644 --- a/administrator/components/com_content/models/featured.php +++ b/administrator/components/com_content/models/featured.php @@ -14,10 +14,7 @@ /** * About Page Model * - * @package Joomla.Administrator - * @subpackage com_content - * - * @since 1.6 + * @since 1.6 */ class ContentModelFeatured extends ContentModelArticles { diff --git a/administrator/components/com_content/models/fields/modal/article.php b/administrator/components/com_content/models/fields/modal/article.php index c2ffc972b9e98..cba60df80dc49 100644 --- a/administrator/components/com_content/models/fields/modal/article.php +++ b/administrator/components/com_content/models/fields/modal/article.php @@ -12,9 +12,7 @@ /** * Supports a modal article picker. * - * @package Joomla.Administrator - * @subpackage com_content - * @since 1.6 + * @since 1.6 */ class JFormFieldModal_Article extends JFormField { diff --git a/administrator/components/com_content/tables/featured.php b/administrator/components/com_content/tables/featured.php index 40b65036184e5..00a68b9f8cb7c 100644 --- a/administrator/components/com_content/tables/featured.php +++ b/administrator/components/com_content/tables/featured.php @@ -10,8 +10,7 @@ defined('_JEXEC') or die; /** - * @package Joomla.Administrator - * @subpackage com_content + * Featured Table class. */ class ContentTableFeatured extends JTable { diff --git a/administrator/components/com_content/views/article/view.html.php b/administrator/components/com_content/views/article/view.html.php index 5084c0b441af9..6b9191ab6abc9 100644 --- a/administrator/components/com_content/views/article/view.html.php +++ b/administrator/components/com_content/views/article/view.html.php @@ -12,9 +12,7 @@ /** * View to edit an article. * - * @package Joomla.Administrator - * @subpackage com_content - * @since 1.6 + * @since 1.6 */ class ContentViewArticle extends JViewLegacy { diff --git a/administrator/components/com_content/views/articles/view.html.php b/administrator/components/com_content/views/articles/view.html.php index ff81e3799622f..238fcfaf64a2d 100644 --- a/administrator/components/com_content/views/articles/view.html.php +++ b/administrator/components/com_content/views/articles/view.html.php @@ -12,9 +12,7 @@ /** * View class for a list of articles. * - * @package Joomla.Administrator - * @subpackage com_content - * @since 1.6 + * @since 1.6 */ class ContentViewArticles extends JViewLegacy { diff --git a/administrator/components/com_content/views/featured/view.html.php b/administrator/components/com_content/views/featured/view.html.php index 63a5d49a745c1..67c47ed289d4e 100644 --- a/administrator/components/com_content/views/featured/view.html.php +++ b/administrator/components/com_content/views/featured/view.html.php @@ -12,9 +12,7 @@ /** * View class for a list of featured articles. * - * @package Joomla.Administrator - * @subpackage com_content - * @since 1.6 + * @since 1.6 */ class ContentViewFeatured extends JViewLegacy { diff --git a/administrator/components/com_contenthistory/controller.php b/administrator/components/com_contenthistory/controller.php index 7444dfbae5e6a..b70f658950568 100644 --- a/administrator/components/com_contenthistory/controller.php +++ b/administrator/components/com_contenthistory/controller.php @@ -12,9 +12,7 @@ /** * Contenthistory Controller * - * @package Joomla.Administrator - * @subpackage com_contenthistory - * @since 3.2 + * @since 3.2 */ class ContenthistoryController extends JControllerLegacy { diff --git a/administrator/components/com_contenthistory/controllers/history.php b/administrator/components/com_contenthistory/controllers/history.php index 830b5b52b53f8..c2245e4db0d0a 100644 --- a/administrator/components/com_contenthistory/controllers/history.php +++ b/administrator/components/com_contenthistory/controllers/history.php @@ -12,9 +12,7 @@ /** * Contenthistory list controller class. * - * @package Joomla.Administrator - * @subpackage com_contenthistory - * @since 3.2 + * @since 3.2 */ class ContenthistoryControllerHistory extends JControllerAdmin { diff --git a/administrator/components/com_contenthistory/controllers/preview.php b/administrator/components/com_contenthistory/controllers/preview.php index b5558f25462cb..d1e6310ea8370 100644 --- a/administrator/components/com_contenthistory/controllers/preview.php +++ b/administrator/components/com_contenthistory/controllers/preview.php @@ -12,9 +12,7 @@ /** * Contenthistory list controller class. * - * @package Joomla.Administrator - * @subpackage com_contenthistory - * @since 3.2 + * @since 3.2 */ class ContenthistoryControllerPreview extends JControllerLegacy { diff --git a/administrator/components/com_contenthistory/helpers/contenthistory.php b/administrator/components/com_contenthistory/helpers/contenthistory.php index a92755d102a9b..3be58c0b7e528 100644 --- a/administrator/components/com_contenthistory/helpers/contenthistory.php +++ b/administrator/components/com_contenthistory/helpers/contenthistory.php @@ -12,9 +12,7 @@ /** * Categories helper. * - * @package Joomla.Administrator - * @subpackage com_contenthistory - * @since 3.2 + * @since 3.2 */ class ContenthistoryHelper { diff --git a/administrator/components/com_contenthistory/helpers/html/textdiff.php b/administrator/components/com_contenthistory/helpers/html/textdiff.php index 6a6e88822826a..7f71640b46f45 100644 --- a/administrator/components/com_contenthistory/helpers/html/textdiff.php +++ b/administrator/components/com_contenthistory/helpers/html/textdiff.php @@ -12,9 +12,7 @@ /** * HTML utility class for creating text diffs using jQuery, diff_patch_match.js and jquery.pretty-text-diff.js JavaScript libraries. * - * @package Joomla.Administrator - * @subpackage com_contenthistory.HTML - * @since 3.2 + * @since 3.2 */ abstract class JHtmlTextdiff { diff --git a/administrator/components/com_contenthistory/models/compare.php b/administrator/components/com_contenthistory/models/compare.php index 7c2eab88c000c..465bfb77ca841 100644 --- a/administrator/components/com_contenthistory/models/compare.php +++ b/administrator/components/com_contenthistory/models/compare.php @@ -14,9 +14,7 @@ /** * Methods supporting a list of contenthistory records. * - * @package Joomla.Administrator - * @subpackage com_contenthistory - * @since 3.2 + * @since 3.2 */ class ContenthistoryModelCompare extends JModelItem { diff --git a/administrator/components/com_contenthistory/models/history.php b/administrator/components/com_contenthistory/models/history.php index f019041c018a4..9de82fba75bf3 100644 --- a/administrator/components/com_contenthistory/models/history.php +++ b/administrator/components/com_contenthistory/models/history.php @@ -12,9 +12,7 @@ /** * Methods supporting a list of contenthistory records. * - * @package Joomla.Administrator - * @subpackage com_contenthistory - * @since 3.2 + * @since 3.2 */ class ContenthistoryModelHistory extends JModelList { diff --git a/administrator/components/com_contenthistory/models/preview.php b/administrator/components/com_contenthistory/models/preview.php index 692fe859701ee..acfb70c89bbf5 100644 --- a/administrator/components/com_contenthistory/models/preview.php +++ b/administrator/components/com_contenthistory/models/preview.php @@ -14,9 +14,7 @@ /** * Methods supporting a list of contenthistory records. * - * @package Joomla.Administrator - * @subpackage com_contenthistory - * @since 3.2 + * @since 3.2 */ class ContenthistoryModelPreview extends JModelItem { diff --git a/administrator/components/com_contenthistory/views/compare/view.html.php b/administrator/components/com_contenthistory/views/compare/view.html.php index 89b622d3b8893..ea56efa0b8754 100644 --- a/administrator/components/com_contenthistory/views/compare/view.html.php +++ b/administrator/components/com_contenthistory/views/compare/view.html.php @@ -12,9 +12,7 @@ /** * View class for a list of contenthistory. * - * @package Joomla.Administrator - * @subpackage com_contenthistory - * @since 3.2 + * @since 3.2 */ class ContenthistoryViewCompare extends JViewLegacy { diff --git a/administrator/components/com_contenthistory/views/history/view.html.php b/administrator/components/com_contenthistory/views/history/view.html.php index f93dbb93facfc..63db3f464497b 100644 --- a/administrator/components/com_contenthistory/views/history/view.html.php +++ b/administrator/components/com_contenthistory/views/history/view.html.php @@ -12,9 +12,7 @@ /** * View class for a list of contenthistory. * - * @package Joomla.Administrator - * @subpackage com_contenthistory - * @since 3.2 + * @since 3.2 */ class ContenthistoryViewHistory extends JViewLegacy { diff --git a/administrator/components/com_contenthistory/views/preview/view.html.php b/administrator/components/com_contenthistory/views/preview/view.html.php index e734d8e170590..7a68c6e2ee1e5 100644 --- a/administrator/components/com_contenthistory/views/preview/view.html.php +++ b/administrator/components/com_contenthistory/views/preview/view.html.php @@ -12,9 +12,7 @@ /** * View class for a list of contenthistory. * - * @package Joomla.Administrator - * @subpackage com_contenthistory - * @since 1.5 + * @since 1.5 */ class ContenthistoryViewPreview extends JViewLegacy { diff --git a/administrator/components/com_cpanel/controller.php b/administrator/components/com_cpanel/controller.php index ee287b3cfb433..86066193dc2b5 100644 --- a/administrator/components/com_cpanel/controller.php +++ b/administrator/components/com_cpanel/controller.php @@ -12,9 +12,7 @@ /** * Cpanel Controller * - * @package Joomla.Administrator - * @subpackage com_cpanel - * @since 1.5 + * @since 1.5 */ class CpanelController extends JControllerLegacy { diff --git a/administrator/components/com_cpanel/views/cpanel/view.html.php b/administrator/components/com_cpanel/views/cpanel/view.html.php index 81d84bfa086a3..1f80f105d5e29 100644 --- a/administrator/components/com_cpanel/views/cpanel/view.html.php +++ b/administrator/components/com_cpanel/views/cpanel/view.html.php @@ -12,9 +12,7 @@ /** * HTML View class for the Cpanel component * - * @package Joomla.Administrator - * @subpackage com_cpanel - * @since 1.0 + * @since 1.0 */ class CpanelViewCpanel extends JViewLegacy { diff --git a/administrator/components/com_finder/controller.php b/administrator/components/com_finder/controller.php index 8d92f6defc7f4..2f58558cb61cd 100644 --- a/administrator/components/com_finder/controller.php +++ b/administrator/components/com_finder/controller.php @@ -12,9 +12,7 @@ /** * Base controller class for Finder. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderController extends JControllerLegacy { diff --git a/administrator/components/com_finder/controllers/filter.php b/administrator/components/com_finder/controllers/filter.php index fe45dfc5a0174..caddc0d7c36a8 100644 --- a/administrator/components/com_finder/controllers/filter.php +++ b/administrator/components/com_finder/controllers/filter.php @@ -12,9 +12,7 @@ /** * Indexer controller class for Finder. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderControllerFilter extends JControllerForm { diff --git a/administrator/components/com_finder/controllers/filters.php b/administrator/components/com_finder/controllers/filters.php index 5d485297a10a0..617b1a3d1ba1f 100644 --- a/administrator/components/com_finder/controllers/filters.php +++ b/administrator/components/com_finder/controllers/filters.php @@ -12,9 +12,7 @@ /** * Filters controller class for Finder. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderControllerFilters extends JControllerAdmin { @@ -32,6 +30,7 @@ class FinderControllerFilters extends JControllerAdmin public function getModel($name = 'Filter', $prefix = 'FinderModel', $config = array('ignore_request' => true)) { $model = parent::getModel($name, $prefix, $config); + return $model; } } diff --git a/administrator/components/com_finder/controllers/index.php b/administrator/components/com_finder/controllers/index.php index f5e654c4200a7..dbdfec614a5d4 100644 --- a/administrator/components/com_finder/controllers/index.php +++ b/administrator/components/com_finder/controllers/index.php @@ -12,9 +12,7 @@ /** * Index controller class for Finder. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderControllerIndex extends JControllerAdmin { @@ -32,6 +30,7 @@ class FinderControllerIndex extends JControllerAdmin public function getModel($name = 'Index', $prefix = 'FinderModel', $config = array('ignore_request' => true)) { $model = parent::getModel($name, $prefix, $config); + return $model; } @@ -58,12 +57,14 @@ public function purge() { $message = JText::_('COM_FINDER_INDEX_PURGE_FAILED', $model->getError()); $this->setRedirect('index.php?option=com_finder&view=index', $message); + return false; } else { $message = JText::_('COM_FINDER_INDEX_PURGE_SUCCESS'); $this->setRedirect('index.php?option=com_finder&view=index', $message); + return true; } } diff --git a/administrator/components/com_finder/controllers/indexer.json.php b/administrator/components/com_finder/controllers/indexer.json.php index 15e20bd77597b..334bae27a17ef 100644 --- a/administrator/components/com_finder/controllers/indexer.json.php +++ b/administrator/components/com_finder/controllers/indexer.json.php @@ -15,9 +15,7 @@ /** * Indexer controller class for Finder. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderControllerIndexer extends JControllerLegacy { @@ -145,7 +143,7 @@ public function batch() * in order to work around some plugins that don't do proper environment * checks before trying to use HTML document functions. */ - $raw = clone(JFactory::getDocument()); + $raw = clone JFactory::getDocument(); $lang = JFactory::getLanguage(); // Get the document properties. @@ -165,7 +163,7 @@ public function batch() $doc = $html; // Get the admin application. - $admin = clone(JFactory::getApplication()); + $admin = clone JFactory::getApplication(); // Get the site app. $site = JApplication::getInstance('site'); @@ -304,9 +302,7 @@ public static function sendResponse($data = null) /** * Finder Indexer JSON Response Class * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderIndexerResponse { diff --git a/administrator/components/com_finder/controllers/maps.php b/administrator/components/com_finder/controllers/maps.php index c1f91c610f2ff..f272528fc6630 100644 --- a/administrator/components/com_finder/controllers/maps.php +++ b/administrator/components/com_finder/controllers/maps.php @@ -12,9 +12,7 @@ /** * Maps controller class for Finder. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderControllerMaps extends JControllerAdmin { @@ -32,6 +30,7 @@ class FinderControllerMaps extends JControllerAdmin public function getModel($name = 'Maps', $prefix = 'FinderModel', $config = array('ignore_request' => true)) { $model = parent::getModel($name, $prefix, $config); + return $model; } } diff --git a/administrator/components/com_finder/helpers/finder.php b/administrator/components/com_finder/helpers/finder.php index 514f79fddd5f5..ebfdf01feaf18 100644 --- a/administrator/components/com_finder/helpers/finder.php +++ b/administrator/components/com_finder/helpers/finder.php @@ -12,9 +12,7 @@ /** * Helper class for Finder. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderHelper { diff --git a/administrator/components/com_finder/helpers/html/finder.php b/administrator/components/com_finder/helpers/html/finder.php index 38bd6d9bab181..f464d9f784488 100644 --- a/administrator/components/com_finder/helpers/html/finder.php +++ b/administrator/components/com_finder/helpers/html/finder.php @@ -14,9 +14,7 @@ /** * HTML behavior class for Finder. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ abstract class JHtmlFinder { diff --git a/administrator/components/com_finder/helpers/indexer/adapter.php b/administrator/components/com_finder/helpers/indexer/adapter.php index 565a981e67bb3..85b2f118d77a9 100644 --- a/administrator/components/com_finder/helpers/indexer/adapter.php +++ b/administrator/components/com_finder/helpers/indexer/adapter.php @@ -17,9 +17,7 @@ /** * Prototype adapter class for the Finder indexer package. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ abstract class FinderIndexerAdapter extends JPlugin { @@ -167,7 +165,6 @@ public function __construct(&$subject, $config) */ public function onStartIndex() { - // Get the indexer state. $iState = FinderIndexer::getState(); @@ -392,7 +389,7 @@ abstract protected function setup(); */ protected function categoryAccessChange($row) { - $query = clone($this->getStateQuery()); + $query = clone $this->getStateQuery(); $query->where('c.id = ' . (int) $row->id); // Get the access level. @@ -432,7 +429,7 @@ protected function categoryStateChange($pks, $value) */ foreach ($pks as $pk) { - $query = clone($this->getStateQuery()); + $query = clone $this->getStateQuery(); $query->where('c.id = ' . (int) $pk); // Get the published states. @@ -520,7 +517,7 @@ protected function getContentCount() // Tweak the SQL query to make the total lookup faster. if ($query instanceof JDatabaseQuery) { - $query = clone($query); + $query = clone $query; $query->clear('select') ->select('COUNT(*)') ->clear('order'); @@ -812,7 +809,7 @@ protected function getItemMenuTitle($url) */ protected function itemAccessChange($row) { - $query = clone($this->getStateQuery()); + $query = clone $this->getStateQuery(); $query->where('a.id = ' . (int) $row->id); // Get the access level. @@ -845,7 +842,7 @@ protected function itemStateChange($pks, $value) */ foreach ($pks as $pk) { - $query = clone($this->getStateQuery()); + $query = clone $this->getStateQuery(); $query->where('a.id = ' . (int) $pk); // Get the published states. @@ -881,7 +878,7 @@ protected function pluginDisable($pks) if ($this->getPluginType($pk) == strtolower($this->context)) { // Get all of the items to unindex them - $query = clone($this->getStateQuery()); + $query = clone $this->getStateQuery(); $this->db->setQuery($query); $items = $this->db->loadColumn(); diff --git a/administrator/components/com_finder/helpers/indexer/driver/mysql.php b/administrator/components/com_finder/helpers/indexer/driver/mysql.php index 4c8d1e8746406..d72d6f674864a 100644 --- a/administrator/components/com_finder/helpers/indexer/driver/mysql.php +++ b/administrator/components/com_finder/helpers/indexer/driver/mysql.php @@ -22,9 +22,7 @@ * Note: All exceptions thrown from within this class should be caught * by the controller. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 3.0 + * @since 3.0 */ class FinderIndexerDriverMysql extends FinderIndexer { @@ -605,6 +603,7 @@ protected function addTokensToDB($tokens, $context = '') ); $values++; } + $db->setQuery($query); $db->execute(); diff --git a/administrator/components/com_finder/helpers/indexer/driver/postgresql.php b/administrator/components/com_finder/helpers/indexer/driver/postgresql.php index 19e53e4979730..91190fc83e731 100644 --- a/administrator/components/com_finder/helpers/indexer/driver/postgresql.php +++ b/administrator/components/com_finder/helpers/indexer/driver/postgresql.php @@ -14,9 +14,7 @@ /** * Indexer class supporting PostgreSQL for the Finder indexer package. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 3.0 + * @since 3.0 */ class FinderIndexerDriverPostgresql extends FinderIndexer { @@ -328,6 +326,7 @@ public function index($item, $format = 'html') ' FROM ' . $db->quoteName('#__finder_tokens_aggregate') . ' AS ta' . ' WHERE ta.term_id = 0' ); + if ($db->loadRow() == null) { $db->setQuery( @@ -610,6 +609,7 @@ protected function addTokensToDB($tokens, $context = '') ); $values++; } + $db->setQuery($query); $db->execute(); diff --git a/administrator/components/com_finder/helpers/indexer/driver/sqlsrv.php b/administrator/components/com_finder/helpers/indexer/driver/sqlsrv.php index 7192d57e20a5b..4b04797ed3c81 100644 --- a/administrator/components/com_finder/helpers/indexer/driver/sqlsrv.php +++ b/administrator/components/com_finder/helpers/indexer/driver/sqlsrv.php @@ -22,9 +22,7 @@ * Note: All exceptions thrown from within this class should be caught * by the controller. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 3.1 + * @since 3.1 */ class FinderIndexerDriverSqlsrv extends FinderIndexer { diff --git a/administrator/components/com_finder/helpers/indexer/helper.php b/administrator/components/com_finder/helpers/indexer/helper.php index 86d29243fcba3..2d7df8cc3f038 100644 --- a/administrator/components/com_finder/helpers/indexer/helper.php +++ b/administrator/components/com_finder/helpers/indexer/helper.php @@ -16,9 +16,7 @@ /** * Helper class for the Finder indexer package. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderIndexerHelper { @@ -121,6 +119,7 @@ public static function tokenize($input, $lang, $phrase = false) for ($j = 0; $j < $charCount; $j++) { $tSplit = JString::str_ireplace($charMatches[0][$j], '', $terms[$i], false); + if (!empty($tSplit)) { $terms[$i] = $tSplit; @@ -190,6 +189,7 @@ public static function tokenize($input, $lang, $phrase = false) if ($store) { $cache[$store] = count($tokens) > 1 ? $tokens : array_shift($tokens); + return $cache[$store]; } else diff --git a/administrator/components/com_finder/helpers/indexer/indexer.php b/administrator/components/com_finder/helpers/indexer/indexer.php index 95fe02c48e3b6..a4794ac5833d9 100644 --- a/administrator/components/com_finder/helpers/indexer/indexer.php +++ b/administrator/components/com_finder/helpers/indexer/indexer.php @@ -28,9 +28,7 @@ * Note: All exceptions thrown from within this class should be caught * by the controller. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ abstract class FinderIndexer { @@ -111,6 +109,7 @@ public static function getInstance() { $format = 'sqlsrv'; } + $path = __DIR__ . '/driver/' . $format . '.php'; $class = 'FinderIndexerDriver' . ucfirst($format); @@ -119,6 +118,7 @@ public static function getInstance() { // Instantiate the parser. include_once $path; + return new $class; } else diff --git a/administrator/components/com_finder/helpers/indexer/parser.php b/administrator/components/com_finder/helpers/indexer/parser.php index 42f22e888fefa..0632bea60fe4e 100644 --- a/administrator/components/com_finder/helpers/indexer/parser.php +++ b/administrator/components/com_finder/helpers/indexer/parser.php @@ -12,9 +12,7 @@ /** * Parser base class for the Finder indexer package. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ abstract class FinderIndexerParser { diff --git a/administrator/components/com_finder/helpers/indexer/parser/html.php b/administrator/components/com_finder/helpers/indexer/parser/html.php index 3e0d761e4ee8d..99f11bf273bbd 100644 --- a/administrator/components/com_finder/helpers/indexer/parser/html.php +++ b/administrator/components/com_finder/helpers/indexer/parser/html.php @@ -14,9 +14,7 @@ /** * HTML Parser class for the Finder indexer package. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderIndexerParserHtml extends FinderIndexerParser { diff --git a/administrator/components/com_finder/helpers/indexer/parser/rtf.php b/administrator/components/com_finder/helpers/indexer/parser/rtf.php index 290e5a1fbf34c..b944230239da4 100644 --- a/administrator/components/com_finder/helpers/indexer/parser/rtf.php +++ b/administrator/components/com_finder/helpers/indexer/parser/rtf.php @@ -14,9 +14,7 @@ /** * RTF Parser class for the Finder indexer package. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderIndexerParserRtf extends FinderIndexerParser { diff --git a/administrator/components/com_finder/helpers/indexer/parser/txt.php b/administrator/components/com_finder/helpers/indexer/parser/txt.php index 7f7ad41df3750..32b189978300c 100644 --- a/administrator/components/com_finder/helpers/indexer/parser/txt.php +++ b/administrator/components/com_finder/helpers/indexer/parser/txt.php @@ -14,9 +14,7 @@ /** * Text Parser class for the Finder indexer package. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderIndexerParserTxt extends FinderIndexerParser { diff --git a/administrator/components/com_finder/helpers/indexer/query.php b/administrator/components/com_finder/helpers/indexer/query.php index 9cff3cee507e5..14a55ff4097e1 100644 --- a/administrator/components/com_finder/helpers/indexer/query.php +++ b/administrator/components/com_finder/helpers/indexer/query.php @@ -17,9 +17,7 @@ /** * Query class for the Finder indexer package. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderIndexerQuery { @@ -190,14 +188,17 @@ public function __construct($options) { $this->dates->set('date1', $options['date1']); } + if (isset($options['date2']) && !empty($options['date1'])) { $this->dates->set('date2', $options['date2']); } + if (isset($options['when1']) && !empty($options['date1'])) { $this->dates->set('when1', $options['when1']); } + if (isset($options['when2']) && !empty($options['date1'])) { $this->dates->set('when2', $options['when2']); @@ -300,6 +301,7 @@ public function toURI($base = null) { continue; } + $uri->setVar('t[]', $node); } } @@ -1023,6 +1025,7 @@ protected function processString($input, $lang, $mode) { unset($phrases[$pk]); } + if (($pk = array_search($terms[$i + 2], $phrases)) !== false) { unset($phrases[$pk]); @@ -1084,6 +1087,7 @@ protected function processString($input, $lang, $mode) { unset($phrases[$pk]); } + if (($pk = array_search($terms[$i + 2], $phrases)) !== false) { unset($phrases[$pk]); @@ -1134,7 +1138,7 @@ protected function processString($input, $lang, $mode) unset($terms[$i + 1]); // Adjust the loop. - $i += 1; + $i++; continue; } // Handle the NOT operator. @@ -1171,7 +1175,7 @@ protected function processString($input, $lang, $mode) unset($terms[$i + 1]); // Adjust the loop. - $i += 1; + $i++; continue; } } @@ -1286,7 +1290,7 @@ protected function getTokenData($token) ->where('t.phrase = 0'); // Clone the query, replace the WHERE clause. - $sub = clone($query); + $sub = clone $query; $sub->clear('where'); $sub->where('t.stem = ' . $db->quote($token->stem)); $sub->where('t.phrase = 0'); diff --git a/administrator/components/com_finder/helpers/indexer/result.php b/administrator/components/com_finder/helpers/indexer/result.php index ca96805ff5957..994bbf1166a0d 100644 --- a/administrator/components/com_finder/helpers/indexer/result.php +++ b/administrator/components/com_finder/helpers/indexer/result.php @@ -19,9 +19,7 @@ * declared will be pushed into the elements array and can be accessed * explicitly using the getElement() method. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderIndexerResult { diff --git a/administrator/components/com_finder/helpers/indexer/stemmer.php b/administrator/components/com_finder/helpers/indexer/stemmer.php index a182a44228666..382b1155e9f47 100644 --- a/administrator/components/com_finder/helpers/indexer/stemmer.php +++ b/administrator/components/com_finder/helpers/indexer/stemmer.php @@ -12,9 +12,7 @@ /** * Stemmer base class for the Finder indexer package. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ abstract class FinderIndexerStemmer { diff --git a/administrator/components/com_finder/helpers/indexer/stemmer/fr.php b/administrator/components/com_finder/helpers/indexer/stemmer/fr.php index 24bd6dec6ead7..f5e309a4c4053 100644 --- a/administrator/components/com_finder/helpers/indexer/stemmer/fr.php +++ b/administrator/components/com_finder/helpers/indexer/stemmer/fr.php @@ -17,9 +17,7 @@ * First contributed by Eric Sanou (bobotche@hotmail.fr) * This class is inspired in Alexis Ulrich's French stemmer code (http://alx2002.free.fr) * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 3.0 + * @since 3.0 */ class FinderIndexerStemmerFr extends FinderIndexerStemmer { @@ -85,13 +83,15 @@ protected static function getStemRules() $vars = array(); // French accented letters in ISO-8859-1 encoding - $vars['accents'] = chr(224) . chr(226) . chr(232) . chr(233) . chr(234) . chr(235) . chr(238) . chr(239) . chr(244) . chr(251) . chr(249) . chr(231); + $vars['accents'] = chr(224) . chr(226) . chr(232) . chr(233) . chr(234) . chr(235) . chr(238) . chr(239) + . chr(244) . chr(251) . chr(249) . chr(231); // The rule patterns include all accented words for french language $vars['rule_pattern'] = "/^([a-z" . $vars['accents'] . "]*)(\*){0,1}(\d)([a-z" . $vars['accents'] . "]*)([.|>])/"; // French vowels (including y) in ISO-8859-1 encoding - $vars['vowels'] = chr(97) . chr(224) . chr(226) . chr(101) . chr(232) . chr(233) . chr(234) . chr(235) . chr(105) . chr(238) . chr(239) . chr(111) . chr(244) . chr(117) . chr(251) . chr(249) . chr(121); + $vars['vowels'] = chr(97) . chr(224) . chr(226) . chr(101) . chr(232) . chr(233) . chr(234) . chr(235) + . chr(105) . chr(238) . chr(239) . chr(111) . chr(244) . chr(117) . chr(251) . chr(249) . chr(121); // The French rules in ISO-8859-1 encoding $vars['rules'] = array( @@ -230,6 +230,7 @@ private static function _getStem($input) // No other rule can be applied => the stem has been found break; } + $rule = $vars['rules'][$rule_number]; preg_match($vars['rule_pattern'], $rule, $matches); diff --git a/administrator/components/com_finder/helpers/indexer/stemmer/porter_en.php b/administrator/components/com_finder/helpers/indexer/stemmer/porter_en.php index 11593e717cc21..b7fde68d858c4 100644 --- a/administrator/components/com_finder/helpers/indexer/stemmer/porter_en.php +++ b/administrator/components/com_finder/helpers/indexer/stemmer/porter_en.php @@ -17,9 +17,7 @@ * This class was adapted from one written by Richard Heyes. * See copyright and link information above. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderIndexerStemmerPorter_En extends FinderIndexerStemmer { diff --git a/administrator/components/com_finder/helpers/indexer/stemmer/snowball.php b/administrator/components/com_finder/helpers/indexer/stemmer/snowball.php index 39fd44184e513..7c6ca647efba6 100644 --- a/administrator/components/com_finder/helpers/indexer/stemmer/snowball.php +++ b/administrator/components/com_finder/helpers/indexer/stemmer/snowball.php @@ -14,9 +14,7 @@ /** * Snowball stemmer class for the Finder indexer package. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderIndexerStemmerSnowball extends FinderIndexerStemmer { diff --git a/administrator/components/com_finder/helpers/indexer/taxonomy.php b/administrator/components/com_finder/helpers/indexer/taxonomy.php index 8cd52ea64cc2b..75befb2257074 100644 --- a/administrator/components/com_finder/helpers/indexer/taxonomy.php +++ b/administrator/components/com_finder/helpers/indexer/taxonomy.php @@ -12,9 +12,7 @@ /** * Stemmer base class for the Finder indexer package. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderIndexerTaxonomy { @@ -81,6 +79,7 @@ public static function addBranch($title, $state = 1, $access = 1) * out which case is true and deal with it. */ $branch = new JObject; + if (empty($result)) { // Prepare the branch object. @@ -160,6 +159,7 @@ public static function addNode($branch, $title, $state = 1, $access = 1) * out which case is true and deal with it. */ $node = new JObject; + if (empty($result)) { // Prepare the node object. diff --git a/administrator/components/com_finder/helpers/indexer/token.php b/administrator/components/com_finder/helpers/indexer/token.php index de3affd4c7911..6077b4c59b419 100644 --- a/administrator/components/com_finder/helpers/indexer/token.php +++ b/administrator/components/com_finder/helpers/indexer/token.php @@ -12,9 +12,7 @@ /** * Token class for the Finder indexer package. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderIndexerToken { diff --git a/administrator/components/com_finder/helpers/language.php b/administrator/components/com_finder/helpers/language.php index 16862bd4e2dd9..7146962006d0e 100644 --- a/administrator/components/com_finder/helpers/language.php +++ b/administrator/components/com_finder/helpers/language.php @@ -12,9 +12,7 @@ /** * Finder language helper class. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderHelperLanguage { @@ -86,6 +84,7 @@ public static function loadPluginLanguage() { return; } + $loaded = true; // Get array of all the enabled Smart Search plug-in names. diff --git a/administrator/components/com_finder/models/fields/directories.php b/administrator/components/com_finder/models/fields/directories.php index 5f5f4c4ee0846..46426e3102b29 100644 --- a/administrator/components/com_finder/models/fields/directories.php +++ b/administrator/components/com_finder/models/fields/directories.php @@ -17,9 +17,7 @@ /** * Renders a list of directories. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class JFormFieldDirectories extends JFormFieldList { diff --git a/administrator/components/com_finder/models/fields/searchfilter.php b/administrator/components/com_finder/models/fields/searchfilter.php index 999c4f25cbd7e..636ec18036b54 100644 --- a/administrator/components/com_finder/models/fields/searchfilter.php +++ b/administrator/components/com_finder/models/fields/searchfilter.php @@ -14,9 +14,7 @@ /** * Search Filter field for the Finder package. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class JFormFieldSearchFilter extends JFormFieldList { diff --git a/administrator/components/com_finder/models/filter.php b/administrator/components/com_finder/models/filter.php index b46e716158500..e3da81ec97a04 100644 --- a/administrator/components/com_finder/models/filter.php +++ b/administrator/components/com_finder/models/filter.php @@ -12,9 +12,7 @@ /** * Filter model class for Finder. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderModelFilter extends JModelAdmin { @@ -70,6 +68,7 @@ public function getFilter() if ($return === false && $filter->getError()) { $this->setError($filter->getError()); + return false; } @@ -87,6 +86,7 @@ public function getFilter() if ($this->_db->getErrorNum()) { $this->setError($this->_db->getErrorMsg()); + return false; } diff --git a/administrator/components/com_finder/models/filters.php b/administrator/components/com_finder/models/filters.php index 3c22d06195040..b3a6a42f44763 100644 --- a/administrator/components/com_finder/models/filters.php +++ b/administrator/components/com_finder/models/filters.php @@ -12,9 +12,7 @@ /** * Filters model class for Finder. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderModelFilters extends JModelList { diff --git a/administrator/components/com_finder/models/index.php b/administrator/components/com_finder/models/index.php index a8f79b9ec1e7a..35af0d551b154 100644 --- a/administrator/components/com_finder/models/index.php +++ b/administrator/components/com_finder/models/index.php @@ -12,9 +12,7 @@ /** * Index model class for Finder. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderModelIndex extends JModelList { @@ -70,6 +68,7 @@ public function __construct($config = array()) protected function canDelete($record) { $user = JFactory::getUser(); + return $user->authorise('core.delete', $this->option); } @@ -85,6 +84,7 @@ protected function canDelete($record) protected function canEditState($record) { $user = JFactory::getUser(); + return $user->authorise('core.edit.state', $this->option); } @@ -117,15 +117,18 @@ public function delete(&$pks) // Trigger the onContentBeforeDelete event. $result = $dispatcher->trigger($this->event_before_delete, array($context, $table)); + if (in_array(false, $result, true)) { $this->setError($table->getError()); + return false; } if (!$table->delete($pk)) { $this->setError($table->getError()); + return false; } @@ -137,6 +140,7 @@ public function delete(&$pks) // Prune items that you can't change. unset($pks[$i]); $error = $this->getError(); + if ($error) { $this->setError($error); @@ -150,6 +154,7 @@ public function delete(&$pks) else { $this->setError($table->getError()); + return false; } } @@ -198,6 +203,7 @@ protected function getListQuery() // Handle the list ordering. $ordering = $this->getState('list.ordering'); $direction = $this->getState('list.direction'); + if (!empty($ordering)) { $query->order($db->escape($ordering) . ' ' . $db->escape($direction)); @@ -376,6 +382,7 @@ public function publish(&$pks, $value = 1) // Prune items that you can't change. unset($pks[$i]); $this->setError(JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED')); + return false; } } @@ -385,6 +392,7 @@ public function publish(&$pks, $value = 1) if (!$table->publish($pks, $value, $user->get('id'))) { $this->setError($table->getError()); + return false; } @@ -396,6 +404,7 @@ public function publish(&$pks, $value = 1) if (in_array(false, $result, true)) { $this->setError($table->getError()); + return false; } diff --git a/administrator/components/com_finder/models/indexer.php b/administrator/components/com_finder/models/indexer.php index 7c86d996e3807..70019c09f34e2 100644 --- a/administrator/components/com_finder/models/indexer.php +++ b/administrator/components/com_finder/models/indexer.php @@ -12,9 +12,7 @@ /** * Indexer model class for Finder. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderModelIndexer extends JModelLegacy { diff --git a/administrator/components/com_finder/models/maps.php b/administrator/components/com_finder/models/maps.php index ec935356d0911..0649cb8d555d7 100644 --- a/administrator/components/com_finder/models/maps.php +++ b/administrator/components/com_finder/models/maps.php @@ -12,9 +12,7 @@ /** * Maps model for the Finder package. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderModelMaps extends JModelList { @@ -51,6 +49,7 @@ public function __construct($config = array()) protected function canDelete($record) { $user = JFactory::getUser(); + return $user->authorise('core.delete', $this->option); } @@ -66,6 +65,7 @@ protected function canDelete($record) protected function canEditState($record) { $user = JFactory::getUser(); + return $user->authorise('core.edit.state', $this->option); } @@ -98,15 +98,18 @@ public function delete(&$pks) // Trigger the onContentBeforeDelete event. $result = $dispatcher->trigger('onContentBeforeDelete', array($context, $table)); + if (in_array(false, $result, true)) { $this->setError($table->getError()); + return false; } if (!$table->delete($pk)) { $this->setError($table->getError()); + return false; } @@ -118,6 +121,7 @@ public function delete(&$pks) // Prune items that you can't change. unset($pks[$i]); $error = $this->getError(); + if ($error) { $this->setError($error); @@ -131,6 +135,7 @@ public function delete(&$pks) else { $this->setError($table->getError()); + return false; } } @@ -164,7 +169,6 @@ protected function getListQuery() // Join to get the map links $query->select('COUNT(c.node_id) AS num_nodes') ->join('LEFT', $db->quoteName('#__finder_taxonomy_map') . ' AS c ON c.node_id=a.id') - ->group('a.id, a.parent_id, a.title, a.state, a.access, a.ordering'); // If the model is set to check item state, add to the query. @@ -175,6 +179,7 @@ protected function getListQuery() // Filter the maps over the branch if set. $branch_id = $this->getState('filter.branch'); + if (!empty($branch_id)) { $query->where('a.parent_id = ' . (int) $branch_id); @@ -182,6 +187,7 @@ protected function getListQuery() // Filter the maps over the search string if set. $search = $this->getState('filter.search'); + if (!empty($search)) { $query->where('a.title LIKE ' . $db->quote('%' . $search . '%')); @@ -190,6 +196,7 @@ protected function getListQuery() // Handle the list ordering. $ordering = $this->getState('list.ordering'); $direction = $this->getState('list.direction'); + if (!empty($ordering)) { $query->order($db->escape($ordering) . ' ' . $db->escape($direction)); @@ -299,6 +306,7 @@ public function publish(&$pks, $value = 1) // Prune items that you can't change. unset($pks[$i]); $this->setError(JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED')); + return false; } } @@ -308,6 +316,7 @@ public function publish(&$pks, $value = 1) if (!$table->publish($pks, $value, $user->get('id'))) { $this->setError($table->getError()); + return false; } @@ -319,6 +328,7 @@ public function publish(&$pks, $value = 1) if (in_array(false, $result, true)) { $this->setError($table->getError()); + return false; } diff --git a/administrator/components/com_finder/models/statistics.php b/administrator/components/com_finder/models/statistics.php index 6df9fb40a3adb..8a707e1e347a8 100644 --- a/administrator/components/com_finder/models/statistics.php +++ b/administrator/components/com_finder/models/statistics.php @@ -12,9 +12,7 @@ /** * Statistics model class for Finder. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderModelStatistics extends JModelLegacy { diff --git a/administrator/components/com_finder/tables/filter.php b/administrator/components/com_finder/tables/filter.php index b644d9f60d075..e370e37a2a150 100644 --- a/administrator/components/com_finder/tables/filter.php +++ b/administrator/components/com_finder/tables/filter.php @@ -12,9 +12,7 @@ /** * Filter table class for the Finder package. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderTableFilter extends JTable { @@ -125,6 +123,7 @@ public function publish($pks = null, $state = 1, $userId = 0) else { $this->setError(JText::_('JLIB_DATABASE_ERROR_NO_ROWS_SELECTED')); + return false; } } @@ -156,6 +155,7 @@ public function publish($pks = null, $state = 1, $userId = 0) catch (RuntimeException $e) { $this->setError($e->getMessage()); + return false; } @@ -212,6 +212,7 @@ public function store($updateNulls = false) { $this->created = $date->toSql(); } + if (empty($this->created_by)) { $this->created_by = $user->get('id'); @@ -231,11 +232,14 @@ public function store($updateNulls = false) // Verify that the alias is unique $table = JTable::getInstance('Filter', 'FinderTable'); + if ($table->load(array('alias' => $this->alias)) && ($table->filter_id != $this->filter_id || $this->filter_id == 0)) { $this->setError(JText::_('JLIB_DATABASE_ERROR_ARTICLE_UNIQUE_ALIAS')); + return false; } + return parent::store($updateNulls); } } diff --git a/administrator/components/com_finder/tables/link.php b/administrator/components/com_finder/tables/link.php index 92f7b1b0ae338..1beb7e676daff 100644 --- a/administrator/components/com_finder/tables/link.php +++ b/administrator/components/com_finder/tables/link.php @@ -12,9 +12,7 @@ /** * Link table class for the Finder package. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderTableLink extends JTable { diff --git a/administrator/components/com_finder/tables/map.php b/administrator/components/com_finder/tables/map.php index 5a77dafc0ad60..927a10e06f7c6 100644 --- a/administrator/components/com_finder/tables/map.php +++ b/administrator/components/com_finder/tables/map.php @@ -12,9 +12,7 @@ /** * Map table class for the Finder package. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderTableMap extends JTable { @@ -63,6 +61,7 @@ public function publish($pks = null, $state = 1, $userId = 0) else { $this->setError(JText::_('JLIB_DATABASE_ERROR_NO_ROWS_SELECTED')); + return false; } } @@ -84,6 +83,7 @@ public function publish($pks = null, $state = 1, $userId = 0) catch (RuntimeException $e) { $this->setError($e->getMessage()); + return false; } diff --git a/administrator/components/com_finder/views/filter/view.html.php b/administrator/components/com_finder/views/filter/view.html.php index db4dbdace4bf0..c7adaf1546ca0 100644 --- a/administrator/components/com_finder/views/filter/view.html.php +++ b/administrator/components/com_finder/views/filter/view.html.php @@ -12,9 +12,7 @@ /** * Filter view class for Finder. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderViewFilter extends JViewLegacy { @@ -39,6 +37,7 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); + return false; } @@ -81,6 +80,7 @@ protected function addToolbar() JToolbarHelper::save('filter.save'); JToolbarHelper::save2new('filter.save2new'); } + JToolbarHelper::cancel('filter.cancel'); } else @@ -101,13 +101,16 @@ protected function addToolbar() } } } + // If an existing item, can save as a copy if ($canDo->get('core.create')) { JToolbarHelper::save2copy('filter.save2copy'); } + JToolbarHelper::cancel('filter.cancel', 'JTOOLBAR_CLOSE'); } + JToolbarHelper::divider(); JToolbarHelper::help('JHELP_COMPONENTS_FINDER_MANAGE_SEARCH_FILTERS_EDIT'); } diff --git a/administrator/components/com_finder/views/filters/view.html.php b/administrator/components/com_finder/views/filters/view.html.php index 3e1c11e01384b..b14bff75beb25 100644 --- a/administrator/components/com_finder/views/filters/view.html.php +++ b/administrator/components/com_finder/views/filters/view.html.php @@ -12,9 +12,7 @@ /** * Filters view class for Finder. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderViewFilters extends JViewLegacy { @@ -41,6 +39,7 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); + return false; } @@ -72,21 +71,25 @@ protected function addToolbar() JToolbarHelper::editList('filter.edit'); JToolbarHelper::divider(); } + if ($canDo->get('core.edit.state')) { JToolbarHelper::publishList('filters.publish'); JToolbarHelper::unpublishList('filters.unpublish'); JToolbarHelper::divider(); } + if ($canDo->get('core.delete')) { JToolbarHelper::deleteList('', 'filters.delete'); JToolbarHelper::divider(); } + if ($canDo->get('core.admin')) { JToolbarHelper::preferences('com_finder'); } + JToolbarHelper::divider(); $toolbar->appendButton('Popup', 'bars', 'COM_FINDER_STATISTICS', 'index.php?option=com_finder&view=statistics&tmpl=component', 550, 350); JToolbarHelper::divider(); diff --git a/administrator/components/com_finder/views/index/view.html.php b/administrator/components/com_finder/views/index/view.html.php index 42091e3824e3f..15212230e5bce 100644 --- a/administrator/components/com_finder/views/index/view.html.php +++ b/administrator/components/com_finder/views/index/view.html.php @@ -14,9 +14,7 @@ /** * Index view class for Finder. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderViewIndex extends JViewLegacy { @@ -46,6 +44,7 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); + return false; } @@ -81,10 +80,12 @@ protected function addToolbar() JToolbarHelper::publishList('index.publish'); JToolbarHelper::unpublishList('index.unpublish'); } + if ($canDo->get('core.delete')) { JToolbarHelper::deleteList('', 'index.delete'); } + if ($canDo->get('core.edit.state')) { JToolbarHelper::trash('index.purge', 'COM_FINDER_INDEX_TOOLBAR_PURGE', false); diff --git a/administrator/components/com_finder/views/indexer/view.html.php b/administrator/components/com_finder/views/indexer/view.html.php index 46c52c8c94e61..215f7ca4cd295 100644 --- a/administrator/components/com_finder/views/indexer/view.html.php +++ b/administrator/components/com_finder/views/indexer/view.html.php @@ -12,9 +12,7 @@ /** * Indexer view class for Finder. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderViewIndexer extends JViewLegacy { diff --git a/administrator/components/com_finder/views/maps/view.html.php b/administrator/components/com_finder/views/maps/view.html.php index c45bc8d48442a..bb48f40edcadd 100644 --- a/administrator/components/com_finder/views/maps/view.html.php +++ b/administrator/components/com_finder/views/maps/view.html.php @@ -14,9 +14,7 @@ /** * Groups view class for Finder. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderViewMaps extends JViewLegacy { @@ -46,6 +44,7 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); + return false; } @@ -77,15 +76,18 @@ protected function addToolbar() JToolbarHelper::unpublishList('maps.unpublish'); JToolbarHelper::divider(); } + if ($canDo->get('core.delete')) { JToolbarHelper::deleteList('', 'maps.delete'); JToolbarHelper::divider(); } + if ($canDo->get('core.admin')) { JToolbarHelper::preferences('com_finder'); } + JToolbarHelper::divider(); $toolbar->appendButton('Popup', 'bars', 'COM_FINDER_STATISTICS', 'index.php?option=com_finder&view=statistics&tmpl=component', 550, 350); JToolbarHelper::divider(); diff --git a/administrator/components/com_finder/views/statistics/view.html.php b/administrator/components/com_finder/views/statistics/view.html.php index ed3c8714e0b93..71ecda55f059c 100644 --- a/administrator/components/com_finder/views/statistics/view.html.php +++ b/administrator/components/com_finder/views/statistics/view.html.php @@ -12,9 +12,7 @@ /** * Statistics view class for Finder. * - * @package Joomla.Administrator - * @subpackage com_finder - * @since 2.5 + * @since 2.5 */ class FinderViewStatistics extends JViewLegacy { @@ -36,6 +34,7 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); + return false; } diff --git a/administrator/components/com_installer/controller.php b/administrator/components/com_installer/controller.php index e4f15205b6d7f..1dd52bee4c284 100644 --- a/administrator/components/com_installer/controller.php +++ b/administrator/components/com_installer/controller.php @@ -12,9 +12,7 @@ /** * Installer Controller * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 1.5 + * @since 1.5 */ class InstallerController extends JControllerLegacy { diff --git a/administrator/components/com_installer/controllers/database.php b/administrator/components/com_installer/controllers/database.php index 0808a807ff97d..5196750486c88 100644 --- a/administrator/components/com_installer/controllers/database.php +++ b/administrator/components/com_installer/controllers/database.php @@ -12,9 +12,7 @@ /** * Installer Database Controller * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 2.5 + * @since 2.5 */ class InstallerControllerDatabase extends JControllerLegacy { diff --git a/administrator/components/com_installer/controllers/discover.php b/administrator/components/com_installer/controllers/discover.php index 10a911d099a5c..ab4884ac90e0c 100644 --- a/administrator/components/com_installer/controllers/discover.php +++ b/administrator/components/com_installer/controllers/discover.php @@ -12,9 +12,7 @@ /** * Discover Installation Controller * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 1.6 + * @since 1.6 */ class InstallerControllerDiscover extends JControllerLegacy { diff --git a/administrator/components/com_installer/controllers/install.php b/administrator/components/com_installer/controllers/install.php index e7e10af4053b6..b105d4dc6691a 100644 --- a/administrator/components/com_installer/controllers/install.php +++ b/administrator/components/com_installer/controllers/install.php @@ -10,8 +10,9 @@ defined('_JEXEC') or die; /** - * @package Joomla.Administrator - * @subpackage com_installer + * Installer controller for Joomla! installer class. + * + * @since 1.5 */ class InstallerControllerInstall extends JControllerLegacy { @@ -24,29 +25,34 @@ class InstallerControllerInstall extends JControllerLegacy */ public function install() { - // Check for request forgeries + // Check for request forgeries. JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $model = $this->getModel('install'); + if ($model->install()) { $cache = JFactory::getCache('mod_menu'); $cache->clean(); - // TODO: Reset the users acl here as well to kill off any missing bits + + // TODO: Reset the users acl here as well to kill off any missing bits. } $app = JFactory::getApplication(); $redirect_url = $app->getUserState('com_installer.redirect_url'); + if (empty($redirect_url)) { $redirect_url = JRoute::_('index.php?option=com_installer&view=install', false); - } else + } + else { - // wipe out the user state when we're going to redirect + // Wipe out the user state when we're going to redirect. $app->setUserState('com_installer.redirect_url', ''); $app->setUserState('com_installer.message', ''); $app->setUserState('com_installer.extension_message', ''); } + $this->setRedirect($redirect_url); } } diff --git a/administrator/components/com_installer/controllers/languages.php b/administrator/components/com_installer/controllers/languages.php index f96c7279a5aed..9524904e628ea 100644 --- a/administrator/components/com_installer/controllers/languages.php +++ b/administrator/components/com_installer/controllers/languages.php @@ -11,8 +11,6 @@ /** * Languages Installer Controller * - * @package Joomla.Administrator - * @subpackage com_installer * @since 2.5.7 */ class InstallerControllerLanguages extends JControllerLegacy diff --git a/administrator/components/com_installer/controllers/manage.php b/administrator/components/com_installer/controllers/manage.php index 029365edad380..1ff27376d6ab4 100644 --- a/administrator/components/com_installer/controllers/manage.php +++ b/administrator/components/com_installer/controllers/manage.php @@ -12,9 +12,7 @@ /** * Installer Manage Controller * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 1.6 + * @since 1.6 */ class InstallerControllerManage extends JControllerLegacy { @@ -75,6 +73,7 @@ public function publish() { $ntext = 'COM_INSTALLER_N_EXTENSIONS_UNPUBLISHED'; } + $this->setMessage(JText::plural($ntext, count($ids))); } } @@ -91,7 +90,7 @@ public function publish() */ public function remove() { - // Check for request forgeries + // Check for request forgeries. JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $eid = $this->input->get('cid', array(), 'array'); @@ -113,7 +112,7 @@ public function remove() */ public function refresh() { - // Check for request forgeries + // Check for request forgeries. JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $uid = $this->input->get('cid', array(), 'array'); diff --git a/administrator/components/com_installer/controllers/update.php b/administrator/components/com_installer/controllers/update.php index 37b2aaae7d3e4..f691d48bf8780 100644 --- a/administrator/components/com_installer/controllers/update.php +++ b/administrator/components/com_installer/controllers/update.php @@ -12,9 +12,7 @@ /** * Installer Update Controller * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 1.6 + * @since 1.6 */ class InstallerControllerUpdate extends JControllerLegacy { @@ -27,13 +25,14 @@ class InstallerControllerUpdate extends JControllerLegacy */ public function update() { - // Check for request forgeries + // Check for request forgeries. JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $model = $this->getModel('update'); $uid = $this->input->get('cid', array(), 'array'); JArrayHelper::toInteger($uid, array()); + if ($model->update($uid)) { $cache = JFactory::getCache('mod_menu'); @@ -42,17 +41,19 @@ public function update() $app = JFactory::getApplication(); $redirect_url = $app->getUserState('com_installer.redirect_url'); + if (empty($redirect_url)) { $redirect_url = JRoute::_('index.php?option=com_installer&view=update', false); } else { - // Wipe out the user state when we're going to redirect + // Wipe out the user state when we're going to redirect. $app->setUserState('com_installer.redirect_url', ''); $app->setUserState('com_installer.message', ''); $app->setUserState('com_installer.extension_message', ''); } + $this->setRedirect($redirect_url); } @@ -65,16 +66,16 @@ public function update() */ public function find() { - // Check for request forgeries + // Check for request forgeries. JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); - // Get the caching duration + // Get the caching duration. $component = JComponentHelper::getComponent('com_installer'); $params = $component->params; $cache_timeout = $params->get('cachetimeout', 6, 'int'); $cache_timeout = 3600 * $cache_timeout; - // Find updates + // Find updates. $model = $this->getModel('update'); $model->findUpdates(0, $cache_timeout); $this->setRedirect(JRoute::_('index.php?option=com_installer&view=update', false)); @@ -89,8 +90,7 @@ public function find() */ public function purge() { - // Purge updates - // Check for request forgeries + // Check for request forgeries. JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $model = $this->getModel('update'); $model->purge(); @@ -112,11 +112,11 @@ public function ajax() * asynchronously. This means that between requests the token might * change, making it impossible for AJAX to work. */ - $eid = $this->input->getInt('eid', 0); $skip = $this->input->get('skip', array(), 'array'); $cache_timeout = $this->input->getInt('cache_timeout', 0); + if ($cache_timeout == 0) { $component = JComponentHelper::getComponent('com_installer'); @@ -130,16 +130,19 @@ public function ajax() $model->setState('list.start', 0); $model->setState('list.limit', 0); + if ($eid != 0) { $model->setState('filter.extension_id', $eid); } + $updates = $model->getItems(); if (!empty($skip)) { $unfiltered_updates = $updates; $updates = array(); + foreach ($unfiltered_updates as $update) { if (!in_array($update->extension_id, $skip)) @@ -148,6 +151,7 @@ public function ajax() } } } + echo json_encode($updates); JFactory::getApplication()->close(); diff --git a/administrator/components/com_installer/helpers/html/manage.php b/administrator/components/com_installer/helpers/html/manage.php index f0eb9449f1252..bc9721cd7d163 100644 --- a/administrator/components/com_installer/helpers/html/manage.php +++ b/administrator/components/com_installer/helpers/html/manage.php @@ -10,6 +10,8 @@ defined('_JEXEC') or die; /** + * Installer HTML class. + * * @package Joomla.Administrator * @subpackage com_installer * @since 2.5 @@ -17,12 +19,12 @@ abstract class InstallerHtmlManage { /** - * Returns a published state on a grid + * Returns a published state on a grid. * - * @param integer $value The state value. - * @param integer $i The row index - * @param boolean $enabled An optional setting for access control on the action. - * @param string $checkbox An optional prefix for checkboxes. + * @param integer $value The state value. + * @param integer $i The row index. + * @param boolean $enabled An optional setting for access control on the action. + * @param string $checkbox An optional prefix for checkboxes. * * @return string The Html code * diff --git a/administrator/components/com_installer/helpers/installer.php b/administrator/components/com_installer/helpers/installer.php index 2a30c544f05b4..182349bf10ed3 100644 --- a/administrator/components/com_installer/helpers/installer.php +++ b/administrator/components/com_installer/helpers/installer.php @@ -12,9 +12,7 @@ /** * Installer helper. * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 1.6 + * @since 1.6 */ class InstallerHelper { @@ -81,6 +79,7 @@ public static function getExtensionTypes() $types = $db->loadColumn(); $options = array(); + foreach ($types as $type) { $options[] = JHtml::_('select.option', $type, 'COM_INSTALLER_TYPE_' . strtoupper($type)); @@ -108,6 +107,7 @@ public static function getExtensionGroupes() $folders = $db->loadColumn(); $options = array(); + foreach ($folders as $folder) { $options[] = JHtml::_('select.option', $folder, $folder); diff --git a/administrator/components/com_installer/models/database.php b/administrator/components/com_installer/models/database.php index 3a19f8a90deec..c3794fdaf8c27 100644 --- a/administrator/components/com_installer/models/database.php +++ b/administrator/components/com_installer/models/database.php @@ -15,9 +15,7 @@ /** * Installer Manage Model * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 1.6 + * @since 1.6 */ class InstallerModelDatabase extends InstallerModel { @@ -46,7 +44,7 @@ protected function populateState($ordering = null, $direction = null) } /** - * Fixes database problems + * Fixes database problems. * * @return void */ @@ -56,6 +54,7 @@ public function fix() { return false; } + $changeSet->fix(); $this->fixSchemaVersion($changeSet); $this->fixUpdateVersion(); @@ -65,7 +64,7 @@ public function fix() } /** - * Gets the changeset object + * Gets the changeset object. * * @return JSchemaChangeset */ @@ -80,6 +79,7 @@ public function getItems() catch (RuntimeException $e) { JFactory::getApplication()->enqueueMessage($e->getMessage(), 'warning'); + return false; } return $changeSet; @@ -98,9 +98,9 @@ public function getPagination() } /** - * Get version from #__schemas table + * Get version from #__schemas table. * - * @return mixed the return value from the query, or null if the query fails + * @return mixed the return value from the query, or null if the query fails. * * @throws Exception */ @@ -118,52 +118,55 @@ public function getSchemaVersion() } /** - * Fix schema version if wrong + * Fix schema version if wrong. * - * @param JSchemaChangeSet $changeSet Schema change set + * @param JSchemaChangeSet $changeSet Schema change set. * - * @return mixed string schema version if success, false if fail + * @return mixed string schema version if success, false if fail. */ public function fixSchemaVersion($changeSet) { - // Get correct schema version -- last file in array + // Get correct schema version -- last file in array. $schema = $changeSet->getSchema(); $db = JFactory::getDbo(); $result = false; - // Check value. If ok, don't do update + // Check value. If ok, don't do update. $version = $this->getSchemaVersion(); + if ($version == $schema) { $result = $version; } else { - // Delete old row + // Delete old row. $query = $db->getQuery(true) ->delete($db->quoteName('#__schemas')) ->where($db->quoteName('extension_id') . ' = 700'); $db->setQuery($query); $db->execute(); - // Add new row + // Add new row. $query->clear() ->insert($db->quoteName('#__schemas')) ->set($db->quoteName('extension_id') . '= 700') ->set($db->quoteName('version_id') . '= ' . $db->quote($schema)); $db->setQuery($query); + if ($db->execute()) { $result = $schema; } } + return $result; } /** - * Get current version from #__extensions table + * Get current version from #__extensions table. * - * @return mixed version if successful, false if fail + * @return mixed version if successful, false if fail. */ public function getUpdateVersion() @@ -171,13 +174,14 @@ public function getUpdateVersion() $table = JTable::getInstance('Extension'); $table->load('700'); $cache = new JRegistry($table->manifest_cache); + return $cache->get('version'); } /** - * Fix Joomla version in #__extensions table if wrong (doesn't equal JVersion short version) + * Fix Joomla version in #__extensions table if wrong (doesn't equal JVersion short version). * - * @return mixed string update version if success, false if fail + * @return mixed string update version if success, false if fail. */ public function fixUpdateVersion() { @@ -186,6 +190,7 @@ public function fixUpdateVersion() $cache = new JRegistry($table->manifest_cache); $updateVersion = $cache->get('version'); $cmsVersion = new JVersion; + if ($updateVersion == $cmsVersion->getShortVersion()) { return $updateVersion; @@ -194,6 +199,7 @@ public function fixUpdateVersion() { $cache->set('version', $cmsVersion->getShortVersion()); $table->manifest_cache = $cache->toString(); + if ($table->store()) { return $cmsVersion->getShortVersion(); @@ -202,7 +208,6 @@ public function fixUpdateVersion() { return false; } - } } @@ -210,36 +215,40 @@ public function fixUpdateVersion() * For version 2.5.x only * Check if com_config parameters are blank. * - * @return string default text filters (if any) + * @return string default text filters (if any). */ public function getDefaultTextFilters() { $table = JTable::getInstance('Extension'); $table->load($table->find(array('name' => 'com_config'))); + return $table->params; } + /** * For version 2.5.x only * Check if com_config parameters are blank. If so, populate with com_content text filters. * - * @return mixed boolean true if params are updated, null otherwise + * @return mixed boolean true if params are updated, null otherwise. */ public function fixDefaultTextFilters() { $table = JTable::getInstance('Extension'); $table->load($table->find(array('name' => 'com_config'))); - // Check for empty $config and non-empty content filters + // Check for empty $config and non-empty content filters. if (!$table->params) { - // Get filters from com_content and store if you find them + // Get filters from com_content and store if you find them. $contentParams = JComponentHelper::getParams('com_content'); + if ($contentParams->get('filters')) { $newParams = new JRegistry; $newParams->set('filters', $contentParams->get('filters')); $table->params = (string) $newParams; $table->store(); + return true; } } diff --git a/administrator/components/com_installer/models/discover.php b/administrator/components/com_installer/models/discover.php index 33a2509ef8105..14ec62568a356 100644 --- a/administrator/components/com_installer/models/discover.php +++ b/administrator/components/com_installer/models/discover.php @@ -14,9 +14,7 @@ /** * Installer Discover Model * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 1.6 + * @since 1.6 */ class InstallerModelDiscover extends InstallerModel { diff --git a/administrator/components/com_installer/models/extension.php b/administrator/components/com_installer/models/extension.php index 6beb8c75144de..f66b2b615c70f 100644 --- a/administrator/components/com_installer/models/extension.php +++ b/administrator/components/com_installer/models/extension.php @@ -10,12 +10,9 @@ defined('_JEXEC') or die; /** - * Extension Manager Abstract Extension Model + * Extension Manager Abstract Extension Model. * - * @abstract - * @package Joomla.Administrator - * @subpackage com_installer - * @since 1.5 + * @since 1.5 */ class InstallerModel extends JModelList { @@ -80,14 +77,17 @@ protected function _getList($query, $limitstart = 0, $limit = 0) } } } + JArrayHelper::sortObjects($result, $this->getState('list.ordering'), $this->getState('list.direction') == 'desc' ? -1 : 1, true, true); $total = count($result); $this->cache[$this->getStoreId('getTotal')] = $total; + if ($total < $limitstart) { $limitstart = 0; $this->setState('list.start', 0); } + return array_slice($result, $limitstart, $limit ? $limit : null); } else @@ -95,6 +95,7 @@ protected function _getList($query, $limitstart = 0, $limit = 0) $query->order($db->quoteName($ordering) . ' ' . $this->getState('list.direction')); $result = parent::_getList($query, $limitstart, $limit); $this->translate($result); + return $result; } } @@ -109,11 +110,13 @@ protected function _getList($query, $limitstart = 0, $limit = 0) private function translate(&$items) { $lang = JFactory::getLanguage(); + foreach ($items as &$item) { if (strlen($item->manifest_cache)) { $data = json_decode($item->manifest_cache); + if ($data) { foreach ($data as $key => $value) @@ -123,13 +126,16 @@ private function translate(&$items) // Ignore the type field continue; } + $item->$key = $value; } } } + $item->author_info = @$item->authorEmail . '
' . @$item->authorUrl; $item->client = $item->client_id ? JText::_('JADMINISTRATOR') : JText::_('JSITE'); $path = $item->client_id ? JPATH_ADMINISTRATOR : JPATH_SITE; + switch ($item->type) { case 'component': @@ -169,11 +175,14 @@ private function translate(&$items) || $lang->load("$extension.sys", $source, null, false, true); break; } + if (!in_array($item->type, array('language', 'template', 'library'))) { $item->name = JText::_($item->name); } + settype($item->description, 'string'); + if (!in_array($item->type, array('language'))) { $item->description = JText::_($item->description); diff --git a/administrator/components/com_installer/models/install.php b/administrator/components/com_installer/models/install.php index d52694c001b5f..8e7818372ca67 100644 --- a/administrator/components/com_installer/models/install.php +++ b/administrator/components/com_installer/models/install.php @@ -12,9 +12,7 @@ /** * Extension Manager Install Model * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 1.5 + * @since 1.5 */ class InstallerModelInstall extends JModelLegacy { @@ -62,7 +60,7 @@ protected function populateState() /** * Install an extension from either folder, url or upload. * - * @return boolean result of install + * @return boolean result of install. * * @since 1.5 */ @@ -80,8 +78,8 @@ public function install() $package = null; - // This event allows an input pre-treatment, a custom pre-packing or custom installation - // (e.g. from a JSON description) + // This event allows an input pre-treatment, a custom pre-packing or custom installation. + // (e.g. from a JSON description). $results = $dispatcher->trigger('onInstallerBeforeInstallation', array($this, &$package)); if (in_array(true, $results, true)) @@ -147,22 +145,23 @@ public function install() } $app->setUserState('com_installer.message', JText::_('COM_INSTALLER_UNABLE_TO_FIND_INSTALL_PACKAGE')); + return false; } - // Get an installer instance + // Get an installer instance. $installer = JInstaller::getInstance(); - // Install the package + // Install the package. if (!$installer->install($package['dir'])) { - // There was an error installing the package + // There was an error installing the package. $msg = JText::sprintf('COM_INSTALLER_INSTALL_ERROR', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type']))); $result = false; } else { - // Package installed sucessfully + // Package installed sucessfully. $msg = JText::sprintf('COM_INSTALLER_INSTALL_SUCCESS', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type']))); $result = true; } @@ -170,7 +169,7 @@ public function install() // This event allows a custom a post-flight: $dispatcher->trigger('onInstallerAfterInstaller', array($this, &$package, $installer, &$result, &$msg)); - // Set some model state values + // Set some model state values. $app = JFactory::getApplication(); $app->enqueueMessage($msg); $this->setState('name', $installer->get('name')); @@ -179,7 +178,7 @@ public function install() $app->setUserState('com_installer.extension_message', $installer->get('extension_message')); $app->setUserState('com_installer.redirect_url', $installer->get('redirect_url')); - // Cleanup the install files + // Cleanup the install files. if (!is_file($package['packagefile'])) { $config = JFactory::getConfig(); @@ -192,17 +191,17 @@ public function install() } /** - * Works out an installation package from a HTTP upload + * Works out an installation package from a HTTP upload. * - * @return array package definition or false on failure + * @return package definition or false on failure. */ protected function _getPackageFromUpload() { - // Get the uploaded file information + // Get the uploaded file information. $input = JFactory::getApplication()->input; $userfile = $input->files->get('install_package', null, 'array'); - // Make sure that file uploads are enabled in php + // Make sure that file uploads are enabled in php. if (!(bool) ini_get('file_uploads')) { JError::raiseWarning('', JText::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLFILE')); @@ -210,7 +209,7 @@ protected function _getPackageFromUpload() return false; } - // Make sure that zlib is loaded so that the package can be unpacked + // Make sure that zlib is loaded so that the package can be unpacked. if (!extension_loaded('zlib')) { JError::raiseWarning('', JText::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLZLIB')); @@ -250,16 +249,16 @@ protected function _getPackageFromUpload() return false; } - // Build the appropriate paths + // Build the appropriate paths. $config = JFactory::getConfig(); $tmp_dest = $config->get('tmp_path') . '/' . $userfile['name']; $tmp_src = $userfile['tmp_name']; - // Move uploaded file + // Move uploaded file. jimport('joomla.filesystem.file'); JFile::upload($tmp_src, $tmp_dest); - // Unpack the downloaded package file + // Unpack the downloaded package file. $package = JInstallerHelper::unpack($tmp_dest, true); return $package; @@ -276,7 +275,7 @@ protected function _getPackageFromFolder() { $input = JFactory::getApplication()->input; - // Get the path to the package to install + // Get the path to the package to install. $p_dir = $input->getString('install_directory'); $p_dir = JPath::clean($p_dir); @@ -306,9 +305,9 @@ protected function _getPackageFromFolder() } /** - * Install an extension from a URL + * Install an extension from a URL. * - * @return Package details or false on failure + * @return Package details or false on failure. * * @since 1.5 */ @@ -316,7 +315,7 @@ protected function _getPackageFromUrl() { $input = JFactory::getApplication()->input; - // Get the URL of the package to install + // Get the URL of the package to install. $url = $input->getString('install_url'); // Did you give us a URL? @@ -343,7 +342,7 @@ protected function _getPackageFromUrl() unset($update); } - // Download the package at the URL given + // Download the package at the URL given. $p_file = JInstallerHelper::downloadPackage($url); // Was the package downloaded? @@ -357,7 +356,7 @@ protected function _getPackageFromUrl() $config = JFactory::getConfig(); $tmp_dest = $config->get('tmp_path'); - // Unpack the downloaded package file + // Unpack the downloaded package file. $package = JInstallerHelper::unpack($tmp_dest . '/' . $p_file, true); return $package; diff --git a/administrator/components/com_installer/models/languages.php b/administrator/components/com_installer/models/languages.php index 834e0432f2d8c..b979166f0fff5 100644 --- a/administrator/components/com_installer/models/languages.php +++ b/administrator/components/com_installer/models/languages.php @@ -13,9 +13,7 @@ /** * Languages Installer Model * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 2.5.7 + * @since 2.5.7 */ class InstallerModelLanguages extends JModelList { @@ -51,7 +49,7 @@ protected function _getListQuery() $db = JFactory::getDbo(); $query = $db->getQuery(true); - // Select the required fields from the updates table + // Select the required fields from the updates table. $query->select('update_id, name, version, detailsurl, type') ->from('#__updates'); @@ -61,6 +59,7 @@ 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) . '%')); @@ -155,23 +154,25 @@ public function install($lids) // Loop through every selected language foreach ($lids as $id) { - // Loads the update database object that represents the language + // Loads the update database object that represents the language. $language = JTable::getInstance('update'); $language->load($id); - // Get the url to the XML manifest file of the selected language + // Get the url to the XML manifest file of the selected language. $remote_manifest = $this->_getLanguageManifest($id); + if (!$remote_manifest) { - // Could not find the url, the information in the update server may be corrupt + // Could not find the url, the information in the update server may be corrupt. $message = JText::sprintf('COM_INSTALLER_MSG_LANGUAGES_CANT_FIND_REMOTE_MANIFEST', $language->name); $message .= ' ' . JText::_('COM_INSTALLER_MSG_LANGUAGES_TRY_LATER'); $app->enqueueMessage($message); continue; } - // Based on the language XML manifest get the url of the package to download + // Based on the language XML manifest get the url of the package to download. $package_url = $this->_getPackageUrl($remote_manifest); + if (!$package_url) { // Could not find the url , maybe the url is wrong in the update server, or there is not internet access @@ -181,34 +182,34 @@ public function install($lids) continue; } - // Download the package to the tmp folder + // Download the package to the tmp folder. $package = $this->_downloadPackage($package_url); // Install the package if (!$installer->install($package['dir'])) { - // There was an error installing the package + // There was an error installing the package. $message = JText::sprintf('COM_INSTALLER_INSTALL_ERROR', $language->name); $message .= ' ' . JText::_('COM_INSTALLER_MSG_LANGUAGES_TRY_LATER'); $app->enqueueMessage($message); continue; } - // Package installed successfully + // Package installed successfully. $app->enqueueMessage(JText::sprintf('COM_INSTALLER_INSTALL_SUCCESS', $language->name)); - // Cleanup the install files in tmp folder + // Cleanup the install files in tmp folder. if (!is_file($package['packagefile'])) { $config = JFactory::getConfig(); $package['packagefile'] = $config->get('tmp_path') . '/' . $package['packagefile']; } + JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']); - // Delete the installed language from the list + // Delete the installed language from the list. $language->delete($id); } - } /** @@ -257,20 +258,21 @@ protected function _getPackageUrl( $remote_manifest ) */ protected function _downloadPackage($url) { - // Download the package from the given URL + // Download the package from the given URL. $p_file = JInstallerHelper::downloadPackage($url); // Was the package downloaded? if (!$p_file) { JError::raiseWarning('', JText::_('COM_INSTALLER_MSG_INSTALL_INVALID_URL')); + return false; } $config = JFactory::getConfig(); $tmp_dest = $config->get('tmp_path'); - // Unpack the downloaded package file + // Unpack the downloaded package file. $package = JInstallerHelper::unpack($tmp_dest . '/' . $p_file); return $package; diff --git a/administrator/components/com_installer/models/manage.php b/administrator/components/com_installer/models/manage.php index c49a512ca76c7..ee4b546b57a03 100644 --- a/administrator/components/com_installer/models/manage.php +++ b/administrator/components/com_installer/models/manage.php @@ -14,9 +14,7 @@ /** * Installer Manage Model * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 1.5 + * @since 1.5 */ class InstallerModelManage extends InstallerModel { @@ -91,6 +89,7 @@ protected function populateState($ordering = null, $direction = null) public function publish(&$eid = array(), $value = 1) { $user = JFactory::getUser(); + if ($user->authorise('core.edit.state', 'com_installer')) { $result = true; @@ -112,9 +111,11 @@ public function publish(&$eid = array(), $value = 1) foreach ($eid as $i => $id) { $table->load($id); + if ($table->type == 'template') { $style = JTable::getInstance('Style', 'TemplatesTable'); + if ($style->load(array('template' => $table->element, 'client_id' => $table->client_id, 'home' => 1))) { JError::raiseNotice(403, JText::_('COM_INSTALLER_ERROR_DISABLE_DEFAULT_TEMPLATE_NOT_PERMITTED')); @@ -122,6 +123,7 @@ public function publish(&$eid = array(), $value = 1) continue; } } + if ($table->protected == 1) { $result = false; @@ -131,6 +133,7 @@ public function publish(&$eid = array(), $value = 1) { $table->enabled = $value; } + if (!$table->store()) { $this->setError($table->getError()); @@ -143,6 +146,7 @@ public function publish(&$eid = array(), $value = 1) $result = false; JError::raiseWarning(403, JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED')); } + return $result; } @@ -171,6 +175,7 @@ public function refresh($eid) { $result |= $installer->refreshManifestCache($id); } + return $result; } @@ -207,6 +212,7 @@ public function remove($eid = array()) // Uninstall the chosen extensions $msgs = array(); $result = false; + foreach ($eid as $id) { $id = trim($id); @@ -214,6 +220,7 @@ public function remove($eid = array()) $langstring = 'COM_INSTALLER_TYPE_TYPE_' . strtoupper($row->type); $rowtype = JText::_($langstring); + if (strpos($rowtype, $langstring) !== false) { $rowtype = $row->type; @@ -241,20 +248,19 @@ public function remove($eid = array()) { if ($row->type == 'language') { - // One should always uninstall a language package, not a single language $msgs[] = JText::_('COM_INSTALLER_UNINSTALL_LANGUAGE'); $result = false; } else { - // There was an error in uninstalling the package $msgs[] = JText::sprintf('COM_INSTALLER_UNINSTALL_ERROR', $rowtype); $result = false; } } } + $msg = implode("
", $msgs); $app = JFactory::getApplication(); $app->enqueueMessage($msg); @@ -262,6 +268,7 @@ public function remove($eid = array()) $this->setState('name', $installer->get('name')); $app->setUserState('com_installer.message', $installer->message); $app->setUserState('com_installer.extension_message', $installer->get('extension_message')); + return $result; } else @@ -288,6 +295,7 @@ protected function getListQuery() ->select('2*protected+(1-protected)*enabled as status') ->from('#__extensions') ->where('state=0'); + if ($status != '') { if ($status == '2') @@ -304,14 +312,17 @@ protected function getListQuery() ->where('enabled=' . (int) $status); } } + if ($type) { $query->where('type=' . $this->_db->quote($type)); } + if ($client != '') { $query->where('client_id=' . (int) $client); } + if ($group != '' && in_array($type, array('plugin', 'library', ''))) { $query->where('folder=' . $this->_db->quote($group == '*' ? '' : $group)); @@ -319,6 +330,7 @@ protected function getListQuery() // Filter by search in id $search = $this->getState('filter.search'); + if (!empty($search) && stripos($search, 'id:') === 0) { $query->where('extension_id = ' . (int) substr($search, 3)); diff --git a/administrator/components/com_installer/models/update.php b/administrator/components/com_installer/models/update.php index c3fe804ead712..9c5ab43d8933b 100644 --- a/administrator/components/com_installer/models/update.php +++ b/administrator/components/com_installer/models/update.php @@ -14,9 +14,7 @@ /** * Installer Update Model * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 1.6 + * @since 1.6 */ class InstallerModelUpdate extends JModelList { @@ -106,10 +104,12 @@ protected function getListQuery() { $query->where('type=' . $db->quote($type)); } + if ($client != '') { $query->where('client_id = ' . intval($client)); } + if ($group != '' && in_array($type, array('plugin', 'library', ''))) { $query->where('folder=' . $db->quote($group == '*' ? '' : $group)); @@ -128,11 +128,13 @@ protected function getListQuery() // Filter by search $search = $this->getState('filter.search'); + if (!empty($search)) { $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); $query->where('name LIKE ' . $search); } + return $query; } @@ -153,6 +155,7 @@ public function findUpdates($eid = 0, $cache_timeout = 0) $updater = JUpdater::getInstance(); $updater->findUpdates($eid, $cache_timeout); + return true; } @@ -170,6 +173,7 @@ public function purge() // Note: TRUNCATE is a DDL operation // This may or may not mean depending on your database $db->setQuery('TRUNCATE TABLE #__updates'); + if ($db->execute()) { // Reset the last update check timestamp @@ -179,11 +183,13 @@ public function purge() $db->setQuery($query); $db->execute(); $this->_message = JText::_('COM_INSTALLER_PURGED_UPDATES'); + return true; } else { $this->_message = JText::_('COM_INSTALLER_FAILED_TO_PURGE_UPDATES'); + return false; } } @@ -203,17 +209,20 @@ public function enableSites() ->set('enabled = 1') ->where('enabled = 0'); $db->setQuery($query); + if ($db->execute()) { if ($rows = $db->getAffectedRows()) { $this->_message .= JText::plural('COM_INSTALLER_ENABLED_UPDATES', $rows); } + return true; } else { $this->_message .= JText::_('COM_INSTALLER_FAILED_TO_ENABLE_UPDATES'); + return false; } } @@ -232,6 +241,7 @@ public function enableSites() public function update($uids) { $result = true; + foreach ($uids as $uid) { $update = new JUpdate; @@ -267,6 +277,7 @@ public function update($uids) private function install($update) { $app = JFactory::getApplication(); + if (isset($update->get('downloadurl')->_data)) { $url = $update->downloadurl->_data; @@ -290,6 +301,7 @@ private function install($update) else { JError::raiseWarning('', JText::_('COM_INSTALLER_INVALID_EXTENSION_UPDATE')); + return false; } @@ -299,6 +311,7 @@ private function install($update) if (!$p_file) { JError::raiseWarning('', JText::sprintf('COM_INSTALLER_PACKAGE_DOWNLOAD_FAILED', $url)); + return false; } @@ -351,15 +364,15 @@ private function install($update) } /** - * Method to get the row form. - * - * @param array $data Data for the form. - * @param boolean $loadData True if the form is to load its own data (default case), false if not. - * - * @return mixed A JForm object on success, false on failure - * - * @since 2.5.2 - */ + * Method to get the row form. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * + * @return mixed A JForm object on success, false on failure + * + * @since 2.5.2 + */ public function getForm($data = array(), $loadData = true) { // Get the form. @@ -371,6 +384,7 @@ public function getForm($data = array(), $loadData = true) if ($form == false) { $this->setError($form->getMessage()); + return false; } // Check the session for previously entered form data. @@ -396,6 +410,7 @@ protected function loadFormData() { // Check the session for previously entered form data. $data = JFactory::getApplication()->getUserState($this->context . '.data', array()); + return $data; } } diff --git a/administrator/components/com_installer/models/warnings.php b/administrator/components/com_installer/models/warnings.php index 41e10e23d8249..47fd310e6d16a 100644 --- a/administrator/components/com_installer/models/warnings.php +++ b/administrator/components/com_installer/models/warnings.php @@ -12,9 +12,7 @@ /** * Extension Manager Templates Model * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 1.6 + * @since 1.6 */ class InstallerModelWarnings extends JModelList { @@ -37,6 +35,7 @@ public function return_bytes($val) { $val = trim($val); $last = strtolower($val{strlen($val) - 1}); + switch ($last) { // The 'G' modifier is available since PHP 5.1.0 @@ -61,12 +60,15 @@ public function return_bytes($val) public function getItems() { static $messages; + if ($messages) { return $messages; } + $messages = array(); $file_uploads = ini_get('file_uploads'); + if (!$file_uploads) { $messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_FILEUPLOADSDISABLED'), @@ -74,6 +76,7 @@ public function getItems() } $upload_dir = ini_get('upload_tmp_dir'); + if (!$upload_dir) { $messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTSET'), @@ -90,6 +93,7 @@ public function getItems() $config = JFactory::getConfig(); $tmp_path = $config->get('tmp_path'); + if (!$tmp_path) { $messages[] = array('message' => JText::_('COM_INSTALLER_MSG_WARNINGS_JOOMLATMPNOTSET'), @@ -105,6 +109,7 @@ public function getItems() } $memory_limit = $this->return_bytes(ini_get('memory_limit')); + if ($memory_limit < (8 * 1024 * 1024) && $memory_limit != -1) { // 8MB diff --git a/administrator/components/com_installer/views/database/view.html.php b/administrator/components/com_installer/views/database/view.html.php index 6a4138824c4e7..9c6f26ce47c60 100644 --- a/administrator/components/com_installer/views/database/view.html.php +++ b/administrator/components/com_installer/views/database/view.html.php @@ -14,14 +14,12 @@ /** * Extension Manager Manage View * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 1.6 + * @since 1.6 */ class InstallerViewDatabase extends InstallerViewDefault { /** - * Display the view + * Display the view. * * @param string $tpl Template * @@ -31,7 +29,7 @@ class InstallerViewDatabase extends InstallerViewDefault */ public function display($tpl = null) { - // Get data from the model + // Get data from the model. $this->state = $this->get('State'); $this->changeSet = $this->get('Items'); $this->errors = $this->changeSet->check(); @@ -48,10 +46,12 @@ public function display($tpl = null) { $this->errorCount++; } + if (!$this->filterParams) { $this->errorCount++; } + if (version_compare($this->updateVersion, JVERSION) != 0) { $this->errorCount++; @@ -70,7 +70,7 @@ public function display($tpl = null) protected function addToolbar() { /* - * Set toolbar items for the page + * Set toolbar items for the page. */ JToolbarHelper::custom('database.fix', 'refresh', 'refresh', 'COM_INSTALLER_TOOLBAR_DATABASE_FIX', false, false); JToolbarHelper::divider(); diff --git a/administrator/components/com_installer/views/default/view.php b/administrator/components/com_installer/views/default/view.php index ac37422e06f7b..4101d3560bad9 100644 --- a/administrator/components/com_installer/views/default/view.php +++ b/administrator/components/com_installer/views/default/view.php @@ -12,14 +12,12 @@ /** * Extension Manager Default View * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 1.5 + * @since 1.5 */ class InstallerViewDefault extends JViewLegacy { /** - * Constructor + * Constructor. * * @param array $config Configuration array * @@ -34,7 +32,7 @@ public function __construct($config = null) } /** - * Display the view + * Display the view. * * @param string $tpl Template * @@ -44,11 +42,12 @@ public function __construct($config = null) */ public function display($tpl = null) { - // Get data from the model - $state = $this->get('State'); + // Get data from the model. + $state = $this->get('State'); + + // Are there messages to display? + $showMessage = false; - // Are there messages to display ? - $showMessage = false; if (is_object($state)) { $message1 = $state->get('message'); @@ -81,11 +80,11 @@ protected function addToolbar() JToolbarHelper::divider(); } - // Document + // Document. $document = JFactory::getDocument(); $document->setTitle(JText::_('COM_INSTALLER_TITLE_' . $this->getName())); - // Render side bar + // Render side bar. $this->sidebar = JHtmlSidebar::render(); } } diff --git a/administrator/components/com_installer/views/discover/view.html.php b/administrator/components/com_installer/views/discover/view.html.php index 4baf0e961d64c..c49aae837b825 100644 --- a/administrator/components/com_installer/views/discover/view.html.php +++ b/administrator/components/com_installer/views/discover/view.html.php @@ -14,14 +14,12 @@ /** * Extension Manager Discover View * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 1.6 + * @since 1.6 */ class InstallerViewDiscover extends InstallerViewDefault { /** - * Display the view + * Display the view. * * @param string $tpl Template * @@ -31,7 +29,7 @@ class InstallerViewDiscover extends InstallerViewDefault */ public function display($tpl = null) { - // Get data from the model + // Get data from the model. $this->state = $this->get('State'); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); @@ -49,7 +47,7 @@ public function display($tpl = null) protected function addToolbar() { /* - * Set toolbar items for the page + * Set toolbar items for the page. */ JToolbarHelper::custom('discover.install', 'upload', 'upload', 'JTOOLBAR_INSTALL', true, false); JToolbarHelper::custom('discover.refresh', 'refresh', 'refresh', 'COM_INSTALLER_TOOLBAR_DISCOVER', false, false); @@ -61,19 +59,40 @@ protected function addToolbar() JHtmlSidebar::addFilter( JText::_('COM_INSTALLER_VALUE_CLIENT_SELECT'), 'filter_client_id', - JHtml::_('select.options', array('0' => 'JSITE', '1' => 'JADMINISTRATOR'), 'value', 'text', $this->state->get('filter.client_id'), true) + JHtml::_( + 'select.options', + array('0' => 'JSITE', '1' => 'JADMINISTRATOR'), + 'value', + 'text', + $this->state->get('filter.client_id'), + true + ) ); JHtmlSidebar::addFilter( JText::_('COM_INSTALLER_VALUE_TYPE_SELECT'), 'filter_type', - JHtml::_('select.options', InstallerHelper::getExtensionTypes(), 'value', 'text', $this->state->get('filter.type'), true) + JHtml::_( + 'select.options', + InstallerHelper::getExtensionTypes(), + 'value', + 'text', + $this->state->get('filter.type'), + true + ) ); JHtmlSidebar::addFilter( JText::_('COM_INSTALLER_VALUE_FOLDER_SELECT'), 'filter_group', - JHtml::_('select.options', array_merge(InstallerHelper::getExtensionGroupes(), array('*' => JText::_('COM_INSTALLER_VALUE_FOLDER_NONAPPLICABLE'))), 'value', 'text', $this->state->get('filter.group'), true) + JHtml::_( + 'select.options', + array_merge(InstallerHelper::getExtensionGroupes(), array('*' => JText::_('COM_INSTALLER_VALUE_FOLDER_NONAPPLICABLE'))), + 'value', + 'text', + $this->state->get('filter.group'), + true + ) ); parent::addToolbar(); diff --git a/administrator/components/com_installer/views/install/view.html.php b/administrator/components/com_installer/views/install/view.html.php index 654ef5a2e66fb..98f21217af902 100644 --- a/administrator/components/com_installer/views/install/view.html.php +++ b/administrator/components/com_installer/views/install/view.html.php @@ -14,9 +14,7 @@ /** * Extension Manager Install View * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 1.5 + * @since 1.5 */ class InstallerViewInstall extends InstallerViewDefault { diff --git a/administrator/components/com_installer/views/languages/view.html.php b/administrator/components/com_installer/views/languages/view.html.php index 7749c66c4e052..e12667b40335e 100644 --- a/administrator/components/com_installer/views/languages/view.html.php +++ b/administrator/components/com_installer/views/languages/view.html.php @@ -13,9 +13,7 @@ /** * Language installer view * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 2.5.7 + * @since 2.5.7 */ class InstallerViewLanguages extends InstallerViewDefault { @@ -35,7 +33,7 @@ class InstallerViewLanguages extends InstallerViewDefault protected $state; /** - * Display the view + * Display the view. * * @param null $tpl template to display * @@ -43,7 +41,7 @@ class InstallerViewLanguages extends InstallerViewDefault */ public function display($tpl = null) { - // Get data from the model + // Get data from the model. $this->state = $this->get('State'); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); @@ -52,6 +50,7 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); + return false; } @@ -75,7 +74,7 @@ protected function addToolbar() JToolBarHelper::divider(); parent::addToolbar(); - // TODO: this help screen will need to be created + // TODO: this help screen will need to be created. JToolBarHelper::help('JHELP_EXTENSIONS_EXTENSION_MANAGER_LANGUAGES'); } } diff --git a/administrator/components/com_installer/views/manage/view.html.php b/administrator/components/com_installer/views/manage/view.html.php index 2a668d049ef12..c1d8a97747c4b 100644 --- a/administrator/components/com_installer/views/manage/view.html.php +++ b/administrator/components/com_installer/views/manage/view.html.php @@ -14,9 +14,7 @@ /** * Extension Manager Manage View * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 1.6 + * @since 1.6 */ class InstallerViewManage extends InstallerViewDefault { @@ -29,7 +27,7 @@ class InstallerViewManage extends InstallerViewDefault protected $state; /** - * Display the view + * Display the view. * * @param string $tpl Template * @@ -39,7 +37,7 @@ class InstallerViewManage extends InstallerViewDefault */ public function display($tpl = null) { - // Get data from the model + // Get data from the model. $this->state = $this->get('State'); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); @@ -48,10 +46,11 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); + return false; } - // Check if there are no matching items + // Check if there are no matching items. if (!count($this->items)) { JFactory::getApplication()->enqueueMessage( @@ -63,7 +62,7 @@ public function display($tpl = null) // Include the component HTML helpers. JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); - // Display the view + // Display the view. parent::display($tpl); } @@ -77,14 +76,17 @@ public function display($tpl = null) protected function addToolbar() { $canDo = JHelperContent::getActions('com_installer'); + if ($canDo->get('core.edit.state')) { JToolbarHelper::publish('manage.publish', 'JTOOLBAR_ENABLE', true); JToolbarHelper::unpublish('manage.unpublish', 'JTOOLBAR_DISABLE', true); JToolbarHelper::divider(); } + JToolbarHelper::custom('manage.refresh', 'refresh', 'refresh', 'JTOOLBAR_REFRESH_CACHE', true); JToolbarHelper::divider(); + if ($canDo->get('core.delete')) { JToolbarHelper::deleteList('', 'manage.remove', 'JTOOLBAR_UNINSTALL'); @@ -98,25 +100,53 @@ protected function addToolbar() JHtmlSidebar::addFilter( JText::_('COM_INSTALLER_VALUE_CLIENT_SELECT'), 'filter_client_id', - JHtml::_('select.options', array('0' => 'JSITE', '1' => 'JADMINISTRATOR'), 'value', 'text', $this->state->get('filter.client_id'), true) + JHtml::_( + 'select.options', + array('0' => 'JSITE', '1' => 'JADMINISTRATOR'), + 'value', + 'text', + $this->state->get('filter.client_id'), + true + ) ); JHtmlSidebar::addFilter( JText::_('COM_INSTALLER_VALUE_STATE_SELECT'), 'filter_status', - JHtml::_('select.options', array('0' => 'JDISABLED', '1' => 'JENABLED', '2' => 'JPROTECTED', '3' => 'JUNPROTECTED'), 'value', 'text', $this->state->get('filter.status'), true) + JHtml::_( + 'select.options', + array('0' => 'JDISABLED', '1' => 'JENABLED', '2' => 'JPROTECTED', '3' => 'JUNPROTECTED'), + 'value', + 'text', + $this->state->get('filter.status'), + true + ) ); JHtmlSidebar::addFilter( JText::_('COM_INSTALLER_VALUE_TYPE_SELECT'), 'filter_type', - JHtml::_('select.options', InstallerHelper::getExtensionTypes(), 'value', 'text', $this->state->get('filter.type'), true) + JHtml::_( + 'select.options', + InstallerHelper::getExtensionTypes(), + 'value', + 'text', + $this->state->get('filter.type'), + true + ) ); JHtmlSidebar::addFilter( JText::_('COM_INSTALLER_VALUE_FOLDER_SELECT'), 'filter_group', - JHtml::_('select.options', array_merge(InstallerHelper::getExtensionGroupes(), array('*' => JText::_('COM_INSTALLER_VALUE_FOLDER_NONAPPLICABLE'))), 'value', 'text', $this->state->get('filter.group'), true) + JHtml::_( + 'select.options', + array_merge(InstallerHelper::getExtensionGroupes(), array('*' => JText::_('COM_INSTALLER_VALUE_FOLDER_NONAPPLICABLE'))), + 'value', + 'text', + $this->state->get('filter.group'), + true + ) ); parent::addToolbar(); diff --git a/administrator/components/com_installer/views/update/view.html.php b/administrator/components/com_installer/views/update/view.html.php index 120618af6a1e6..003428903eda2 100644 --- a/administrator/components/com_installer/views/update/view.html.php +++ b/administrator/components/com_installer/views/update/view.html.php @@ -14,35 +14,33 @@ /** * Extension Manager Update View * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 1.6 + * @since 1.6 */ class InstallerViewUpdate extends InstallerViewDefault { /** - * List of update items + * List of update items. * * @var array */ protected $items; /** - * Model state object + * Model state object. * * @var object */ protected $state; /** - * List pagination + * List pagination. * * @var JPagination */ protected $pagination; /** - * Display the view + * Display the view. * * @param string $tpl Template * @@ -54,7 +52,7 @@ public function display($tpl = null) { $app = JFactory::getApplication(); - // Get data from the model + // Get data from the model. $this->state = $this->get('State'); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); @@ -62,10 +60,12 @@ public function display($tpl = null) $paths->first = ''; $this->paths = &$paths; + if (count($this->items) > 0) { $app->enqueueMessage(JText::_('COM_INSTALLER_MSG_WARNINGS_UPDATE_NOTICE'), 'notice'); } + parent::display($tpl); } diff --git a/administrator/components/com_installer/views/warnings/view.html.php b/administrator/components/com_installer/views/warnings/view.html.php index 8f70c853420ff..9291e489ce1d7 100644 --- a/administrator/components/com_installer/views/warnings/view.html.php +++ b/administrator/components/com_installer/views/warnings/view.html.php @@ -14,9 +14,7 @@ /** * Extension Manager Templates View * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 1.6 + * @since 1.6 */ class InstallerViewWarnings extends InstallerViewDefault { diff --git a/administrator/components/com_joomlaupdate/controller.php b/administrator/components/com_joomlaupdate/controller.php index ed33f7f921250..f746171056fa1 100644 --- a/administrator/components/com_joomlaupdate/controller.php +++ b/administrator/components/com_joomlaupdate/controller.php @@ -12,19 +12,18 @@ /** * Joomla! Update Controller * - * @package Joomla.Administrator - * @subpackage com_joomlaupdate - * @since 2.5.4 + * @since 2.5.4 */ class JoomlaupdateController extends JControllerLegacy { /** * Method to display a view. * - * @param boolean If true, the view output will be cached - * @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. + * @param boolean $cachable If true, the view output will be cached. + * @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * * @return JController This object to support chaining. + * * @since 2.5.4 */ public function display($cachable = false, $urlparams = false) @@ -46,7 +45,7 @@ public function display($cachable = false, $urlparams = false) // Get the model for the view. $model = $this->getModel($vName); - // Perform update source preference check and refresh update information + // Perform update source preference check and refresh update information. $model->applyUpdateSite(); $model->refreshUpdates(); diff --git a/administrator/components/com_joomlaupdate/controllers/update.php b/administrator/components/com_joomlaupdate/controllers/update.php index 17b3328f85fa0..064fa21eb3463 100644 --- a/administrator/components/com_joomlaupdate/controllers/update.php +++ b/administrator/components/com_joomlaupdate/controllers/update.php @@ -12,9 +12,7 @@ /** * The Joomla! update controller for the Update view * - * @package Joomla.Administrator - * @subpackage com_joomlaupdate - * @since 2.5.4 + * @since 2.5.4 */ class JoomlaupdateControllerUpdate extends JControllerLegacy { diff --git a/administrator/components/com_joomlaupdate/helpers/download.php b/administrator/components/com_joomlaupdate/helpers/download.php index 1dfe55657aa0e..e1ac889c17202 100644 --- a/administrator/components/com_joomlaupdate/helpers/download.php +++ b/administrator/components/com_joomlaupdate/helpers/download.php @@ -13,16 +13,15 @@ * Smart download helper. Automatically uses cURL or URL fopen() wrappers to * fetch the package. * - * @package Joomla.Administrator - * @since 2.5.4 + * @since 2.5.4 */ class AdmintoolsHelperDownload { /** - * Downloads from a URL and saves the result as a local file + * Downloads from a URL and saves the result as a local file. * - * @param string $url The URL to download from - * @param string $target The file path to download to + * @param string $url The URL to download from. + * @param string $target The file path to download to. * * @return bool True on success * @@ -32,7 +31,7 @@ public static function download($url, $target) { jimport('joomla.filesystem.file'); - // Make sure the target does not exist + // Make sure the target does not exist. if (JFile::exists($target)) { if (!@unlink($target)) @@ -41,7 +40,7 @@ public static function download($url, $target) } } - // Try to open the output file for writing + // Try to open the output file for writing. $fp = @fopen($target, 'wb'); if ($fp === false) @@ -65,22 +64,23 @@ public static function download($url, $target) // First try to download directly to file if $fp !== false $adapters = self::getAdapters(); $result = false; + while (!empty($adapters) && ($result === false)) { - // Run the current download method + // Run the current download method. $method = 'get' . strtoupper(array_shift($adapters)); $result = self::$method($url, $fp); - // Check if we have a download + // Check if we have a download. if ($result === true) { - - // The download is complete, close the file pointer + // The download is complete, close the file pointer. @fclose($fp); // If the filesize is not at least 1 byte, we consider it failed. clearstatcache(); $filesize = @filesize($target); + if ($filesize <= 0) { $result = false; @@ -89,7 +89,7 @@ public static function download($url, $target) } } - // If we have no download, close the file pointer + // If we have no download, close the file pointer. if ($result === false) { @fclose($fp); @@ -98,8 +98,7 @@ public static function download($url, $target) if ($result === false) { - - // Delete the target file if it exists + // Delete the target file if it exists. if (file_exists($target)) { if ( !@unlink($target) ) @@ -108,7 +107,7 @@ public static function download($url, $target) } } - // Download and write using JFile::write(); + // Download and write using JFile::write(). $result = JFile::write($target, self::downloadAndReturn($url)); } @@ -116,11 +115,11 @@ public static function download($url, $target) } /** - * Downloads from a URL and returns the result as a string + * Downloads from a URL and returns the result as a string. * - * @param string $url The URL to download from + * @param string $url The URL to download from. * - * @return mixed Result string on success, false on failure + * @return mixed Result string on success, false on failure. * * @since 2.5.4 */ @@ -131,7 +130,6 @@ public static function downloadAndReturn($url) while (!empty($adapters) && ($result === false)) { - // Run the current download method $method = 'get' . strtoupper(array_shift($adapters)); $result = self::$method($url, null); @@ -161,13 +159,13 @@ private static function hasCURL() /** * Downloads the contents of a URL and writes them to disk (if $fp is not null) - * or returns them as a string (if $fp is null) + * or returns them as a string (if $fp is null). * - * @param string $url The URL to download from + * @param string $url The URL to download from. * @param resource $fp The file pointer to download to. Omit to return the contents. * @param boolean $nofollow Should we follow 301/302/307 redirection HTTP headers? * - * @return bool|string False on failure, true on success ($fp not null) or the URL contents (if $fp is null) + * @return bool|string False on failure, true on success ($fp not null) or the URL contents (if $fp is null). * * @since 2.5.4 */ @@ -177,7 +175,6 @@ private static function &getCURL($url, $fp = null, $nofollow = false) if ( !@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1) && !$nofollow ) { - // Safe Mode is enabled. We have to fetch the headers and // parse any redirections present in there. curl_setopt($ch, CURLOPT_AUTOREFERER, true); @@ -188,15 +185,16 @@ private static function &getCURL($url, $fp = null, $nofollow = false) curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($ch, CURLOPT_TIMEOUT, 30); - // Get the headers + // Get the headers. $data = curl_exec($ch); curl_close($ch); // Init $newURL = $url; - // Parse the headers + // Parse the headers. $lines = explode("\n", $data); + foreach ($lines as $line) { if (substr($line, 0, 9) == "Location:") @@ -217,6 +215,7 @@ private static function &getCURL($url, $fp = null, $nofollow = false) else { @curl_setopt($ch, CURLOPT_MAXREDIRS, 20); + if (function_exists('set_time_limit')) { set_time_limit(0); @@ -255,7 +254,6 @@ private static function hasFOPEN() if (is_null($result)) { - // If we are not allowed to use ini_get, we assume that URL fopen is // disabled. if (!function_exists('ini_get')) @@ -272,12 +270,12 @@ private static function hasFOPEN() } /** - * Download from a URL using URL fopen() wrappers + * Download from a URL using URL fopen() wrappers. * - * @param string $url The URL to download from - * @param resource $fp The file pointer to download to; leave null to return the d/l file as a string + * @param string $url The URL to download from. + * @param resource $fp The file pointer to download to; leave null to return the d/l file as a string. * - * @return bool|string False on failure, true on success ($fp not null) or the URL contents (if $fp is null) + * @return bool|string False on failure, true on success ($fp not null) or the URL contents (if $fp is null). * * @since 2.5.4 */ @@ -295,12 +293,12 @@ private static function &getFOPEN($url, $fp = null) } else { - // PHP 4 way (actually, it's just a fallback) if ( function_exists('ini_set') ) { ini_set('user_agent', 'Joomla/' . JVERSION); } + $ih = @fopen($url, 'r'); } @@ -314,18 +312,22 @@ private static function &getFOPEN($url, $fp = null) $bytes = 0; $result = true; $return = ''; + while (!feof($ih) && $result) { $contents = fread($ih, 4096); + if ($contents === false) { @fclose($ih); $result = false; + return $result; } else { $bytes += strlen($contents); + if (is_resource($fp)) { $result = @fwrite($fp, $contents); @@ -356,7 +358,7 @@ private static function &getFOPEN($url, $fp = null) /** * Detect and return available download "adapters" (not really adapters, as - * we don't follow the Adapter pattern, yet) + * we don't follow the Adapter pattern, yet).. * * @return array * @@ -364,26 +366,29 @@ private static function &getFOPEN($url, $fp = null) */ private static function getAdapters() { - // Detect available adapters + // Detect available adapters. $adapters = array(); + if (self::hasCURL()) { $adapters[] = 'curl'; } + if (self::hasFOPEN()) { $adapters[] = 'fopen'; } + return $adapters; } /** - * Change the permissions of a file, optionally using FTP + * Change the permissions of a file, optionally using FTP. * - * @param string $path Absolute path to file - * @param int $mode Permissions, e.g. 0755 + * @param string $path Absolute path to file. + * @param int $mode Permissions, e.g. 0755. * - * @return boolean True on success + * @return boolean True on success. * * @since 2.5.4 */ @@ -392,6 +397,7 @@ private static function chmod($path, $mode) if (is_string($mode)) { $mode = octdec($mode); + if ( ($mode < 0600) || ($mode > 0777) ) { $mode = 0755; @@ -405,7 +411,6 @@ private static function chmod($path, $mode) if ($ftpOptions['enabled'] == 1) { - // Connect the FTP client $ftp = JClientFtp::getInstance( $ftpOptions['host'], $ftpOptions['port'], array(), @@ -424,11 +429,12 @@ private static function chmod($path, $mode) // FTP connector throws an error $ret = $ftp->chmod($path, $mode); - } else + } + else { return false; } + return $ret; } - } diff --git a/administrator/components/com_joomlaupdate/helpers/joomlaupdate.php b/administrator/components/com_joomlaupdate/helpers/joomlaupdate.php index 954b92726730b..efa34e3f37ed5 100644 --- a/administrator/components/com_joomlaupdate/helpers/joomlaupdate.php +++ b/administrator/components/com_joomlaupdate/helpers/joomlaupdate.php @@ -12,9 +12,7 @@ /** * Joomla! update helper. * - * @package Joomla.Administrator - * @subpackage com_joomlaupdate - * @since 2.5.4 + * @since 2.5.4 */ class JoomlaupdateHelper { diff --git a/administrator/components/com_joomlaupdate/helpers/select.php b/administrator/components/com_joomlaupdate/helpers/select.php index 3c33eb03feda8..379ec0aaa65ff 100644 --- a/administrator/components/com_joomlaupdate/helpers/select.php +++ b/administrator/components/com_joomlaupdate/helpers/select.php @@ -12,9 +12,7 @@ /** * Joomla! update selection list helper. * - * @package Joomla.Administrator - * @subpackage com_joomlaupdate - * @since 2.5.4 + * @since 2.5.4 */ class JoomlaupdateHelperSelect { diff --git a/administrator/components/com_joomlaupdate/models/default.php b/administrator/components/com_joomlaupdate/models/default.php index 466e247ece8e0..7994faaec6074 100644 --- a/administrator/components/com_joomlaupdate/models/default.php +++ b/administrator/components/com_joomlaupdate/models/default.php @@ -17,7 +17,6 @@ * * @package Joomla.Administrator * @subpackage com_joomlaupdate - * @author nikosdion * @since 2.5.4 */ class JoomlaupdateModelDefault extends JModelLegacy @@ -32,16 +31,17 @@ class JoomlaupdateModelDefault extends JModelLegacy */ public function applyUpdateSite() { - // Determine the intended update URL + // Determine the intended update URL. $params = JComponentHelper::getParams('com_joomlaupdate'); + switch ($params->get('updatesource', 'nochange')) { - // "Long Term Support (LTS) branch - Recommended" + // "Long Term Support (LTS) branch - Recommended". case 'lts': $updateURL = 'http://update.joomla.org/core/list.xml'; break; - // "Short term support (STS) branch" + // "Short term support (STS) branch". case 'sts': $updateURL = 'http://update.joomla.org/core/sts/list_sts.xml'; break; @@ -51,7 +51,7 @@ public function applyUpdateSite() $updateURL = 'http://update.joomla.org/core/test/list_test.xml'; break; - // "Custom" if custom URL empty no changes + // "Custom" if custom URL empty no changes. case 'custom': if ($params->get('customurl', '') != '') { @@ -63,7 +63,7 @@ public function applyUpdateSite() } break; - // "Do not change" + // "Do not change". case 'nochange': default: return; @@ -84,12 +84,12 @@ public function applyUpdateSite() if ($update_site->location != $updateURL) { - // Modify the database record + // Modify the database record. $update_site->last_check_timestamp = 0; $update_site->location = $updateURL; $db->updateObject('#__update_sites', $update_site, 'update_site_id'); - // Remove cached updates + // Remove cached updates. $query->clear() ->delete($db->quoteName('#__updates')) ->where($db->quoteName('extension_id') . ' = ' . $db->quote('700')); @@ -99,9 +99,9 @@ public function applyUpdateSite() } /** - * Makes sure that the Joomla! update cache is up-to-date + * Makes sure that the Joomla! update cache is up-to-date. * - * @param boolean $force Force reload, ignoring the cache timeout + * @param boolean $force Force reload, ignoring the cache timeout. * * @return void * @@ -119,12 +119,13 @@ public function refreshUpdates($force = false) $cache_timeout = $update_params->get('cachetimeout', 6, 'int'); $cache_timeout = 3600 * $cache_timeout; } + $updater = JUpdater::getInstance(); $updater->findUpdates(700, $cache_timeout); } /** - * Returns an array with the Joomla! update information + * Returns an array with the Joomla! update information. * * @return array * @@ -132,14 +133,14 @@ public function refreshUpdates($force = false) */ public function getUpdateInformation() { - // Initialise the return array + // Initialise the return array. $ret = array( 'installed' => JVERSION, 'latest' => null, 'object' => null ); - // Fetch the update information from the database + // Fetch the update information from the database. $db = $this->getDbo(); $query = $db->getQuery(true) ->select('*') @@ -151,6 +152,7 @@ public function getUpdateInformation() if (is_null($updateObject)) { $ret['latest'] = JVERSION; + return $ret; } else @@ -158,12 +160,12 @@ public function getUpdateInformation() $ret['latest'] = $updateObject->version; } - // Fetch the full update details from the update details URL + // Fetch the full update details from the update details URL. jimport('joomla.updater.update'); $update = new JUpdate; $update->loadFromXML($updateObject->detailsurl); - // Pass the update object + // Pass the update object. if ($ret['latest'] == JVERSION) { $ret['object'] = null; @@ -177,7 +179,7 @@ public function getUpdateInformation() } /** - * Returns an array with the configured FTP options + * Returns an array with the configured FTP options. * * @return array * @@ -186,6 +188,7 @@ public function getUpdateInformation() public function getFTPOptions() { $config = JFactory::getConfig(); + return array( 'host' => $config->get('ftp_host'), 'port' => $config->get('ftp_port'), @@ -199,7 +202,7 @@ public function getFTPOptions() /** * Removes all of the updates from the table and enable all update streams. * - * @return boolean Result of operation + * @return boolean Result of operation. * * @since 3.0 */ @@ -222,19 +225,21 @@ public function purge() if ($db->execute()) { $this->_message = JText::_('JLIB_INSTALLER_PURGED_UPDATES'); + return true; } else { $this->_message = JText::_('JLIB_INSTALLER_FAILED_TO_PURGE_UPDATES'); + return false; } } /** - * Downloads the update package to the site + * Downloads the update package to the site. * - * @return bool|string False on failure, basename of the file in any other case + * @return bool|string False on failure, basename of the file in any other case. * * @since 2.5.4 */ @@ -244,7 +249,7 @@ public function download() $packageURL = $updateInfo['object']->downloadurl->_data; $basename = basename($packageURL); - // Find the path to the temp directory and the local package + // Find the path to the temp directory and the local package. $config = JFactory::getConfig(); $tempdir = $config->get('tmp_path'); $target = $tempdir . '/' . $basename; @@ -254,19 +259,20 @@ public function download() if (!$exists) { - // Not there, let's fetch it + // Not there, let's fetch it. return $this->downloadPackage($packageURL, $target); } else { // Is it a 0-byte file? If so, re-download please. $filesize = @filesize($target); + if (empty($filesize)) { return $this->downloadPackage($packageURL, $target); } - // Yes, it's there, skip downloading + // Yes, it's there, skip downloading. return $basename; } } @@ -298,6 +304,12 @@ protected function downloadPackage($url, $target) } /** + * Create restoration file. + * + * @param string $basename Optional base path to the file. + * + * @return boolean True if successful; false otherwise. + * * @since 2.5.4 */ public function createRestorationFile($basename = null) @@ -310,10 +322,10 @@ public function createRestorationFile($basename = null) // Do we have to use FTP? $method = $app->input->get('method', 'direct'); - // Get the absolute path to site's root + // Get the absolute path to site's root. $siteroot = JPATH_SITE; - // If the package name is not specified, get it from the update info + // If the package name is not specified, get it from the update info. if (empty($basename)) { $updateInfo = $this->getUpdateInformation(); @@ -321,7 +333,7 @@ public function createRestorationFile($basename = null) $basename = basename($packageURL); } - // Get the package name + // Get the package name. $config = JFactory::getConfig(); $tempdir = $config->get('tmp_path'); $file = $tempdir . '/' . $basename; @@ -347,9 +359,11 @@ public function createRestorationFile($basename = null) if ($method == 'ftp') { - // Fetch the FTP parameters from the request. Note: The password should be - // allowed as raw mode, otherwise something like !@43H% would be - // sanitised to !@43H% which is just plain wrong. + /* + * Fetch the FTP parameters from the request. Note: The password should be + * allowed as raw mode, otherwise something like !@43H% would be + * sanitised to !@43H% which is just plain wrong. + */ $ftp_host = $app->input->get('ftp_host', ''); $ftp_port = $app->input->get('ftp_port', '21'); $ftp_user = $app->input->get('ftp_user', ''); @@ -358,10 +372,12 @@ public function createRestorationFile($basename = null) // Is the tempdir really writable? $writable = @is_writeable($tempdir); + if ($writable) { - // Let's be REALLY sure + // Let's be REALLY sure. $fp = @fopen($tempdir . '/test.txt', 'w'); + if ($fp === false) { $writable = false; @@ -373,16 +389,18 @@ public function createRestorationFile($basename = null) } } - // If the tempdir is not writable, create a new writable subdirectory + // If the tempdir is not writable, create a new writable subdirectory. if (!$writable) { $FTPOptions = JClientHelper::getCredentials('ftp'); $ftp = JClientFtp::getInstance($FTPOptions['host'], $FTPOptions['port'], null, $FTPOptions['user'], $FTPOptions['pass']); $dest = JPath::clean(str_replace(JPATH_ROOT, $FTPOptions['root'], $tempdir . '/admintools'), '/'); + if (!@mkdir($tempdir . '/admintools')) { $ftp->mkdir($dest); } + if (!@chmod($tempdir . '/admintools', 511)) { $ftp->chmod($dest, 511); @@ -391,8 +409,9 @@ public function createRestorationFile($basename = null) $tempdir .= '/admintools'; } - // Just in case the temp-directory was off-root, try using the default tmp directory + // Just in case the temp-directory was off-root, try using the default tmp directory. $writable = @is_writeable($tempdir); + if (!$writable) { $tempdir = JPATH_ROOT . '/tmp'; @@ -400,21 +419,22 @@ public function createRestorationFile($basename = null) // Does the JPATH_ROOT/tmp directory exist? if (!is_dir($tempdir)) { - JFolder::create($tempdir, 511); JFile::write($tempdir . '/.htaccess', "order deny,allow\ndeny from all\nallow from none\n"); } - // If it exists and it is unwritable, try creating a writable admintools subdirectory + // If it exists and it is unwritable, try creating a writable admintools subdirectory. if (!is_writable($tempdir)) { $FTPOptions = JClientHelper::getCredentials('ftp'); $ftp = JClientFtp::getInstance($FTPOptions['host'], $FTPOptions['port'], null, $FTPOptions['user'], $FTPOptions['pass']); $dest = JPath::clean(str_replace(JPATH_ROOT, $FTPOptions['root'], $tempdir . '/admintools'), '/'); + if (!@mkdir($tempdir . '/admintools')) { $ftp->mkdir($dest); } + if (!@chmod($tempdir . '/admintools', 511)) { $ftp->chmod($dest, 511); @@ -424,7 +444,7 @@ public function createRestorationFile($basename = null) } } - // If we still have no writable directory, we'll try /tmp and the system's temp-directory + // If we still have no writable directory, we'll try /tmp and the system's temp-directory. $writable = @is_writeable($tempdir); if (!$writable) @@ -435,7 +455,7 @@ public function createRestorationFile($basename = null) } else { - // Try to find the system temp path + // Try to find the system temp path. $tmpfile = @tempnam("dummy", ""); $systemp = @dirname($tmpfile); @unlink($tmpfile); @@ -467,6 +487,7 @@ public function createRestorationFile($basename = null) // Remove the old file, if it's there... $configpath = JPATH_COMPONENT_ADMINISTRATOR . '/restoration.php'; + if (JFile::exists($configpath)) { JFile::delete($configpath); @@ -474,12 +495,14 @@ public function createRestorationFile($basename = null) // Write new file. First try with JFile. $result = JFile::write($configpath, $data); - // In case JFile used FTP but direct access could help + + // In case JFile used FTP but direct access could help. if (!$result) { if (function_exists('file_put_contents')) { $result = @file_put_contents($configpath, $data); + if ($result !== false) { $result = true; @@ -492,14 +515,17 @@ public function createRestorationFile($basename = null) if ($fp !== false) { $result = @fwrite($fp, $data); + if ($result !== false) { $result = true; } + @fclose($fp); } } } + return $result; } @@ -508,7 +534,7 @@ public function createRestorationFile($basename = null) * manifest cache and #__extensions entry. Essentially, it is identical to * JInstallerFile::install() without the file copy. * - * @return boolean True on success + * @return boolean True on success. * * @since 2.5.4 */ @@ -535,7 +561,7 @@ public function finaliseUpgrade() $manifestPath = JPath::clean($installer->getPath('manifest')); $element = preg_replace('/\.xml/', '', basename($manifestPath)); - // Run the script file + // Run the script file. $manifestScript = (string) $manifest->scriptfile; if ($manifestScript) @@ -544,7 +570,7 @@ public function finaliseUpgrade() if (is_file($manifestScriptFile)) { - // load the file + // Load the file. include_once $manifestScriptFile; } @@ -558,6 +584,7 @@ public function finaliseUpgrade() ob_start(); ob_implicit_flush(false); + if ($manifestClass && method_exists($manifestClass, 'preflight')) { if ($manifestClass->preflight('update', $this) === false) @@ -568,61 +595,72 @@ public function finaliseUpgrade() } } - $msg = ob_get_contents(); // create msg object; first use here + // Create msg object; first use here. + $msg = ob_get_contents(); ob_end_clean(); - // Get a database connector object + // Get a database connector object. $db = JFactory::getDbo(); - // Check to see if a file extension by the same name is already installed - // If it is, then update the table because if the files aren't there - // we can assume that it was (badly) uninstalled - // If it isn't, add an entry to extensions + /* + * Check to see if a file extension by the same name is already installed. + * If it is, then update the table because if the files aren't there + * we can assume that it was (badly) uninstalled. + * If it isn't, add an entry to extensions. + */ $query = $db->getQuery(true) ->select($db->quoteName('extension_id')) ->from($db->quoteName('#__extensions')) ->where($db->quoteName('type') . ' = ' . $db->quote('file')) ->where($db->quoteName('element') . ' = ' . $db->quote('joomla')); $db->setQuery($query); + try { $db->execute(); } catch (RuntimeException $e) { - // Install failed, roll back changes + // Install failed, roll back changes. $installer->abort( JText::sprintf('JLIB_INSTALLER_ABORT_FILE_ROLLBACK', JText::_('JLIB_INSTALLER_UPDATE'), $db->stderr(true)) ); + return false; } + $id = $db->loadResult(); $row = JTable::getInstance('extension'); if ($id) { - // Load the entry and update the manifest_cache + // Load the entry and update the manifest_cache. $row->load($id); - // Update name + + // Update name. $row->set('name', 'files_joomla'); - // Update manifest + + // Update manifest. $row->manifest_cache = $installer->generateManifestCache(); + if (!$row->store()) { - // Install failed, roll back changes + // Install failed, roll back changes. $installer->abort( JText::sprintf('JLIB_INSTALLER_ABORT_FILE_ROLLBACK', JText::_('JLIB_INSTALLER_UPDATE'), $db->stderr(true)) ); + return false; } } else { - // Add an entry to the extension table with a whole heap of defaults + // Add an entry to the extension table with a whole heap of defaults. $row->set('name', 'files_joomla'); $row->set('type', 'file'); $row->set('element', 'joomla'); - // There is no folder for files so leave it blank + + // There is no folder for files so leave it blank. $row->set('folder', ''); $row->set('enabled', 1); $row->set('protected', 0); @@ -634,12 +672,13 @@ public function finaliseUpgrade() if (!$row->store()) { - // Install failed, roll back changes + // Install failed, roll back changes. $installer->abort(JText::sprintf('JLIB_INSTALLER_ABORT_FILE_INSTALL_ROLLBACK', $db->stderr(true))); + return false; } - // Set the insert id + // Set the insert id. $row->set('extension_id', $db->insertid()); // Since we have created a module item, we add it to the installation step stack @@ -648,20 +687,22 @@ public function finaliseUpgrade() } /* - * Let's run the queries for the file + * Let's run the queries for the file. */ if ($manifest->update) { $result = $installer->parseSchemaUpdates($manifest->update->schemas, $row->extension_id); + if ($result === false) { - // Install failed, rollback changes + // Install failed, rollback changes. $installer->abort(JText::sprintf('JLIB_INSTALLER_ABORT_FILE_UPDATE_SQL_ERROR', $db->stderr(true))); + return false; } } - // Start Joomla! 1.6 + // Start Joomla! 1.6. ob_start(); ob_implicit_flush(false); @@ -669,28 +710,31 @@ public function finaliseUpgrade() { if ($manifestClass->update($installer) === false) { - // Install failed, rollback changes + // Install failed, rollback changes. $installer->abort(JText::_('JLIB_INSTALLER_ABORT_FILE_INSTALL_CUSTOM_INSTALL_FAILURE')); return false; } } - $msg .= ob_get_contents(); // append messages + // Append messages. + $msg .= ob_get_contents(); ob_end_clean(); // Lastly, we will copy the manifest file to its appropriate place. $manifest = array(); $manifest['src'] = $installer->getPath('manifest'); $manifest['dest'] = JPATH_MANIFESTS . '/files/' . basename($installer->getPath('manifest')); + if (!$installer->copyFiles(array($manifest), true)) { - // Install failed, rollback changes + // Install failed, rollback changes. $installer->abort(JText::_('JLIB_INSTALLER_ABORT_FILE_INSTALL_COPY_SETUP')); + return false; } - // Clobber any possible pending updates + // Clobber any possible pending updates. $update = JTable::getInstance('update'); $uid = $update->find( array('element' => $element, 'type' => 'file', 'client_id' => '0', 'folder' => '') @@ -701,7 +745,7 @@ public function finaliseUpgrade() $update->delete($uid); } - // And now we run the postflight + // And now we run the postflight. ob_start(); ob_implicit_flush(false); @@ -710,7 +754,8 @@ public function finaliseUpgrade() $manifestClass->postflight('update', $this); } - $msg .= ob_get_contents(); // append messages + // Append messages. + $msg .= ob_get_contents(); ob_end_clean(); if ($msg != '') @@ -718,14 +763,14 @@ public function finaliseUpgrade() $installer->set('extension_message', $msg); } - // Refresh versionable assets cache + // Refresh versionable assets cache. JFactory::getApplication()->flushAssets(); return true; } /** - * Removes the extracted package file + * Removes the extracted package file. * * @return void * @@ -733,32 +778,35 @@ public function finaliseUpgrade() */ public function cleanUp() { - // Remove the update package + // Remove the update package. $config = JFactory::getConfig(); $tempdir = $config->get('tmp_path'); $file = JFactory::getApplication()->getUserState('com_joomlaupdate.file', null); $target = $tempdir . '/' . $file; + if (!@unlink($target)) { JFile::delete($target); } - // Remove the restoration.php file + // Remove the restoration.php file. $target = JPATH_COMPONENT_ADMINISTRATOR . '/restoration.php'; + if (!@unlink($target)) { JFile::delete($target); } - // Remove joomla.xml from the site's root + // Remove joomla.xml from the site's root. $target = JPATH_ROOT . '/joomla.xml'; + if (!@unlink($target)) { JFile::delete($target); } - // Unset the update filename from the session + // Unset the update filename from the session. JFactory::getApplication()->setUserState('com_joomlaupdate.file', null); } } diff --git a/administrator/components/com_joomlaupdate/views/default/view.html.php b/administrator/components/com_joomlaupdate/views/default/view.html.php index 520b4288d5db5..b3d620ce56c16 100644 --- a/administrator/components/com_joomlaupdate/views/default/view.html.php +++ b/administrator/components/com_joomlaupdate/views/default/view.html.php @@ -12,8 +12,6 @@ /** * Joomla! Update's Default View * - * @package Joomla.Administrator - * @subpackage com_installer * @since 2.5.4 */ class JoomlaupdateViewDefault extends JViewLegacy @@ -29,23 +27,23 @@ class JoomlaupdateViewDefault extends JViewLegacy */ public function display($tpl = null) { - // Get data from the model + // Get data from the model. $this->state = $this->get('State'); - // Load useful classes + // Load useful classes. $model = $this->getModel(); $this->loadHelper('select'); - // Assign view variables + // Assign view variables. $ftp = $model->getFTPOptions(); $this->assign('updateInfo', $model->getUpdateInformation()); $this->assign('methodSelect', JoomlaupdateHelperSelect::getMethods($ftp['enabled'])); - // Set the toolbar information + // Set the toolbar information. JToolbarHelper::title(JText::_('COM_JOOMLAUPDATE_OVERVIEW'), 'arrow-up-2 install'); JToolbarHelper::custom('update.purge', 'purge', 'purge', 'JTOOLBAR_PURGE_CACHE', false, false); - // Add toolbar buttons + // Add toolbar buttons. if (JFactory::getUser()->authorise('core.admin', 'com_joomlaupdate')) { JToolbarHelper::preferences('com_joomlaupdate'); @@ -54,13 +52,13 @@ public function display($tpl = null) JToolBarHelper::divider(); JToolBarHelper::help('JHELP_COMPONENTS_JOOMLA_UPDATE'); - // Load mooTools + // Load mooTools. JHtml::_('behavior.framework', true); - // Include jQuery + // Include jQuery. JHtml::_('jquery.framework'); - // Load our Javascript + // Load our Javascript. $document = JFactory::getDocument(); $document->addScript('../media/com_joomlaupdate/default.js'); JHtml::_('stylesheet', 'media/mediamanager.css', array(), true); @@ -71,8 +69,7 @@ public function display($tpl = null) JFactory::getApplication()->enqueueMessage(JText::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_UPDATE_NOTICE'), 'notice'); } - // Render the view + // Render the view. parent::display($tpl); } - } diff --git a/administrator/components/com_joomlaupdate/views/update/view.html.php b/administrator/components/com_joomlaupdate/views/update/view.html.php index 549978a4fca70..e5687441cc7f1 100644 --- a/administrator/components/com_joomlaupdate/views/update/view.html.php +++ b/administrator/components/com_joomlaupdate/views/update/view.html.php @@ -12,16 +12,14 @@ /** * Joomla! Update's Update View * - * @package Joomla.Administrator - * @subpackage com_installer - * @since 2.5.4 + * @since 2.5.4 */ class JoomlaupdateViewUpdate extends JViewLegacy { /** - * Renders the view + * Renders the view. * - * @param string $tpl Template name + * @param string $tpl Template name. * * @return void */ @@ -29,24 +27,24 @@ public function display($tpl=null) { $password = JFactory::getApplication()->getUserState('com_joomlaupdate.password', null); $filesize = JFactory::getApplication()->getUserState('com_joomlaupdate.filesize', null); - $ajaxUrl = JUri::base().'components/com_joomlaupdate/restore.php'; + $ajaxUrl = JUri::base() . 'components/com_joomlaupdate/restore.php'; $returnUrl = 'index.php?option=com_joomlaupdate&task=update.finalise'; - // Set the toolbar information + // Set the toolbar information. JToolbarHelper::title(JText::_('COM_JOOMLAUPDATE_OVERVIEW'), 'arrow-up-2 install'); JToolBarHelper::divider(); JToolBarHelper::help('JHELP_COMPONENTS_JOOMLA_UPDATE'); - // Add toolbar buttons + // Add toolbar buttons. if (JFactory::getUser()->authorise('core.admin', 'com_joomlaupdate')) { JToolbarHelper::preferences('com_joomlaupdate'); } - // Load mooTools + // Load mooTools. JHtml::_('behavior.framework', true); - // Include jQuery + // Include jQuery. JHtml::_('jquery.framework'); $updateScript = <<addScript('../media/com_joomlaupdate/json2.js'); $document->addScript('../media/com_joomlaupdate/encryption.js'); @@ -67,8 +65,7 @@ public function display($tpl=null) JHtml::_('stylesheet', 'media/mediamanager.css', array(), true); $document->addScriptDeclaration($updateScript); - // Render the view + // Render the view. parent::display($tpl); } - } diff --git a/administrator/components/com_languages/controller.php b/administrator/components/com_languages/controller.php index 78b05db8bc3f4..0cd47c34726cb 100644 --- a/administrator/components/com_languages/controller.php +++ b/administrator/components/com_languages/controller.php @@ -10,11 +10,9 @@ defined('_JEXEC') or die; /** - * Languages Controller + * Languages Controller. * - * @package Joomla.Administrator - * @subpackage com_languages - * @since 1.5 + * @since 1.5 */ class LanguagesController extends JControllerLegacy { @@ -27,23 +25,24 @@ class LanguagesController extends JControllerLegacy /** * Method to display a view. * - * @param boolean If true, the view output will be cached - * @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. + * @param boolean $cachable If true, the view output will be cached. + * @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * * @return JController This object to support chaining. + * * @since 1.5 */ public function display($cachable = false, $urlparams = false) { - require_once JPATH_COMPONENT.'/helpers/languages.php'; + require_once JPATH_COMPONENT . '/helpers/languages.php'; $view = $this->input->get('view', 'languages'); $layout = $this->input->get('layout', 'default'); $id = $this->input->getInt('id'); // Check for edit form. - if ($view == 'language' && $layout == 'edit' && !$this->checkEditId('com_languages.edit.language', $id)) { - + if ($view == 'language' && $layout == 'edit' && !$this->checkEditId('com_languages.edit.language', $id)) + { // Somehow the person just went to the form - we don't allow that. $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); $this->setMessage($this->getError(), 'error'); diff --git a/administrator/components/com_languages/controllers/installed.php b/administrator/components/com_languages/controllers/installed.php index 7e83c4e6abf55..8c06fd9c3d32d 100644 --- a/administrator/components/com_languages/controllers/installed.php +++ b/administrator/components/com_languages/controllers/installed.php @@ -10,24 +10,25 @@ defined('_JEXEC') or die; /** - * Languages Controller + * Languages Controller. * - * @package Joomla.Administrator - * @subpackage com_languages - * @since 1.5 + * @since 1.5 */ class LanguagesControllerInstalled extends JControllerLegacy { /** - * task to set the default language + * Task to set the default language. + * + * @return void */ public function setDefault() { - // Check for request forgeries + // Check for request forgeries. JSession::checkToken() or jexit(JText::_('JInvalid_Token')); $cid = $this->input->get('cid', ''); $model = $this->getModel('installed'); + if ($model->publish($cid)) { $msg = JText::_('COM_LANGUAGES_MSG_DEFAULT_LANGUAGE_SAVED'); @@ -40,6 +41,6 @@ public function setDefault() } $clientId = $model->getState('filter.client_id'); - $this->setredirect('index.php?option=com_languages&view=installed&client='.$clientId, $msg, $type); + $this->setredirect('index.php?option=com_languages&view=installed&client=' . $clientId, $msg, $type); } } diff --git a/administrator/components/com_languages/controllers/language.php b/administrator/components/com_languages/controllers/language.php index a55b03e8ff578..da89f3b164edd 100644 --- a/administrator/components/com_languages/controllers/language.php +++ b/administrator/components/com_languages/controllers/language.php @@ -12,17 +12,15 @@ /** * Languages list actions controller. * - * @package Joomla.Administrator - * @subpackage com_languages - * @since 1.6 + * @since 1.6 */ class LanguagesControllerLanguage extends JControllerForm { /** * Gets the URL arguments to append to an item redirect. * - * @param int $recordId The primary key id for the item. - * @param string $key The name of the primary key variable. + * @param int $recordId The primary key id for the item. + * @param string $key The name of the primary key variable. * * @return string The arguments to append to the redirect URL. * diff --git a/administrator/components/com_languages/controllers/languages.php b/administrator/components/com_languages/controllers/languages.php index 4a9ee4636eef4..2adbdba7c1d22 100644 --- a/administrator/components/com_languages/controllers/languages.php +++ b/administrator/components/com_languages/controllers/languages.php @@ -10,9 +10,9 @@ defined('_JEXEC') or die; /** - * @package Joomla.Administrator - * @subpackage com_languages - * @since 1.6 + * Languages controller Class. + * + * @since 1.6 */ class LanguagesControllerLanguages extends JControllerAdmin { @@ -30,6 +30,7 @@ class LanguagesControllerLanguages extends JControllerAdmin public function getModel($name = 'Language', $prefix = 'LanguagesModel', $config = array('ignore_request' => true)) { $model = parent::getModel($name, $prefix, $config); + return $model; } @@ -45,14 +46,14 @@ public function saveOrderAjax() $pks = $this->input->post->get('cid', array(), 'array'); $order = $this->input->post->get('order', array(), 'array'); - // Sanitize the input + // Sanitize the input. JArrayHelper::toInteger($pks); JArrayHelper::toInteger($order); - // Get the model + // Get the model. $model = $this->getModel(); - // Save the ordering + // Save the ordering. $return = $model->saveorder($pks, $order); if ($return) @@ -60,7 +61,7 @@ public function saveOrderAjax() echo "1"; } - // Close the application + // Close the application. JFactory::getApplication()->close(); } } diff --git a/administrator/components/com_languages/controllers/override.php b/administrator/components/com_languages/controllers/override.php index c25350adcfed6..87055ad3ce2f7 100644 --- a/administrator/components/com_languages/controllers/override.php +++ b/administrator/components/com_languages/controllers/override.php @@ -12,21 +12,19 @@ /** * Languages Override Controller * - * @package Joomla.Administrator - * @subpackage com_languages - * @since 2.5 + * @since 2.5 */ class LanguagesControllerOverride extends JControllerForm { /** - * Method to edit an existing override + * Method to edit an existing override. * - * @param string $key The name of the primary key of the URL variable (not used here). - * @param string $urlVar The name of the URL variable if different from the primary key (not used here). + * @param string $key The name of the primary key of the URL variable (not used here). + * @param string $urlVar The name of the URL variable if different from the primary key (not used here). * * @return void * - * @since 2.5 + * @since 2.5 */ public function edit($key = null, $urlVar = null) { @@ -34,36 +32,36 @@ public function edit($key = null, $urlVar = null) $cid = $this->input->post->get('cid', array(), 'array'); $context = "$this->option.edit.$this->context"; - // Get the constant name + // Get the constant name. $recordId = (count($cid) ? $cid[0] : $this->input->get('id')); - // Access check + // Access check. if (!$this->allowEdit()) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED')); $this->setMessage($this->getError(), 'error'); - $this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_list.$this->getRedirectToListAppend(), false)); + $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false)); return; } - $app->setUserState($context.'.data', null); - $this->setRedirect('index.php?option='.$this->option.'&view='.$this->view_item.$this->getRedirectToItemAppend($recordId, 'id')); + $app->setUserState($context . '.data', null); + $this->setRedirect('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId, 'id')); } /** - * Method to save an override + * Method to save an override. * - * @param string $key The name of the primary key of the URL variable (not used here). - * @param string $urlVar The name of the URL variable if different from the primary key (not used here). + * @param string $key The name of the primary key of the URL variable (not used here). + * @param string $urlVar The name of the URL variable if different from the primary key (not used here). * * @return void * - * @since 2.5 + * @since 2.5 */ public function save($key = null, $urlVar = null) { - // Check for request forgeries + // Check for request forgeries. JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $app = JFactory::getApplication(); @@ -75,18 +73,19 @@ public function save($key = null, $urlVar = null) $recordId = $this->input->get('id'); $data['id'] = $recordId; - // Access check + // Access check. if (!$this->allowSave($data, 'id')) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED')); $this->setMessage($this->getError(), 'error'); - $this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_list.$this->getRedirectToListAppend(), false)); + $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false)); return; } - // Validate the posted data + // Validate the posted data. $form = $model->getForm($data, false); + if (!$form) { $app->enqueueMessage($model->getError(), 'error'); @@ -94,8 +93,8 @@ public function save($key = null, $urlVar = null) return; } - // Require helper for filter functions called by JForm - require_once JPATH_COMPONENT.'/helpers/languages.php'; + // Require helper for filter functions called by JForm. + require_once JPATH_COMPONENT . '/helpers/languages.php'; // Test whether the data is valid. $validData = $model->validate($form, $data); @@ -103,7 +102,7 @@ public function save($key = null, $urlVar = null) // Check for validation errors. if ($validData === false) { - // Get the validation messages + // Get the validation messages. $errors = $model->getErrors(); // Push up to three validation messages out to the user. @@ -119,78 +118,86 @@ public function save($key = null, $urlVar = null) } } - // Save the data in the session - $app->setUserState($context.'.data', $data); + // Save the data in the session. + $app->setUserState($context . '.data', $data); - // Redirect back to the edit screen - $this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_item.$this->getRedirectToItemAppend($recordId, 'id'), false)); + // Redirect back to the edit screen. + $this->setRedirect( + JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId, 'id'), false) + ); return; } - // Attempt to save the data + // Attempt to save the data. if (!$model->save($validData)) { - // Save the data in the session - $app->setUserState($context.'.data', $validData); + // Save the data in the session. + $app->setUserState($context . '.data', $validData); - // Redirect back to the edit screen + // Redirect back to the edit screen. $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError())); $this->setMessage($this->getError(), 'error'); - $this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_item.$this->getRedirectToItemAppend($recordId, 'id'), false)); + $this->setRedirect( + JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId, 'id'), false) + ); return; } - // Add message of success + // Add message of success. $this->setMessage(JText::_('COM_LANGUAGES_VIEW_OVERRIDE_SAVE_SUCCESS')); - // Redirect the user and adjust session state based on the chosen task + // Redirect the user and adjust session state based on the chosen task. switch ($task) { case 'apply': - // Set the record data in the session - $app->setUserState($context.'.data', null); + // Set the record data in the session. + $app->setUserState($context . '.data', null); // Redirect back to the edit screen - $this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_item.$this->getRedirectToItemAppend($validData['key'], 'id'), false)); + $this->setRedirect( + JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($validData['key'], 'id'), false) + ); break; case 'save2new': - // Clear the record id and data from the session - $app->setUserState($context.'.data', null); + // Clear the record id and data from the session. + $app->setUserState($context . '.data', null); // Redirect back to the edit screen - $this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_item.$this->getRedirectToItemAppend(null, 'id'), false)); + $this->setRedirect( + JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend(null, 'id'), false) + ); break; default: - // Clear the record id and data from the session - $app->setUserState($context.'.data', null); + // Clear the record id and data from the session. + $app->setUserState($context . '.data', null); - // Redirect to the list screen - $this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_list.$this->getRedirectToListAppend(), false)); + // Redirect to the list screen. + $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false)); break; } } /** - * Method to cancel an edit + * Method to cancel an edit. * - * @param string $key The name of the primary key of the URL variable (not used here). + * @param string $key The name of the primary key of the URL variable (not used here). * * @return void * - * @since 2.5 + * @since 2.5 */ - public function cancel($key = null, $test = null) + public function cancel($key = null) { JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $app = JFactory::getApplication(); $context = "$this->option.edit.$this->context"; - $app->setUserState($context.'.data', null); - $this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_list.$this->getRedirectToListAppend(), false)); + $app->setUserState($context . '.data', null); + $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false)); } } diff --git a/administrator/components/com_languages/controllers/overrides.php b/administrator/components/com_languages/controllers/overrides.php index 978f805bd9916..2ba9540e599f9 100644 --- a/administrator/components/com_languages/controllers/overrides.php +++ b/administrator/components/com_languages/controllers/overrides.php @@ -10,16 +10,14 @@ defined('_JEXEC') or die; /** - * Languages Overrides Controller + * Languages Overrides Controller. * - * @package Joomla.Administrator - * @subpackage com_languages - * @since 2.5 + * @since 2.5 */ class LanguagesControllerOverrides extends JControllerAdmin { /** - * The prefix to use with controller messages + * The prefix to use with controller messages. * * @var string * @since 2.5 @@ -27,7 +25,7 @@ class LanguagesControllerOverrides extends JControllerAdmin protected $text_prefix = 'COM_LANGUAGES_VIEW_OVERRIDES'; /** - * Method for deleting one or more overrides + * Method for deleting one or more overrides. * * @return void * @@ -35,25 +33,25 @@ class LanguagesControllerOverrides extends JControllerAdmin */ public function delete() { - // Check for request forgeries + // Check for request forgeries. JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); - // Get items to dlete from the request + // Get items to dlete from the request. $cid = $this->input->get('cid', array(), 'array'); if (!is_array($cid) || count($cid) < 1) { - $this->setMessage(JText::_($this->text_prefix.'_NO_ITEM_SELECTED'), 'warning'); + $this->setMessage(JText::_($this->text_prefix . '_NO_ITEM_SELECTED'), 'warning'); } else { - // Get the model + // Get the model. $model = $this->getModel('overrides'); - // Remove the items + // Remove the items. if ($model->delete($cid)) { - $this->setMessage(JText::plural($this->text_prefix.'_N_ITEMS_DELETED', count($cid))); + $this->setMessage(JText::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid))); } else { @@ -61,6 +59,6 @@ public function delete() } } - $this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_list, false)); + $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false)); } } diff --git a/administrator/components/com_languages/controllers/strings.json.php b/administrator/components/com_languages/controllers/strings.json.php index a77c7ee66b715..1835e623330e2 100644 --- a/administrator/components/com_languages/controllers/strings.json.php +++ b/administrator/components/com_languages/controllers/strings.json.php @@ -12,9 +12,7 @@ /** * Languages Strings JSON Controller * - * @package Joomla.Administrator - * @subpackage com_languages - * @since 2.5 + * @since 2.5 */ class LanguagesControllerStrings extends JControllerAdmin { diff --git a/administrator/components/com_languages/helpers/html/languages.php b/administrator/components/com_languages/helpers/html/languages.php index d6a5acfe7ab8d..2d46b13653eda 100644 --- a/administrator/components/com_languages/helpers/html/languages.php +++ b/administrator/components/com_languages/helpers/html/languages.php @@ -12,18 +12,16 @@ /** * Utility class working with languages * - * @package Joomla.Administrator - * @subpackage com_languages - * @since 1.6 + * @since 1.6 */ abstract class JHtmlLanguages { /** - * Method to generate an information about the default language + * Method to generate an information about the default language. * - * @param boolean $published is the language the default? + * @param boolean $published True if the language is the default. * - * @return string html code + * @return string HTML code. */ public static function published($published) { @@ -38,18 +36,30 @@ public static function published($published) } /** - * Method to generate an input radio button + * Method to generate an input radio button. * - * @param integer $rowNum the row number - * @param string language tag + * @param integer $rowNum The row number. + * @param string $language Language tag. * - * @return string html code + * @return string HTML code. */ public static function id($rowNum, $language) { - return ''; + return ''; } + /** + * Method to generate an array of clients. + * + * @return array of client objects. + */ public static function clients() { return array( @@ -61,7 +71,8 @@ public static function clients() /** * Returns an array of published state filter options. * - * @return string The HTML code for the select tag + * @return string The HTML code for the select tag. + * * @since 1.6 */ public static function publishedOptions() @@ -75,5 +86,4 @@ public static function publishedOptions() return $options; } - } diff --git a/administrator/components/com_languages/helpers/jsonresponse.php b/administrator/components/com_languages/helpers/jsonresponse.php index 585d67787d2e7..2c5753b54a581 100644 --- a/administrator/components/com_languages/helpers/jsonresponse.php +++ b/administrator/components/com_languages/helpers/jsonresponse.php @@ -10,17 +10,15 @@ defined('_JEXEC') or die; /** - * JSON Response class + * JSON Response class. * - * @package Joomla.Administrator - * @subpackage com_languages * @since 2.5 - * @deprecated 4.0 + * @deprecated 4.0 */ class JJsonResponse { /** - * Determines whether the request was successful + * Determines whether the request was successful. * * @var boolean * @since 2.5 @@ -38,7 +36,7 @@ class JJsonResponse public $error = false; /** - * The main response message + * The main response message. * * @var string * @since 2.5 @@ -46,7 +44,7 @@ class JJsonResponse public $message = null; /** - * Array of messages gathered in the JApplication object + * Array of messages gathered in the JApplication object. * * @var array * @since 2.5 @@ -54,7 +52,7 @@ class JJsonResponse public $messages = null; /** - * The response data + * The response data. * * @var mixed * @since 2.5 @@ -64,12 +62,12 @@ class JJsonResponse /** * Constructor * - * @param mixed $response The Response data - * @param string $message The main response message - * @param boolean $error True, if the success flag shall be set to false, defaults to false + * @param mixed $response The Response data. + * @param string $message The main response message. + * @param boolean $error True, if the success flag shall be set to false, defaults to false. * * @since 2.5 - * @deprecated 4.0 Use JResponseJson instead + * @deprecated 4.0 Use JResponseJson instead. */ public function __construct($response = null, $message = null, $error = false) { @@ -77,10 +75,10 @@ public function __construct($response = null, $message = null, $error = false) $this->message = $message; - // Get the message queue + // Get the message queue. $messages = JFactory::getApplication()->getMessageQueue(); - // Build the sorted messages list + // Build the sorted messages list. if (is_array($messages) && count($messages)) { foreach ($messages as $message) @@ -92,23 +90,23 @@ public function __construct($response = null, $message = null, $error = false) } } - // If messages exist add them to the output + // If messages exist add them to the output. if (isset($lists) && is_array($lists)) { $this->messages = $lists; } - // Check if we are dealing with an error + // Check if we are dealing with an error. if ($response instanceof Exception) { - // Prepare the error response + // Prepare the error response. $this->success = false; $this->error = true; $this->message = $response->getMessage(); } else { - // Prepare the response data + // Prepare the response data. $this->success = !$error; $this->error = $error; $this->data = $response; @@ -116,9 +114,9 @@ public function __construct($response = null, $message = null, $error = false) } /** - * Magic toString method for sending the response in JSON format + * Magic toString method for sending the response in JSON format. * - * @return string The response in JSON format + * @return string The response in JSON format. * * @since 2.5 */ diff --git a/administrator/components/com_languages/helpers/languages.php b/administrator/components/com_languages/helpers/languages.php index a3d8be5a800fb..772dc51cfa243 100644 --- a/administrator/components/com_languages/helpers/languages.php +++ b/administrator/components/com_languages/helpers/languages.php @@ -12,9 +12,7 @@ /** * Languages component helper. * - * @package Joomla.Administrator - * @subpackage com_languages - * @since 1.6 + * @since 1.6 */ class LanguagesHelper { @@ -22,7 +20,7 @@ class LanguagesHelper * Configure the Linkbar. * * @param string $vName The name of the active view. - * @param int $client The client id of the active view. Maybe be 0 or 1 + * @param int $client The client id of the active view. Maybe be 0 or 1. * * @return void */ @@ -55,25 +53,25 @@ public static function addSubmenu($vName, $client = 0) * * @return JObject * - * @deprecated 3.2 Use JHelperContent::getActions() instead + * @deprecated 3.2 Use JHelperContent::getActions() instead. */ public static function getActions() { - // Log usage of deprecated function + // Log usage of deprecated function. JLog::add(__METHOD__ . '() is deprecated, use JHelperContent::getActions() with new arguments order instead.', JLog::WARNING, 'deprecated'); - // Get list of actions + // Get list of actions. $result = JHelperContent::getActions('com_languages'); return $result; } /** - * Method for parsing ini files + * Method for parsing ini files. * - * @param string $filename Path and name of the ini file to parse + * @param string $filename Path and name of the ini file to parse. * - * @return array Array of strings found in the file, the array indices will be the keys. On failure an empty array will be returned + * @return array Array of strings found in the file, the array indices will be the keys. On failure an empty array will be returned. * * @since 2.5 */ @@ -100,9 +98,9 @@ public static function parseFile($filename) * Filter method for language keys. * This method will be called by JForm while filtering the form data. * - * @param string $value The language key to filter + * @param string $value The language key to filter. * - * @return string The filtered language key + * @return string The filtered language key. * * @since 2.5 */ @@ -117,9 +115,9 @@ public static function filterKey($value) * Filter method for language strings. * This method will be called by JForm while filtering the form data. * - * @param string $value The language string to filter + * @param string $value The language string to filter. * - * @return string The filtered language string + * @return string The filtered language string. * * @since 2.5 */ diff --git a/administrator/components/com_languages/helpers/multilangstatus.php b/administrator/components/com_languages/helpers/multilangstatus.php index 232a5f63d392f..1256226218b33 100644 --- a/administrator/components/com_languages/helpers/multilangstatus.php +++ b/administrator/components/com_languages/helpers/multilangstatus.php @@ -12,15 +12,18 @@ /** * Multilang status helper. * - * @package Joomla.Administrator - * @subpackage com_languages - * @since 1.7.1 + * @since 1.7.1 */ abstract class MultilangstatusHelper { + /** + * Method to get the number of published home pages. + * + * @return integer + */ public static function getHomes() { - // Check for multiple Home pages + // Check for multiple Home pages. $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('COUNT(*)') @@ -29,12 +32,18 @@ public static function getHomes() ->where('published = 1') ->where('client_id = 0'); $db->setQuery($query); + return $db->loadResult(); } + /** + * Method to get the number of published language switcher modules. + * + * @return integer. + */ public static function getLangswitchers() { - // Check if switcher is published + // Check if switcher is published. $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('COUNT(*)') @@ -43,24 +52,36 @@ public static function getLangswitchers() ->where('published = 1') ->where('client_id = 0'); $db->setQuery($query); + return $db->loadResult(); } + /** + * Method to return a list of published content languages. + * + * @return array of language objects. + */ public static function getContentlangs() { - // Check for published Content Languages + // Check for published Content Languages. $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('a.lang_code AS lang_code') ->select('a.published AS published') ->from('#__languages AS a'); $db->setQuery($query); + return $db->loadObjectList(); } + /** + * Method to return a list of published site languages. + * + * @return array of language extension objects. + */ public static function getSitelangs() { - // check for published Site Languages + // Check for published Site Languages. $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('a.element AS element') @@ -69,12 +90,18 @@ public static function getSitelangs() ->where('a.client_id = 0') ->where('a.enabled = 1'); $db->setQuery($query); + return $db->loadObjectList('element'); } + /** + * Method to return a list of language home page menu items. + * + * @return array of menu objects. + */ public static function getHomepages() { - // Check for Home pages languages + // Check for Home pages languages. $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('language') @@ -83,12 +110,18 @@ public static function getHomepages() ->where('published = 1') ->where('client_id = 0'); $db->setQuery($query); + return $db->loadObjectList('language'); } + /** + * Method to return combined language status. + * + * @return array of language objects. + */ public static function getStatus() { - //check for combined status + // Check for combined status. $db = JFactory::getDbo(); $query = $db->getQuery(true); @@ -98,10 +131,10 @@ public static function getStatus() ->select('a.lang_code AS lang_code') ->from('#__languages AS a'); - // Select the language home pages + // Select the language home pages. $query->select('l.home AS home') ->select('l.language AS home_language') - ->join('LEFT', '#__menu AS l ON l.language = a.lang_code AND l.home=1 AND l.published=1 AND l.language <> \'*\'') + ->join('LEFT', '#__menu AS l ON l.language = a.lang_code AND l.home=1 AND l.published=1 AND l.language <> \'*\'') ->select('e.enabled AS enabled') ->select('e.element AS element') ->join('LEFT', '#__extensions AS e ON e.element = a.lang_code') @@ -110,9 +143,15 @@ public static function getStatus() ->where('e.state = 0'); $db->setQuery($query); + return $db->loadObjectList(); } + /** + * Method to return a list of contact objects. + * + * @return array of contact objects. + */ public static function getContacts() { $db = JFactory::getDbo(); @@ -128,6 +167,7 @@ public static function getContacts() ->having('(counted !=' . count(JLanguageHelper::getLanguages()) . ' OR all_languages=1)') ->having('(counted !=1 OR all_languages=0)'); $db->setQuery($query); + return $db->loadObjectList(); } } diff --git a/administrator/components/com_languages/models/installed.php b/administrator/components/com_languages/models/installed.php index e26e0371db82d..d7339a52bcf19 100644 --- a/administrator/components/com_languages/models/installed.php +++ b/administrator/components/com_languages/models/installed.php @@ -12,9 +12,7 @@ /** * Languages Component Languages Model * - * @package Joomla.Administrator - * @subpackage com_languages - * @since 1.6 + * @since 1.6 */ class LanguagesModelInstalled extends JModelList { @@ -63,7 +61,11 @@ class LanguagesModelInstalled extends JModelList * * Note. Calling getState in this method will result in recursion. * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * * @return void + * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) @@ -89,26 +91,28 @@ protected function populateState($ordering = null, $direction = null) * different modules that might need different sets of data or different * ordering requirements. * - * @param string $id A prefix for the store id. + * @param string $id A prefix for the store id. * * @return string A store id. + * * @since 1.6 */ protected function getStoreId($id = '') { // Compile the store id. - $id .= ':'.$this->getState('filter.client_id'); + $id .= ':' . $this->getState('filter.client_id'); return parent::getStoreId($id); } /** - * Method to get the client object + * Method to get the client object. * * @return object + * * @since 1.6 */ - public function &getClient() + public function getClient() { if (is_null($this->client)) { @@ -119,12 +123,13 @@ public function &getClient() } /** - * Method to get the ftp credentials + * Method to get the ftp credentials. * * @return object + * * @since 1.6 */ - public function &getFtp() + public function getFtp() { if (is_null($this->ftp)) { @@ -135,12 +140,13 @@ public function &getFtp() } /** - * Method to get the option + * Method to get the option. * * @return object + * * @since 1.6 */ - public function &getOption() + public function getOption() { $option = $this->getState('option'); @@ -148,25 +154,27 @@ public function &getOption() } /** - * Method to get Languages item data + * Method to get Languages item data. * * @return array + * * @since 1.6 */ - public function &getData() + public function getData() { - if (is_null($this->data)) { - - // Get information + if (is_null($this->data)) + { + // Get information. $path = $this->getPath(); $client = $this->getClient(); $langlist = $this->getLanguageList(); - // Compute all the languages + // Compute all the languages. $data = array (); - foreach ($langlist as $lang) { - $file = $path . '/' . $lang . '/' . $lang.'.xml'; + foreach ($langlist as $lang) + { + $file = $path . '/' . $lang . '/' . $lang . '.xml'; $info = JApplicationHelper::parseXMLLangMetaFile($file); $row = new JObject; $row->language = $lang; @@ -181,22 +189,25 @@ public function &getData() $row->$key = $value; } - // if current than set published + // If current than set published. $params = JComponentHelper::getParams('com_languages'); + if ($params->get($client->name, 'en-GB') == $row->language) { $row->published = 1; } - else { + else + { $row->published = 0; } $row->checked_out = 0; $data[] = $row; } + usort($data, array($this, 'compareLanguages')); - // Prepare data + // Prepare data. $limit = $this->getState('list.limit'); $start = $this->getState('list.start'); $total = $this->getTotal(); @@ -206,11 +217,13 @@ public function &getData() $start = 0; $end = $total; } - else { + else + { if ($start > $total) { $start = $total - $total % $limit; } + $end = $start + $limit; if ($end > $total) @@ -219,9 +232,10 @@ public function &getData() } } - // Compute the displayed languages + // Compute the displayed languages. $this->data = array(); - for ($i = $start;$i < $end;$i++) + + for ($i = $start; $i < $end; $i++) { $this->data[] = & $data[$i]; } @@ -233,7 +247,8 @@ public function &getData() /** * Method to get installed languages data. * - * @return string An SQL query + * @return string An SQL query. + * * @since 1.6 */ protected function getLanguageList() @@ -243,19 +258,18 @@ protected function getLanguageList() $query = $db->getQuery(true); $client = $this->getState('filter.client_id'); $type = "language"; + // Select field element from the extensions table. $query->select($this->getState('list.select', 'a.element')) ->from('#__extensions AS a'); $type = $db->quote($type); - $query->where('(a.type = '.$type.')') - + $query->where('(a.type = ' . $type . ')') ->where('state = 0') ->where('enabled = 1') - ->where('client_id=' . (int) $client); - // for client_id = 1 do we need to check language table also ? + // For client_id = 1 do we need to check language table also? $db->setQuery($query); $this->langlist = $db->loadColumn(); @@ -264,9 +278,10 @@ protected function getLanguageList() } /** - * Method to get the total number of Languages items + * Method to get the total number of Languages items. * * @return integer + * * @since 1.6 */ public function getTotal() @@ -281,9 +296,12 @@ public function getTotal() } /** - * Method to set the default language + * Method to set the default language. + * + * @param integer $cid Id of the language to publish. * * @return boolean + * * @since 1.6 */ public function publish($cid) @@ -298,31 +316,36 @@ public function publish($cid) $table = JTable::getInstance('extension'); $id = $table->find(array('element' => 'com_languages')); - // Load + // Load. if (!$table->load($id)) { $this->setError($table->getError()); + return false; } $table->params = (string) $params; - // pre-save checks + + // Pre-save checks. if (!$table->check()) { $this->setError($table->getError()); + return false; } - // save the changes + // Save the changes. if (!$table->store()) { $this->setError($table->getError()); + return false; } } else { $this->setError(JText::_('COM_LANGUAGES_ERR_NO_LANGUAGE_SELECTED')); + return false; } @@ -335,9 +358,10 @@ public function publish($cid) } /** - * Method to get the folders + * Method to get the folders. + * + * @return array Languages folders. * - * @return array Languages folders * @since 1.6 */ protected function getFolders() @@ -353,9 +377,10 @@ protected function getFolders() } /** - * Method to get the path + * Method to get the path. + * + * @return string The path to the languages folders. * - * @return string The path to the languages folders * @since 1.6 */ protected function getPath() @@ -370,12 +395,13 @@ protected function getPath() } /** - * Method to compare two languages in order to sort them + * Method to compare two languages in order to sort them. * - * @param object $lang1 the first language - * @param object $lang2 the second language + * @param object $lang1 The first language. + * @param object $lang2 The second language. * * @return integer + * * @since 1.6 */ protected function compareLanguages($lang1, $lang2) diff --git a/administrator/components/com_languages/models/language.php b/administrator/components/com_languages/models/language.php index b4eed707a9117..36fed6a6e33ab 100644 --- a/administrator/components/com_languages/models/language.php +++ b/administrator/components/com_languages/models/language.php @@ -12,16 +12,19 @@ /** * Languages Component Language Model * - * @package Joomla.Administrator - * @subpackage com_languages - * @since 1.5 + * @since 1.5 */ class LanguagesModelLanguage extends JModelAdmin { /** - * Override to get the table + * Override to get the table. + * + * @param string $name Name of the table. + * @param string $prefix Table name prefix. + * @param array $options Array of options. * * @return JTable + * * @since 1.6 */ public function getTable($name = '', $prefix = '', $options = array()) @@ -35,6 +38,7 @@ public function getTable($name = '', $prefix = '', $options = array()) * Note. Calling getState in this method will result in recursion. * * @return void + * * @since 1.6 */ protected function populateState() @@ -53,9 +57,10 @@ protected function populateState() /** * Method to get a member item. * - * @param integer The id of the member to get. + * @param integer $langId The id of the member to get. * * @return mixed User data object on success, false on failure. + * * @since 1.0 */ public function getItem($langId = null) @@ -73,6 +78,7 @@ public function getItem($langId = null) if ($return === false && $table->getError()) { $this->setError($table->getError()); + return $false; } @@ -91,16 +97,18 @@ public function getItem($langId = null) /** * Method to get the group form. * - * @param array $data Data for the form. - * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * + * @return mixed A JForm object on success, false on failure. * - * @return mixed A JForm object on success, false on failure * @since 1.6 */ public function getForm($data = array(), $loadData = true) { // Get the form. $form = $this->loadForm('com_languages.language', 'language', array('control' => 'jform', 'load_data' => $loadData)); + if (empty($form)) { return false; @@ -113,6 +121,7 @@ public function getForm($data = array(), $loadData = true) * Method to get the data that should be injected in the form. * * @return mixed The data for the form. + * * @since 1.6 */ protected function loadFormData() @@ -133,9 +142,10 @@ protected function loadFormData() /** * Method to save the form data. * - * @param array The form data. + * @param array $data The form data. * * @return boolean True on success. + * * @since 1.6 */ public function save($data) @@ -155,23 +165,25 @@ public function save($data) $isNew = false; } - // Prevent white spaces, including East Asian double bytes + // Prevent white spaces, including East Asian double bytes. $spaces = array('/\xE3\x80\x80/', ' '); $data['lang_code'] = str_replace($spaces, '', $data['lang_code']); $data['sef'] = str_replace($spaces, '', $data['sef']); - // Bind the data + // Bind the data. if (!$table->bind($data)) { $this->setError($table->getError()); + return false; } - // Check the data + // Check the data. if (!$table->check()) { $this->setError($table->getError()); + return false; } @@ -182,13 +194,15 @@ public function save($data) if (in_array(false, $result, true)) { $this->setError($table->getError()); + return false; } - // Store the data + // Store the data. if (!$table->store()) { $this->setError($table->getError()); + return false; } @@ -204,7 +218,12 @@ public function save($data) } /** - * Custom clean cache method + * Custom clean cache method. + * + * @param string $group Optional cache group name. + * @param integer $client_id Application client id. + * + * @return void * * @since 1.6 */ diff --git a/administrator/components/com_languages/models/languages.php b/administrator/components/com_languages/models/languages.php index 770889f244a6d..93e762fcffe0c 100644 --- a/administrator/components/com_languages/models/languages.php +++ b/administrator/components/com_languages/models/languages.php @@ -12,16 +12,15 @@ /** * Languages Model Class * - * @package Joomla.Administrator - * @subpackage com_languages - * @since 1.6 + * @since 1.6 */ class LanguagesModelLanguages extends JModelList { /** * Constructor. * - * @param array An optional associative array of configuration settings. + * @param array $config An optional associative array of configuration settings. + * * @see JController * @since 1.6 */ @@ -85,9 +84,10 @@ protected function populateState($ordering = null, $direction = null) * different modules that might need different sets of data or different * ordering requirements. * - * @param string $id A prefix for the store id. + * @param string $id A prefix for the store id. * * @return string A store id. + * * @since 1.6 */ protected function getStoreId($id = '') @@ -104,6 +104,7 @@ protected function getStoreId($id = '') * Method to build an SQL query to load the list data. * * @return string An SQL query + * * @since 1.6 */ protected function getListQuery() @@ -120,12 +121,13 @@ protected function getListQuery() $query->select('ag.title AS access_level') ->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); - // Select the language home pages + // Select the language home pages. $query->select('l.home AS home') ->join('LEFT', $db->quoteName('#__menu') . ' AS l ON l.language = a.lang_code AND l.home=1 AND l.language <> ' . $db->quote('*')); // Filter on the published state. $published = $this->getState('filter.published'); + if (is_numeric($published)) { $query->where('a.published = ' . (int) $published); @@ -135,8 +137,9 @@ protected function getListQuery() $query->where('(a.published IN (0, 1))'); } - // Filter by search in title + // Filter by search in title. $search = $this->getState('filter.search'); + if (!empty($search)) { $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); @@ -156,12 +159,13 @@ protected function getListQuery() } /** - * Set the published language(s) + * Set the published language(s). * - * @param array $cid An array of language IDs. - * @param integer $value The value of the published state. + * @param array $cid An array of language IDs. + * @param integer $value The value of the published state. * * @return boolean True on success, false otherwise. + * * @since 1.6 */ public function setPublished($cid, $value = 0) @@ -172,9 +176,10 @@ public function setPublished($cid, $value = 0) /** * Method to delete records. * - * @param array An array of item primary keys. + * @param array $pks An array of item primary keys. * * @return boolean Returns true on success, false on failure. + * * @since 1.6 */ public function delete($pks) @@ -203,7 +208,12 @@ public function delete($pks) } /** - * Custom clean cache method, 2 places for 2 clients + * Custom clean cache method, 2 places for 2 clients. + * + * @param string $group Optional cache group name. + * @param integer $client_id Application client id. + * + * @return void * * @since 1.6 */ diff --git a/administrator/components/com_languages/models/override.php b/administrator/components/com_languages/models/override.php index 53db9c8df7c5f..994c7791481db 100644 --- a/administrator/components/com_languages/models/override.php +++ b/administrator/components/com_languages/models/override.php @@ -12,26 +12,25 @@ /** * Languages Override Model * - * @package Joomla.Administrator - * @subpackage com_languages - * @since 2.5 + * @since 2.5 */ class LanguagesModelOverride extends JModelAdmin { /** * Method to get the record form. * - * @param array $data Data for the form. - * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. * - * @return mixed A JForm object on success, false on failure + * @return mixed A JForm object on success, false on failure. * - * @since 2.5 + * @since 2.5 */ public function getForm($data = array(), $loadData = true) { - // Get the form + // Get the form. $form = $this->loadForm('com_languages.override', 'override', array('control' => 'jform', 'load_data' => $loadData)); + if (empty($form)) { return false; @@ -40,15 +39,17 @@ public function getForm($data = array(), $loadData = true) $client = $this->getState('filter.client', 'site'); $language = $this->getState('filter.language', 'en-GB'); $langName = JLanguage::getInstance($language)->getName(); + if (!$langName) { // If a language only exists in frontend, it's meta data cannot be - // loaded in backend at the moment, so fall back to the language tag + // loaded in backend at the moment, so fall back to the language tag. $langName = $language; } - $form->setValue('client', null, JText::_('COM_LANGUAGES_VIEW_OVERRIDE_CLIENT_'.strtoupper($client))); + + $form->setValue('client', null, JText::_('COM_LANGUAGES_VIEW_OVERRIDE_CLIENT_' . strtoupper($client))); $form->setValue('language', null, JText::sprintf('COM_LANGUAGES_VIEW_OVERRIDE_LANGUAGE', $langName, $language)); - $form->setValue('file', null, JPath::clean(constant('JPATH_'.strtoupper($client)) . '/language/overrides/' . $language . '.override.ini')); + $form->setValue('file', null, JPath::clean(constant('JPATH_' . strtoupper($client)) . '/language/overrides/' . $language . '.override.ini')); return $form; } @@ -56,9 +57,9 @@ public function getForm($data = array(), $loadData = true) /** * Method to get the data that should be injected in the form. * - * @return mixed The data for the form + * @return mixed The data for the form. * - * @since 2.5 + * @since 2.5 */ protected function loadFormData() { @@ -78,24 +79,26 @@ protected function loadFormData() /** * Method to get a single record. * - * @param string $pk The key name. + * @param string $pk The key name. * * @return mixed Object on success, false otherwise. * - * @since 2.5 + * @since 2.5 */ public function getItem($pk = null) { - require_once JPATH_COMPONENT.'/helpers/languages.php'; + require_once JPATH_COMPONENT . '/helpers/languages.php'; $input = JFactory::getApplication()->input; $pk = (!empty($pk)) ? $pk : $input->get('id'); - $filename = constant('JPATH_'.strtoupper($this->getState('filter.client'))) . '/language/overrides/' . $this->getState('filter.language', 'en-GB').'.override.ini'; + $filename = constant('JPATH_' . strtoupper($this->getState('filter.client'))) + . '/language/overrides/' . $this->getState('filter.language', 'en-GB') . '.override.ini'; $strings = LanguagesHelper::parseFile($filename); $result = new stdClass; $result->key = ''; $result->override = ''; + if (isset($strings[$pk])) { $result->key = $pk; @@ -108,23 +111,23 @@ public function getItem($pk = null) /** * Method to save the form data. * - * @param array $data The form data. - * @param boolean $opposite_client Indicates whether the override should not be created for the current client + * @param array $data The form data. + * @param boolean $opposite_client Indicates whether the override should not be created for the current client. * * @return boolean True on success, false otherwise. * - * @since 2.5 + * @since 2.5 */ public function save($data, $opposite_client = false) { $app = JFactory::getApplication(); - require_once JPATH_COMPONENT.'/helpers/languages.php'; + require_once JPATH_COMPONENT . '/helpers/languages.php'; jimport('joomla.filesystem.file'); $client = $app->getUserState('com_languages.overrides.filter.client', 0); $language = $app->getUserState('com_languages.overrides.filter.language', 'en-GB'); - // If the override should be created for both + // If the override should be created for both. if ($opposite_client) { $client = 1 - $client; @@ -132,29 +135,29 @@ public function save($data, $opposite_client = false) $client = $client ? 'administrator' : 'site'; - // Parse the override.ini file in oder to get the keys and strings - $filename = constant('JPATH_'.strtoupper($client)) . '/language/overrides/' . $language . '.override.ini'; + // Parse the override.ini file in oder to get the keys and strings. + $filename = constant('JPATH_' . strtoupper($client)) . '/language/overrides/' . $language . '.override.ini'; $strings = LanguagesHelper::parseFile($filename); if (isset($strings[$data['id']])) { // If an existent string was edited check whether - // the name of the constant is still the same + // the name of the constant is still the same. if ($data['key'] == $data['id']) { - // If yes, simply override it + // If yes, simply override it. $strings[$data['key']] = $data['override']; } else { - // If no, delete the old string and prepend the new one + // If no, delete the old string and prepend the new one. unset($strings[$data['id']]); $strings = array($data['key'] => $data['override']) + $strings; } } else { - // If it is a new override simply prepend it + // If it is a new override simply prepend it. $strings = array($data['key'] => $data['override']) + $strings; } @@ -163,7 +166,7 @@ public function save($data, $opposite_client = false) $strings[$key] = str_replace('"', '"_QQ_"', $string); } - // Write override.ini file with the strings + // Write override.ini file with the strings. $registry = new JRegistry; $registry->loadObject($strings); $reg = $registry->toString('INI'); @@ -174,7 +177,7 @@ public function save($data, $opposite_client = false) } // If the override should be stored for both clients save - // it also for the other one and prevent endless recursion + // it also for the other one and prevent endless recursion. if (isset($data['both']) && $data['both'] && !$opposite_client) { return $this->save($data, true); @@ -190,7 +193,7 @@ public function save($data, $opposite_client = false) * * @return void * - * @since 2.5 + * @since 2.5 */ protected function populateState() { diff --git a/administrator/components/com_languages/models/overrides.php b/administrator/components/com_languages/models/overrides.php index 0849461230a13..e2123e666a533 100644 --- a/administrator/components/com_languages/models/overrides.php +++ b/administrator/components/com_languages/models/overrides.php @@ -12,18 +12,14 @@ /** * Languages Overrides Model * - * @package Joomla.Administrator - * @subpackage com_languages - * @since 2.5 + * @since 2.5 */ class LanguagesModelOverrides extends JModelList { /** - * Constructor + * Constructor. * - * @param array An optional associative array of configuration settings - * - * @return void + * @param array $config An optional associative array of configuration settings. * * @since 2.5 */ @@ -45,10 +41,10 @@ public function __construct($config = array()) */ public function getOverrides($all = false) { - // Get a storage key + // Get a storage key. $store = $this->getStoreId(); - // Try to load the data from internal storage + // Try to load the data from internal storage. if (!empty($this->cache[$store])) { return $this->cache[$store]; @@ -56,17 +52,17 @@ public function getOverrides($all = false) $client = in_array($this->state->get('filter.client'), array(0, 'site')) ? 'SITE' : 'ADMINISTRATOR'; - // Parse the override.ini file in order to get the keys and strings + // Parse the override.ini file in order to get the keys and strings. $filename = constant('JPATH_' . $client) . '/language/overrides/' . $this->getState('filter.language') . '.override.ini'; $strings = LanguagesHelper::parseFile($filename); - // Delete the override.ini file if empty + // Delete the override.ini file if empty. if (file_exists($filename) && empty($strings)) { JFile::delete($filename); } - // Filter the loaded strings according to the search box + // Filter the loaded strings according to the search box. $search = $this->getState('filter.search'); if ($search != '') @@ -77,7 +73,7 @@ public function getOverrides($all = false) $strings = array_merge($matchvals, $matchkeys); } - // Consider the odering + // Consider the ordering if ($this->getState('list.ordering') == 'text') { if (strtoupper($this->getState('list.direction')) == 'DESC') @@ -101,28 +97,28 @@ public function getOverrides($all = false) } } - // Consider the pagination + // Consider the pagination. if (!$all && $this->getState('list.limit') && $this->getTotal() > $this->getState('list.limit')) { $strings = array_slice($strings, $this->getStart(), $this->getState('list.limit'), true); } - // Add the items to the internal cache + // Add the items to the internal cache. $this->cache[$store] = $strings; return $this->cache[$store]; } /** - * Method to get the total number of overrides + * Method to get the total number of overrides. * - * @return int The total number of overrides + * @return int The total number of overrides. * * @since 2.5 */ public function getTotal() { - // Get a storage key + // Get a storage key. $store = $this->getStoreId('getTotal'); // Try to load the data from internal storage @@ -131,7 +127,7 @@ public function getTotal() return $this->cache[$store]; } - // Add the total to the internal cache + // Add the total to the internal cache. $this->cache[$store] = count($this->getOverrides(true)); return $this->cache[$store]; @@ -153,8 +149,8 @@ protected function populateState($ordering = null, $direction = null) { $app = JFactory::getApplication(); - // Use default language of frontend for default filter - $default = JComponentHelper::getParams('com_languages')->get('site').'0'; + // Use default language of frontend for default filter. + $default = JComponentHelper::getParams('com_languages')->get('site') . '0'; $old_language_client = $app->getUserState('com_languages.overrides.filter.language_client', ''); $language_client = $this->getUserStateFromRequest('com_languages.overrides.filter.language_client', 'filter_language_client', $default, 'cmd'); @@ -170,15 +166,15 @@ protected function populateState($ordering = null, $direction = null) $language = $app->getUserState('com_languages.overrides.filter.language', 'en-GB'); } - // Sets the search filter + // Sets the search filter. $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); - $this->setState('filter.language_client', $language.$client); + $this->setState('filter.language_client', $language . $client); $this->setState('filter.client', $client ? 'administrator' : 'site'); $this->setState('filter.language', $language); - // Add filters to the session because they won't be stored there by 'getUserStateFromRequest' if they aren't in the current request + // Add filters to the session because they won't be stored there by 'getUserStateFromRequest' if they aren't in the current request. $app->setUserState('com_languages.overrides.filter.client', $client); $app->setUserState('com_languages.overrides.filter.language', $language); @@ -192,54 +188,55 @@ protected function populateState($ordering = null, $direction = null) * The resulting array has entries of the following style: * 0|1 => - * - * @return array Sorted associative array of languages + * @return array Sorted associative array of languages. * * @since 2.5 */ public function getLanguages() { - // Try to load the data from internal storage + // Try to load the data from internal storage. if (!empty($this->cache['languages'])) { return $this->cache['languages']; } - // Get all languages of frontend and backend - $languages = array(); + // Get all languages of frontend and backend. + $languages = array(); $site_languages = JLanguage::getKnownLanguages(JPATH_SITE); $admin_languages = JLanguage::getKnownLanguages(JPATH_ADMINISTRATOR); - // Create a single array of them + // Create a single array of them. foreach ($site_languages as $tag => $language) { - $languages[$tag.'0'] = JText::sprintf('COM_LANGUAGES_VIEW_OVERRIDES_LANGUAGES_BOX_ITEM', $language['name'], JText::_('JSITE')); + $languages[$tag . '0'] = JText::sprintf('COM_LANGUAGES_VIEW_OVERRIDES_LANGUAGES_BOX_ITEM', $language['name'], JText::_('JSITE')); } + foreach ($admin_languages as $tag => $language) { - $languages[$tag.'1'] = JText::sprintf('COM_LANGUAGES_VIEW_OVERRIDES_LANGUAGES_BOX_ITEM', $language['name'], JText::_('JADMINISTRATOR')); + $languages[$tag . '1'] = JText::sprintf('COM_LANGUAGES_VIEW_OVERRIDES_LANGUAGES_BOX_ITEM', $language['name'], JText::_('JADMINISTRATOR')); } - // Sort it by language tag and by client after that + // Sort it by language tag and by client after that. ksort($languages); - // Add the languages to the internal cache + // Add the languages to the internal cache. $this->cache['languages'] = $languages; return $this->cache['languages']; } /** - * Method to delete one or more overrides + * Method to delete one or more overrides. * - * @param array Array of keys to delete + * @param array $cids Array of keys to delete. * - * @return integer Number of successfully deleted overrides, boolean false if an error occured + * @return integer Number of successfully deleted overrides, boolean false if an error occured. * * @since 2.5 */ public function delete($cids) { - // Check permissions first + // Check permissions first. if (!JFactory::getUser()->authorise('core.delete', 'com_languages')) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED')); @@ -248,12 +245,12 @@ public function delete($cids) } jimport('joomla.filesystem.file'); - require_once JPATH_COMPONENT.'/helpers/languages.php'; + require_once JPATH_COMPONENT . '/helpers/languages.php'; $filterclient = JFactory::getApplication()->getUserState('com_languages.overrides.filter.client'); $client = $filterclient == 0 ? 'SITE' : 'ADMINISTRATOR'; - // Parse the override.ini file in oder to get the keys and strings + // Parse the override.ini file in oder to get the keys and strings. $filename = constant('JPATH_' . $client) . '/language/overrides/' . $this->getState('filter.language') . '.override.ini'; $strings = LanguagesHelper::parseFile($filename); @@ -271,7 +268,7 @@ public function delete($cids) $strings[$key] = str_replace('"', '"_QQ_"', $string); } - // Write override.ini file with the left strings + // Write override.ini file with the left strings. $registry = new JRegistry; $registry->loadObject($strings); $reg = $registry->toString('INI'); diff --git a/administrator/components/com_languages/models/strings.php b/administrator/components/com_languages/models/strings.php index 4f44c401a0307..0963f64d88ac9 100644 --- a/administrator/components/com_languages/models/strings.php +++ b/administrator/components/com_languages/models/strings.php @@ -12,31 +12,29 @@ /** * Languages Strings Model * - * @package Joomla.Administrator - * @subpackage com_languages - * @since 2.5 + * @since 2.5 */ class LanguagesModelStrings extends JModelLegacy { /** - * Method for refreshing the cache in the database with the known language strings + * Method for refreshing the cache in the database with the known language strings. * - * @return boolean True on success, Exception object otherwise + * @return boolean True on success, Exception object otherwise. * * @since 2.5 */ public function refresh() { - require_once JPATH_COMPONENT.'/helpers/languages.php'; + require_once JPATH_COMPONENT . '/helpers/languages.php'; $app = JFactory::getApplication(); $app->setUserState('com_languages.overrides.cachedtime', null); - // Empty the database cache first + // Empty the database cache first. try { - $this->_db->setQuery('TRUNCATE TABLE '.$this->_db->quoteName('#__overrider')); + $this->_db->setQuery('TRUNCATE TABLE ' . $this->_db->quoteName('#__overrider')); $this->_db->execute(); } catch (RuntimeException $e) @@ -44,49 +42,52 @@ public function refresh() return $e; } - // Create the insert query + // Create the insert query. $query = $this->_db->getQuery(true) ->insert($this->_db->quoteName('#__overrider')) ->columns('constant, string, file'); - // Initialize some variables + // Initialize some variables. $client = $app->getUserState('com_languages.overrides.filter.client', 'site') ? 'administrator' : 'site'; $language = $app->getUserState('com_languages.overrides.filter.language', 'en-GB'); - $base = constant('JPATH_'.strtoupper($client)); + $base = constant('JPATH_' . strtoupper($client)); $path = $base . '/language/' . $language; $files = array(); - // Parse common language directory + // Parse common language directory. jimport('joomla.filesystem.folder'); + if (is_dir($path)) { - $files = JFolder::files($path, $language.'.*ini$', false, true); + $files = JFolder::files($path, $language . '.*ini$', false, true); } - // Parse language directories of components - $files = array_merge($files, JFolder::files($base.'/components', $language.'.*ini$', 3, true)); + // Parse language directories of components. + $files = array_merge($files, JFolder::files($base . '/components', $language . '.*ini$', 3, true)); - // Parse language directories of modules - $files = array_merge($files, JFolder::files($base.'/modules', $language.'.*ini$', 3, true)); + // Parse language directories of modules. + $files = array_merge($files, JFolder::files($base . '/modules', $language . '.*ini$', 3, true)); - // Parse language directories of templates - $files = array_merge($files, JFolder::files($base.'/templates', $language.'.*ini$', 3, true)); + // Parse language directories of templates. + $files = array_merge($files, JFolder::files($base . '/templates', $language . '.*ini$', 3, true)); - // Parse language directories of plugins - $files = array_merge($files, JFolder::files(JPATH_PLUGINS, $language.'.*ini$', 3, true)); + // Parse language directories of plugins. + $files = array_merge($files, JFolder::files(JPATH_PLUGINS, $language . '.*ini$', 3, true)); - // Parse all found ini files and add the strings to the database cache + // Parse all found ini files and add the strings to the database cache. foreach ($files as $file) { $strings = LanguagesHelper::parseFile($file); + if ($strings && count($strings)) { $query->clear('values'); + foreach ($strings as $key => $string) { - $query->values($this->_db->quote($key).','.$this->_db->quote($string).','.$this->_db->quote(JPath::clean($file))); + $query->values($this->_db->quote($key) . ',' . $this->_db->quote($string) . ',' . $this->_db->quote(JPath::clean($file))); } try @@ -101,16 +102,16 @@ public function refresh() } } - // Update the cached time - $app->setUserState('com_languages.overrides.cachedtime.'.$client.'.'.$language, time()); + // Update the cached time. + $app->setUserState('com_languages.overrides.cachedtime.' . $client . '.' . $language, time()); return true; } /** - * Method for searching language strings + * Method for searching language strings. * - * @return array Array of resuls on success, Exception object otherwise + * @return array Array of resuls on success, Exception object otherwise. * * @since 2.5 */ @@ -125,31 +126,32 @@ public function search() { $searchstring = $this->_db->quote('%' . $input->getString('searchstring') . '%'); - // Create the search query + // Create the search query. $query = $this->_db->getQuery(true) ->select('constant, string, file') ->from($this->_db->quoteName('#__overrider')); + if ($input->get('searchtype') == 'constant') { - $query->where('constant LIKE '.$searchstring); + $query->where('constant LIKE ' . $searchstring); } else { - $query->where('string LIKE '.$searchstring); + $query->where('string LIKE ' . $searchstring); } - // Consider the limitstart according to the 'more' parameter and load the results + // Consider the limitstart according to the 'more' parameter and load the results. $this->_db->setQuery($query, $limitstart, 10); $results['results'] = $this->_db->loadObjectList(); - // Check whether there are more results than already loaded + // Check whether there are more results than already loaded. $query->clear('select') ->select('COUNT(id)'); $this->_db->setQuery($query); if ($this->_db->loadResult() > $limitstart + 10) { - // If this is set a 'More Results' link will be displayed in the view + // If this is set a 'More Results' link will be displayed in the view. $results['more'] = $limitstart + 10; } } diff --git a/administrator/components/com_languages/views/installed/view.html.php b/administrator/components/com_languages/views/installed/view.html.php index b7c1cae18e2a9..1091278ed3107 100644 --- a/administrator/components/com_languages/views/installed/view.html.php +++ b/administrator/components/com_languages/views/installed/view.html.php @@ -12,34 +12,32 @@ /** * Displays a list of the installed languages. * - * @package Joomla.Administrator - * @subpackage com_languages - * @since 1.6 + * @since 1.6 */ class LanguagesViewInstalled extends JViewLegacy { /** - * @var object client object + * @var object client object. */ protected $client = null; /** - * @var boolean|JExeption True, if FTP settings should be shown, or an exeption + * @var boolean|JException True, if FTP settings should be shown, or an exception. */ protected $ftp = null; /** - * @var string option name + * @var string option name. */ protected $option = null; /** - * @var object pagination information + * @var object pagination information. */ protected $pagination = null; /** - * @var array languages information + * @var array languages information. */ protected $rows = null; @@ -49,7 +47,11 @@ class LanguagesViewInstalled extends JViewLegacy protected $user = null; /** - * Display the view + * Display the view. + * + * @param string $tpl The name of the template file to parse. + * + * @return void */ public function display($tpl = null) { @@ -69,6 +71,8 @@ public function display($tpl = null) /** * Add the page title and toolbar. * + * @return void + * * @since 1.6 */ protected function addToolbar() @@ -85,7 +89,7 @@ protected function addToolbar() if ($canDo->get('core.admin')) { - // Add install languages link to the lang installer component + // Add install languages link to the lang installer component. $bar = JToolbar::getInstance('toolbar'); $bar->appendButton('Link', 'upload', 'COM_LANGUAGES_INSTALL', 'index.php?option=com_installer&view=languages'); JToolbarHelper::divider(); diff --git a/administrator/components/com_languages/views/language/view.html.php b/administrator/components/com_languages/views/language/view.html.php index 883a2fad4e21f..5700d14fad178 100644 --- a/administrator/components/com_languages/views/language/view.html.php +++ b/administrator/components/com_languages/views/language/view.html.php @@ -10,11 +10,9 @@ defined('_JEXEC') or die; /** - * HTML View class for the Languages component + * HTML View class for the Languages component. * - * @package Joomla.Administrator - * @subpackage com_languages - * @since 1.5 + * @since 1.5 */ class LanguagesViewLanguage extends JViewLegacy { @@ -25,7 +23,11 @@ class LanguagesViewLanguage extends JViewLegacy public $state; /** - * Display the view + * Display the view. + * + * @param string $tpl The name of the template file to parse. + * + * @return void */ public function display($tpl = null) { @@ -38,6 +40,7 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); + return false; } @@ -48,7 +51,9 @@ public function display($tpl = null) /** * Add the page title and toolbar. * - * @since 1.6 + * @return void + * + * @since 1.6 */ protected function addToolbar() { @@ -58,7 +63,9 @@ protected function addToolbar() $isNew = empty($this->item->lang_id); $canDo = $this->canDo; - JToolbarHelper::title(JText::_($isNew ? 'COM_LANGUAGES_VIEW_LANGUAGE_EDIT_NEW_TITLE' : 'COM_LANGUAGES_VIEW_LANGUAGE_EDIT_EDIT_TITLE'), 'comments-2 langmanager'); + JToolbarHelper::title( + JText::_($isNew ? 'COM_LANGUAGES_VIEW_LANGUAGE_EDIT_NEW_TITLE' : 'COM_LANGUAGES_VIEW_LANGUAGE_EDIT_EDIT_TITLE'), 'comments-2 langmanager' + ); // If a new item, can save. if ($isNew && $canDo->get('core.create')) @@ -66,7 +73,7 @@ protected function addToolbar() JToolbarHelper::save('language.save'); } - //If an existing item, allow to Apply and Save. + // If an existing item, allow to Apply and Save. if (!$isNew && $canDo->get('core.edit')) { JToolbarHelper::apply('language.apply'); diff --git a/administrator/components/com_languages/views/languages/view.html.php b/administrator/components/com_languages/views/languages/view.html.php index a55f7b64cb7b4..2288a2b3b5562 100644 --- a/administrator/components/com_languages/views/languages/view.html.php +++ b/administrator/components/com_languages/views/languages/view.html.php @@ -10,11 +10,9 @@ defined('_JEXEC') or die; /** - * HTML Languages View class for the Languages component + * HTML Languages View class for the Languages component. * - * @package Joomla.Administrator - * @subpackage com_languages - * @since 1.6 + * @since 1.6 */ class LanguagesViewLanguages extends JViewLegacy { @@ -25,7 +23,11 @@ class LanguagesViewLanguages extends JViewLegacy protected $state; /** - * Display the view + * Display the view. + * + * @param string $tpl The name of the template file to parse. + * + * @return void */ public function display($tpl = null) { @@ -39,6 +41,7 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); + return false; } @@ -50,6 +53,8 @@ public function display($tpl = null) /** * Add the page title and toolbar. * + * @return void + * * @since 1.6 */ protected function addToolbar() @@ -82,7 +87,8 @@ protected function addToolbar() { JToolbarHelper::deleteList('', 'languages.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolbarHelper::divider(); - } elseif ($canDo->get('core.edit.state')) + } + elseif ($canDo->get('core.edit.state')) { JToolbarHelper::trash('languages.trash'); JToolbarHelper::divider(); @@ -90,7 +96,7 @@ protected function addToolbar() if ($canDo->get('core.admin')) { - // Add install languages link to the lang installer component + // Add install languages link to the lang installer component. $bar = JToolbar::getInstance('toolbar'); $bar->appendButton('Link', 'upload', 'COM_LANGUAGES_INSTALL', 'index.php?option=com_installer&view=languages'); JToolbarHelper::divider(); @@ -117,9 +123,9 @@ protected function addToolbar() } /** - * Returns an array of fields the table can be sorted by + * Returns an array of fields the table can be sorted by. * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value. * * @since 3.0 */ diff --git a/administrator/components/com_languages/views/multilangstatus/view.html.php b/administrator/components/com_languages/views/multilangstatus/view.html.php index 56a166110ac23..adfa47f3015e6 100644 --- a/administrator/components/com_languages/views/multilangstatus/view.html.php +++ b/administrator/components/com_languages/views/multilangstatus/view.html.php @@ -12,14 +12,16 @@ /** * Displays the multilang status. * - * @package Joomla.Administrator - * @subpackage com_languages - * @since 1.7.1 + * @since 1.7.1 */ class LanguagesViewMultilangstatus extends JViewLegacy { /** - * Display the view + * Display the view. + * + * @param string $tpl The name of the template file to parse. + * + * @return void */ public function display($tpl = null) { diff --git a/administrator/components/com_languages/views/override/view.html.php b/administrator/components/com_languages/views/override/view.html.php index 681f16300586c..0800c5a6fdf82 100644 --- a/administrator/components/com_languages/views/override/view.html.php +++ b/administrator/components/com_languages/views/override/view.html.php @@ -12,14 +12,12 @@ /** * View to edit an language override * - * @package Joomla.Administrator - * @subpackage com_languages - * @since 2.5 + * @since 2.5 */ class LanguagesViewOverride extends JViewLegacy { /** - * The form to use for the view + * The form to use for the view. * * @var object * @since 2.5 @@ -27,7 +25,7 @@ class LanguagesViewOverride extends JViewLegacy protected $form; /** - * The item to edit + * The item to edit. * * @var object * @since 2.5 @@ -35,7 +33,7 @@ class LanguagesViewOverride extends JViewLegacy protected $item; /** - * The model state + * The model state. * * @var object * @since 2.5 @@ -43,13 +41,13 @@ class LanguagesViewOverride extends JViewLegacy protected $state; /** - * Displays the view + * Displays the view. * - * @param string $tpl The name of the template file to parse + * @param string $tpl The name of the template file to parse * * @return void * - * @since 2.5 + * @since 2.5 */ public function display($tpl = null) { @@ -61,20 +59,24 @@ public function display($tpl = null) $this->item = $this->get('Item'); $this->state = $this->get('State'); - // Check for errors + // Check for errors. if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors)); } - // Check whether the cache has to be refreshed - $cached_time = JFactory::getApplication()->getUserState('com_languages.overrides.cachedtime.'.$this->state->get('filter.client').'.'.$this->state->get('filter.language'), 0); + // Check whether the cache has to be refreshed. + $cached_time = JFactory::getApplication()->getUserState( + 'com_languages.overrides.cachedtime.' . $this->state->get('filter.client') . '.' . $this->state->get('filter.language'), + 0 + ); + if (time() - $cached_time > 60 * 5) { $this->state->set('cache_expired', true); } - // Add strings for translations in Javascript + // Add strings for translations in Javascript. JText::script('COM_LANGUAGES_VIEW_OVERRIDE_NO_RESULTS'); JText::script('COM_LANGUAGES_VIEW_OVERRIDE_REQUEST_ERROR'); @@ -83,7 +85,7 @@ public function display($tpl = null) } /** - * Adds the page title and toolbar + * Adds the page title and toolbar. * * @return void * @@ -103,8 +105,7 @@ protected function addToolbar() JToolbarHelper::save('override.save'); } - // This component does not support Save as Copy - + // This component does not support Save as Copy. if ($canDo->get('core.edit') && $canDo->get('core.create')) { JToolbarHelper::save2new('override.save2new'); @@ -118,6 +119,7 @@ protected function addToolbar() { JToolbarHelper::cancel('override.cancel', 'JTOOLBAR_CLOSE'); } + JToolbarHelper::divider(); JToolbarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_OVERRIDES_EDIT'); } diff --git a/administrator/components/com_languages/views/overrides/view.html.php b/administrator/components/com_languages/views/overrides/view.html.php index 18932118a039e..09f7662245d38 100644 --- a/administrator/components/com_languages/views/overrides/view.html.php +++ b/administrator/components/com_languages/views/overrides/view.html.php @@ -10,16 +10,14 @@ defined('_JEXEC') or die; /** - * View for language overrides list + * View for language overrides list. * - * @package Joomla.Administrator - * @subpackage com_languages - * @since 2.5 + * @since 2.5 */ class LanguagesViewOverrides extends JViewLegacy { /** - * The items to list + * The items to list. * * @var array * @since 2.5 @@ -27,7 +25,7 @@ class LanguagesViewOverrides extends JViewLegacy protected $items; /** - * The pagination object + * The pagination object. * * @var object * @since 2.5 @@ -35,7 +33,7 @@ class LanguagesViewOverrides extends JViewLegacy protected $pagination; /** - * The model state + * The model state. * * @var object * @since 2.5 @@ -43,13 +41,13 @@ class LanguagesViewOverrides extends JViewLegacy protected $state; /** - * Displays the view + * Displays the view. * - * @param string $tpl The name of the template file to parse + * @param string $tpl The name of the template file to parse. * * @return void * - * @since 2.5 + * @since 2.5 */ public function display($tpl = null) { @@ -60,7 +58,7 @@ public function display($tpl = null) LanguagesHelper::addSubmenu('overrides'); - // Check for errors + // Check for errors. if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors)); @@ -71,11 +69,11 @@ public function display($tpl = null) } /** - * Adds the page title and toolbar + * Adds the page title and toolbar. * * @return void * - * @since 2.5 + * @since 2.5 */ protected function addToolbar() { @@ -103,6 +101,7 @@ protected function addToolbar() { JToolbarHelper::preferences('com_languages'); } + JToolbarHelper::divider(); JToolbarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_OVERRIDES'); diff --git a/administrator/components/com_login/controller.php b/administrator/components/com_login/controller.php index 73ee4bcebd7ca..ada1c6ef2d9f0 100644 --- a/administrator/components/com_login/controller.php +++ b/administrator/components/com_login/controller.php @@ -10,31 +10,29 @@ defined('_JEXEC') or die; /** - * Login Controller + * Login Controller. * - * @package Joomla.Administrator - * @subpackage com_login - * @since 1.5 + * @since 1.5 */ class LoginController extends JControllerLegacy { /** - * Typical view method for MVC based architecture + * Method to display a view. * - * This function is provide as a default implementation, in most cases - * you will need to override it in your own controllers. + * @param boolean $cachable If true, the view output will be cached + * @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * - * @param boolean If true, the view output will be cached - * @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * @return JController This object to support chaining. + * * @since 1.5 */ public function display($cachable = false, $urlparams = false) { - // Special treatment is required for this component, as this view may be called - // after a session timeout. We must reset the view and layout prior to display - // otherwise an error will occur. - + /* + * Special treatment is required for this component, as this view may be called + * after a session timeout. We must reset the view and layout prior to display + * otherwise an error will occur. + */ $this->input->set('view', 'login'); $this->input->set('layout', 'default'); diff --git a/administrator/components/com_login/login.php b/administrator/components/com_login/login.php index 7572105640d91..5080eeda79b52 100644 --- a/administrator/components/com_login/login.php +++ b/administrator/components/com_login/login.php @@ -11,6 +11,7 @@ $input = JFactory::getApplication()->input; $task = $input->get('task'); + if ($task != 'login' && $task != 'logout') { $input->set('task', ''); diff --git a/administrator/components/com_login/models/login.php b/administrator/components/com_login/models/login.php index 75934dbfaf2a9..634ab9263a0a0 100644 --- a/administrator/components/com_login/models/login.php +++ b/administrator/components/com_login/models/login.php @@ -12,9 +12,7 @@ /** * Login Model * - * @package Joomla.Administrator - * @subpackage com_login - * @since 1.5 + * @since 1.5 */ class LoginModelLogin extends JModelLegacy { @@ -41,7 +39,7 @@ protected function populateState() ); $this->setState('credentials', $credentials); - // Check for return URL from the request first + // Check for return URL from the request first. if ($return = $input->$method->get('return', '', 'BASE64')) { $return = base64_decode($return); @@ -62,12 +60,12 @@ protected function populateState() } /** - * Get the administrator login module by name (real, eg 'login' or folder, eg 'mod_login') + * Get the administrator login module by name (real, eg 'login' or folder, eg 'mod_login'). * - * @param string $name The name of the module - * @param string $title The title of the module, optional + * @param string $name The name of the module. + * @param string $title The title of the module, optional. * - * @return object The Module object + * @return object The Module object. * * @since 11.1 */ @@ -79,7 +77,7 @@ public static function getLoginModule($name = 'mod_login', $title = null) for ($i = 0; $i < $total; $i++) { - // Match the title if we're looking for a specific instance of the module + // Match the title if we're looking for a specific instance of the module. if (!$title || $modules[$i]->title == $title) { $result = $modules[$i]; @@ -87,7 +85,7 @@ public static function getLoginModule($name = 'mod_login', $title = null) } } - // If we didn't find it, and the name is mod_something, create a dummy object + // If we didn't find it, and the name is mod_something, create a dummy object. if (is_null($result) && substr($name, 0, 4) == 'mod_') { $result = new stdClass; @@ -114,7 +112,7 @@ public static function getLoginModule($name = 'mod_login', $title = null) * This is put in as a failsafe to avoid super user lock out caused by an unpublished * login module or by a module set to have a viewing access level that is not Public. * - * @param string $module The name of the module + * @param string $module The name of the module. * * @return array * @@ -145,11 +143,10 @@ protected static function _load($module) ->select('m.id, m.title, m.module, m.position, m.showtitle, m.params') ->from('#__modules AS m') ->where('m.module =' . $db->quote($module) . ' AND m.client_id = 1') - ->join('LEFT', '#__extensions AS e ON e.element = m.module AND e.client_id = m.client_id') ->where('e.enabled = 1'); - // Filter by language + // Filter by language. if ($app->isSite() && $app->getLanguageFilter()) { $query->where('m.language IN (' . $db->quote($lang) . ',' . $db->quote('*') . ')'); @@ -157,7 +154,7 @@ protected static function _load($module) $query->order('m.position, m.ordering'); - // Set the query + // Set the query. $db->setQuery($query); try diff --git a/administrator/components/com_login/views/login/view.html.php b/administrator/components/com_login/views/login/view.html.php index 09f0949aec481..ff03f2ad379ef 100644 --- a/administrator/components/com_login/views/login/view.html.php +++ b/administrator/components/com_login/views/login/view.html.php @@ -12,9 +12,7 @@ /** * HTML View class for the Login component * - * @package Joomla.Administrator - * @subpackage com_login - * @since 1.6 + * @since 1.6 */ class LoginViewLogin extends JViewLegacy { diff --git a/administrator/components/com_media/controller.php b/administrator/components/com_media/controller.php index 82405c5a0a00a..1d47c69d9cc4a 100644 --- a/administrator/components/com_media/controller.php +++ b/administrator/components/com_media/controller.php @@ -12,9 +12,7 @@ /** * Media Manager Component Controller * - * @package Joomla.Administrator - * @subpackage com_media - * @since 1.5 + * @since 1.5 */ class MediaController extends JControllerLegacy { diff --git a/administrator/components/com_media/controllers/file.json.php b/administrator/components/com_media/controllers/file.json.php index fae5c6023acd9..3a4a6f31ddcc0 100644 --- a/administrator/components/com_media/controllers/file.json.php +++ b/administrator/components/com_media/controllers/file.json.php @@ -15,9 +15,7 @@ /** * File Media Controller * - * @package Joomla.Administrator - * @subpackage com_media - * @since 1.6 + * @since 1.6 */ class MediaControllerFile extends JControllerLegacy { diff --git a/administrator/components/com_media/controllers/file.php b/administrator/components/com_media/controllers/file.php index 618f964a09148..4316e9c6da2d4 100644 --- a/administrator/components/com_media/controllers/file.php +++ b/administrator/components/com_media/controllers/file.php @@ -15,9 +15,7 @@ /** * Media File Controller * - * @package Joomla.Administrator - * @subpackage com_media - * @since 1.5 + * @since 1.5 */ class MediaControllerFile extends JControllerLegacy { diff --git a/administrator/components/com_media/controllers/folder.php b/administrator/components/com_media/controllers/folder.php index b8c1e68de93f4..4541c25610195 100644 --- a/administrator/components/com_media/controllers/folder.php +++ b/administrator/components/com_media/controllers/folder.php @@ -15,9 +15,7 @@ /** * Folder Media Controller * - * @package Joomla.Administrator - * @subpackage com_media - * @since 1.5 + * @since 1.5 */ class MediaControllerFolder extends JControllerLegacy { diff --git a/administrator/components/com_media/helpers/media.php b/administrator/components/com_media/helpers/media.php index 6e03d057b928e..43f81894249e9 100644 --- a/administrator/components/com_media/helpers/media.php +++ b/administrator/components/com_media/helpers/media.php @@ -10,9 +10,9 @@ defined('_JEXEC') or die; /** - * @package Joomla.Administrator - * @subpackage com_media - * @since 1.5 + * Media helper class. + * + * @since 1.6 * @deprecated 4.0 Use JHelperMedia instead */ abstract class MediaHelper diff --git a/administrator/components/com_media/models/list.php b/administrator/components/com_media/models/list.php index 09fde76aba382..c3e954e3a0abc 100644 --- a/administrator/components/com_media/models/list.php +++ b/administrator/components/com_media/models/list.php @@ -15,9 +15,7 @@ /** * Media Component List Model * - * @package Joomla.Administrator - * @subpackage com_media - * @since 1.5 + * @since 1.5 */ class MediaModelList extends JModelLegacy { diff --git a/administrator/components/com_media/models/manager.php b/administrator/components/com_media/models/manager.php index b99f2b2bd9b15..4f3ba450362c0 100644 --- a/administrator/components/com_media/models/manager.php +++ b/administrator/components/com_media/models/manager.php @@ -12,9 +12,7 @@ /** * Media Component Manager Model * - * @package Joomla.Administrator - * @subpackage com_media - * @since 1.5 + * @since 1.5 */ class MediaModelManager extends JModelLegacy { diff --git a/administrator/components/com_media/views/images/view.html.php b/administrator/components/com_media/views/images/view.html.php index f2937e091c4a8..038dff873b46d 100644 --- a/administrator/components/com_media/views/images/view.html.php +++ b/administrator/components/com_media/views/images/view.html.php @@ -12,9 +12,7 @@ /** * HTML View class for the Media component * - * @package Joomla.Administrator - * @subpackage com_media - * @since 1.0 + * @since 1.0 */ class MediaViewImages extends JViewLegacy { diff --git a/administrator/components/com_media/views/imageslist/view.html.php b/administrator/components/com_media/views/imageslist/view.html.php index 2647e71729b4f..90d7eb692b73f 100644 --- a/administrator/components/com_media/views/imageslist/view.html.php +++ b/administrator/components/com_media/views/imageslist/view.html.php @@ -12,9 +12,7 @@ /** * HTML View class for the Media component * - * @package Joomla.Administrator - * @subpackage com_media - * @since 1.0 + * @since 1.0 */ class MediaViewImagesList extends JViewLegacy { diff --git a/administrator/components/com_media/views/media/view.html.php b/administrator/components/com_media/views/media/view.html.php index 18d5740ae0928..2e4a8b9520773 100644 --- a/administrator/components/com_media/views/media/view.html.php +++ b/administrator/components/com_media/views/media/view.html.php @@ -15,9 +15,7 @@ /** * HTML View class for the Media component * - * @package Joomla.Administrator - * @subpackage com_media - * @since 1.0 + * @since 1.0 */ class MediaViewMedia extends JViewLegacy { diff --git a/administrator/components/com_media/views/medialist/view.html.php b/administrator/components/com_media/views/medialist/view.html.php index 6353b325fafc5..c312d462168a8 100644 --- a/administrator/components/com_media/views/medialist/view.html.php +++ b/administrator/components/com_media/views/medialist/view.html.php @@ -12,9 +12,7 @@ /** * HTML View class for the Media component * - * @package Joomla.Administrator - * @subpackage com_media - * @since 1.0 + * @since 1.0 */ class MediaViewMediaList extends JViewLegacy { diff --git a/administrator/components/com_menus/controller.php b/administrator/components/com_menus/controller.php index 1e88225a6b32c..9aed354640f67 100644 --- a/administrator/components/com_menus/controller.php +++ b/administrator/components/com_menus/controller.php @@ -12,9 +12,7 @@ /** * Base controller class for Menu Manager. * - * @package Joomla.Administrator - * @subpackage com_menus - * @since 1.6 + * @since 1.6 */ class MenusController extends JControllerLegacy { diff --git a/administrator/components/com_menus/controllers/item.php b/administrator/components/com_menus/controllers/item.php index 3743d776998a3..28c66f460e3d1 100644 --- a/administrator/components/com_menus/controllers/item.php +++ b/administrator/components/com_menus/controllers/item.php @@ -12,9 +12,7 @@ /** * The Menu Item Controller * - * @package Joomla.Administrator - * @subpackage com_menus - * @since 1.6 + * @since 1.6 */ class MenusControllerItem extends JControllerForm { diff --git a/administrator/components/com_menus/controllers/items.php b/administrator/components/com_menus/controllers/items.php index 2f1faf8446b28..0aa210a176fa1 100644 --- a/administrator/components/com_menus/controllers/items.php +++ b/administrator/components/com_menus/controllers/items.php @@ -12,9 +12,7 @@ /** * The Menu Item Controller * - * @package Joomla.Administrator - * @subpackage com_menus - * @since 1.6 + * @since 1.6 */ class MenusControllerItems extends JControllerAdmin { diff --git a/administrator/components/com_menus/controllers/menu.php b/administrator/components/com_menus/controllers/menu.php index 31e154410e06a..ffd2b253d4231 100644 --- a/administrator/components/com_menus/controllers/menu.php +++ b/administrator/components/com_menus/controllers/menu.php @@ -12,9 +12,7 @@ /** * The Menu Type Controller * - * @package Joomla.Administrator - * @subpackage com_menus - * @since 1.6 + * @since 1.6 */ class MenusControllerMenu extends JControllerForm { diff --git a/administrator/components/com_menus/controllers/menus.php b/administrator/components/com_menus/controllers/menus.php index 5ceddda8f8e90..a66d87fe8a822 100644 --- a/administrator/components/com_menus/controllers/menus.php +++ b/administrator/components/com_menus/controllers/menus.php @@ -12,9 +12,7 @@ /** * The Menu List Controller * - * @package Joomla.Administrator - * @subpackage com_menus - * @since 1.6 + * @since 1.6 */ class MenusControllerMenus extends JControllerLegacy { diff --git a/administrator/components/com_menus/helpers/menus.php b/administrator/components/com_menus/helpers/menus.php index d522fd8998d9b..7a19d20c11094 100644 --- a/administrator/components/com_menus/helpers/menus.php +++ b/administrator/components/com_menus/helpers/menus.php @@ -12,9 +12,7 @@ /** * Menus component helper. * - * @package Joomla.Administrator - * @subpackage com_menus - * @since 1.6 + * @since 1.6 */ class MenusHelper { diff --git a/administrator/components/com_menus/models/fields/menuordering.php b/administrator/components/com_menus/models/fields/menuordering.php index 83899d227348f..ea7dffae4c181 100644 --- a/administrator/components/com_menus/models/fields/menuordering.php +++ b/administrator/components/com_menus/models/fields/menuordering.php @@ -14,9 +14,7 @@ /** * Form Field class for the Joomla Framework. * - * @package Joomla.Administrator - * @subpackage com_menus - * @since 1.6 + * @since 1.6 */ class JFormFieldMenuOrdering extends JFormFieldList { diff --git a/administrator/components/com_menus/models/fields/menuparent.php b/administrator/components/com_menus/models/fields/menuparent.php index a96614471f7de..d2d6839c4b4ad 100644 --- a/administrator/components/com_menus/models/fields/menuparent.php +++ b/administrator/components/com_menus/models/fields/menuparent.php @@ -14,9 +14,7 @@ /** * Form Field class for the Joomla Framework. * - * @package Joomla.Administrator - * @subpackage com_menus - * @since 1.6 + * @since 1.6 */ class JFormFieldMenuParent extends JFormFieldList { diff --git a/administrator/components/com_menus/models/fields/menutype.php b/administrator/components/com_menus/models/fields/menutype.php index 163803a0db439..ac7627387a640 100644 --- a/administrator/components/com_menus/models/fields/menutype.php +++ b/administrator/components/com_menus/models/fields/menutype.php @@ -14,9 +14,7 @@ /** * Form Field class for the Joomla Framework. * - * @package Joomla.Administrator - * @subpackage com_menus - * @since 1.6 + * @since 1.6 */ class JFormFieldMenutype extends JFormFieldList { @@ -69,11 +67,46 @@ protected function getInput() $value = JText::_(JArrayHelper::getValue($rlu, MenusHelper::getLinkKey($link))); break; } - // Load the javascript and css - JHtml::_('behavior.framework'); - JHtml::_('behavior.modal'); - $html[] = ' '.JText::_('JSELECT').''; + // Include jQuery + JHtml::_('jquery.framework'); + JHtml::_('bootstrap.modal'); + + // Build the script. + $script = array(); + $script[] = ' function jSelectPosition_' . $this->id . '(name) {'; + $script[] = ' document.getElementById("' . $this->id . '").value = name;'; + $script[] = ' jQuery("#menuTypeModal").modal("hide");'; + $script[] = ' }'; + + // Add normalized style. + $style = '@media only screen and (min-width : 768px) { + #menuTypeModal { + width: 80% !important; + margin-left:-40% !important; + height:auto; + } + #menuTypeModal #menuTypeModal-container .modal-body iframe { + margin:0; + padding:0; + display:block; + width:100%; + height:600px !important; + border:none; + } + }'; + + // Add the script to the document head. + JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); + JFactory::getDocument()->addStyleDeclaration($style); + + $link = JRoute::_('index.php?option=com_menus&view=menutypes&tmpl=component&recordId='.$recordId); + + $html[] = ''; + + $html[] = ' '.JText::_('JSELECT').''; + $html[] = JHtmlBootstrap::renderModal('menuTypeModal', array( 'url' => $link, 'title' => JText::_('COM_MENUS_ITEM_FIELD_TYPE_LABEL'),'height' => '800px', 'width' => '800px'), ''); + $html[] = ''; return implode("\n", $html); diff --git a/administrator/components/com_menus/models/item.php b/administrator/components/com_menus/models/item.php index 5ad95076e5426..d14f111556e77 100644 --- a/administrator/components/com_menus/models/item.php +++ b/administrator/components/com_menus/models/item.php @@ -15,9 +15,7 @@ /** * Menu Item Model for Menus. * - * @package Joomla.Administrator - * @subpackage com_menus - * @since 1.6 + * @since 1.6 */ class MenusModelItem extends JModelAdmin { diff --git a/administrator/components/com_menus/models/items.php b/administrator/components/com_menus/models/items.php index 1f052d02aa4d5..d039075fa632f 100644 --- a/administrator/components/com_menus/models/items.php +++ b/administrator/components/com_menus/models/items.php @@ -12,9 +12,7 @@ /** * Menu Item List Model for Menus. * - * @package Joomla.Administrator - * @subpackage com_menus - * @since 1.6 + * @since 1.6 */ class MenusModelItems extends JModelList { @@ -73,7 +71,7 @@ protected function populateState($ordering = null, $direction = null) { $app = JFactory::getApplication('administrator'); - $parentId = $this->getUserStateFromRequest($this->context . '.filter.parent_id', 'filter_parent_id', 0, 'int'); + $parentId = $this->getUserStateFromRequest($this->context . '.filter.parent_id', 'filter_parent_id'); $this->setState('filter.parent_id', $parentId); $search = $this->getUserStateFromRequest($this->context . '.search', 'filter_search'); @@ -82,13 +80,13 @@ protected function populateState($ordering = null, $direction = null) $published = $this->getUserStateFromRequest($this->context . '.published', 'filter_published', ''); $this->setState('filter.published', $published); - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); + $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access'); $this->setState('filter.access', $access); - $parentId = $this->getUserStateFromRequest($this->context . '.filter.parent_id', 'filter_parent_id', 0, 'int'); + $parentId = $this->getUserStateFromRequest($this->context . '.filter.parent_id', 'filter_parent_id'); $this->setState('filter.parent_id', $parentId); - $level = $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level', 0, 'int'); + $level = $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level'); $this->setState('filter.level', $level); $menuType = $app->input->getString('menutype', null); diff --git a/administrator/components/com_menus/models/menu.php b/administrator/components/com_menus/models/menu.php index 76df61056e5a9..6744631324859 100644 --- a/administrator/components/com_menus/models/menu.php +++ b/administrator/components/com_menus/models/menu.php @@ -12,9 +12,7 @@ /** * Menu Item Model for Menus. * - * @package Joomla.Administrator - * @subpackage com_menus - * @since 1.6 + * @since 1.6 */ class MenusModelMenu extends JModelForm { diff --git a/administrator/components/com_menus/models/menus.php b/administrator/components/com_menus/models/menus.php index 1f753afb85e4e..bd759a95ebade 100644 --- a/administrator/components/com_menus/models/menus.php +++ b/administrator/components/com_menus/models/menus.php @@ -12,9 +12,7 @@ /** * Menu List Model for Menus. * - * @package Joomla.Administrator - * @subpackage com_menus - * @since 1.6 + * @since 1.6 */ class MenusModelMenus extends JModelList { diff --git a/administrator/components/com_menus/models/menutypes.php b/administrator/components/com_menus/models/menutypes.php index 401b615dda457..20d66ce756384 100644 --- a/administrator/components/com_menus/models/menutypes.php +++ b/administrator/components/com_menus/models/menutypes.php @@ -14,9 +14,7 @@ /** * Menu Item Types Model for Menus. * - * @package Joomla.Administrator - * @subpackage com_menus - * @since 1.6 + * @since 1.6 */ class MenusModelMenutypes extends JModelLegacy { diff --git a/administrator/components/com_menus/tables/menu.php b/administrator/components/com_menus/tables/menu.php index 0afac7a1e3d6d..506fbcaed2291 100644 --- a/administrator/components/com_menus/tables/menu.php +++ b/administrator/components/com_menus/tables/menu.php @@ -12,8 +12,6 @@ /** * Menu table * - * @package Joomla.Administrator - * @subpackage com_menus */ class MenusTableMenu extends JTableMenu { diff --git a/administrator/components/com_menus/views/item/tmpl/edit.php b/administrator/components/com_menus/views/item/tmpl/edit.php index 2789dd0e762f6..4d889cf8f2eae 100644 --- a/administrator/components/com_menus/views/item/tmpl/edit.php +++ b/administrator/components/com_menus/views/item/tmpl/edit.php @@ -13,9 +13,10 @@ JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); JHtml::_('behavior.framework'); +JHtml::_('behavior.core'); JHtml::_('behavior.formvalidation'); -JHtml::_('behavior.modal'); JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.tabstate'); JText::script('ERROR'); JText::script('JGLOBAL_VALIDATION_FORM_FAILED'); diff --git a/administrator/components/com_menus/views/item/tmpl/edit_modules.php b/administrator/components/com_menus/views/item/tmpl/edit_modules.php index f6adeb302c641..77a2d14d3cd6d 100644 --- a/administrator/components/com_menus/views/item/tmpl/edit_modules.php +++ b/administrator/components/com_menus/views/item/tmpl/edit_modules.php @@ -9,18 +9,49 @@ defined('_JEXEC') or die; -JHtml::_('behavior.framework', true); +JHtml::_('behavior.framework'); +// Include jQuery +JHtml::_('behavior.core'); +JHtml::_('bootstrap.modal'); $script = array(); -$script[] = " window.addEvent('domready', function() {"; -$script[] = " document.id('showmods').addEvent('click', function(e) {"; -$script[] = " document.id('showmods').setStyle('display', 'block');"; +$script[] = "jQuery(document).ready(function() {"; +$script[] = " jQuery('#showmods').click(function() {"; +$script[] = " jQuery('#showmods').css('display', 'block');"; $script[] = " jQuery('.table tr.no').toggle();"; -$script[] = " });"; -$script[] = " })"; +$script[] = " });"; +$script[] = ' jQuery("#moduleModal").on("hidden", function () {'; +$script[] = ' setTimeout(function(){'; +$script[] = ' window.parent.location.reload();'; +$script[] = ' },1000);'; +$script[] = ' });'; +$script[] = ' function jSelectPosition_' . $this->id . '(name) {'; +$script[] = ' document.getElementById("' . $this->id . '").value = name;'; +$script[] = ' jQuery("#moduleModal").modal("hide");'; +$script[] = ' }'; +$script[] = "});"; + +// Add normalized style. +$style = '@media only screen and (min-width : 768px) { + #moduleModal { + width: 80% !important; + margin-left:-40% !important; + height:auto; + } + #moduleModal #moduleModal-container .modal-body iframe { + margin:0; + padding:0; + display:block; + width:100%; + height:600px !important; + border:none; + } + }'; // Add the script to the document head. JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); +JFactory::getDocument()->addStyleDeclaration($style); + ?>
@@ -54,7 +85,7 @@ id . '&tmpl=component&view=module&layout=modal'; ?> - + escape($module->title), $this->escape($module->access_title), $this->escape($module->position)); ?> @@ -86,3 +117,5 @@ + + $link, 'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'),'height' => '800px', 'width' => '800px'), ''); ?> diff --git a/administrator/components/com_menus/views/item/view.html.php b/administrator/components/com_menus/views/item/view.html.php index 2c7b8d4d5ee8e..7c5b294d9e416 100644 --- a/administrator/components/com_menus/views/item/view.html.php +++ b/administrator/components/com_menus/views/item/view.html.php @@ -12,9 +12,7 @@ /** * The HTML Menus Menu Item View. * - * @package Joomla.Administrator - * @subpackage com_menus - * @since 1.6 + * @since 1.6 */ class MenusViewItem extends JViewLegacy { diff --git a/administrator/components/com_menus/views/items/view.html.php b/administrator/components/com_menus/views/items/view.html.php index ee665deeceae5..b0c31c0b56726 100644 --- a/administrator/components/com_menus/views/items/view.html.php +++ b/administrator/components/com_menus/views/items/view.html.php @@ -12,9 +12,7 @@ /** * The HTML Menus Menu Items View. * - * @package Joomla.Administrator - * @subpackage com_menus - * @since 1.6 + * @since 1.6 */ class MenusViewItems extends JViewLegacy { diff --git a/administrator/components/com_menus/views/menu/view.html.php b/administrator/components/com_menus/views/menu/view.html.php index 5f2cbf4bad242..9787fe181b21f 100644 --- a/administrator/components/com_menus/views/menu/view.html.php +++ b/administrator/components/com_menus/views/menu/view.html.php @@ -12,9 +12,7 @@ /** * The HTML Menus Menu Item View. * - * @package Joomla.Administrator - * @subpackage com_menus - * @since 1.6 + * @since 1.6 */ class MenusViewMenu extends JViewLegacy { diff --git a/administrator/components/com_menus/views/menus/tmpl/default.php b/administrator/components/com_menus/views/menus/tmpl/default.php index ca6bb0f09c2ad..c29491dc84f34 100644 --- a/administrator/components/com_menus/views/menus/tmpl/default.php +++ b/administrator/components/com_menus/views/menus/tmpl/default.php @@ -12,11 +12,51 @@ // Include the component HTML helpers. JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); +// Include jQuery +JHtml::_('behavior.core'); +JHtml::_('bootstrap.modal'); JHtml::_('bootstrap.tooltip'); JHtml::_('behavior.multiselect'); -JHtml::_('behavior.modal'); JHtml::_('formbehavior.chosen', 'select'); +$script = array(); +$script[] = "jQuery(document).ready(function() {"; +$script[] = ' function jSelectPosition_' . $this->id . '(name) {'; +$script[] = ' document.getElementById("' . $this->id . '").value = name;'; +$script[] = ' jQuery("#menusModuleModal").modal("hide");'; +$script[] = ' };'; +$script[] = ' jQuery("#moduleModal").on("hidden", function () {'; +$script[] = ' setTimeout(function(){'; +$script[] = ' window.parent.location.reload();'; +$script[] = ' },1000);'; +$script[] = ' });'; +$script[] = "});"; + +// Add normalized style. +$style = 'div#moduleModal.modal.hide {display: block;} +@media only screen and (min-width : 768px) { + #moduleModal { + width: 80% !important; + margin-left:-40% !important; + height:auto; + } + .modal-body { + max-height: 1000px; + } + #moduleModal #moduleModal-container .modal-body iframe { + margin:0; + padding:0; + display:block; + width:100%; + height:800px !important; + border:none; + } + }'; + +// Add the script to the document head. +JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); +JFactory::getDocument()->addStyleDeclaration($style); + $uri = JUri::getInstance(); $return = base64_encode($uri); $user = JFactory::getUser(); @@ -136,8 +176,10 @@ modules[$item->menutype] as &$module) : ?>
  • - + id.'&return='.$return.'&tmpl=component&layout=modal'); ?> + escape($module->title), $this->escape($module->access_title), $this->escape($module->position)); ?> + escape($module->title), $this->escape($module->access_title), $this->escape($module->position)); ?> @@ -158,6 +200,8 @@ + $link, 'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'),'height' => '800px', 'width' => '800px'), ''); ?> + diff --git a/administrator/components/com_menus/views/menus/view.html.php b/administrator/components/com_menus/views/menus/view.html.php index 3b89d1cb457a5..51180be0c8452 100644 --- a/administrator/components/com_menus/views/menus/view.html.php +++ b/administrator/components/com_menus/views/menus/view.html.php @@ -12,9 +12,7 @@ /** * The HTML Menus Menu Menus View. * - * @package Joomla.Administrator - * @subpackage com_menus - * @since 1.6 + * @since 1.6 */ class MenusViewMenus extends JViewLegacy { diff --git a/administrator/components/com_menus/views/menutypes/view.html.php b/administrator/components/com_menus/views/menutypes/view.html.php index 8376f4d4f7eec..67cebd9197d9a 100644 --- a/administrator/components/com_menus/views/menutypes/view.html.php +++ b/administrator/components/com_menus/views/menutypes/view.html.php @@ -12,9 +12,7 @@ /** * The HTML Menus Menu Item TYpes View. * - * @package Joomla.Administrator - * @subpackage com_menus - * @since 1.6 + * @since 1.6 */ class MenusViewMenutypes extends JViewLegacy { diff --git a/administrator/components/com_messages/controller.php b/administrator/components/com_messages/controller.php index 7b0e3aa2a3f3c..64937e2f098ce 100644 --- a/administrator/components/com_messages/controller.php +++ b/administrator/components/com_messages/controller.php @@ -12,9 +12,7 @@ /** * Messages master display controller. * - * @package Joomla.Administrator - * @subpackage com_messages - * @since 1.6 + * @since 1.6 */ class MessagesController extends JControllerLegacy { diff --git a/administrator/components/com_messages/controllers/config.php b/administrator/components/com_messages/controllers/config.php index 59deec7272495..e7f7f04ca2721 100644 --- a/administrator/components/com_messages/controllers/config.php +++ b/administrator/components/com_messages/controllers/config.php @@ -12,9 +12,7 @@ /** * Messages Component Message Model * - * @package Joomla.Administrator - * @subpackage com_messages - * @since 1.6 + * @since 1.6 */ class MessagesControllerConfig extends JControllerLegacy { diff --git a/administrator/components/com_messages/controllers/message.php b/administrator/components/com_messages/controllers/message.php index 8c0dc090a1bd2..3b1624977f04a 100644 --- a/administrator/components/com_messages/controllers/message.php +++ b/administrator/components/com_messages/controllers/message.php @@ -12,9 +12,7 @@ /** * Messages Component Message Model * - * @package Joomla.Administrator - * @subpackage com_messages - * @since 1.6 + * @since 1.6 */ class MessagesControllerMessage extends JControllerForm { diff --git a/administrator/components/com_messages/controllers/messages.php b/administrator/components/com_messages/controllers/messages.php index faeada02c3745..5c1fd89fb81e7 100644 --- a/administrator/components/com_messages/controllers/messages.php +++ b/administrator/components/com_messages/controllers/messages.php @@ -12,9 +12,7 @@ /** * Messages list controller class. * - * @package Joomla.Administrator - * @subpackage com_messages - * @since 1.6 + * @since 1.6 */ class MessagesControllerMessages extends JControllerAdmin { diff --git a/administrator/components/com_messages/helpers/html/messages.php b/administrator/components/com_messages/helpers/html/messages.php index 2e78db3514f40..8163af454b28e 100644 --- a/administrator/components/com_messages/helpers/html/messages.php +++ b/administrator/components/com_messages/helpers/html/messages.php @@ -10,9 +10,9 @@ defined('_JEXEC') or die; /** - * @package Joomla.Administrator - * @subpackage com_messages - * @since 1.6 + * JHtml administrator messages class. + * + * @since 1.6 */ class JHtmlMessages { diff --git a/administrator/components/com_messages/helpers/messages.php b/administrator/components/com_messages/helpers/messages.php index f8689c8b9a3f9..9708ead5b6a5f 100644 --- a/administrator/components/com_messages/helpers/messages.php +++ b/administrator/components/com_messages/helpers/messages.php @@ -10,9 +10,9 @@ defined('_JEXEC') or die; /** - * @package Joomla.Administrator - * @subpackage com_messages - * @since 1.6 + * Messages helper class. + * + * @since 1.6 */ class MessagesHelper { diff --git a/administrator/components/com_messages/models/config.php b/administrator/components/com_messages/models/config.php index b6e2ed1cab906..e38a189e20148 100644 --- a/administrator/components/com_messages/models/config.php +++ b/administrator/components/com_messages/models/config.php @@ -12,9 +12,7 @@ /** * Message configuration model. * - * @package Joomla.Administrator - * @subpackage com_messages - * @since 1.6 + * @since 1.6 */ class MessagesModelConfig extends JModelForm { diff --git a/administrator/components/com_messages/models/fields/usermessages.php b/administrator/components/com_messages/models/fields/usermessages.php index aaf82db7e4a38..612cd92bb8347 100644 --- a/administrator/components/com_messages/models/fields/usermessages.php +++ b/administrator/components/com_messages/models/fields/usermessages.php @@ -14,9 +14,7 @@ /** * Supports an modal select of user that have access to com_messages * - * @package Joomla.Administrator - * @subpackage com_messages - * @since 1.6 + * @since 1.6 */ class JFormFieldUserMessages extends JFormFieldUser { diff --git a/administrator/components/com_messages/models/message.php b/administrator/components/com_messages/models/message.php index 039eb1e52f577..6e12257076fe2 100644 --- a/administrator/components/com_messages/models/message.php +++ b/administrator/components/com_messages/models/message.php @@ -12,9 +12,7 @@ /** * Private Message model. * - * @package Joomla.Administrator - * @subpackage com_messages - * @since 1.6 + * @since 1.6 */ class MessagesModelMessage extends JModelAdmin { diff --git a/administrator/components/com_messages/models/messages.php b/administrator/components/com_messages/models/messages.php index 02580e15f175a..044860dae24fa 100644 --- a/administrator/components/com_messages/models/messages.php +++ b/administrator/components/com_messages/models/messages.php @@ -12,9 +12,7 @@ /** * Messages Component Messages Model * - * @package Joomla.Administrator - * @subpackage com_messages - * @since 1.6 + * @since 1.6 */ class MessagesModelMessages extends JModelList { diff --git a/administrator/components/com_messages/tables/message.php b/administrator/components/com_messages/tables/message.php index 14b54f57e465c..e657b64c80582 100644 --- a/administrator/components/com_messages/tables/message.php +++ b/administrator/components/com_messages/tables/message.php @@ -12,9 +12,7 @@ /** * Message Table class * - * @package Joomla.Administrator - * @subpackage com_messages - * @since 1.5 + * @since 1.5 */ class MessagesTableMessage extends JTable { diff --git a/administrator/components/com_messages/views/config/view.html.php b/administrator/components/com_messages/views/config/view.html.php index e94a1b65404b6..e872ae46087b6 100644 --- a/administrator/components/com_messages/views/config/view.html.php +++ b/administrator/components/com_messages/views/config/view.html.php @@ -12,9 +12,7 @@ /** * View to edit messages user configuration. * - * @package Joomla.Administrator - * @subpackage com_messages - * @since 1.6 + * @since 1.6 */ class MessagesViewConfig extends JViewLegacy { diff --git a/administrator/components/com_messages/views/message/view.html.php b/administrator/components/com_messages/views/message/view.html.php index 5b537d0d13fd7..6ad6d12a7da33 100644 --- a/administrator/components/com_messages/views/message/view.html.php +++ b/administrator/components/com_messages/views/message/view.html.php @@ -12,9 +12,7 @@ /** * HTML View class for the Messages component * - * @package Joomla.Administrator - * @subpackage com_messages - * @since 1.6 + * @since 1.6 */ class MessagesViewMessage extends JViewLegacy { diff --git a/administrator/components/com_messages/views/messages/view.html.php b/administrator/components/com_messages/views/messages/view.html.php index 2f01331926b78..ec6ed8d7d4f69 100644 --- a/administrator/components/com_messages/views/messages/view.html.php +++ b/administrator/components/com_messages/views/messages/view.html.php @@ -13,9 +13,7 @@ /** * View class for a list of messages. * - * @package Joomla.Administrator - * @subpackage com_messages - * @since 1.6 + * @since 1.6 */ class MessagesViewMessages extends JViewLegacy { diff --git a/administrator/components/com_modules/controller.php b/administrator/components/com_modules/controller.php index 5412d518919d2..0861f618c3574 100644 --- a/administrator/components/com_modules/controller.php +++ b/administrator/components/com_modules/controller.php @@ -12,25 +12,23 @@ /** * Modules manager master display controller. * - * @package Joomla.Administrator - * @subpackage com_modules - * @since 1.6 + * @since 1.6 */ class ModulesController extends JControllerLegacy { /** * Method to display a view. * - * @param boolean $cachable If true, the view output will be cached - * @param array|boolean $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()} - . + * @param boolean $cachable If true, the view output will be cached + * @param array|boolean $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()} + * + * @return JController This object to support chaining. * - * @return JController This object to support chaining. * @since 1.5 */ public function display($cachable = false, $urlparams = false) { - require_once JPATH_COMPONENT.'/helpers/modules.php'; + require_once JPATH_COMPONENT . '/helpers/modules.php'; // Load the submenu. ModulesHelper::addSubmenu($this->input->get('view', 'modules')); diff --git a/administrator/components/com_modules/controllers/module.php b/administrator/components/com_modules/controllers/module.php index b24a821ce4fa0..33efd5d105a6e 100644 --- a/administrator/components/com_modules/controllers/module.php +++ b/administrator/components/com_modules/controllers/module.php @@ -12,9 +12,7 @@ /** * Module controller class. * - * @package Joomla.Administrator - * @subpackage com_modules - * @since 1.6 + * @since 1.6 */ class ModulesControllerModule extends JControllerForm { @@ -31,6 +29,7 @@ public function add() // Get the result of the parent method. If an error, just return it. $result = parent::add(); + if ($result instanceof Exception) { return $result; @@ -38,9 +37,13 @@ public function add() // Look for the Extension ID. $extensionId = $app->input->get('eid', 0, 'int'); + if (empty($extensionId)) { - $this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_item.'&layout=edit', false)); + $redirectUrl = 'index.php?option=' . $this->option . '&view=' . $this->view_item . '&layout=edit'; + + $this->setRedirect(JRoute::_($redirectUrl, false)); + return JError::raiseWarning(500, JText::_('COM_MODULES_ERROR_INVALID_EXTENSION')); } @@ -85,7 +88,7 @@ public function cancel($key = null) */ protected function allowSave($data, $key = 'id') { - // use custom position if selected + // Use custom position if selected if (isset($data['custom_position'])) { if (empty($data['position'])) @@ -143,7 +146,9 @@ public function batch($model = null) $model = $this->getModel('Module', '', array()); // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_modules&view=modules'.$this->getRedirectToListAppend(), false)); + $redirectUrl = 'index.php?option=com_modules&view=modules' . $this->getRedirectToListAppend(); + + $this->setRedirect(JRoute::_($redirectUrl, false)); return parent::batch($model); } diff --git a/administrator/components/com_modules/controllers/modules.php b/administrator/components/com_modules/controllers/modules.php index cf55d57c8025d..2a472eb3495cc 100644 --- a/administrator/components/com_modules/controllers/modules.php +++ b/administrator/components/com_modules/controllers/modules.php @@ -12,14 +12,15 @@ /** * Modules list controller class. * - * @package Joomla.Administrator - * @subpackage com_modules - * @since 1.6 + * @since 1.6 */ class ModulesControllerModules extends JControllerAdmin { /** * Method to clone an existing module. + * + * @return void + * * @since 1.6 */ public function duplicate() @@ -30,15 +31,18 @@ public function duplicate() $pks = $this->input->post->get('cid', array(), 'array'); JArrayHelper::toInteger($pks); - try { + try + { if (empty($pks)) { throw new Exception(JText::_('COM_MODULES_ERROR_NO_MODULES_SELECTED')); } + $model = $this->getModel(); $model->duplicate($pks); $this->setMessage(JText::plural('COM_MODULES_N_MODULES_DUPLICATED', count($pks))); - } catch (Exception $e) + } + catch (Exception $e) { JError::raiseWarning(500, $e->getMessage()); } @@ -60,6 +64,7 @@ public function duplicate() public function getModel($name = 'Module', $prefix = 'ModulesModel', $config = array('ignore_request' => true)) { $model = parent::getModel($name, $prefix, $config); + return $model; } } diff --git a/administrator/components/com_modules/helpers/html/modules.php b/administrator/components/com_modules/helpers/html/modules.php index a165608fb2b49..e710628a30eff 100644 --- a/administrator/components/com_modules/helpers/html/modules.php +++ b/administrator/components/com_modules/helpers/html/modules.php @@ -9,10 +9,10 @@ defined('_JEXEC') or die; -/** - * @package Joomla.Administrator - * @subpackage com_modules - * @since 1.6 +/** + * JHtml module helper class. + * + * @since 1.6 */ abstract class JHtmlModules { @@ -146,19 +146,24 @@ public static function positions($clientId, $state = 1, $selectedPosition = '') // Add positions from templates $isTemplatePosition = false; + foreach ($templates as $template) { $options = array(); $positions = TemplatesHelper::getPositions($clientId, $template); - if (is_array($positions)) foreach ($positions as $position) - { - $text = ModulesHelper::getTranslatedModulePosition($clientId, $template, $position) . ' [' . $position . ']'; - $options[] = ModulesHelper::createOption($position, $text); - if (!$isTemplatePosition && $selectedPosition === $position) + if (is_array($positions)) + { + foreach ($positions as $position) { - $isTemplatePosition = true; + $text = ModulesHelper::getTranslatedModulePosition($clientId, $template, $position) . ' [' . $position . ']'; + $options[] = ModulesHelper::createOption($position, $text); + + if (!$isTemplatePosition && $selectedPosition === $position) + { + $isTemplatePosition = true; + } } } @@ -175,6 +180,11 @@ public static function positions($clientId, $state = 1, $selectedPosition = '') return $templateGroups; } + /** + * Get a select with the batch action options + * + * @return void + */ public static function batchOptions() { // Create the copy/move options. diff --git a/administrator/components/com_modules/helpers/modules.php b/administrator/components/com_modules/helpers/modules.php index 6c4047f1293e8..83b1038c4eba5 100644 --- a/administrator/components/com_modules/helpers/modules.php +++ b/administrator/components/com_modules/helpers/modules.php @@ -12,9 +12,7 @@ /** * Modules component helper. * - * @package Joomla.Administrator - * @subpackage com_modules - * @since 1.6 + * @since 1.6 */ abstract class ModulesHelper { @@ -22,6 +20,8 @@ abstract class ModulesHelper * Configure the Linkbar. * * @param string $vName The name of the active view. + * + * @return void */ public static function addSubmenu($vName) { @@ -31,7 +31,7 @@ public static function addSubmenu($vName) /** * Gets a list of the actions that can be performed. * - * @param integer The module ID. + * @param integer $moduleId The module ID. * * @return JObject * @@ -67,6 +67,7 @@ public static function getStateOptions() $options[] = JHtml::_('select.option', '1', JText::_('JPUBLISHED')); $options[] = JHtml::_('select.option', '0', JText::_('JUNPUBLISHED')); $options[] = JHtml::_('select.option', '-2', JText::_('JTRASHED')); + return $options; } @@ -81,13 +82,15 @@ public static function getClientOptions() $options = array(); $options[] = JHtml::_('select.option', '0', JText::_('JSITE')); $options[] = JHtml::_('select.option', '1', JText::_('JADMINISTRATOR')); + return $options; } /** * Get a list of modules positions * - * @param integer $clientId Client ID + * @param integer $clientId Client ID + * @param boolean $editPositions Allow to edit the positions * * @return array A list of positions */ @@ -110,23 +113,25 @@ public static function getPositions($clientId, $editPositions = false) catch (RuntimeException $e) { JError::raiseWarning(500, $e->getMessage()); + return; } // Build the list $options = array(); + foreach ($positions as $position) { if (!$position && !$editPositions) { $options[] = JHtml::_('select.option', 'none', ':: ' . JText::_('JNONE') . ' ::'); - } else { $options[] = JHtml::_('select.option', $position, $position); } } + return $options; } @@ -151,6 +156,7 @@ public static function getTemplates($clientId = 0, $state = '', $template = '') ->from('#__extensions') ->where('client_id = ' . (int) $clientId) ->where('type = ' . $db->quote('template')); + if ($state != '') { $query->where('enabled = ' . $db->quote($state)); @@ -164,6 +170,7 @@ public static function getTemplates($clientId = 0, $state = '', $template = '') // Set the query and load the templates. $db->setQuery($query); $templates = $db->loadObjectList('element'); + return $templates; } @@ -199,7 +206,9 @@ public static function getModules($clientId) || $lang->load("$extension.sys", $source, null, false, true); $modules[$i]->text = JText::_($module->text); } + JArrayHelper::sortObjects($modules, 'text', 1, true, true); + return $modules; } @@ -228,8 +237,9 @@ public static function getAssignmentOptions($clientId) /** * Return a translated module position name * - * @param string $template Template name - * @param string $position Position name + * @param integer $clientId Application client id 0: site | 1: admin + * @param string $template Template name + * @param string $position Position name * * @return string Return a translated position name * @@ -241,10 +251,10 @@ public static function getTranslatedModulePosition($clientId, $template, $positi $lang = JFactory::getLanguage(); $path = $clientId ? JPATH_ADMINISTRATOR : JPATH_SITE; - $lang->load('tpl_'.$template.'.sys', $path, null, false, false) - || $lang->load('tpl_'.$template.'.sys', $path.'/templates/'.$template, null, false, false) - || $lang->load('tpl_'.$template.'.sys', $path, $lang->getDefault(), false, false) - || $lang->load('tpl_'.$template.'.sys', $path.'/templates/'.$template, $lang->getDefault(), false, false); + $lang->load('tpl_' . $template . '.sys', $path, null, false, false) + || $lang->load('tpl_' . $template . '.sys', $path . '/templates/' . $template, null, false, false) + || $lang->load('tpl_' . $template . '.sys', $path, $lang->getDefault(), false, false) + || $lang->load('tpl_' . $template . '.sys', $path . '/templates/' . $template, $lang->getDefault(), false, false); $langKey = strtoupper('TPL_' . $template . '_POSITION_' . $position); $text = JText::_($langKey); diff --git a/administrator/components/com_modules/helpers/xml.php b/administrator/components/com_modules/helpers/xml.php index a955fb3435d89..9df1cba180a11 100644 --- a/administrator/components/com_modules/helpers/xml.php +++ b/administrator/components/com_modules/helpers/xml.php @@ -14,15 +14,20 @@ /** * Helper for parse XML module files * - * @package Joomla.Administrator - * @subpackage com_modules * @since 1.5 * @deprecated 3.2 Do not use. */ class ModulesHelperXML { /** + * Parse the module XML file + * + * @param array &$rows XML rows + * + * @return void + * * @since 1.5 + * * @deprecated 3.2 Do not use. */ public function parseXMLModuleFile(&$rows) diff --git a/administrator/components/com_modules/models/module.php b/administrator/components/com_modules/models/module.php index d014d0e8ccd3b..88f370ae45c59 100644 --- a/administrator/components/com_modules/models/module.php +++ b/administrator/components/com_modules/models/module.php @@ -12,9 +12,7 @@ /** * Module model. * - * @package Joomla.Administrator - * @subpackage com_modules - * @since 1.6 + * @since 1.6 */ class ModulesModelModule extends JModelAdmin { @@ -93,6 +91,7 @@ public function batch($commands, $pks, $contexts) if (empty($pks)) { $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); + return false; } @@ -107,6 +106,7 @@ public function batch($commands, $pks, $contexts) if ($cmd == 'c') { $result = $this->batchCopy($commands['position_id'], $pks, $contexts); + if (is_array($result)) { $pks = $result; @@ -120,6 +120,7 @@ public function batch($commands, $pks, $contexts) { return false; } + $done = true; } } @@ -147,6 +148,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; } @@ -195,6 +197,7 @@ protected function batchCopy($value, $pks, $contexts) { $position = $value; } + $table->position = $position; // Alter the title if necessary @@ -210,6 +213,7 @@ protected function batchCopy($value, $pks, $contexts) if (!$table->store()) { $this->setError($table->getError()); + return false; } @@ -243,6 +247,7 @@ protected function batchCopy($value, $pks, $contexts) else { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_CREATE')); + return false; } } @@ -290,6 +295,7 @@ protected function batchMove($value, $pks, $contexts) { $position = $value; } + $table->position = $position; // Alter the title if necessary @@ -302,12 +308,14 @@ protected function batchMove($value, $pks, $contexts) if (!$table->store()) { $this->setError($table->getError()); + return false; } } else { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); + return false; } } @@ -321,9 +329,10 @@ protected function batchMove($value, $pks, $contexts) /** * Method to test whether a record can have its state edited. * - * @param object $record A record object. + * @param object $record A record object. * * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * * @since 3.2 */ protected function canEditState($record) @@ -364,9 +373,10 @@ public function delete(&$pks) if ($table->load($pk)) { // Access checks. - if (!$user->authorise('core.delete', 'com_modules.module.'.(int) $pk) || $table->published != -2) + if (!$user->authorise('core.delete', 'com_modules.module.' . (int) $pk) || $table->published != -2) { JError::raiseWarning(403, JText::_('JERROR_CORE_DELETE_NOT_PERMITTED')); + return; } @@ -432,6 +442,7 @@ public function duplicate(&$pks) // Alter the title. $m = null; + if (preg_match('#\((\d+)\)$#', $table->title, $m)) { $table->title = preg_replace('#\(\d+\)$#', '(' . ($m[1] + 1) . ')', $table->title); @@ -508,6 +519,7 @@ protected function generateNewTitle($category_id, $title, $position) { // Alter the title & alias $table = $this->getTable(); + while ($table->load(array('position' => $position, 'title' => $title))) { $title = JString::increment($title); @@ -561,6 +573,7 @@ public function getForm($data = array(), $loadData = true) // Get the form. $form = $this->loadForm('com_modules.module', 'module', array('control' => 'jform', 'load_data' => $loadData)); + if (empty($form)) { return false; @@ -570,11 +583,12 @@ public function getForm($data = array(), $loadData = true) $user = JFactory::getUser(); - // Check for existing module - // Modify the form based on Edit State access controls. - if ($id != 0 && (!$user->authorise('core.edit.state', 'com_modules.module.'.(int) $id)) - || ($id == 0 && !$user->authorise('core.edit.state', 'com_modules')) - ) + /** + * Check for existing module + * Modify the form based on Edit State access controls. + */ + if ($id != 0 && (!$user->authorise('core.edit.state', 'com_modules.module.' . (int) $id)) + || ($id == 0 && !$user->authorise('core.edit.state', 'com_modules')) ) { // Disable fields for display. $form->setFieldAttribute('ordering', 'disabled', 'true'); @@ -613,6 +627,7 @@ protected function loadFormData() // This allows us to inject parameter settings into a new module. $params = $app->getUserState('com_modules.add.module.params'); + if (is_array($params)) { $data->set('params', $params); @@ -848,6 +863,7 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') // Get the help data from the XML file if present. $help = $xml->xpath('/extension/help'); + if (!empty($help)) { $helpKey = trim((string) $help[0]['key']); @@ -856,7 +872,6 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') $this->helpKey = $helpKey ? $helpKey : $this->helpKey; $this->helpURL = $helpURL ? $helpURL : $this->helpURL; } - } // Load the default advanced params @@ -916,7 +931,7 @@ public function save($data) if ($input->get('task') == 'save2copy') { $orig_data = $input->post->get('jform', array(), 'array'); - $orig_table = clone($this->getTable()); + $orig_table = clone $this->getTable(); $orig_table->load((int) $orig_data['id']); if ($data['title'] == $orig_table->title) diff --git a/administrator/components/com_modules/models/modules.php b/administrator/components/com_modules/models/modules.php index 843166a76b51c..85551357ef63b 100644 --- a/administrator/components/com_modules/models/modules.php +++ b/administrator/components/com_modules/models/modules.php @@ -12,16 +12,15 @@ /** * Modules Component Module Model * - * @package Joomla.Administrator - * @subpackage com_modules - * @since 1.5 + * @since 1.5 */ class ModulesModelModules extends JModelList { /** * Constructor. * - * @param array An optional associative array of configuration settings. + * @param array $config An optional associative array of configuration settings. + * * @see JController * @since 1.6 */ @@ -56,6 +55,11 @@ public function __construct($config = array()) * * Note. Calling getState in this method will result in recursion. * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) @@ -80,11 +84,13 @@ protected function populateState($ordering = null, $direction = null) $clientId = $this->getUserStateFromRequest($this->context . '.filter.client_id', 'filter_client_id', 0, 'int', false); $previousId = $app->getUserState($this->context . '.filter.client_id_previous', null); + if ($previousId != $clientId || $previousId === null) { $this->getUserStateFromRequest($this->context . '.filter.client_id_previous', 'filter_client_id_previous', 0, 'int', true); $app->setUserState($this->context . '.filter.client_id_previous', $clientId); } + $this->setState('filter.client_id', $clientId); $language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', ''); @@ -105,7 +111,7 @@ protected function populateState($ordering = null, $direction = null) * different modules that might need different sets of data or different * ordering requirements. * - * @param string A prefix for the store id. + * @param string $id A prefix for the store id. * * @return string A store id. */ @@ -126,14 +132,16 @@ protected function getStoreId($id = '') /** * Returns an object list * - * @param string The query - * @param int Offset - * @param int The number of records + * @param string $query The query + * @param int $limitstart Offset + * @param int $limit The number of records + * * @return array */ protected function _getList($query, $limitstart = 0, $limit = 0) { $ordering = $this->getState('list.ordering', 'ordering'); + if (in_array($ordering, array('pages', 'name'))) { $this->_db->setQuery($query); @@ -142,11 +150,13 @@ protected function _getList($query, $limitstart = 0, $limit = 0) JArrayHelper::sortObjects($result, $ordering, $this->getState('list.direction') == 'desc' ? -1 : 1, true, true); $total = count($result); $this->cache[$this->getStoreId('getTotal')] = $total; + if ($total < $limitstart) { $limitstart = 0; $this->setState('list.start', 0); } + return array_slice($result, $limitstart, $limit ? $limit : null); } else @@ -156,17 +166,22 @@ protected function _getList($query, $limitstart = 0, $limit = 0) $query->order('a.position ASC'); $ordering = 'a.ordering'; } + if ($ordering == 'language_title') { $ordering = 'l.title'; } + $query->order($this->_db->quoteName($ordering) . ' ' . $this->getState('list.direction')); + if ($ordering == 'position') { $query->order('a.ordering ASC'); } + $result = parent::_getList($query, $limitstart, $limit); $this->translate($result); + return $result; } } @@ -174,7 +189,8 @@ protected function _getList($query, $limitstart = 0, $limit = 0) /** * Translate a list of objects * - * @param array The array of objects + * @param array &$items The array of objects + * * @return array The array of translated objects */ protected function translate(&$items) @@ -189,6 +205,7 @@ protected function translate(&$items) $lang->load("$extension.sys", constant('JPATH_' . strtoupper($client)), null, false, true) || $lang->load("$extension.sys", $source, null, false, true); $item->name = JText::_($item->name); + if (is_null($item->pages)) { $item->pages = JText::_('JNONE'); @@ -262,6 +279,7 @@ protected function getListQuery() // Filter by published state $state = $this->getState('filter.state'); + if (is_numeric($state)) { $query->where('a.published = ' . (int) $state); @@ -273,6 +291,7 @@ protected function getListQuery() // Filter by position $position = $this->getState('filter.position'); + if ($position && $position != 'none') { $query->where('a.position = ' . $db->quote($position)); @@ -285,6 +304,7 @@ protected function getListQuery() // Filter by module $module = $this->getState('filter.module'); + if ($module) { $query->where('a.module = ' . $db->quote($module)); @@ -292,6 +312,7 @@ protected function getListQuery() // Filter by client. $clientId = $this->getState('filter.client_id'); + if (is_numeric($clientId)) { $query->where('a.client_id = ' . (int) $clientId . ' AND e.client_id =' . (int) $clientId); @@ -299,6 +320,7 @@ protected function getListQuery() // Filter by search in title $search = $this->getState('filter.search'); + if (!empty($search)) { if (stripos($search, 'id:') === 0) @@ -318,7 +340,6 @@ protected function getListQuery() $query->where('a.language = ' . $db->quote($language)); } - //echo nl2br(str_replace('#__','jos_',$query)); return $query; } } diff --git a/administrator/components/com_modules/models/positions.php b/administrator/components/com_modules/models/positions.php index dcc85d7ff8aa7..ca7fcab7aef45 100644 --- a/administrator/components/com_modules/models/positions.php +++ b/administrator/components/com_modules/models/positions.php @@ -12,16 +12,14 @@ /** * Modules Component Positions Model * - * @package Joomla.Administrator - * @subpackage com_modules - * @since 1.6 + * @since 1.6 */ class ModulesModelPositions extends JModelList { /** * Constructor. * - * @param array An optional associative array of configuration settings. + * @param array $config An optional associative array of configuration settings. * * @see JController * @since 1.6 @@ -44,6 +42,11 @@ public function __construct($config = array()) * * Note. Calling getState in this method will result in recursion. * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) @@ -104,6 +107,7 @@ public function getItems() ->select('DISTINCT(position) as value') ->from('#__modules') ->where($this->_db->quoteName('client_id') . ' = ' . (int) $clientId); + if ($search) { $search = $this->_db->quote('%' . str_replace(' ', '%', $this->_db->escape(trim($search), true) . '%')); @@ -141,10 +145,12 @@ public function getItems() if (file_exists($path)) { $xml = simplexml_load_file($path); + if (isset($xml->positions[0])) { $lang->load('tpl_' . $template->element . '.sys', $client->path, null, false, true) || $lang->load('tpl_' . $template->element . '.sys', $client->path . '/templates/' . $template->element, null, false, true); + foreach ($xml->positions[0] as $position) { $value = (string) $position['value']; @@ -161,6 +167,7 @@ public function getItems() $label = $altlabel; } } + if ($type == 'user' || ($state != '' && $state != $template->enabled)) { unset($positions[$value]); @@ -171,12 +178,14 @@ public function getItems() { $positions[$value] = array(); } + $positions[$value][$template->name] = $label; } } } } } + $this->total = count($positions); if ($limitstart >= $this->total) @@ -207,6 +216,7 @@ public function getItems() arsort($positions); } } + $this->items = array_slice($positions, $limitstart, $limit ? $limit : null); } diff --git a/administrator/components/com_modules/models/select.php b/administrator/components/com_modules/models/select.php index 00977bab34ecc..8afe3203bff7f 100644 --- a/administrator/components/com_modules/models/select.php +++ b/administrator/components/com_modules/models/select.php @@ -12,9 +12,7 @@ /** * Module model. * - * @package Joomla.Administrator - * @subpackage com_modules - * @since 1.6 + * @since 1.6 */ class ModulesModelSelect extends JModelList { @@ -23,6 +21,11 @@ class ModulesModelSelect extends JModelList * * Note. Calling getState in this method will result in recursion. * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) @@ -51,7 +54,7 @@ protected function populateState($ordering = null, $direction = null) * different modules that might need different sets of data or different * ordering requirements. * - * @param string A prefix for the store id. + * @param string $id A prefix for the store id. * * @return string A store id. */ @@ -96,7 +99,6 @@ protected function getListQuery() // Add the list ordering clause. $query->order($db->escape($this->getState('list.ordering', 'a.ordering')) . ' ' . $db->escape($this->getState('list.direction', 'ASC'))); - //echo nl2br(str_replace('#__','jos_',$query)); return $query; } @@ -118,6 +120,7 @@ public function getItems() foreach ($items as &$item) { $path = JPath::clean($client->path . '/modules/' . $item->module . '/' . $item->module . '.xml'); + if (file_exists($path)) { $item->xml = simplexml_load_file($path); @@ -142,6 +145,7 @@ public function getItems() $item->desc = JText::_('COM_MODULES_NODESCRIPTION'); } } + $items = JArrayHelper::sortObjects($items, 'name', 1, true, true); // TODO: Use the cached XML from the extensions table? diff --git a/administrator/components/com_modules/views/module/tmpl/edit.php b/administrator/components/com_modules/views/module/tmpl/edit.php index 2448a207ce81a..5e62bf0f5ee00 100644 --- a/administrator/components/com_modules/views/module/tmpl/edit.php +++ b/administrator/components/com_modules/views/module/tmpl/edit.php @@ -11,6 +11,7 @@ JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); +JHtml::_('behavior.core'); JHtml::_('behavior.formvalidation'); JHtml::_('behavior.combobox'); JHtml::_('formbehavior.chosen', 'select'); @@ -35,9 +36,9 @@ $script .= $this->form->getField($hasContentFieldName)->save(); } $script .= " Joomla.submitform(task, document.getElementById('module-form')); - if (self != top) + if (self.location != top.location) { - window.top.setTimeout('window.parent.SqueezeBox.close()', 1000); + window.parent.jQuery('#moduleModal').modal('hide'); } } };"; diff --git a/administrator/components/com_modules/views/module/tmpl/modal.php b/administrator/components/com_modules/views/module/tmpl/modal.php index 2f9936c78b19a..56444b3b5cc17 100644 --- a/administrator/components/com_modules/views/module/tmpl/modal.php +++ b/administrator/components/com_modules/views/module/tmpl/modal.php @@ -15,7 +15,7 @@
  • -
    diff --git a/administrator/components/com_modules/views/module/view.html.php b/administrator/components/com_modules/views/module/view.html.php index 2f5bffda919b0..e8b2fa6bfe325 100644 --- a/administrator/components/com_modules/views/module/view.html.php +++ b/administrator/components/com_modules/views/module/view.html.php @@ -12,9 +12,7 @@ /** * View to edit a module. * - * @package Joomla.Administrator - * @subpackage com_modules - * @since 1.6 + * @since 1.6 */ class ModulesViewModule extends JViewLegacy { @@ -26,6 +24,10 @@ class ModulesViewModule extends JViewLegacy /** * Display the view + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return void */ public function display($tpl = null) { @@ -38,6 +40,7 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); + return false; } @@ -48,6 +51,8 @@ public function display($tpl = null) /** * Add the page title and toolbar. * + * @return void + * * @since 1.6 */ protected function addToolbar() @@ -101,6 +106,7 @@ protected function addToolbar() $lang = JFactory::getLanguage(); $help = $this->get('Help'); + if ($lang->hasKey($help->url)) { $debug = $lang->setDebug(false); @@ -111,6 +117,7 @@ protected function addToolbar() { $url = null; } + JToolbarHelper::help($help->key, false, $url); } } diff --git a/administrator/components/com_modules/views/modules/view.html.php b/administrator/components/com_modules/views/modules/view.html.php index c4144516e3cc4..c3de464cf55c1 100644 --- a/administrator/components/com_modules/views/modules/view.html.php +++ b/administrator/components/com_modules/views/modules/view.html.php @@ -12,9 +12,7 @@ /** * View class for a list of modules. * - * @package Joomla.Administrator - * @subpackage com_modules - * @since 1.6 + * @since 1.6 */ class ModulesViewModules extends JViewLegacy { @@ -26,6 +24,10 @@ class ModulesViewModules extends JViewLegacy /** * Display the view + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return void */ public function display($tpl = null) { @@ -37,11 +39,13 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); + return false; } // Check if there are no matching items - if (!count($this->items)){ + if (!count($this->items)) + { JFactory::getApplication()->enqueueMessage( JText::_('COM_MODULES_MSG_MANAGE_NO_MODULES'), 'warning' @@ -49,6 +53,7 @@ public function display($tpl = null) } $this->addToolbar(); + // Include the component HTML helpers. JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); parent::display($tpl); @@ -57,6 +62,8 @@ public function display($tpl = null) /** * Add the page title and toolbar. * + * @return void + * * @since 1.6 */ protected function addToolbar() @@ -98,13 +105,15 @@ protected function addToolbar() if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) { JToolbarHelper::deleteList('', 'modules.delete', 'JTOOLBAR_EMPTY_TRASH'); - } elseif ($canDo->get('core.edit.state')) + } + elseif ($canDo->get('core.edit.state')) { JToolbarHelper::trash('modules.trash'); } // Add a batch button - if ($user->authorise('core.create', 'com_modules') && $user->authorise('core.edit', 'com_modules') && $user->authorise('core.edit.state', 'com_modules')) + if ($user->authorise('core.create', 'com_modules') && $user->authorise('core.edit', 'com_modules') + && $user->authorise('core.edit.state', 'com_modules')) { JHtml::_('bootstrap.modal', 'collapseModal'); $title = JText::_('JTOOLBAR_BATCH'); @@ -120,6 +129,7 @@ protected function addToolbar() { JToolbarHelper::preferences('com_modules'); } + JToolbarHelper::help('JHELP_EXTENSIONS_MODULE_MANAGER'); JHtmlSidebar::addEntry( @@ -153,7 +163,10 @@ protected function addToolbar() JHtmlSidebar::addFilter( JText::_('COM_MODULES_OPTION_SELECT_POSITION'), 'filter_position', - JHtml::_('select.options', ModulesHelper::getPositions($this->state->get('filter.client_id')), 'value', 'text', $this->state->get('filter.position')) + JHtml::_( + 'select.options', + ModulesHelper::getPositions($this->state->get('filter.client_id')), 'value', 'text', $this->state->get('filter.position') + ) ); JHtmlSidebar::addFilter( diff --git a/administrator/components/com_modules/views/positions/view.html.php b/administrator/components/com_modules/views/positions/view.html.php index 1d4ee3a9adcb8..7860c50ac5681 100644 --- a/administrator/components/com_modules/views/positions/view.html.php +++ b/administrator/components/com_modules/views/positions/view.html.php @@ -10,8 +10,8 @@ defined('_JEXEC') or die; /** - * @package Joomla.Administrator - * @subpackage com_modules + * View Module positions class. + * * @since 1.6 */ class ModulesViewPositions extends JViewLegacy @@ -24,6 +24,10 @@ class ModulesViewPositions extends JViewLegacy /** * Display the view + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return void */ public function display($tpl = null) { @@ -35,6 +39,7 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); + return false; } diff --git a/administrator/components/com_modules/views/preview/view.html.php b/administrator/components/com_modules/views/preview/view.html.php index 7b2e7800e2956..9f77cb0f21e64 100644 --- a/administrator/components/com_modules/views/preview/view.html.php +++ b/administrator/components/com_modules/views/preview/view.html.php @@ -12,12 +12,17 @@ /** * HTML View class for the Modules component * - * @package Joomla.Administrator - * @subpackage com_modules - * @since 1.6 + * @since 1.6 */ class ModulesViewPreview extends JViewLegacy { + /** + * Display the view + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return void + */ public function display($tpl = null) { $editor = JFactory::getConfig()->get('editor'); diff --git a/administrator/components/com_modules/views/select/view.html.php b/administrator/components/com_modules/views/select/view.html.php index 6caf98af2f847..fe9af3d331dfb 100644 --- a/administrator/components/com_modules/views/select/view.html.php +++ b/administrator/components/com_modules/views/select/view.html.php @@ -12,9 +12,7 @@ /** * HTML View class for the Modules component * - * @package Joomla.Administrator - * @subpackage com_modules - * @since 1.6 + * @since 1.6 */ class ModulesViewSelect extends JViewLegacy { @@ -24,6 +22,10 @@ class ModulesViewSelect extends JViewLegacy /** * Display the view + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return void */ public function display($tpl = null) { @@ -34,6 +36,7 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); + return false; } @@ -47,7 +50,9 @@ public function display($tpl = null) /** * Add the page title and toolbar. * - * @since 3.0 + * @return void + * + * @since 1.6 */ protected function addToolbar() { diff --git a/administrator/components/com_newsfeeds/controller.php b/administrator/components/com_newsfeeds/controller.php index 88a73e0ab0903..274120e37a556 100644 --- a/administrator/components/com_newsfeeds/controller.php +++ b/administrator/components/com_newsfeeds/controller.php @@ -12,9 +12,7 @@ /** * Newsfeeds master display controller. * - * @package Joomla.Administrator - * @subpackage com_newsfeeds - * @since 1.6 + * @since 1.6 */ class NewsfeedsController extends JControllerLegacy { diff --git a/administrator/components/com_newsfeeds/controllers/newsfeed.php b/administrator/components/com_newsfeeds/controllers/newsfeed.php index e48fb1a3319a2..38fa483390330 100644 --- a/administrator/components/com_newsfeeds/controllers/newsfeed.php +++ b/administrator/components/com_newsfeeds/controllers/newsfeed.php @@ -12,9 +12,7 @@ /** * Newsfeed controller class. * - * @package Joomla.Administrator - * @subpackage com_newsfeeds - * @since 1.6 + * @since 1.6 */ class NewsfeedsControllerNewsfeed extends JControllerForm { diff --git a/administrator/components/com_newsfeeds/controllers/newsfeeds.php b/administrator/components/com_newsfeeds/controllers/newsfeeds.php index 74ed4b41311a3..de74cdbd588b5 100644 --- a/administrator/components/com_newsfeeds/controllers/newsfeeds.php +++ b/administrator/components/com_newsfeeds/controllers/newsfeeds.php @@ -12,9 +12,7 @@ /** * Newsfeeds list controller class. * - * @package Joomla.Administrator - * @subpackage com_newsfeeds - * @since 1.6 + * @since 1.6 */ class NewsfeedsControllerNewsfeeds extends JControllerAdmin { diff --git a/administrator/components/com_newsfeeds/helpers/html/newsfeed.php b/administrator/components/com_newsfeeds/helpers/html/newsfeed.php index 67c8827da62f2..e762e58f170b5 100644 --- a/administrator/components/com_newsfeeds/helpers/html/newsfeed.php +++ b/administrator/components/com_newsfeeds/helpers/html/newsfeed.php @@ -12,12 +12,9 @@ JLoader::register('NewsfeedsHelper', JPATH_ADMINISTRATOR . '/components/com_newsfeeds/helpers/newsfeeds.php'); /** - * Utility class for creating HTML Grids - * - * @static - * @package Joomla.Administrator - * @subpackage com_newsfeeds - * @since 1.5 + * Utility class for creating HTML Grids. + * + * @since 1.5 */ class JHtmlNewsfeed { diff --git a/administrator/components/com_newsfeeds/helpers/newsfeeds.php b/administrator/components/com_newsfeeds/helpers/newsfeeds.php index 630dc08801355..ffc5587c281fc 100644 --- a/administrator/components/com_newsfeeds/helpers/newsfeeds.php +++ b/administrator/components/com_newsfeeds/helpers/newsfeeds.php @@ -12,9 +12,7 @@ /** * Newsfeeds component helper. * - * @package Joomla.Administrator - * @subpackage com_newsfeeds - * @since 1.6 + * @since 1.6 */ class NewsfeedsHelper extends JHelperContent { diff --git a/administrator/components/com_newsfeeds/models/fields/modal/newsfeed.php b/administrator/components/com_newsfeeds/models/fields/modal/newsfeed.php index 5db009b0b8f81..6a54cfcab59b9 100644 --- a/administrator/components/com_newsfeeds/models/fields/modal/newsfeed.php +++ b/administrator/components/com_newsfeeds/models/fields/modal/newsfeed.php @@ -12,9 +12,7 @@ /** * Supports a modal newsfeeds picker. * - * @package Joomla.Administrator - * @subpackage com_newsfeeds - * @since 1.6 + * @since 1.6 */ class JFormFieldModal_Newsfeed extends JFormField { diff --git a/administrator/components/com_newsfeeds/models/fields/newsfeeds.php b/administrator/components/com_newsfeeds/models/fields/newsfeeds.php index ec42832d3ff06..6b365af70404b 100644 --- a/administrator/components/com_newsfeeds/models/fields/newsfeeds.php +++ b/administrator/components/com_newsfeeds/models/fields/newsfeeds.php @@ -14,9 +14,7 @@ /** * Form Field class for the Joomla Framework. * - * @package Joomla.Administrator - * @subpackage com_newsfeeds - * @since 1.6 + * @since 1.6 */ class JFormFieldNewsfeeds extends JFormFieldList { diff --git a/administrator/components/com_newsfeeds/models/newsfeed.php b/administrator/components/com_newsfeeds/models/newsfeed.php index 306c9970d4a04..0fc55ceb604d8 100644 --- a/administrator/components/com_newsfeeds/models/newsfeed.php +++ b/administrator/components/com_newsfeeds/models/newsfeed.php @@ -14,9 +14,7 @@ /** * Newsfeed model. * - * @package Joomla.Administrator - * @subpackage com_newsfeeds - * @since 1.6 + * @since 1.6 */ class NewsfeedsModelNewsfeed extends JModelAdmin { diff --git a/administrator/components/com_newsfeeds/models/newsfeeds.php b/administrator/components/com_newsfeeds/models/newsfeeds.php index cc0e3127f5215..af81266420605 100644 --- a/administrator/components/com_newsfeeds/models/newsfeeds.php +++ b/administrator/components/com_newsfeeds/models/newsfeeds.php @@ -12,9 +12,7 @@ /** * Methods supporting a list of newsfeed records. * - * @package Joomla.Administrator - * @subpackage com_newsfeeds - * @since 1.6 + * @since 1.6 */ class NewsfeedsModelNewsfeeds extends JModelList { diff --git a/administrator/components/com_newsfeeds/tables/newsfeed.php b/administrator/components/com_newsfeeds/tables/newsfeed.php index bede2c2139501..7c8cbe68c8691 100644 --- a/administrator/components/com_newsfeeds/tables/newsfeed.php +++ b/administrator/components/com_newsfeeds/tables/newsfeed.php @@ -10,8 +10,7 @@ defined('_JEXEC') or die; /** - * @package Joomla.Administrator - * @subpackage com_newsfeeds + * Newsfeed Table class. */ class NewsfeedsTableNewsfeed extends JTable { diff --git a/administrator/components/com_newsfeeds/views/newsfeed/view.html.php b/administrator/components/com_newsfeeds/views/newsfeed/view.html.php index e256c5715cf85..861c9dd4cac91 100644 --- a/administrator/components/com_newsfeeds/views/newsfeed/view.html.php +++ b/administrator/components/com_newsfeeds/views/newsfeed/view.html.php @@ -12,9 +12,7 @@ /** * View to edit a newsfeed. * - * @package Joomla.Administrator - * @subpackage com_newsfeeds - * @since 1.6 + * @since 1.6 */ class NewsfeedsViewNewsfeed extends JViewLegacy { diff --git a/administrator/components/com_newsfeeds/views/newsfeeds/view.html.php b/administrator/components/com_newsfeeds/views/newsfeeds/view.html.php index 5e5e03a3210c8..821414b1d5755 100644 --- a/administrator/components/com_newsfeeds/views/newsfeeds/view.html.php +++ b/administrator/components/com_newsfeeds/views/newsfeeds/view.html.php @@ -12,9 +12,7 @@ /** * View class for a list of newsfeeds. * - * @package Joomla.Administrator - * @subpackage com_newsfeeds - * @since 1.6 + * @since 1.6 */ class NewsfeedsViewNewsfeeds extends JViewLegacy { diff --git a/administrator/components/com_plugins/controller.php b/administrator/components/com_plugins/controller.php index 3ac7acbcc94d1..a851a26c25791 100644 --- a/administrator/components/com_plugins/controller.php +++ b/administrator/components/com_plugins/controller.php @@ -12,24 +12,23 @@ /** * Plugins master display controller. * - * @package Joomla.Administrator - * @subpackage com_plugins - * @since 1.5 + * @since 1.5 */ class PluginsController extends JControllerLegacy { /** * Method to display a view. * - * @param boolean If true, the view output will be cached - * @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. + * @param boolean $cachable If true, the view output will be cached + * @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * * @return JController This object to support chaining. + * * @since 1.5 */ public function display($cachable = false, $urlparams = false) { - require_once JPATH_COMPONENT.'/helpers/plugins.php'; + require_once JPATH_COMPONENT . '/helpers/plugins.php'; // Load the submenu. PluginsHelper::addSubmenu($this->input->get('view', 'plugins')); diff --git a/administrator/components/com_plugins/controllers/plugin.php b/administrator/components/com_plugins/controllers/plugin.php index 31370540b8898..f35dedd20d648 100644 --- a/administrator/components/com_plugins/controllers/plugin.php +++ b/administrator/components/com_plugins/controllers/plugin.php @@ -12,9 +12,7 @@ /** * Plugin controller class. * - * @package Joomla.Administrator - * @subpackage com_plugins - * @since 1.6 + * @since 1.6 */ class PluginsControllerPlugin extends JControllerForm { diff --git a/administrator/components/com_plugins/controllers/plugins.php b/administrator/components/com_plugins/controllers/plugins.php index f5e148ed4d79c..1ec95f0cfc7f9 100644 --- a/administrator/components/com_plugins/controllers/plugins.php +++ b/administrator/components/com_plugins/controllers/plugins.php @@ -12,9 +12,7 @@ /** * Plugins list controller class. * - * @package Joomla.Administrator - * @subpackage com_plugins - * @since 1.6 + * @since 1.6 */ class PluginsControllerPlugins extends JControllerAdmin { @@ -32,6 +30,7 @@ class PluginsControllerPlugins extends JControllerAdmin public function getModel($name = 'Plugin', $prefix = 'PluginsModel', $config = array('ignore_request' => true)) { $model = parent::getModel($name, $prefix, $config); + return $model; } } diff --git a/administrator/components/com_plugins/helpers/plugins.php b/administrator/components/com_plugins/helpers/plugins.php index 12b7532ab67a7..db515e61e525f 100644 --- a/administrator/components/com_plugins/helpers/plugins.php +++ b/administrator/components/com_plugins/helpers/plugins.php @@ -12,9 +12,7 @@ /** * Plugins component helper. * - * @package Joomla.Administrator - * @subpackage com_plugins - * @since 1.6 + * @since 1.6 */ class PluginsHelper { @@ -23,7 +21,9 @@ class PluginsHelper /** * Configure the Linkbar. * - * @param string The name of the active view. + * @param string $vName The name of the active view. + * + * @return void */ public static function addSubmenu($vName) { @@ -39,10 +39,10 @@ public static function addSubmenu($vName) */ public static function getActions() { - // Log usage of deprecated function + // Log usage of deprecated function. JLog::add(__METHOD__ . '() is deprecated, use JHelperContent::getActions() with new arguments order instead.', JLog::WARNING, 'deprecated'); - // Get list of actions + // Get list of actions. $result = JHelperContent::getActions('com_plugins'); return $result; @@ -91,12 +91,21 @@ public static function folderOptions() return $options; } + /** + * Parse the template file. + * + * @param string $templateBaseDir Base path to the template directory. + * @param string $templateDir Template directory. + * + * @return JObject + */ public function parseXMLTemplateFile($templateBaseDir, $templateDir) { $data = new JObject; - // Check of the xml file exists + // Check of the xml file exists. $filePath = JPath::clean($templateBaseDir . '/templates/' . $templateDir . '/templateDetails.xml'); + if (is_file($filePath)) { $xml = JInstaller::parseXMLInstallFile($filePath); diff --git a/administrator/components/com_plugins/models/fields/pluginordering.php b/administrator/components/com_plugins/models/fields/pluginordering.php index ab02d2572fca2..979a641be9c00 100644 --- a/administrator/components/com_plugins/models/fields/pluginordering.php +++ b/administrator/components/com_plugins/models/fields/pluginordering.php @@ -12,11 +12,9 @@ JFormHelper::loadFieldClass('ordering'); /** - * Supports an HTML select list of plugins + * Supports an HTML select list of plugins. * - * @package Joomla.Administrator - * @subpackage com_plugins - * @since 1.6 + * @since 1.6 */ class JFormFieldPluginordering extends JFormFieldOrdering { @@ -31,7 +29,7 @@ class JFormFieldPluginordering extends JFormFieldOrdering /** * Builds the query for the ordering list. * - * @return JDatabaseQuery The query for the ordering form field + * @return JDatabaseQuery The query for the ordering form field. */ protected function getQuery() { @@ -40,7 +38,15 @@ protected function getQuery() // Build the query for the ordering list. $query = $db->getQuery(true) - ->select(array($db->quoteName('ordering', 'value'), $db->quoteName('name', 'text'), $db->quoteName('type'), $db->quote('folder'), $db->quote('extension_id'))) + ->select( + array( + $db->quoteName('ordering', 'value'), + $db->quoteName('name', 'text'), + $db->quoteName('type'), + $db->quote('folder'), + $db->quote('extension_id') + ) + ) ->from($db->quoteName('#__extensions')) ->where('(type =' . $db->quote('plugin') . 'AND folder=' . $db->quote($folder) . ')') ->order('ordering'); @@ -51,7 +57,7 @@ protected function getQuery() /** * Retrieves the current Item's Id. * - * @return integer The current item ID + * @return integer The current item ID. */ protected function getItemId() { diff --git a/administrator/components/com_plugins/models/plugin.php b/administrator/components/com_plugins/models/plugin.php index 3a4f8513649c4..75866a30283e0 100644 --- a/administrator/components/com_plugins/models/plugin.php +++ b/administrator/components/com_plugins/models/plugin.php @@ -12,9 +12,7 @@ /** * Plugin model. * - * @package Joomla.Administrator - * @subpackage com_plugins - * @since 1.6 + * @since 1.6 */ class PluginsModelPlugin extends JModelAdmin { @@ -53,8 +51,9 @@ class PluginsModelPlugin extends JModelAdmin * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. - * - * @return JForm A JForm object on success, false on failure + * + * @return JForm A JForm object on success, false on failure. + * * @since 1.6 */ public function getForm($data = array(), $loadData = true) @@ -104,6 +103,7 @@ public function getForm($data = array(), $loadData = true) * Method to get the data that should be injected in the form. * * @return mixed The data for the form. + * * @since 1.6 */ protected function loadFormData() @@ -124,7 +124,7 @@ protected function loadFormData() /** * Method to get a single record. * - * @param integer The id of the primary key. + * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. */ @@ -146,6 +146,7 @@ public function getItem($pk = null) if ($return === false && $table->getError()) { $this->setError($table->getError()); + return $false; } @@ -175,13 +176,14 @@ public function getItem($pk = null) } /** - * Returns a reference to the a Table object, always creating it. + * Returns a reference to the Table object, always creating it. + * + * @param string $type The table type to instantiate. + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. * - * @param type The table type to instantiate - * @param string A prefix for the table class name. Optional. - * @param array Configuration array for model. Optional. * @return JTable A database object - */ + */ public function getTable($type = 'Extension', $prefix = 'JTable', $config = array()) { return JTable::getInstance($type, $prefix, $config); @@ -193,6 +195,7 @@ public function getTable($type = 'Extension', $prefix = 'JTable', $config = arra * Note. Calling getState in this method will result in recursion. * * @return void + * * @since 1.6 */ protected function populateState() @@ -208,9 +211,14 @@ protected function populateState() } /** - * @param object A form object. - * @param mixed The data expected for the form. + * Preprocess the form. + * + * @param JForm $form A form object. + * @param mixed $data The data expected for the form. + * @param string $group Cache group name. + * * @return mixed True if successful. + * * @throws Exception if there is an error in the form event. * @since 1.6 */ @@ -245,6 +253,7 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') } $formFile = JPath::clean(JPATH_PLUGINS . '/' . $folder . '/' . $element . '/' . $element . '.xml'); + if (!file_exists($formFile)) { throw new Exception(JText::sprintf('COM_PLUGINS_ERROR_FILE_NOT_FOUND', $element . '.xml')); @@ -271,6 +280,7 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') // Get the help data from the XML file if present. $help = $xml->xpath('/extension/help'); + if (!empty($help)) { $helpKey = trim((string) $help[0]['key']); @@ -287,8 +297,10 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') /** * A protected method to get a set of ordering conditions. * - * @param object A record object. + * @param object $table A record object. + * * @return array An array of conditions to add to add to ordering queries. + * * @since 1.6 */ protected function getReorderConditions($table) @@ -296,14 +308,17 @@ protected function getReorderConditions($table) $condition = array(); $condition[] = 'type = ' . $this->_db->quote($table->type); $condition[] = 'folder = ' . $this->_db->quote($table->folder); + return $condition; } /** * Override method to save the form data. * - * @param array The form data. + * @param array $data The form data. + * * @return boolean True on success. + * * @since 1.6 */ public function save($data) @@ -311,7 +326,7 @@ public function save($data) // Load the extension plugin group. JPluginHelper::importPlugin('extension'); - // Setup type + // Setup type. $data['type'] = 'plugin'; return parent::save($data); @@ -321,6 +336,7 @@ public function save($data) * Get the necessary data to load an item help screen. * * @return object An object with key, url, and local properties for loading the item help screen. + * * @since 1.6 */ public function getHelp() @@ -329,7 +345,12 @@ public function getHelp() } /** - * Custom clean cache method, plugins are cached in 2 places for different clients + * Custom clean cache method, plugins are cached in 2 places for different clients. + * + * @param string $group Cache group name. + * @param integer $client_id Application client id. + * + * @return void * * @since 1.6 */ diff --git a/administrator/components/com_plugins/models/plugins.php b/administrator/components/com_plugins/models/plugins.php index 98ddf9617d43d..f9703aead81c2 100644 --- a/administrator/components/com_plugins/models/plugins.php +++ b/administrator/components/com_plugins/models/plugins.php @@ -12,16 +12,15 @@ /** * Methods supporting a list of plugin records. * - * @package Joomla.Administrator - * @subpackage com_plugins - * @since 1.6 + * @since 1.6 */ class PluginsModelPlugins extends JModelList { /** * Constructor. * - * @param array An optional associative array of configuration settings. + * @param array $config An optional associative array of configuration settings. + * * @see JController * @since 1.6 */ @@ -92,7 +91,7 @@ protected function populateState($ordering = null, $direction = null) * different modules that might need different sets of data or different * ordering requirements. * - * @param string A prefix for the store id. + * @param string $id A prefix for the store id. * * @return string A store id. */ @@ -109,25 +108,29 @@ protected function getStoreId($id = '') } /** - * Returns an object list + * Returns an object list. + * + * @param JDatabaseQuery $query A database query object. + * @param integer $limitstart Offset. + * @param integer $limit The number of records. * - * @param string The query - * @param int Offset - * @param int The number of records * @return array */ protected function _getList($query, $limitstart = 0, $limit = 0) { $search = $this->getState('filter.search'); $ordering = $this->getState('list.ordering', 'ordering'); + if ($ordering == 'name' || (!empty($search) && stripos($search, 'id:') !== 0)) { $this->_db->setQuery($query); $result = $this->_db->loadObjectList(); $this->translate($result); + if (!empty($search)) { $search = str_replace(' ', '.*', preg_quote(trim($search), '/')); + foreach ($result as $i => $item) { if (!preg_match("/$search/i", $item->name)) @@ -142,11 +145,13 @@ protected function _getList($query, $limitstart = 0, $limit = 0) $total = count($result); $this->cache[$this->getStoreId('getTotal')] = $total; + if ($total < $limitstart) { $limitstart = 0; $this->setState('list.start', 0); } + return array_slice($result, $limitstart, $limit ? $limit : null); } else @@ -156,23 +161,27 @@ protected function _getList($query, $limitstart = 0, $limit = 0) $query->order('a.folder ASC'); $ordering = 'a.ordering'; } + $query->order($this->_db->quoteName($ordering) . ' ' . $this->getState('list.direction')); if ($ordering == 'folder') { $query->order('a.ordering ASC'); } + $result = parent::_getList($query, $limitstart, $limit); $this->translate($result); + return $result; } } /** - * Translate a list of objects + * Translate a list of objects. * - * @param array The array of objects - * @return array The array of translated objects + * @param array &$items The array of objects. + * + * @return array The array of translated objects. */ protected function translate(&$items) { @@ -224,8 +233,9 @@ protected function getListQuery() $query->where('a.access = ' . (int) $access); } - // Filter by published state + // Filter by published state. $published = $this->getState('filter.enabled'); + if (is_numeric($published)) { $query->where('a.enabled = ' . (int) $published); @@ -235,7 +245,7 @@ protected function getListQuery() $query->where('(a.enabled IN (0, 1))'); } - // Filter by state + // Filter by state. $query->where('a.state >= 0'); // Filter by folder. @@ -244,8 +254,9 @@ protected function getListQuery() $query->where('a.folder = ' . $db->quote($folder)); } - // Filter by search in name or id + // Filter by search in name or id. $search = $this->getState('filter.search'); + if (!empty($search)) { if (stripos($search, 'id:') === 0) diff --git a/administrator/components/com_plugins/views/plugin/view.html.php b/administrator/components/com_plugins/views/plugin/view.html.php index f5aa4765d5da4..73b766c11b124 100644 --- a/administrator/components/com_plugins/views/plugin/view.html.php +++ b/administrator/components/com_plugins/views/plugin/view.html.php @@ -12,9 +12,7 @@ /** * View to edit a plugin. * - * @package Joomla.Administrator - * @subpackage com_plugins - * @since 1.5 + * @since 1.5 */ class PluginsViewPlugin extends JViewLegacy { @@ -25,7 +23,11 @@ class PluginsViewPlugin extends JViewLegacy protected $state; /** - * Display the view + * Display the view. + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return mixed A string if successful, otherwise a Error object. */ public function display($tpl = null) { @@ -37,6 +39,7 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); + return false; } @@ -47,6 +50,8 @@ public function display($tpl = null) /** * Add the page title and toolbar. * + * @return void + * * @since 1.6 */ protected function addToolbar() @@ -63,13 +68,15 @@ protected function addToolbar() JToolbarHelper::apply('plugin.apply'); JToolbarHelper::save('plugin.save'); } + JToolbarHelper::cancel('plugin.cancel', 'JTOOLBAR_CLOSE'); JToolbarHelper::divider(); - // Get the help information for the plugin item. + // Get the help information for the plugin item. $lang = JFactory::getLanguage(); $help = $this->get('Help'); + if ($lang->hasKey($help->url)) { $debug = $lang->setDebug(false); @@ -80,6 +87,7 @@ protected function addToolbar() { $url = null; } + JToolbarHelper::help($help->key, false, $url); } } diff --git a/administrator/components/com_plugins/views/plugins/view.html.php b/administrator/components/com_plugins/views/plugins/view.html.php index 6c3aedaefd6e8..5f5cbb4b6287d 100644 --- a/administrator/components/com_plugins/views/plugins/view.html.php +++ b/administrator/components/com_plugins/views/plugins/view.html.php @@ -12,9 +12,7 @@ /** * View class for a list of plugins. * - * @package Joomla.Administrator - * @subpackage com_plugins - * @since 1.5 + * @since 1.5 */ class PluginsViewPlugins extends JViewLegacy { @@ -25,7 +23,11 @@ class PluginsViewPlugins extends JViewLegacy protected $state; /** - * Display the view + * Display the view. + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return mixed A string if successful, otherwise a Error object. */ public function display($tpl = null) { @@ -37,10 +39,11 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); + return false; } - // Check if there are no matching items + // Check if there are no matching items. if (!count($this->items)) { JFactory::getApplication()->enqueueMessage( @@ -56,6 +59,8 @@ public function display($tpl = null) /** * Add the page title and toolbar. * + * @return void + * * @since 1.6 */ protected function addToolbar() @@ -86,31 +91,30 @@ protected function addToolbar() JHtmlSidebar::setAction('index.php?option=com_plugins&view=plugins'); JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_enabled', - JHtml::_('select.options', PluginsHelper::publishedOptions(), 'value', 'text', $this->state->get('filter.enabled'), true) + JText::_('JOPTION_SELECT_PUBLISHED'), + 'filter_enabled', + JHtml::_('select.options', PluginsHelper::publishedOptions(), 'value', 'text', $this->state->get('filter.enabled'), true) ); JHtmlSidebar::addFilter( - JText::_('COM_PLUGINS_OPTION_FOLDER'), - 'filter_folder', - JHtml::_('select.options', PluginsHelper::folderOptions(), 'value', 'text', $this->state->get('filter.folder')) + JText::_('COM_PLUGINS_OPTION_FOLDER'), + 'filter_folder', + JHtml::_('select.options', PluginsHelper::folderOptions(), 'value', 'text', $this->state->get('filter.folder')) ); JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) + JText::_('JOPTION_SELECT_ACCESS'), + 'filter_access', + JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) ); $this->sidebar = JHtmlSidebar::render(); - } /** - * Returns an array of fields the table can be sorted by + * Returns an array of fields the table can be sorted by. * - * @return array Array containing the field name to sort by as the key and display text as value + * @return array Array containing the field name to sort by as the key and display text as value. * * @since 3.0 */ diff --git a/administrator/components/com_postinstall/controllers/message.php b/administrator/components/com_postinstall/controllers/message.php index c09e2949eefe0..9a2e7f80b5f7b 100644 --- a/administrator/components/com_postinstall/controllers/message.php +++ b/administrator/components/com_postinstall/controllers/message.php @@ -9,10 +9,15 @@ defined('_JEXEC') or die; +/** + * Postinstall message controller. + * + * @since 3.2 + */ class PostinstallControllerMessage extends FOFController { /** - * Resets all post-installation messages of the specified extension + * Resets all post-installation messages of the specified extension. * * @return void * @@ -30,7 +35,7 @@ public function reset() } /** - * Executes the action associated with an item + * Executes the action associated with an item. * * @return void * @@ -38,7 +43,7 @@ public function reset() */ public function action() { - // CSRF prevention + // CSRF prevention. if ($this->csrfProtection) { $this->_csrfProtection(); diff --git a/administrator/components/com_postinstall/models/messages.php b/administrator/components/com_postinstall/models/messages.php index 8eec4eaa73b17..19fe6b3bc6519 100644 --- a/administrator/components/com_postinstall/models/messages.php +++ b/administrator/components/com_postinstall/models/messages.php @@ -12,9 +12,7 @@ /** * Model class to manage postinstall messages * - * @package Joomla.Administrator - * @subpackage com_postinstall - * @since 3.2 + * @since 3.2 */ class PostinstallModelMessages extends FOFModel { @@ -117,7 +115,7 @@ public function resetMessages($eid) * Do note that this a core method of the RAD Layer which operates directly * on the list it's being fed. A little touch of modern magic. * - * @param array $resultArray A list of items to process + * @param array &$resultArray A list of items to process * * @return void * @@ -130,7 +128,7 @@ protected function onProcessList(&$resultArray) foreach ($resultArray as $key => $item) { - // Filter out messages based on dynamically loaded programmatic conditions + // Filter out messages based on dynamically loaded programmatic conditions. if (!empty($item->condition_file) && !empty($item->condition_method)) { jimport('joomla.filesystem.file'); @@ -150,7 +148,7 @@ protected function onProcessList(&$resultArray) } } - // Load the necessary language files + // Load the necessary language files. if (!empty($item->language_extension)) { $hash = $item->language_client_id . '-' . $item->language_extension; diff --git a/administrator/components/com_postinstall/postinstall.php b/administrator/components/com_postinstall/postinstall.php index e8450c4535942..2d938f8c5d7ec 100644 --- a/administrator/components/com_postinstall/postinstall.php +++ b/administrator/components/com_postinstall/postinstall.php @@ -9,11 +9,11 @@ defined('_JEXEC') or die; -// Load the RAD layer +// Load the RAD layer. if (!defined('FOF_INCLUDED')) { require_once JPATH_LIBRARIES . '/fof/include.php'; } -// Dispatch the component -FOFDispatcher::getTmpInstance('com_postinstall')->dispatch(); \ No newline at end of file +// Dispatch the component. +FOFDispatcher::getTmpInstance('com_postinstall')->dispatch(); diff --git a/administrator/components/com_postinstall/toolbar.php b/administrator/components/com_postinstall/toolbar.php index 52018617d25e1..15f956ec2f62e 100644 --- a/administrator/components/com_postinstall/toolbar.php +++ b/administrator/components/com_postinstall/toolbar.php @@ -12,9 +12,7 @@ /** * The Toolbar class renders the component title area and the toolbar. * - * @package Joomla.Administrator - * @subpackage com_postinstall - * @since 3.2 + * @since 3.2 */ class PostinstallToolbar extends FOFToolbar { diff --git a/administrator/components/com_postinstall/views/messages/view.html.php b/administrator/components/com_postinstall/views/messages/view.html.php index bebcf08eaa36e..9f5e7dc2010ec 100644 --- a/administrator/components/com_postinstall/views/messages/view.html.php +++ b/administrator/components/com_postinstall/views/messages/view.html.php @@ -12,9 +12,7 @@ /** * Model class to display postinstall messages * - * @package Joomla.Administrator - * @subpackage com_postinstall - * @since 3.2 + * @since 3.2 */ class PostinstallViewMessages extends FOFViewHtml { diff --git a/administrator/components/com_redirect/controller.php b/administrator/components/com_redirect/controller.php index b4739532896dc..9d6474c0397dc 100644 --- a/administrator/components/com_redirect/controller.php +++ b/administrator/components/com_redirect/controller.php @@ -12,9 +12,7 @@ /** * Redirect master display controller. * - * @package Joomla.Administrator - * @subpackage com_redirect - * @since 1.6 + * @since 1.6 */ class RedirectController extends JControllerLegacy { @@ -27,15 +25,16 @@ class RedirectController extends JControllerLegacy /** * Method to display a view. * - * @param boolean If true, the view output will be cached - * @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. + * @param boolean $cachable If true, the view output will be cached. + * @param mixed $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * * @return JController This object to support chaining. + * * @since 1.5 */ public function display($cachable = false, $urlparams = false) { - require_once JPATH_COMPONENT.'/helpers/redirect.php'; + require_once JPATH_COMPONENT . '/helpers/redirect.php'; // Load the submenu. RedirectHelper::addSubmenu($this->input->get('view', 'links')); diff --git a/administrator/components/com_redirect/controllers/link.php b/administrator/components/com_redirect/controllers/link.php index c89ebfc50a133..7855ab348ca93 100644 --- a/administrator/components/com_redirect/controllers/link.php +++ b/administrator/components/com_redirect/controllers/link.php @@ -12,9 +12,7 @@ /** * Redirect link controller class. * - * @package Joomla.Administrator - * @subpackage com_redirect - * @since 1.6 + * @since 1.6 */ class RedirectControllerLink extends JControllerForm { diff --git a/administrator/components/com_redirect/controllers/links.php b/administrator/components/com_redirect/controllers/links.php index a2c707610e788..d22aa7f53e73d 100644 --- a/administrator/components/com_redirect/controllers/links.php +++ b/administrator/components/com_redirect/controllers/links.php @@ -12,14 +12,15 @@ /** * Redirect link list controller class. * - * @package Joomla.Administrator - * @subpackage com_redirect - * @since 1.6 + * @since 1.6 */ class RedirectControllerLinks extends JControllerAdmin { /** * Method to update a record. + * + * @return void. + * * @since 1.6 */ public function activate() @@ -47,7 +48,8 @@ public function activate() { JError::raiseWarning(500, $model->getError()); } - else { + else + { $this->setMessage(JText::plural('COM_REDIRECT_N_LINKS_UPDATED', count($ids))); } } @@ -57,6 +59,13 @@ public function activate() /** * Proxy for getModel. + * + * @param string $name The name of the model. + * @param string $prefix The prefix of the model. + * @param array $config An array of settings. + * + * @return JModel instance + * * @since 1.6 */ public function getModel($name = 'Link', $prefix = 'RedirectModel', $config = array('ignore_request' => true)) diff --git a/administrator/components/com_redirect/helpers/html/redirect.php b/administrator/components/com_redirect/helpers/html/redirect.php index 9201418b726ac..254d167dc08fc 100644 --- a/administrator/components/com_redirect/helpers/html/redirect.php +++ b/administrator/components/com_redirect/helpers/html/redirect.php @@ -10,23 +10,33 @@ defined('_JEXEC') or die; /** - * Utility class for creating HTML Grids + * Utility class for creating HTML Grids. * - * @static - * @package Joomla.Administrator - * @subpackage com_redirect - * @since 1.6 + * @since 1.6 */ class JHtmlRedirect { /** - * @param int $value The state value. - * @param int $i - * @param string An optional prefix for the task. - * @param boolean An optional setting for access control on the action. + * Display the published or unpublished state of an item. + * + * @param int $value The state value. + * @param int $i The ID of the item. + * @param boolean $canChange An optional prefix for the task. + * + * @return string + * + * @since 1.6 + * + * @throws InvalidArgumentException */ - public static function published($value = 0, $i, $canChange = true) + public static function published($value = 0, $i = null, $canChange = true) { + // Note: $i is required but has to be an optional argument in the function call due to argument order + if (null === $i) + { + throw new InvalidArgumentException('$i is a required argument in JHtmlRedirect::published'); + } + // Array of image, task, title, action $states = array( 1 => array('tick.png', 'links.unpublish', 'JENABLED', 'COM_REDIRECT_DISABLE_LINK'), @@ -35,11 +45,11 @@ public static function published($value = 0, $i, $canChange = true) -2 => array('trash.png', 'links.publish', 'JTRASHED', 'COM_REDIRECT_ENABLE_LINK'), ); $state = JArrayHelper::getValue($states, (int) $value, $states[0]); - $html = JHtml::_('image', 'admin/'.$state[0], JText::_($state[2]), null, true); + $html = JHtml::_('image', 'admin/' . $state[0], JText::_($state[2]), null, true); + if ($canChange) { - $html = '' - . $html.''; + $html = '' . $html . ''; } return $html; diff --git a/administrator/components/com_redirect/helpers/redirect.php b/administrator/components/com_redirect/helpers/redirect.php index 156917a8ea3cc..7814e5f93fcb8 100644 --- a/administrator/components/com_redirect/helpers/redirect.php +++ b/administrator/components/com_redirect/helpers/redirect.php @@ -12,9 +12,7 @@ /** * Redirect component helper. * - * @package Joomla.Administrator - * @subpackage com_redirect - * @since 1.6 + * @since 1.6 */ class RedirectHelper { @@ -23,7 +21,11 @@ class RedirectHelper /** * Configure the Linkbar. * - * @param string The name of the active view. + * @param string $vName The name of the active view. + * + * @return void. + * + * @since 1.6 */ public static function addSubmenu($vName) { diff --git a/administrator/components/com_redirect/models/link.php b/administrator/components/com_redirect/models/link.php index 2184c1c77de5b..92ad5353fd7a3 100644 --- a/administrator/components/com_redirect/models/link.php +++ b/administrator/components/com_redirect/models/link.php @@ -12,9 +12,7 @@ /** * Redirect link model. * - * @package Joomla.Administrator - * @subpackage com_redirect - * @since 1.6 + * @since 1.6 */ class RedirectModelLink extends JModelAdmin { @@ -27,28 +25,31 @@ class RedirectModelLink extends JModelAdmin /** * Method to test whether a record can be deleted. * - * @param object $record A record object. + * @param object $record A record object. * * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. + * * @since 1.6 */ protected function canDelete($record) { - if ($record->published != -2) { return false; } + $user = JFactory::getUser(); + return $user->authorise('core.delete', 'com_redirect'); } /** * Method to test whether a record can have its state edited. * - * @param object $record A record object. + * @param object $record A record object. * * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. + * * @since 1.6 */ protected function canEditState($record) @@ -62,10 +63,12 @@ protected function canEditState($record) /** * Returns a reference to the a Table object, always creating it. * - * @param type The table type to instantiate - * @param string A prefix for the table class name. Optional. - * @param array Configuration array for model. Optional. + * @param string $type The table type to instantiate + * @param string $prefix A prefix for the table class name. Optional. + * @param array $config Configuration array for model. Optional. + * * @return JTable A database object + * * @since 1.6 */ public function getTable($type = 'Link', $prefix = 'RedirectTable', $config = array()) @@ -76,15 +79,18 @@ public function getTable($type = 'Link', $prefix = 'RedirectTable', $config = ar /** * Method to get the record form. * - * @param array $data Data for the form. - * @param boolean $loadData True if the form is to load its own data (default case), false if not. - * @return JForm A JForm object on success, false on failure + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * + * @return JForm A JForm object on success, false on failure + * * @since 1.6 */ public function getForm($data = array(), $loadData = true) { // Get the form. $form = $this->loadForm('com_redirect.link', 'link', array('control' => 'jform', 'load_data' => $loadData)); + if (empty($form)) { return false; @@ -108,6 +114,7 @@ public function getForm($data = array(), $loadData = true) * Method to get the data that should be injected in the form. * * @return mixed The data for the form. + * * @since 1.6 */ protected function loadFormData() @@ -128,10 +135,12 @@ protected function loadFormData() /** * Method to activate links. * - * @param array An array of link ids. - * @param string The new URL to set for the redirect. - * @param string A comment for the redirect links. + * @param array &$pks An array of link ids. + * @param string $url The new URL to set for the redirect. + * @param string $comment A comment for the redirect links. + * * @return boolean Returns true on success, false on failure. + * * @since 1.6 */ public function activate(&$pks, $url, $comment = null) @@ -151,6 +160,7 @@ public function activate(&$pks, $url, $comment = null) { $pks = array(); $this->setError(JText::_('JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED')); + return false; } @@ -160,7 +170,7 @@ public function activate(&$pks, $url, $comment = null) $query = $db->getQuery(true) ->update($db->quoteName('#__redirect_links')) ->set($db->quoteName('new_url') . ' = ' . $db->quote($url)) - ->set($db->quoteName('published') . ' = ' . $db->quote(1)) + ->set($db->quoteName('published') . ' = ' . (int) 1) ->set($db->quoteName('comment') . ' = ' . $db->quote($comment)) ->where($db->quoteName('id') . ' IN (' . implode(',', $pks) . ')'); $db->setQuery($query); @@ -172,9 +182,11 @@ public function activate(&$pks, $url, $comment = null) catch (RuntimeException $e) { $this->setError($e->getMessage()); + return false; } } + return true; } } diff --git a/administrator/components/com_redirect/models/links.php b/administrator/components/com_redirect/models/links.php index e11f663366940..394daee7f5770 100644 --- a/administrator/components/com_redirect/models/links.php +++ b/administrator/components/com_redirect/models/links.php @@ -12,17 +12,15 @@ /** * Methods supporting a list of redirect links. * - * @package Joomla.Administrator - * @subpackage com_redirect - * @since 1.6 + * @since 1.6 */ class RedirectModelLinks extends JModelList { /** * Constructor. * - * @param array An optional associative array of configuration settings. - * @see JController + * @param array $config An optional associative array of configuration settings. + * * @since 1.6 */ public function __construct($config = array()) @@ -79,9 +77,10 @@ protected function populateState($ordering = null, $direction = null) * different modules that might need different sets of data or different * ordering requirements. * - * @param string A prefix for the store id. + * @param string $id A prefix for the store id. + * + * @return string A store id. * - * @return string A store id. * @since 1.6 */ protected function getStoreId($id = '') @@ -97,6 +96,7 @@ protected function getStoreId($id = '') * Build an SQL query to load the list data. * * @return JDatabaseQuery + * * @since 1.6 */ protected function getListQuery() @@ -116,6 +116,7 @@ protected function getListQuery() // Filter by published state $state = $this->getState('filter.state'); + if (is_numeric($state)) { $query->where('a.published = ' . (int) $state); @@ -127,6 +128,7 @@ protected function getListQuery() // Filter the items over the search string if set. $search = $this->getState('filter.search'); + if (!empty($search)) { if (stripos($search, 'id:') === 0) @@ -148,7 +150,6 @@ protected function getListQuery() // Add the list ordering clause. $query->order($db->escape($this->getState('list.ordering', 'a.old_url')) . ' ' . $db->escape($this->getState('list.direction', 'ASC'))); - //echo nl2br(str_replace('#__','jos_',$query)); return $query; } } diff --git a/administrator/components/com_redirect/tables/link.php b/administrator/components/com_redirect/tables/link.php index 49bb2a20d4362..33810643468ed 100644 --- a/administrator/components/com_redirect/tables/link.php +++ b/administrator/components/com_redirect/tables/link.php @@ -12,21 +12,18 @@ /** * Link Table for Redirect. * - * @package Joomla.Administrator - * @subpackage com_redirect - * @since 1.6 + * @since 1.6 */ class RedirectTableLink extends JTable { /** * Constructor * - * @param object Database object + * @param JDatabaseDriver $db Database object. * - * @return void * @since 1.6 */ - public function __construct(&$db) + public function __construct($db) { parent::__construct('#__redirect_links', 'id', $db); } @@ -35,6 +32,7 @@ public function __construct(&$db) * Overloaded check function * * @return boolean + * * @since 1.6 */ public function check() @@ -46,6 +44,7 @@ public function check() if (empty($this->old_url)) { $this->setError(JText::_('COM_REDIRECT_ERROR_SOURCE_URL_REQUIRED')); + return false; } @@ -53,6 +52,7 @@ public function check() if (empty($this->new_url)) { $this->setError(JText::_('COM_REDIRECT_ERROR_DESTINATION_URL_REQUIRED')); + return false; } @@ -60,6 +60,7 @@ public function check() if ($this->old_url == $this->new_url) { $this->setError(JText::_('COM_REDIRECT_ERROR_DUPLICATE_URLS')); + return false; } @@ -77,6 +78,7 @@ public function check() if ($xid && $xid != (int) $this->id) { $this->setError(JText::_('COM_REDIRECT_ERROR_DUPLICATE_OLD_URL')); + return false; } @@ -86,10 +88,10 @@ public function check() /** * Overriden store method to set dates. * - * @param boolean True to update fields even if they are null. + * @param boolean $updateNulls True to update fields even if they are null. * * @return boolean True on success. - * @see JTable::store + * * @since 1.6 */ public function store($updateNulls = false) diff --git a/administrator/components/com_redirect/views/link/view.html.php b/administrator/components/com_redirect/views/link/view.html.php index af73e4a9a111b..b34b15adf8df0 100644 --- a/administrator/components/com_redirect/views/link/view.html.php +++ b/administrator/components/com_redirect/views/link/view.html.php @@ -12,9 +12,7 @@ /** * View to edit a redirect link. * - * @package Joomla.Administrator - * @subpackage com_redirect - * @since 1.6 + * @since 1.6 */ class RedirectViewLink extends JViewLegacy { @@ -25,7 +23,11 @@ class RedirectViewLink extends JViewLegacy protected $state; /** - * Display the view + * Display the view. + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return mixed False if unsuccessful, otherwise void. * * @since 1.6 */ @@ -39,6 +41,7 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); + return false; } @@ -49,6 +52,8 @@ public function display($tpl = null) /** * Add the page title and toolbar. * + * @return void. + * * @since 1.6 */ protected function addToolbar() @@ -66,10 +71,11 @@ protected function addToolbar() JToolbarHelper::save('link.save'); } - // This component does not support Save as Copy due to uniqueness checks. - // While it can be done, it causes too much confusion if the user does - // not change the Old URL. - + /** + * This component does not support Save as Copy due to uniqueness checks. + * While it can be done, it causes too much confusion if the user does + * not change the Old URL. + */ if ($canDo->get('core.edit') && $canDo->get('core.create')) { JToolbarHelper::save2new('link.save2new'); diff --git a/administrator/components/com_redirect/views/links/view.html.php b/administrator/components/com_redirect/views/links/view.html.php index df2de3454d08a..c346c08c26a6c 100644 --- a/administrator/components/com_redirect/views/links/view.html.php +++ b/administrator/components/com_redirect/views/links/view.html.php @@ -12,9 +12,7 @@ /** * View class for a list of redirection links. * - * @package Joomla.Administrator - * @subpackage com_redirect - * @since 1.6 + * @since 1.6 */ class RedirectViewLinks extends JViewLegacy { @@ -27,7 +25,11 @@ class RedirectViewLinks extends JViewLegacy protected $state; /** - * Display the view + * Display the view. + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return mixed False if unsuccessful, otherwise void. * * @since 1.6 */ @@ -42,6 +44,7 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); + return false; } @@ -53,6 +56,8 @@ public function display($tpl = null) /** * Add the page title and toolbar. * + * @return void. + * * @since 1.6 */ protected function addToolbar() @@ -61,24 +66,30 @@ protected function addToolbar() $canDo = JHelperContent::getActions('com_redirect'); JToolbarHelper::title(JText::_('COM_REDIRECT_MANAGER_LINKS'), 'refresh redirect'); + if ($canDo->get('core.create')) { JToolbarHelper::addNew('link.add'); } + if ($canDo->get('core.edit')) { JToolbarHelper::editList('link.edit'); } + if ($canDo->get('core.edit.state')) { - if ($state->get('filter.state') != 2){ + if ($state->get('filter.state') != 2) + { JToolbarHelper::divider(); JToolbarHelper::publish('links.publish', 'JTOOLBAR_ENABLE', true); JToolbarHelper::unpublish('links.unpublish', 'JTOOLBAR_DISABLE', true); } + if ($state->get('filter.state') != -1 ) { JToolbarHelper::divider(); + if ($state->get('filter.state') != 2) { JToolbarHelper::archiveList('links.archive'); @@ -89,20 +100,24 @@ protected function addToolbar() } } } + if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) { JToolbarHelper::deleteList('', 'links.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolbarHelper::divider(); - } elseif ($canDo->get('core.edit.state')) + } + elseif ($canDo->get('core.edit.state')) { JToolbarHelper::trash('links.trash'); JToolbarHelper::divider(); } + if ($canDo->get('core.admin')) { JToolbarHelper::preferences('com_redirect'); JToolbarHelper::divider(); } + JToolbarHelper::help('JHELP_COMPONENTS_REDIRECT_MANAGER'); JHtmlSidebar::setAction('index.php?option=com_redirect&view=links'); diff --git a/administrator/components/com_search/controller.php b/administrator/components/com_search/controller.php index d1b9d8fd00c30..c2ca2d2a96bd7 100644 --- a/administrator/components/com_search/controller.php +++ b/administrator/components/com_search/controller.php @@ -12,9 +12,7 @@ /** * Search master display controller. * - * @package Joomla.Administrator - * @subpackage com_search - * @since 1.6 + * @since 1.6 */ class SearchController extends JControllerLegacy { @@ -27,15 +25,16 @@ class SearchController extends JControllerLegacy /** * Method to display a view. * - * @param boolean If true, the view output will be cached - * @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. + * @param boolean $cachable If true, the view output will be cached + * @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * * @return JController This object to support chaining. + * * @since 1.5 */ public function display($cachable = false, $urlparams = false) { - require_once JPATH_COMPONENT.'/helpers/search.php'; + require_once JPATH_COMPONENT . '/helpers/search.php'; // Load the submenu. SearchHelper::addSubmenu($this->input->get('view', 'searches')); diff --git a/administrator/components/com_search/controllers/searches.php b/administrator/components/com_search/controllers/searches.php index 82cfe356c06e0..ab9d755dab097 100644 --- a/administrator/components/com_search/controllers/searches.php +++ b/administrator/components/com_search/controllers/searches.php @@ -12,9 +12,7 @@ /** * Methods supporting a list of search terms. * - * @package Joomla.Administrator - * @subpackage com_search - * @since 1.6 + * @since 1.6 */ class SearchControllerSearches extends JControllerLegacy { diff --git a/administrator/components/com_search/helpers/search.php b/administrator/components/com_search/helpers/search.php index 7bf046e972b26..353c08f1efcee 100644 --- a/administrator/components/com_search/helpers/search.php +++ b/administrator/components/com_search/helpers/search.php @@ -12,16 +12,17 @@ /** * Search component helper. * - * @package Joomla.Administrator - * @subpackage com_search - * @since 1.5 + * @since 1.5 */ class SearchHelper { /** * Configure the Linkbar. * - * @param string The name of the active view. + * @param string $vName The name of the active view. + * + * @return void + * * @since 1.6 */ public static function addSubmenu($vName) @@ -34,19 +35,27 @@ public static function addSubmenu($vName) * * @return JObject * - * @deprecated 3.2 Use JHelperContent::getActions() instead + * @deprecated 3.2 Use JHelperContent::getActions() instead. */ public static function getActions() { - // Log usage of deprecated function + // Log usage of deprecated function. JLog::add(__METHOD__ . '() is deprecated, use JHelperContent::getActions() with new arguments order instead.', JLog::WARNING, 'deprecated'); - // Get list of actions + // Get list of actions. $result = JHelperContent::getActions('com_search'); return $result; } + /** + * Sanitise search word. + * + * @param string &$searchword Search word to be sanitised. + * @param string $searchphrase Either 'all', 'any' or 'exact'. + * + * @return boolean True if search word needs to be sanitised. + */ public static function santiseSearchWord(&$searchword, $searchphrase) { $ignored = false; @@ -55,7 +64,7 @@ public static function santiseSearchWord(&$searchword, $searchphrase) $tag = $lang->getTag(); $search_ignore = $lang->getIgnoredSearchWords(); - // Deprecated in 1.6 use $lang->getIgnoredSearchWords instead + // Deprecated in 1.6 use $lang->getIgnoredSearchWords instead. $ignoreFile = $lang->getLanguagePath() . '/' . $tag . '/' . $tag . '.ignore.php'; if (file_exists($ignoreFile)) @@ -63,16 +72,16 @@ public static function santiseSearchWord(&$searchword, $searchphrase) include $ignoreFile; } - // Check for words to ignore + // Check for words to ignore. $aterms = explode(' ', JString::strtolower($searchword)); - // First case is single ignored word + // First case is single ignored word. if (count($aterms) == 1 && in_array(JString::strtolower($searchword), $search_ignore)) { $ignored = true; } - // Filter out search terms that are too small + // Filter out search terms that are too small. $lower_limit = $lang->getLowerLimitSearchWord(); foreach ($aterms as $aterm) @@ -83,7 +92,7 @@ public static function santiseSearchWord(&$searchword, $searchphrase) } } - // Next is to remove ignored words from type 'all' or 'any' (not exact) searches with multiple words + // Next is to remove ignored words from type 'all' or 'any' (not exact) searches with multiple words. if (count($aterms) > 1 && $searchphrase != 'exact') { $pruned = array_diff($aterms, $search_ignore); @@ -94,6 +103,12 @@ public static function santiseSearchWord(&$searchword, $searchphrase) } /** + * Does search word need to be limited? + * + * @param string &$searchword Search word to be checked. + * + * @return boolean True if search word should be limited; false otherwise. + * * @since 1.5 */ public static function limitSearchWord(&$searchword) @@ -102,7 +117,7 @@ public static function limitSearchWord(&$searchword) $lang = JFactory::getLanguage(); - // Limit searchword to a maximum of characters + // Limit searchword to a maximum of characters. $upper_limit = $lang->getUpperLimitSearchWord(); if (JString::strlen($searchword) > $upper_limit) @@ -111,7 +126,7 @@ public static function limitSearchWord(&$searchword) $restriction = true; } - // Searchword must contain a minimum of characters + // Searchword must contain a minimum of characters. if ($searchword && JString::strlen($searchword) < $lang->getLowerLimitSearchWord()) { $searchword = ''; @@ -122,14 +137,14 @@ public static function limitSearchWord(&$searchword) } /** - * Logs a search term + * Logs a search term. * - * @param string $search_term The term being searched + * @param string $search_term The term being searched. * * @return void * * @since 1.5 - * @deprecated 4.0 Use JSearchHelper::logSearch() instead + * @deprecated 4.0 Use JSearchHelper::logSearch() instead. */ public static function logSearch($search_term) { @@ -139,10 +154,10 @@ public static function logSearch($search_term) } /** - * Prepares results from search for display + * Prepares results from search for display. * - * @param string $text The source string - * @param string $searchword The searchword to select around + * @param string $text The source string. + * @param string $searchword The searchword to select around. * * @return string * @@ -150,26 +165,26 @@ public static function logSearch($search_term) */ public static function prepareSearchContent($text, $searchword) { - // Strips tags won't remove the actual jscript + // Strips tags won't remove the actual jscript. $text = preg_replace("']*>.*?'si", "", $text); $text = preg_replace('/{.+?}/', '', $text); // $text = preg_replace('/]*>([^<]+)<\/a>/is','\2', $text); - // Replace line breaking tags with whitespace + // Replace line breaking tags with whitespace. $text = preg_replace("'<(br[^/>]*?/|hr[^/>]*?/|/(div|h[1-6]|li|p|td))>'si", ' ', $text); return self::_smartSubstr(strip_tags($text), $searchword); } /** - * Checks an object for search terms (after stripping fields of HTML) + * Checks an object for search terms (after stripping fields of HTML). * - * @param object $object The object to check - * @param string $searchTerm Search words to check for - * @param array $fields List of object variables to check against + * @param object $object The object to check. + * @param string $searchTerm Search words to check for. + * @param array $fields List of object variables to check against. * - * @return boolean True if searchTerm is in object, false otherwise + * @return boolean True if searchTerm is in object, false otherwise. */ public static function checkNoHtml($object, $searchTerm, $fields) { @@ -215,9 +230,9 @@ public static function checkNoHtml($object, $searchTerm, $fields) } /** - * Transliterates given text to ASCII + * Transliterates given text to ASCII. * - * @param string $str String to remove accents from + * @param string $str String to remove accents from. * * @return string * @@ -227,15 +242,15 @@ public static function remove_accents($str) { $str = JLanguageTransliterate::utf8_latin_to_ascii($str); - //TODO: remove other prefixes as well? + // @TODO: remove other prefixes as well? return preg_replace("/[\"'^]([a-z])/ui", '\1', $str); } /** - * returns substring of characters around a searchword + * Returns substring of characters around a searchword. * - * @param string $text The source string - * @param integer $searchword Number of chars to return + * @param string $text The source string. + * @param integer $searchword Number of chars to return. * * @return string * diff --git a/administrator/components/com_search/helpers/site.php b/administrator/components/com_search/helpers/site.php index 71c51e43006f8..3dd280cd2ad75 100644 --- a/administrator/components/com_search/helpers/site.php +++ b/administrator/components/com_search/helpers/site.php @@ -12,25 +12,28 @@ /** * Mock JSite class used to fool the frontend search plugins because they route the results. * - * @package Joomla.Administrator - * @subpackage com_search - * @since 1.5 + * @since 1.5 */ class JSite extends JObject { /** - * False method to fool the frontend search plugins + * False method to fool the frontend search plugins. + * + * @return JSite * * @since 1.5 */ public function getMenu() { $result = new JSite; + return $result; } /** - * False method to fool the frontend search plugins + * False method to fool the frontend search plugins. + * + * @return array * * @since 1.5 */ diff --git a/administrator/components/com_search/models/searches.php b/administrator/components/com_search/models/searches.php index b0441cac8a521..69a10b0f6c109 100644 --- a/administrator/components/com_search/models/searches.php +++ b/administrator/components/com_search/models/searches.php @@ -12,16 +12,15 @@ /** * Methods supporting a list of search terms. * - * @package Joomla.Administrator - * @subpackage com_search - * @since 1.6 + * @since 1.6 */ class SearchModelSearches extends JModelList { /** * Constructor. * - * @param array An optional associative array of configuration settings. + * @param array $config An optional associative array of configuration settings. + * * @see JController * @since 1.6 */ @@ -74,9 +73,10 @@ protected function populateState($ordering = null, $direction = null) * different modules that might need different sets of data or different * ordering requirements. * - * @param string $id A prefix for the store id. + * @param string $id A prefix for the store id. * * @return string A store id. + * * @since 1.6 */ protected function getStoreId($id = '') @@ -92,6 +92,7 @@ protected function getStoreId($id = '') * Build an SQL query to load the list data. * * @return JDatabaseQuery + * * @since 1.6 */ protected function getListQuery() @@ -117,6 +118,7 @@ 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) . '%')); @@ -126,7 +128,6 @@ protected function getListQuery() // Add the list ordering clause. $query->order($db->escape($this->getState('list.ordering', 'a.hits')) . ' ' . $db->escape($this->getState('list.direction', 'ASC'))); - //echo nl2br(str_replace('#__','jos_',$query)); return $query; } @@ -134,6 +135,7 @@ protected function getListQuery() * Override the parnet getItems to inject optional data. * * @return mixed An array of objects on success, false on failure. + * * @since 1.6 */ public function getItems() @@ -157,6 +159,7 @@ public function getItems() { $results = $app->triggerEvent('onContentSearch', array($item->search_term)); $item->returns = 0; + foreach ($results as $result) { $item->returns += count($result); @@ -171,6 +174,7 @@ public function getItems() * Method to reset the seach log table. * * @return boolean + * * @since 1.6 */ public function reset() @@ -187,6 +191,7 @@ public function reset() catch (RuntimeException $e) { $this->setError($e->getMessage()); + return false; } diff --git a/administrator/components/com_search/views/searches/view.html.php b/administrator/components/com_search/views/searches/view.html.php index 55343b49c05ae..c66b0ab80192a 100644 --- a/administrator/components/com_search/views/searches/view.html.php +++ b/administrator/components/com_search/views/searches/view.html.php @@ -12,9 +12,7 @@ /** * View class for a list of search terms. * - * @package Joomla.Administrator - * @subpackage com_search - * @since 1.5 + * @since 1.5 */ class SearchViewSearches extends JViewLegacy { @@ -27,7 +25,11 @@ class SearchViewSearches extends JViewLegacy protected $state; /** - * Display the view + * Display the view. + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return mixed A string if successful, otherwise a Error object. */ public function display($tpl = null) { @@ -41,6 +43,7 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); + return false; } @@ -51,6 +54,8 @@ public function display($tpl = null) /** * Add the page title and toolbar. * + * @return void + * * @since 1.6 */ protected function addToolbar() @@ -63,11 +68,14 @@ protected function addToolbar() { JToolbarHelper::custom('searches.reset', 'refresh.png', 'refresh_f2.png', 'JSEARCH_RESET', false); } + JToolbarHelper::divider(); + if ($canDo->get('core.admin')) { JToolbarHelper::preferences('com_search'); } + JToolbarHelper::divider(); JToolbarHelper::help('JHELP_COMPONENTS_SEARCH'); } diff --git a/administrator/components/com_tags/controller.php b/administrator/components/com_tags/controller.php index 9b6f4bca3bb7a..545528f7e176c 100644 --- a/administrator/components/com_tags/controller.php +++ b/administrator/components/com_tags/controller.php @@ -12,9 +12,7 @@ /** * Tags view class for the Tags package. * - * @package Joomla.Administrator - * @subpackage com_tags - * @since 3.1 + * @since 3.1 */ class TagsController extends JControllerLegacy { diff --git a/administrator/components/com_tags/controllers/tag.php b/administrator/components/com_tags/controllers/tag.php index e5ba38534e3f7..b46e44586ddc4 100644 --- a/administrator/components/com_tags/controllers/tag.php +++ b/administrator/components/com_tags/controllers/tag.php @@ -12,9 +12,7 @@ /** * The Tag Controller * - * @package Joomla.Administrator - * @subpackage com_tags - * @since 3.1 + * @since 3.1 */ class TagsControllerTag extends JControllerForm { diff --git a/administrator/components/com_tags/controllers/tags.php b/administrator/components/com_tags/controllers/tags.php index 08a6b620eab4a..af330874e73b4 100644 --- a/administrator/components/com_tags/controllers/tags.php +++ b/administrator/components/com_tags/controllers/tags.php @@ -12,9 +12,7 @@ /** * The Tags List Controller * - * @package Joomla.Administrator - * @subpackage com_tags - * @since 3.1 + * @since 3.1 */ class TagsControllerTags extends JControllerAdmin { diff --git a/administrator/components/com_tags/helpers/tags.php b/administrator/components/com_tags/helpers/tags.php index d34ae4e7e5f2c..009df8bd83a04 100644 --- a/administrator/components/com_tags/helpers/tags.php +++ b/administrator/components/com_tags/helpers/tags.php @@ -12,9 +12,7 @@ /** * Tags helper. * - * @package Joomla.Administrator - * @subpackage com_tags - * @since 3.1 + * @since 3.1 */ class TagsHelper extends JHelperContent { diff --git a/administrator/components/com_tags/models/tag.php b/administrator/components/com_tags/models/tag.php index 7f402f923f8a9..88e9ed2309819 100644 --- a/administrator/components/com_tags/models/tag.php +++ b/administrator/components/com_tags/models/tag.php @@ -12,9 +12,7 @@ /** * Tags Component Tag Model * - * @package Joomla.Administrator - * @subpackage com_tags - * @since 3.1 + * @since 3.1 */ class TagsModelTag extends JModelAdmin { diff --git a/administrator/components/com_tags/models/tags.php b/administrator/components/com_tags/models/tags.php index 898ba21664579..64ad947a1bd93 100644 --- a/administrator/components/com_tags/models/tags.php +++ b/administrator/components/com_tags/models/tags.php @@ -12,9 +12,7 @@ /** * Tags Component Tags Model * - * @package Joomla.Administrator - * @subpackage com_tags - * @since 3.1 + * @since 3.1 */ class TagsModelTags extends JModelList { diff --git a/administrator/components/com_tags/tables/tag.php b/administrator/components/com_tags/tables/tag.php index de5d6d7587d36..171284ad7b3a9 100644 --- a/administrator/components/com_tags/tables/tag.php +++ b/administrator/components/com_tags/tables/tag.php @@ -12,9 +12,7 @@ /** * Tags table * - * @package Joomla.Administrator - * @subpackage com_tags - * @since 3.1 + * @since 3.1 */ class TagsTableTag extends JTableNested { diff --git a/administrator/components/com_tags/views/tag/view.html.php b/administrator/components/com_tags/views/tag/view.html.php index bf2f56805d7af..73abc9c3096d9 100644 --- a/administrator/components/com_tags/views/tag/view.html.php +++ b/administrator/components/com_tags/views/tag/view.html.php @@ -12,9 +12,7 @@ /** * HTML View class for the Tags component * - * @package Joomla.Administrator - * @subpackage com_tags - * @since 3.1 + * @since 3.1 */ class TagsViewTag extends JViewLegacy { diff --git a/administrator/components/com_tags/views/tags/view.html.php b/administrator/components/com_tags/views/tags/view.html.php index a1f959f24dc23..b964ce38c25fc 100644 --- a/administrator/components/com_tags/views/tags/view.html.php +++ b/administrator/components/com_tags/views/tags/view.html.php @@ -12,9 +12,7 @@ /** * Tags view class for the Tags package. * - * @package Joomla.Administrator - * @subpackage com_tags - * @since 3.1 + * @since 3.1 */ class TagsViewTags extends JViewLegacy { diff --git a/administrator/components/com_templates/controller.php b/administrator/components/com_templates/controller.php index bf77577b77ac3..f268b803210df 100644 --- a/administrator/components/com_templates/controller.php +++ b/administrator/components/com_templates/controller.php @@ -12,9 +12,7 @@ /** * Templates manager master display controller. * - * @package Joomla.Administrator - * @subpackage com_templates - * @since 1.6 + * @since 1.6 */ class TemplatesController extends JControllerLegacy { diff --git a/administrator/components/com_templates/controllers/style.php b/administrator/components/com_templates/controllers/style.php index 2188a9d5b5312..f61ad30a7f4ac 100644 --- a/administrator/components/com_templates/controllers/style.php +++ b/administrator/components/com_templates/controllers/style.php @@ -12,9 +12,7 @@ /** * Template style controller class. * - * @package Joomla.Administrator - * @subpackage com_templates - * @since 1.6 + * @since 1.6 */ class TemplatesControllerStyle extends JControllerForm { diff --git a/administrator/components/com_templates/controllers/styles.php b/administrator/components/com_templates/controllers/styles.php index 57ac317cfa31c..16f735c48eb5e 100644 --- a/administrator/components/com_templates/controllers/styles.php +++ b/administrator/components/com_templates/controllers/styles.php @@ -12,9 +12,7 @@ /** * Template styles list controller class. * - * @package Joomla.Administrator - * @subpackage com_templates - * @since 1.6 + * @since 1.6 */ class TemplatesControllerStyles extends JControllerAdmin { diff --git a/administrator/components/com_templates/controllers/template.php b/administrator/components/com_templates/controllers/template.php index d276f59584f14..d40542be11599 100644 --- a/administrator/components/com_templates/controllers/template.php +++ b/administrator/components/com_templates/controllers/template.php @@ -14,9 +14,7 @@ /** * Template style controller class. * - * @package Joomla.Administrator - * @subpackage com_templates - * @since 1.6 + * @since 1.6 */ class TemplatesControllerTemplate extends JControllerLegacy { diff --git a/administrator/components/com_templates/helpers/html/templates.php b/administrator/components/com_templates/helpers/html/templates.php index ee6bd5007a940..07399e9831f3a 100644 --- a/administrator/components/com_templates/helpers/html/templates.php +++ b/administrator/components/com_templates/helpers/html/templates.php @@ -10,8 +10,7 @@ defined('_JEXEC') or die; /** - * @package Joomla.Administrator - * @subpackage com_templates + * JHtml helper class. */ class JHtmlTemplates { diff --git a/administrator/components/com_templates/helpers/template.php b/administrator/components/com_templates/helpers/template.php index f4c9330f39231..37411e19aabe1 100644 --- a/administrator/components/com_templates/helpers/template.php +++ b/administrator/components/com_templates/helpers/template.php @@ -12,9 +12,7 @@ /** * Template Helper class. * - * @package Joomla.Administrator - * @subpackage com_templates - * @since 3.2 + * @since 3.2 */ abstract class TemplateHelper { diff --git a/administrator/components/com_templates/helpers/templates.php b/administrator/components/com_templates/helpers/templates.php index 17e37231fe407..892f021a5d4d2 100644 --- a/administrator/components/com_templates/helpers/templates.php +++ b/administrator/components/com_templates/helpers/templates.php @@ -12,9 +12,7 @@ /** * Templates component helper. * - * @package Joomla.Administrator - * @subpackage com_templates - * @since 1.6 + * @since 1.6 */ class TemplatesHelper { diff --git a/administrator/components/com_templates/models/style.php b/administrator/components/com_templates/models/style.php index 17c549923246c..fa352b17fcf4b 100644 --- a/administrator/components/com_templates/models/style.php +++ b/administrator/components/com_templates/models/style.php @@ -12,9 +12,7 @@ /** * Template style model. * - * @package Joomla.Administrator - * @subpackage com_templates - * @since 1.6 + * @since 1.6 */ class TemplatesModelStyle extends JModelAdmin { diff --git a/administrator/components/com_templates/models/styles.php b/administrator/components/com_templates/models/styles.php index e5c3e7438c893..bb0fef0ef56ed 100644 --- a/administrator/components/com_templates/models/styles.php +++ b/administrator/components/com_templates/models/styles.php @@ -12,9 +12,7 @@ /** * Methods supporting a list of template style records. * - * @package Joomla.Administrator - * @subpackage com_templates - * @since 1.6 + * @since 1.6 */ class TemplatesModelStyles extends JModelList { diff --git a/administrator/components/com_templates/models/template.php b/administrator/components/com_templates/models/template.php index 7506868645a7c..ad13ae1ea75dc 100644 --- a/administrator/components/com_templates/models/template.php +++ b/administrator/components/com_templates/models/template.php @@ -12,9 +12,7 @@ /** * Template model class. * - * @package Joomla.Administrator - * @subpackage com_templates - * @since 1.6 + * @since 1.6 */ class TemplatesModelTemplate extends JModelForm { diff --git a/administrator/components/com_templates/models/templates.php b/administrator/components/com_templates/models/templates.php index 810e320381fae..7cf979370455a 100644 --- a/administrator/components/com_templates/models/templates.php +++ b/administrator/components/com_templates/models/templates.php @@ -12,9 +12,7 @@ /** * Methods supporting a list of template extension records. * - * @package Joomla.Administrator - * @subpackage com_templates - * @since 1.6 + * @since 1.6 */ class TemplatesModelTemplates extends JModelList { diff --git a/administrator/components/com_templates/tables/style.php b/administrator/components/com_templates/tables/style.php index c890ad6c894ac..a3d63f1798042 100644 --- a/administrator/components/com_templates/tables/style.php +++ b/administrator/components/com_templates/tables/style.php @@ -12,9 +12,7 @@ /** * Template style table class. * - * @package Joomla.Administrator - * @subpackage com_templates - * @since 1.6 + * @since 1.6 */ class TemplatesTableStyle extends JTable { diff --git a/administrator/components/com_templates/views/style/view.html.php b/administrator/components/com_templates/views/style/view.html.php index 2e33b29549ef1..2c8307152cd1e 100644 --- a/administrator/components/com_templates/views/style/view.html.php +++ b/administrator/components/com_templates/views/style/view.html.php @@ -12,9 +12,7 @@ /** * View to edit a template style. * - * @package Joomla.Administrator - * @subpackage com_templates - * @since 1.6 + * @since 1.6 */ class TemplatesViewStyle extends JViewLegacy { diff --git a/administrator/components/com_templates/views/style/view.json.php b/administrator/components/com_templates/views/style/view.json.php index 01f7fdc7a80d2..5e41fa94ef2ad 100644 --- a/administrator/components/com_templates/views/style/view.json.php +++ b/administrator/components/com_templates/views/style/view.json.php @@ -12,9 +12,7 @@ /** * View to edit a template style. * - * @package Joomla.Administrator - * @subpackage com_templates - * @since 1.6 + * @since 1.6 */ class TemplatesViewStyle extends JViewLegacy { diff --git a/administrator/components/com_templates/views/styles/view.html.php b/administrator/components/com_templates/views/styles/view.html.php index 981f6b134b77d..3d6886b7ad005 100644 --- a/administrator/components/com_templates/views/styles/view.html.php +++ b/administrator/components/com_templates/views/styles/view.html.php @@ -12,9 +12,7 @@ /** * View class for a list of template styles. * - * @package Joomla.Administrator - * @subpackage com_templates - * @since 1.6 + * @since 1.6 */ class TemplatesViewStyles extends JViewLegacy { diff --git a/administrator/components/com_templates/views/template/view.html.php b/administrator/components/com_templates/views/template/view.html.php index 1fe1bd316bc96..a90ee5b35ad9c 100644 --- a/administrator/components/com_templates/views/template/view.html.php +++ b/administrator/components/com_templates/views/template/view.html.php @@ -12,9 +12,7 @@ /** * View to edit a template style. * -* @package Joomla.Administrator -* @subpackage com_templates -* @since 1.6 +* @since 1.6 */ class TemplatesViewTemplate extends JViewLegacy { diff --git a/administrator/components/com_templates/views/templates/view.html.php b/administrator/components/com_templates/views/templates/view.html.php index 993ba9a35bd13..d78f1435a9cb8 100644 --- a/administrator/components/com_templates/views/templates/view.html.php +++ b/administrator/components/com_templates/views/templates/view.html.php @@ -12,9 +12,7 @@ /** * View class for a list of template styles. * - * @package Joomla.Administrator - * @subpackage com_templates - * @since 1.6 + * @since 1.6 */ class TemplatesViewTemplates extends JViewLegacy { diff --git a/administrator/components/com_users/controller.php b/administrator/components/com_users/controller.php index 64f51358b84b0..4c2d8087a8be4 100644 --- a/administrator/components/com_users/controller.php +++ b/administrator/components/com_users/controller.php @@ -12,9 +12,7 @@ /** * Users master display controller. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersController extends JControllerLegacy { diff --git a/administrator/components/com_users/controllers/group.php b/administrator/components/com_users/controllers/group.php index 8864468faa267..a06437195d132 100644 --- a/administrator/components/com_users/controllers/group.php +++ b/administrator/components/com_users/controllers/group.php @@ -12,9 +12,7 @@ /** * User view level controller class. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersControllerGroup extends JControllerForm { diff --git a/administrator/components/com_users/controllers/groups.php b/administrator/components/com_users/controllers/groups.php index 4609c9d37f76e..e8b301f738661 100644 --- a/administrator/components/com_users/controllers/groups.php +++ b/administrator/components/com_users/controllers/groups.php @@ -12,9 +12,7 @@ /** * User groups list controller class. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersControllerGroups extends JControllerAdmin { diff --git a/administrator/components/com_users/controllers/level.php b/administrator/components/com_users/controllers/level.php index 754a234fcaf40..3ec864ce0a82b 100644 --- a/administrator/components/com_users/controllers/level.php +++ b/administrator/components/com_users/controllers/level.php @@ -12,9 +12,7 @@ /** * User view level controller class. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersControllerLevel extends JControllerForm { diff --git a/administrator/components/com_users/controllers/levels.php b/administrator/components/com_users/controllers/levels.php index 616349c85df9b..eb6786713bf58 100644 --- a/administrator/components/com_users/controllers/levels.php +++ b/administrator/components/com_users/controllers/levels.php @@ -12,9 +12,7 @@ /** * User view levels list controller class. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersControllerLevels extends JControllerAdmin { diff --git a/administrator/components/com_users/controllers/mail.php b/administrator/components/com_users/controllers/mail.php index 5a4eb08e5882c..80d5caeb6a721 100644 --- a/administrator/components/com_users/controllers/mail.php +++ b/administrator/components/com_users/controllers/mail.php @@ -12,9 +12,7 @@ /** * Users mail controller. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersControllerMail extends JControllerLegacy { diff --git a/administrator/components/com_users/controllers/note.php b/administrator/components/com_users/controllers/note.php index 7336dc8b05f14..c3a863f1c45a9 100644 --- a/administrator/components/com_users/controllers/note.php +++ b/administrator/components/com_users/controllers/note.php @@ -12,9 +12,7 @@ /** * User note controller class. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 2.5 + * @since 2.5 */ class UsersControllerNote extends JControllerForm { diff --git a/administrator/components/com_users/controllers/notes.php b/administrator/components/com_users/controllers/notes.php index 1fdb2debf24e5..3daaedb758b4b 100644 --- a/administrator/components/com_users/controllers/notes.php +++ b/administrator/components/com_users/controllers/notes.php @@ -12,9 +12,7 @@ /** * User notes controller class. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 2.5 + * @since 2.5 */ class UsersControllerNotes extends JControllerAdmin { diff --git a/administrator/components/com_users/controllers/user.php b/administrator/components/com_users/controllers/user.php index df13d7739fbd6..1de29f2175318 100644 --- a/administrator/components/com_users/controllers/user.php +++ b/administrator/components/com_users/controllers/user.php @@ -12,9 +12,7 @@ /** * User controller class. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersControllerUser extends JControllerForm { diff --git a/administrator/components/com_users/controllers/users.php b/administrator/components/com_users/controllers/users.php index bc0ebaf5d5868..d1761f1d5377c 100644 --- a/administrator/components/com_users/controllers/users.php +++ b/administrator/components/com_users/controllers/users.php @@ -12,9 +12,7 @@ /** * Users list controller class. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersControllerUsers extends JControllerAdmin { diff --git a/administrator/components/com_users/helpers/debug.php b/administrator/components/com_users/helpers/debug.php index b4af3b400ffcb..89e94bde5f810 100644 --- a/administrator/components/com_users/helpers/debug.php +++ b/administrator/components/com_users/helpers/debug.php @@ -12,9 +12,7 @@ /** * Users component debugging helper. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersHelperDebug { diff --git a/administrator/components/com_users/helpers/html/users.php b/administrator/components/com_users/helpers/html/users.php index 3e7793383e176..a658d81e32b8e 100644 --- a/administrator/components/com_users/helpers/html/users.php +++ b/administrator/components/com_users/helpers/html/users.php @@ -12,9 +12,7 @@ /** * Extended Utility class for the Users component. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 2.5 + * @since 2.5 */ class JHtmlUsers { diff --git a/administrator/components/com_users/helpers/users.php b/administrator/components/com_users/helpers/users.php index dc764ddde8c2c..e037057bfde10 100644 --- a/administrator/components/com_users/helpers/users.php +++ b/administrator/components/com_users/helpers/users.php @@ -12,9 +12,7 @@ /** * Users component helper. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersHelper { diff --git a/administrator/components/com_users/models/debuggroup.php b/administrator/components/com_users/models/debuggroup.php index aaaedfc0159a2..dc0ded7a2d05d 100644 --- a/administrator/components/com_users/models/debuggroup.php +++ b/administrator/components/com_users/models/debuggroup.php @@ -14,9 +14,7 @@ /** * Methods supporting a list of user records. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersModelDebuggroup extends JModelList { diff --git a/administrator/components/com_users/models/debuguser.php b/administrator/components/com_users/models/debuguser.php index a73245751df02..491395a79757d 100644 --- a/administrator/components/com_users/models/debuguser.php +++ b/administrator/components/com_users/models/debuguser.php @@ -14,9 +14,7 @@ /** * Methods supporting a list of user records. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersModelDebugUser extends JModelList { diff --git a/administrator/components/com_users/models/fields/groupparent.php b/administrator/components/com_users/models/fields/groupparent.php index 25247c75f44b9..4db6ae086d028 100644 --- a/administrator/components/com_users/models/fields/groupparent.php +++ b/administrator/components/com_users/models/fields/groupparent.php @@ -14,9 +14,7 @@ /** * Form Field class for the Joomla Framework. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class JFormFieldGroupParent extends JFormFieldList { diff --git a/administrator/components/com_users/models/group.php b/administrator/components/com_users/models/group.php index 82a5dec07eb0f..53844144f824a 100644 --- a/administrator/components/com_users/models/group.php +++ b/administrator/components/com_users/models/group.php @@ -12,9 +12,7 @@ /** * User group model. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersModelGroup extends JModelAdmin { diff --git a/administrator/components/com_users/models/groups.php b/administrator/components/com_users/models/groups.php index ef623ef878be6..17ffd78729a2b 100644 --- a/administrator/components/com_users/models/groups.php +++ b/administrator/components/com_users/models/groups.php @@ -12,9 +12,7 @@ /** * Methods supporting a list of user group records. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersModelGroups extends JModelList { diff --git a/administrator/components/com_users/models/level.php b/administrator/components/com_users/models/level.php index 313e827edca61..ac9c00d796808 100644 --- a/administrator/components/com_users/models/level.php +++ b/administrator/components/com_users/models/level.php @@ -12,9 +12,7 @@ /** * User view level model. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersModelLevel extends JModelAdmin { diff --git a/administrator/components/com_users/models/levels.php b/administrator/components/com_users/models/levels.php index d43e56d12e3d4..a6af463daceb2 100644 --- a/administrator/components/com_users/models/levels.php +++ b/administrator/components/com_users/models/levels.php @@ -12,9 +12,7 @@ /** * Methods supporting a list of user access level records. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersModelLevels extends JModelList { diff --git a/administrator/components/com_users/models/mail.php b/administrator/components/com_users/models/mail.php index 98179b3ad1952..976a92f5012fd 100644 --- a/administrator/components/com_users/models/mail.php +++ b/administrator/components/com_users/models/mail.php @@ -12,9 +12,7 @@ /** * Users mail model. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersModelMail extends JModelAdmin { diff --git a/administrator/components/com_users/models/note.php b/administrator/components/com_users/models/note.php index 84fdecdb381a1..c347c1030ae0e 100644 --- a/administrator/components/com_users/models/note.php +++ b/administrator/components/com_users/models/note.php @@ -12,9 +12,7 @@ /** * User note model. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 2.5 + * @since 2.5 */ class UsersModelNote extends JModelAdmin { diff --git a/administrator/components/com_users/models/notes.php b/administrator/components/com_users/models/notes.php index ffbc35e81c126..75d1fdfbad34c 100644 --- a/administrator/components/com_users/models/notes.php +++ b/administrator/components/com_users/models/notes.php @@ -12,9 +12,7 @@ /** * User notes model class. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 2.5 + * @since 2.5 */ class UsersModelNotes extends JModelList { diff --git a/administrator/components/com_users/models/user.php b/administrator/components/com_users/models/user.php index 6a3e6a0652b41..fc8bf17cd73fe 100644 --- a/administrator/components/com_users/models/user.php +++ b/administrator/components/com_users/models/user.php @@ -12,9 +12,7 @@ /** * User model. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersModelUser extends JModelAdmin { diff --git a/administrator/components/com_users/models/users.php b/administrator/components/com_users/models/users.php index dd6d47f97e9da..48454af40949a 100644 --- a/administrator/components/com_users/models/users.php +++ b/administrator/components/com_users/models/users.php @@ -12,9 +12,7 @@ /** * Methods supporting a list of user records. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersModelUsers extends JModelList { diff --git a/administrator/components/com_users/tables/note.php b/administrator/components/com_users/tables/note.php index 3095706c62def..57da10c7dbe18 100644 --- a/administrator/components/com_users/tables/note.php +++ b/administrator/components/com_users/tables/note.php @@ -12,9 +12,7 @@ /** * User notes table class * - * @package Joomla.Administrator - * @subpackage com_users - * @since 2.5 + * @since 2.5 */ class UsersTableNote extends JTable { diff --git a/administrator/components/com_users/views/debuggroup/view.html.php b/administrator/components/com_users/views/debuggroup/view.html.php index 80cef640a0f07..45ed07e1d35e0 100644 --- a/administrator/components/com_users/views/debuggroup/view.html.php +++ b/administrator/components/com_users/views/debuggroup/view.html.php @@ -12,9 +12,7 @@ /** * View class for a list of users. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersViewDebuggroup extends JViewLegacy { diff --git a/administrator/components/com_users/views/debuguser/view.html.php b/administrator/components/com_users/views/debuguser/view.html.php index 23722f83a73e4..8edc606a9e692 100644 --- a/administrator/components/com_users/views/debuguser/view.html.php +++ b/administrator/components/com_users/views/debuguser/view.html.php @@ -12,9 +12,7 @@ /** * View class for a list of users. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersViewDebuguser extends JViewLegacy { diff --git a/administrator/components/com_users/views/group/view.html.php b/administrator/components/com_users/views/group/view.html.php index 7ce89f5d34a3b..39c520ea052aa 100644 --- a/administrator/components/com_users/views/group/view.html.php +++ b/administrator/components/com_users/views/group/view.html.php @@ -12,9 +12,7 @@ /** * View to edit a user group. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersViewGroup extends JViewLegacy { diff --git a/administrator/components/com_users/views/groups/view.html.php b/administrator/components/com_users/views/groups/view.html.php index 306663ad2e701..2b5a88b0a1c72 100644 --- a/administrator/components/com_users/views/groups/view.html.php +++ b/administrator/components/com_users/views/groups/view.html.php @@ -12,9 +12,7 @@ /** * View class for a list of user groups. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersViewGroups extends JViewLegacy { diff --git a/administrator/components/com_users/views/level/view.html.php b/administrator/components/com_users/views/level/view.html.php index f310b397824d0..f0045ae07ede8 100644 --- a/administrator/components/com_users/views/level/view.html.php +++ b/administrator/components/com_users/views/level/view.html.php @@ -12,9 +12,7 @@ /** * View to edit a user view level. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersViewLevel extends JViewLegacy { diff --git a/administrator/components/com_users/views/levels/view.html.php b/administrator/components/com_users/views/levels/view.html.php index 7526f5208e097..71c36bbe5d616 100644 --- a/administrator/components/com_users/views/levels/view.html.php +++ b/administrator/components/com_users/views/levels/view.html.php @@ -12,9 +12,7 @@ /** * The HTML Users access levels view. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersViewLevels extends JViewLegacy { diff --git a/administrator/components/com_users/views/mail/view.html.php b/administrator/components/com_users/views/mail/view.html.php index 4c8787cdeb850..827dbc0ac52ff 100644 --- a/administrator/components/com_users/views/mail/view.html.php +++ b/administrator/components/com_users/views/mail/view.html.php @@ -12,9 +12,7 @@ /** * Users mail view. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersViewMail extends JViewLegacy { diff --git a/administrator/components/com_users/views/note/view.html.php b/administrator/components/com_users/views/note/view.html.php index 7b63fe6954ae0..54526f958df54 100644 --- a/administrator/components/com_users/views/note/view.html.php +++ b/administrator/components/com_users/views/note/view.html.php @@ -12,9 +12,7 @@ /** * User note edit view * - * @package Joomla.Administrator - * @subpackage com_users - * @since 2.5 + * @since 2.5 */ class UsersViewNote extends JViewLegacy { diff --git a/administrator/components/com_users/views/notes/view.html.php b/administrator/components/com_users/views/notes/view.html.php index 7b4458df1c78d..6283ac34d6970 100644 --- a/administrator/components/com_users/views/notes/view.html.php +++ b/administrator/components/com_users/views/notes/view.html.php @@ -12,9 +12,7 @@ /** * User notes list view * - * @package Joomla.Administrator - * @subpackage com_users - * @since 2.5 + * @since 2.5 */ class UsersViewNotes extends JViewLegacy { diff --git a/administrator/components/com_users/views/user/view.html.php b/administrator/components/com_users/views/user/view.html.php index f1a70db0d728c..64b831f461a05 100644 --- a/administrator/components/com_users/views/user/view.html.php +++ b/administrator/components/com_users/views/user/view.html.php @@ -10,11 +10,9 @@ defined('_JEXEC') or die; /** - * User view - * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.5 + * User view class. + * + * @since 1.5 */ class UsersViewUser extends JViewLegacy { diff --git a/administrator/components/com_users/views/users/view.html.php b/administrator/components/com_users/views/users/view.html.php index 11c18894e31e2..698238218e611 100644 --- a/administrator/components/com_users/views/users/view.html.php +++ b/administrator/components/com_users/views/users/view.html.php @@ -12,9 +12,7 @@ /** * View class for a list of users. * - * @package Joomla.Administrator - * @subpackage com_users - * @since 1.6 + * @since 1.6 */ class UsersViewUsers extends JViewLegacy { diff --git a/administrator/components/com_weblinks/controller.php b/administrator/components/com_weblinks/controller.php index 02d89150af83c..c2205955aff5e 100644 --- a/administrator/components/com_weblinks/controller.php +++ b/administrator/components/com_weblinks/controller.php @@ -12,9 +12,7 @@ /** * Weblinks Weblink Controller * - * @package Joomla.Administrator - * @subpackage com_weblinks - * @since 1.5 + * @since 1.5 */ class WeblinksController extends JControllerLegacy { diff --git a/administrator/components/com_weblinks/controllers/weblink.php b/administrator/components/com_weblinks/controllers/weblink.php index 2361894cae9f5..7c2540e2284b8 100644 --- a/administrator/components/com_weblinks/controllers/weblink.php +++ b/administrator/components/com_weblinks/controllers/weblink.php @@ -12,9 +12,7 @@ /** * Weblink controller class. * - * @package Joomla.Administrator - * @subpackage com_weblinks - * @since 1.6 + * @since 1.6 */ class WeblinksControllerWeblink extends JControllerForm { diff --git a/administrator/components/com_weblinks/controllers/weblinks.php b/administrator/components/com_weblinks/controllers/weblinks.php index f78b72b2d779b..f41136b1c76e8 100644 --- a/administrator/components/com_weblinks/controllers/weblinks.php +++ b/administrator/components/com_weblinks/controllers/weblinks.php @@ -12,9 +12,7 @@ /** * Weblinks list controller class. * - * @package Joomla.Administrator - * @subpackage com_weblinks - * @since 1.6 + * @since 1.6 */ class WeblinksControllerWeblinks extends JControllerAdmin { diff --git a/administrator/components/com_weblinks/helpers/weblinks.php b/administrator/components/com_weblinks/helpers/weblinks.php index 550a87c95bda8..cc765b4ded6bf 100644 --- a/administrator/components/com_weblinks/helpers/weblinks.php +++ b/administrator/components/com_weblinks/helpers/weblinks.php @@ -12,9 +12,7 @@ /** * Weblinks helper. * - * @package Joomla.Administrator - * @subpackage com_weblinks - * @since 1.6 + * @since 1.6 */ class WeblinksHelper extends JHelperContent { diff --git a/administrator/components/com_weblinks/models/weblink.php b/administrator/components/com_weblinks/models/weblink.php index 5742581e5db70..1aea25f7fdd72 100644 --- a/administrator/components/com_weblinks/models/weblink.php +++ b/administrator/components/com_weblinks/models/weblink.php @@ -12,9 +12,7 @@ /** * Weblinks model. * - * @package Joomla.Administrator - * @subpackage com_weblinks - * @since 1.5 + * @since 1.5 */ class WeblinksModelWeblink extends JModelAdmin { diff --git a/administrator/components/com_weblinks/models/weblinks.php b/administrator/components/com_weblinks/models/weblinks.php index 580a360361763..8cfe9dbca1504 100644 --- a/administrator/components/com_weblinks/models/weblinks.php +++ b/administrator/components/com_weblinks/models/weblinks.php @@ -12,9 +12,7 @@ /** * Methods supporting a list of weblink records. * - * @package Joomla.Administrator - * @subpackage com_weblinks - * @since 1.6 + * @since 1.6 */ class WeblinksModelWeblinks extends JModelList { diff --git a/administrator/components/com_weblinks/tables/weblink.php b/administrator/components/com_weblinks/tables/weblink.php index e04fbacdd2216..10d0b47bd2beb 100644 --- a/administrator/components/com_weblinks/tables/weblink.php +++ b/administrator/components/com_weblinks/tables/weblink.php @@ -12,9 +12,7 @@ /** * Weblink Table class * - * @package Joomla.Administrator - * @subpackage com_weblinks - * @since 1.5 + * @since 1.5 */ class WeblinksTableWeblink extends JTable { diff --git a/administrator/components/com_weblinks/views/weblink/view.html.php b/administrator/components/com_weblinks/views/weblink/view.html.php index 152243d4c5d70..526176d6afe4e 100644 --- a/administrator/components/com_weblinks/views/weblink/view.html.php +++ b/administrator/components/com_weblinks/views/weblink/view.html.php @@ -12,9 +12,7 @@ /** * View to edit a weblink. * - * @package Joomla.Administrator - * @subpackage com_weblinks - * @since 1.5 + * @since 1.5 */ class WeblinksViewWeblink extends JViewLegacy { diff --git a/administrator/components/com_weblinks/views/weblinks/view.html.php b/administrator/components/com_weblinks/views/weblinks/view.html.php index 45abc8633999c..5fc0890ddd351 100644 --- a/administrator/components/com_weblinks/views/weblinks/view.html.php +++ b/administrator/components/com_weblinks/views/weblinks/view.html.php @@ -12,9 +12,7 @@ /** * View class for a list of weblinks. * - * @package Joomla.Administrator - * @subpackage com_weblinks - * @since 1.5 + * @since 1.5 */ class WeblinksViewWeblinks extends JViewLegacy { diff --git a/administrator/modules/mod_quickicon/helper.php b/administrator/modules/mod_quickicon/helper.php index c4aa9933f17f8..822391aa89bf7 100644 --- a/administrator/modules/mod_quickicon/helper.php +++ b/administrator/modules/mod_quickicon/helper.php @@ -192,6 +192,7 @@ public static function groupButtons($buttons) { $groupedButtons[$button['group']][] = $button; } + return $groupedButtons; } diff --git a/administrator/templates/isis/css/template.css b/administrator/templates/isis/css/template.css index ceb73a908c3b8..5659379d0dd85 100644 --- a/administrator/templates/isis/css/template.css +++ b/administrator/templates/isis/css/template.css @@ -7196,6 +7196,7 @@ body .navbar-fixed-top { color: #0C192E; text-shadow: 0 1px 0 #FFF; margin-bottom: 10px; + min-height:43px; } .subhead-collapse.collapse { height: auto; diff --git a/administrator/templates/isis/less/template.less b/administrator/templates/isis/less/template.less index 90fb829eff2d2..2d0bdb4a2e3fd 100644 --- a/administrator/templates/isis/less/template.less +++ b/administrator/templates/isis/less/template.less @@ -302,14 +302,11 @@ body .navbar-fixed-top{ background: -ms-linear-gradient(top, #ffffff 0%,#ededed 100%); /* IE10+ */ background: linear-gradient(top, #ffffff 0%,#ededed 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ededed',GradientType=0 ); /* IE6-9 */ - border-bottom: 1px solid #D3D3D3; - color: #0C192E; text-shadow: 0 1px 0 #FFF; - margin-bottom: 10px; - + min-height:43px; } .subhead-collapse.collapse { height: auto; diff --git a/bin/keychain.php b/bin/keychain.php index 5a8348e41665f..e0f862f04094d 100644 --- a/bin/keychain.php +++ b/bin/keychain.php @@ -94,6 +94,7 @@ public function execute( ) { $this->saveKeychain(); } + exit(0); } @@ -203,6 +204,7 @@ protected function create() $this->out('error: entry already exists. To change this entry, use "change"'); exit(1); } + $this->change(); } @@ -220,6 +222,7 @@ protected function change() $this->out("usage: {$this->input->executable} [options] change entry_name entry_value"); exit(1); } + $this->updated = true; $this->keychain->setValue($this->input->args[1], $this->input->args[2]); } @@ -298,6 +301,7 @@ protected function listEntries() { $line .= ': ' . $this->dumpVar($value); } + $this->out($line); } } diff --git a/build/phpcs/Joomla/Sniffs/Commenting/ClassCommentSniff.php b/build/phpcs/Joomla/Sniffs/Commenting/ClassCommentSniff.php index bcd0eeef04c9b..4346f0e3aa8d7 100644 --- a/build/phpcs/Joomla/Sniffs/Commenting/ClassCommentSniff.php +++ b/build/phpcs/Joomla/Sniffs/Commenting/ClassCommentSniff.php @@ -70,7 +70,7 @@ class Joomla_Sniffs_Commenting_ClassCommentSniff extends Joomla_Sniffs_Commentin 'order_text' => 'must follow @version (if used)', ), 'package' => array( - 'required' => true, + 'required' => false, 'allow_multiple' => false, 'order_text' => 'must follow @category (if used)', ), diff --git a/components/com_banners/models/banners.php b/components/com_banners/models/banners.php index 82fcccccba69d..5a32d79329369 100644 --- a/components/com_banners/models/banners.php +++ b/components/com_banners/models/banners.php @@ -146,7 +146,14 @@ protected function getListQuery() foreach ($keywords as $keyword) { $keyword = trim($keyword); - $condition1 = "a.own_prefix=1 AND a.metakey_prefix=SUBSTRING(" . $db->quote($keyword) . ",1,LENGTH( a.metakey_prefix)) OR a.own_prefix=0 AND cl.own_prefix=1 AND cl.metakey_prefix=SUBSTRING(" . $db->quote($keyword) . ",1,LENGTH(cl.metakey_prefix)) OR a.own_prefix=0 AND cl.own_prefix=0 AND " . ($prefix == substr($keyword, 0, strlen($prefix)) ? '1' : '0'); + $condition1 = "a.own_prefix=1 " + . " AND a.metakey_prefix=SUBSTRING(" . $db->quote($keyword) . ",1,LENGTH( a.metakey_prefix)) " + . " OR a.own_prefix=0 " + . " AND cl.own_prefix=1 " + . " AND cl.metakey_prefix=SUBSTRING(" . $db->quote($keyword) . ",1,LENGTH(cl.metakey_prefix)) " + . " OR a.own_prefix=0 " + . " AND cl.own_prefix=0 " + . " AND " . ($prefix == substr($keyword, 0, strlen($prefix)) ? '1' : '0'); $condition2 = "a.metakey REGEXP '[[:<:]]" . $db->escape($keyword) . "[[:>:]]'"; diff --git a/components/com_banners/router.php b/components/com_banners/router.php index 2a9e578278396..3079b74661436 100644 --- a/components/com_banners/router.php +++ b/components/com_banners/router.php @@ -117,7 +117,7 @@ public function parse(&$segments) * @since 3.3 * @deprecated 4.0 Use Class based routers instead */ -function BannersBuildRoute(&$query) +function bannersBuildRoute(&$query) { $router = new BannersRouter; @@ -137,7 +137,7 @@ function BannersBuildRoute(&$query) * @since 3.3 * @deprecated 4.0 Use Class based routers instead */ -function BannersParseRoute($segments) +function bannersParseRoute($segments) { $router = new BannersRouter; diff --git a/components/com_config/controller/cmsbase.php b/components/com_config/controller/cmsbase.php index 60acd49d77585..7a361d152c45a 100644 --- a/components/com_config/controller/cmsbase.php +++ b/components/com_config/controller/cmsbase.php @@ -15,7 +15,7 @@ * @package Joomla.Site * @subpackage com_config * @since 3.2 -*/ + */ class ConfigControllerCmsbase extends JControllerBase { /** diff --git a/components/com_config/controller/config/display.php b/components/com_config/controller/config/display.php index 4d43c5ab696a6..fc98d19d60ad0 100644 --- a/components/com_config/controller/config/display.php +++ b/components/com_config/controller/config/display.php @@ -15,7 +15,7 @@ * @package Joomla.Site * @subpackage com_config * @since 3.2 -*/ + */ class ConfigControllerConfigDisplay extends ConfigControllerDisplay { /** diff --git a/components/com_config/controller/config/save.php b/components/com_config/controller/config/save.php index d79c8952ed869..b80f87b45247b 100644 --- a/components/com_config/controller/config/save.php +++ b/components/com_config/controller/config/save.php @@ -14,7 +14,7 @@ * @package Joomla.Site * @subpackage com_config * @since 3.2 -*/ + */ class ConfigControllerConfigSave extends JControllerBase { /** diff --git a/components/com_config/controller/display.php b/components/com_config/controller/display.php index 604e766ab7e4a..6c7d3497f0b0d 100644 --- a/components/com_config/controller/display.php +++ b/components/com_config/controller/display.php @@ -15,7 +15,7 @@ * @package Joomla.Site * @subpackage com_config * @since 3.2 -*/ + */ class ConfigControllerDisplay extends JControllerBase { /** diff --git a/components/com_config/controller/helper.php b/components/com_config/controller/helper.php index 09eb972dfe02a..a323582d7c0eb 100644 --- a/components/com_config/controller/helper.php +++ b/components/com_config/controller/helper.php @@ -15,7 +15,7 @@ * @package Joomla.Site * @subpackage com_config * @since 3.2 -*/ + */ class ConfigControllerHelper { /** diff --git a/components/com_config/controller/templates/display.php b/components/com_config/controller/templates/display.php index ee13ab38a8da2..bb65d8ce4a1be 100644 --- a/components/com_config/controller/templates/display.php +++ b/components/com_config/controller/templates/display.php @@ -15,7 +15,7 @@ * @package Joomla.Site * @subpackage com_config * @since 3.2 -*/ + */ class ConfigControllerTemplatesDisplay extends ConfigControllerDisplay { /** diff --git a/components/com_config/controller/templates/save.php b/components/com_config/controller/templates/save.php index 14608a6d370f1..43517a9da2767 100644 --- a/components/com_config/controller/templates/save.php +++ b/components/com_config/controller/templates/save.php @@ -14,7 +14,7 @@ * @package Joomla.Site * @subpackage com_config * @since 3.2 -*/ + */ class ConfigControllerTemplatesSave extends JControllerBase { /** diff --git a/components/com_config/model/form.php b/components/com_config/model/form.php index d1403466a4186..fc4280185b82a 100644 --- a/components/com_config/model/form.php +++ b/components/com_config/model/form.php @@ -188,7 +188,6 @@ protected function loadForm($name, $source = null, $options = array(), $clear = // Load the data into the form after the plugins have operated. $form->bind($data); - } catch (Exception $e) { diff --git a/components/com_config/view/cms/html.php b/components/com_config/view/cms/html.php index ce7b9bf7e3c39..0ea7fe2a8e543 100644 --- a/components/com_config/view/cms/html.php +++ b/components/com_config/view/cms/html.php @@ -102,12 +102,6 @@ public function loadTemplate($tpl = null) $lang->load('tpl_' . $template, JPATH_BASE, null, false, true) || $lang->load('tpl_' . $template, JPATH_THEMES . "/$template", null, false, true); - // Change the template folder if alternative layout is in different template - /* if (isset($layoutTemplate) && $layoutTemplate != '_' && $layoutTemplate != $template) - { - $this->_path['template'] = str_replace($template, $layoutTemplate, $this->_path['template']); - } */ - // Prevents adding path twise if (empty($this->_path['template'])) { diff --git a/components/com_contact/controller.php b/components/com_contact/controller.php index 35ad619b893f6..da5593245ef63 100644 --- a/components/com_contact/controller.php +++ b/components/com_contact/controller.php @@ -21,13 +21,14 @@ class ContactController extends JControllerLegacy /** * Method to display a view. * - * @param boolean If true, the view output will be cached - * @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. + * @param boolean $cachable If true, the view output will be cached + * @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. + * + * @return JControllerLegacy This object to support chaining. * - * @return JController This object to support chaining. * @since 1.5 */ - public function display($cachable = false, $urlparams = false) + public function display($cachable = false, $urlparams = array()) { $cachable = true; @@ -35,8 +36,10 @@ public function display($cachable = false, $urlparams = false) $vName = $this->input->get('view', 'categories'); $this->input->set('view', $vName); - $safeurlparams = array('catid' => 'INT', 'id' => 'INT', 'cid' => 'ARRAY', 'year' => 'INT', 'month' => 'INT', 'limit' => 'UINT', 'limitstart' => 'UINT', - 'showall' => 'INT', 'return' => 'BASE64', 'filter' => 'STRING', 'filter_order' => 'CMD', 'filter_order_Dir' => 'CMD', 'filter-search' => 'STRING', 'print' => 'BOOLEAN', 'lang' => 'CMD'); + $safeurlparams = array('catid' => 'INT', 'id' => 'INT', 'cid' => 'ARRAY', 'year' => 'INT', 'month' => 'INT', + 'limit' => 'UINT', 'limitstart' => 'UINT', 'showall' => 'INT', 'return' => 'BASE64', 'filter' => 'STRING', + 'filter_order' => 'CMD', 'filter_order_Dir' => 'CMD', 'filter-search' => 'STRING', 'print' => 'BOOLEAN', + 'lang' => 'CMD'); parent::display($cachable, $safeurlparams); diff --git a/components/com_contact/controllers/contact.php b/components/com_contact/controllers/contact.php index 61d81bd14fd41..057a24dde777d 100644 --- a/components/com_contact/controllers/contact.php +++ b/components/com_contact/controllers/contact.php @@ -10,16 +10,37 @@ defined('_JEXEC') or die; /** + * Controller for single contact view + * * @package Joomla.Site * @subpackage com_contact + * @since 1.5.19 */ class ContactControllerContact extends JControllerForm { + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6.4 + */ public function getModel($name = '', $prefix = '', $config = array('ignore_request' => true)) { return parent::getModel($name, $prefix, array('ignore_request' => false)); } + /** + * Method to submit the contact form and send an email. + * + * @return boolean True on success sending the email. False on failure. + * + * @since 1.5.19 + */ public function submit() { // Check for request forgeries. @@ -145,6 +166,17 @@ public function submit() return true; } + /** + * Method to get a model object, loading it if required. + * + * @param array $data The data to send in the email. + * @param stdClass $contact The user information to send the email to + * @param boolean $copy_email_activated True to send a copy of the email to the user. + * + * @return boolean True on success sending the email, false on failure. + * + * @since 1.6.4 + */ private function _sendEmail($data, $contact, $copy_email_activated) { $app = JFactory::getApplication(); diff --git a/components/com_contact/helpers/category.php b/components/com_contact/helpers/category.php index e814bcabe846a..3757f8b525e16 100644 --- a/components/com_contact/helpers/category.php +++ b/components/com_contact/helpers/category.php @@ -18,6 +18,13 @@ */ class ContactCategories extends JCategories { + /** + * Class constructor + * + * @param array $options Array of options + * + * @since 1.6 + */ public function __construct($options = array()) { $options['table'] = '#__contact_details'; diff --git a/components/com_contact/helpers/icon.php b/components/com_contact/helpers/icon.php index b9ad28cfb0902..8be3e25f8ee10 100644 --- a/components/com_contact/helpers/icon.php +++ b/components/com_contact/helpers/icon.php @@ -60,7 +60,7 @@ public static function print_popup($article, $params, $attribs = array()) } else { - $text = JText::_('JGLOBAL_ICON_SEP') . ' ' . JText::_('JGLOBAL_PRINT') .' ' . JText::_('JGLOBAL_ICON_SEP'); + $text = JText::_('JGLOBAL_ICON_SEP') . ' ' . JText::_('JGLOBAL_PRINT') . ' ' . JText::_('JGLOBAL_ICON_SEP'); } $attribs['title'] = JText::_('JGLOBAL_PRINT'); diff --git a/components/com_contact/helpers/route.php b/components/com_contact/helpers/route.php index 1023c46357380..b6be28e517484 100644 --- a/components/com_contact/helpers/route.php +++ b/components/com_contact/helpers/route.php @@ -24,7 +24,15 @@ abstract class ContactHelperRoute protected static $lang_lookup = array(); /** - * @param integer The route of the contact + * Get the URL route for a contact from a contact ID, contact category ID and language + * + * @param integer $id The id of the contact + * @param integer $catid The id of the contact's category + * @param mixed $language The id of the language being used. + * + * @return string The link to the contact + * + * @since 1.5 */ public static function getContactRoute($id, $catid, $language = 0) { @@ -66,6 +74,16 @@ public static function getContactRoute($id, $catid, $language = 0) return $link; } + /** + * Get the URL route for a contact category from a contact category ID and language + * + * @param mixed $catid The id of the contact's category either an integer id or a instance of JCategoryNode + * @param mixed $language The id of the language being used. + * + * @return string The link to the contact + * + * @since 1.5 + */ public static function getCategoryRoute($catid, $language = 0) { if ($catid instanceof JCategoryNode) diff --git a/components/com_contact/models/categories.php b/components/com_contact/models/categories.php index c894e48bb91dd..5de82c2ece9b3 100644 --- a/components/com_contact/models/categories.php +++ b/components/com_contact/models/categories.php @@ -41,6 +41,11 @@ class ContactModelCategories extends JModelList * * Note. Calling getState in this method will result in recursion. * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) @@ -66,25 +71,25 @@ protected function populateState($ordering = null, $direction = null) * different modules that might need different sets of data or different * ordering requirements. * - * @param string $id A prefix for the store id. + * @param string $id A prefix for the store id. * * @return string A store id. */ protected function getStoreId($id = '') { // Compile the store id. - $id .= ':'.$this->getState('filter.extension'); - $id .= ':'.$this->getState('filter.published'); - $id .= ':'.$this->getState('filter.access'); - $id .= ':'.$this->getState('filter.parentId'); + $id .= ':' . $this->getState('filter.extension'); + $id .= ':' . $this->getState('filter.published'); + $id .= ':' . $this->getState('filter.access'); + $id .= ':' . $this->getState('filter.parentId'); return parent::getStoreId($id); } /** - * redefine the function an add some properties to make the styling more easy + * Redefine the function an add some properties to make the styling more easy * - * @return mixed An array of data items on success, false on failure. + * @return mixed An array of data items on success, false on failure. */ public function getItems() { @@ -94,18 +99,23 @@ public function getItems() $menu = $app->getMenu(); $active = $menu->getActive(); $params = new JRegistry; + if ($active) { $params->loadString($active->params); } + $options = array(); $options['countItems'] = $params->get('show_cat_items_cat', 1) || !$params->get('show_empty_categories_cat', 0); $categories = JCategories::getInstance('Contact', $options); $this->_parent = $categories->get($this->getState('filter.parentId', 'root')); + if (is_object($this->_parent)) { $this->_items = $this->_parent->getChildren(); - } else { + } + else + { $this->_items = false; } } @@ -113,12 +123,20 @@ public function getItems() return $this->_items; } + /** + * Gets the id of the parent category for the selected list of categories + * + * @return integer The id of the parent category + * + * @since 1.6.0 + */ public function getParent() { if (!is_object($this->_parent)) { $this->getItems(); } + return $this->_parent; } } diff --git a/components/com_contact/models/category.php b/components/com_contact/models/category.php index eeead1ec3ae32..7ec77e29b141e 100644 --- a/components/com_contact/models/category.php +++ b/components/com_contact/models/category.php @@ -10,6 +10,8 @@ defined('_JEXEC') or die; /** + * Single item model for a contact + * * @package Joomla.Site * @subpackage com_contact * @since 1.5 @@ -40,18 +42,18 @@ class ContactModelCategory extends JModelList protected $_category = null; /** - * The list of other newfeed categories. + * The list of other contact categories. * * @access protected - * @var array + * @var array */ protected $_categories = null; /** * Constructor. * - * @param array An optional associative array of configuration settings. - * @see JController + * @param array $config An optional associative array of configuration settings. + * @since 1.6 */ public function __construct($config = array()) @@ -98,7 +100,6 @@ public function getItems() } $this->tags = new JHelperTags; $this->tags->getItemTags('com_contact.contact', $item->id); - } return $items; @@ -120,7 +121,7 @@ protected function getListQuery() $query = $db->getQuery(true); // Select required fields from the categories. - //sqlsrv changes + // Changes for sqlsrv $case_when = ' CASE WHEN '; $case_when .= $query->charLength('a.alias', '!=', '0'); $case_when .= ' THEN '; @@ -218,6 +219,7 @@ protected function populateState($ordering = null, $direction = null) // List state information $format = $app->input->getWord('format'); + if ($format == 'feed') { $limit = $app->get('feed_limit'); @@ -226,6 +228,7 @@ protected function populateState($ordering = null, $direction = null) { $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->get('list_limit'), 'uint'); } + $this->setState('list.limit', $limit); $limitstart = $app->input->get('limitstart', 0, 'uint'); @@ -236,10 +239,12 @@ protected function populateState($ordering = null, $direction = null) // Get list ordering default from the parameters $menuParams = new JRegistry; + if ($menu = $app->getMenu()->getActive()) { $menuParams->loadString($menu->params); } + $mergedParams = clone $params; $mergedParams->merge($menuParams); @@ -251,24 +256,28 @@ protected function populateState($ordering = null, $direction = null) $this->setState('list.ordering', $orderCol); $listOrder = $app->input->get('filter_order_Dir', 'ASC'); + if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', ''))) { $listOrder = 'ASC'; } + $this->setState('list.direction', $listOrder); $id = $app->input->get('id', 0, 'int'); $this->setState('category.id', $id); $user = JFactory::getUser(); + if ((!$user->authorise('core.edit.state', 'com_contact')) && (!$user->authorise('core.edit', 'com_contact'))) { - // limit to published for people who can't edit or edit.state. + // Limit to published for people who can't edit or edit.state. $this->setState('filter.published', 1); // Filter by start and end dates. $this->setState('filter.publish_date', true); } + $this->setState('filter.language', JLanguageMultilang::isEnabled()); // Load the parameters. @@ -278,9 +287,8 @@ protected function populateState($ordering = null, $direction = null) /** * Method to get category data for the current category * - * @param integer An optional ID + * @return object The category object * - * @return object * @since 1.5 */ public function getCategory() @@ -305,10 +313,12 @@ public function getCategory() { $this->_children = $this->_item->getChildren(); $this->_parent = false; + if ($this->_item->getParent()) { $this->_parent = $this->_item->getParent(); } + $this->_rightsibling = $this->_item->getSibling(); $this->_leftsibling = $this->_item->getSibling(false); } @@ -325,8 +335,6 @@ public function getCategory() /** * Get the parent category. * - * @param integer An optional category id. If not supplied, the model state 'category.id' will be used. - * * @return mixed An array of categories or false if an error occurs. */ public function getParent() @@ -335,6 +343,7 @@ public function getParent() { $this->getCategory(); } + return $this->_parent; } @@ -343,37 +352,43 @@ public function getParent() * * @return mixed An array of categories or false if an error occurs. */ - function &getLeftSibling() + public function &getLeftSibling() { if (!is_object($this->_item)) { $this->getCategory(); } + return $this->_leftsibling; } - function &getRightSibling() + /** + * Get the sibling (adjacent) categories. + * + * @return mixed An array of categories or false if an error occurs. + */ + public function &getRightSibling() { if (!is_object($this->_item)) { $this->getCategory(); } + return $this->_rightsibling; } /** * Get the child categories. * - * @param integer An optional category id. If not supplied, the model state 'category.id' will be used. - * * @return mixed An array of categories or false if an error occurs. */ - function &getChildren() + public function &getChildren() { if (!is_object($this->_item)) { $this->getCategory(); } + return $this->_children; } diff --git a/components/com_contact/models/contact.php b/components/com_contact/models/contact.php index 07b7ac1b37f35..8c25d67a41059 100644 --- a/components/com_contact/models/contact.php +++ b/components/com_contact/models/contact.php @@ -17,10 +17,17 @@ class ContactModelContact extends JModelForm { /** + * The name of the view for a single item + * * @since 1.6 */ protected $view_item = 'contact'; + /** + * A loaded item + * + * @since 1.6 + */ protected $_item = null; /** @@ -35,6 +42,8 @@ class ContactModelContact extends JModelForm * * Note. Calling getState in this method will result in recursion. * + * @return void + * * @since 1.6 */ protected function populateState() @@ -64,8 +73,9 @@ protected function populateState() * * @param array $data An optional array of data for the form to interrogate. * @param boolean $loadData True if the form is to load its own data (default case), false if not. - * + * * @return JForm A JForm object on success, false on failure + * * @since 1.6 */ public function getForm($data = array(), $loadData = true) @@ -90,6 +100,13 @@ public function getForm($data = array(), $loadData = true) return $form; } + /** + * Method to get the data that should be injected in the form. + * + * @return array The default data is an empty array. + * + * @since 1.6.2 + */ protected function loadFormData() { $data = (array) JFactory::getApplication()->getUserState('com_contact.contact.data', array()); @@ -104,7 +121,9 @@ protected function loadFormData() * * @param integer $pk Id for the contact * - * @return mixed Object or null + * @return mixed Object or null + * + * @since 1.6.0 */ public function &getItem($pk = null) { @@ -122,7 +141,7 @@ public function &getItem($pk = null) $db = $this->getDbo(); $query = $db->getQuery(true); - // Sqlsrv changes + // Changes for sqlsrv $case_when = ' CASE WHEN '; $case_when .= $query->charLength('a.alias', '!=', '0'); $case_when .= ' THEN '; @@ -167,7 +186,6 @@ public function &getItem($pk = null) } $db->setQuery($query); - $data = $db->loadObject(); if (empty($data)) @@ -237,6 +255,15 @@ public function &getItem($pk = null) return $this->_item[$pk]; } + /** + * Gets the query to load a contact item + * + * @param integer $pk The item to be loaded + * + * @return mixed The contact object on success, false on failure + * + * @throws Exception On database failure + */ protected function getContactQuery($pk = null) { // @todo Cache on the fingerprint of the arguments @@ -308,6 +335,7 @@ protected function getContactQuery($pk = null) catch (Exception $e) { $this->setError($e); + return false; } @@ -316,7 +344,7 @@ protected function getContactQuery($pk = null) $user = JFactory::getUser(); $groups = implode(',', $user->getAuthorisedViewLevels()); - //get the content by the linked user + // Get the content by the linked user $query = $db->getQuery(true) ->select('a.id') ->select('a.title') @@ -338,29 +366,35 @@ protected function getContactQuery($pk = null) $c_id = $query->castAsChar('c.id'); $case_when1 .= $query->concatenate(array($c_id, 'c.alias'), ':'); $case_when1 .= ' ELSE '; - $case_when1 .= $c_id.' END as catslug'; + $case_when1 .= $c_id . ' END as catslug'; $query->select($case_when1 . ',' . $case_when) ->from('#__content as a') ->join('LEFT', '#__categories as c on a.catid=c.id') ->where('a.created_by = ' . (int) $result->user_id) ->where('a.access IN (' . $groups . ')') ->order('a.state DESC, a.created DESC'); - // filter per language if plugin published + + // Filter per language if plugin published if (JLanguageMultilang::isEnabled()) { - $query->where(('a.created_by = ' . (int) $result->user_id) . ' AND ' . ('a.language=' . $db->quote(JFactory::getLanguage()->getTag()) . ' OR a.language=' . $db->quote('*'))); + $query->where( + ('a.created_by = ' . (int) $result->user_id) . ' AND ' . + ('a.language=' . $db->quote(JFactory::getLanguage()->getTag()) . ' OR a.language=' . $db->quote('*')) + ); } + if (is_numeric($published)) { $query->where('a.state IN (1,2)') ->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')') ->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')'); } + $db->setQuery($query, 0, 10); $articles = $db->loadObjectList(); $result->articles = $articles; - //get the profile information for the linked user + // Get the profile information for the linked user require_once JPATH_ADMINISTRATOR . '/components/com_users/models/user.php'; $userModel = JModelLegacy::getInstance('User', 'UsersModel', array('ignore_request' => true)); $data = $userModel->getItem((int) $result->user_id); @@ -385,6 +419,8 @@ protected function getContactQuery($pk = null) return $result; } } + + return false; } /** diff --git a/components/com_contact/models/featured.php b/components/com_contact/models/featured.php index 2cd80061d950c..5b77f0f14108d 100644 --- a/components/com_contact/models/featured.php +++ b/components/com_contact/models/featured.php @@ -12,45 +12,78 @@ /** * @package Joomla.Site * @subpackage com_contact + * @since 1.6.0 */ class ContactModelFeatured extends JModelList { /** * Category items data * - * @var array + * @var array + * @since 1.6.0-beta1 + * @deprecated 4.0 Variable not used since 1.6.0-beta8 */ protected $_item = null; + /** + * Who knows what this was for? It has never been used + * + * @var array + * @since 1.6.0-beta1 + * @deprecated 4.0 Variable not used ever + */ protected $_articles = null; + /** + * Get the siblings of the category + * + * @var array + * @since 1.6.0-beta1 + * @deprecated 4.0 Variable not used since 1.6.0-beta8 + */ protected $_siblings = null; + /** + * Get the children of the category + * + * @var array + * @since 1.6.0-beta1 + * @deprecated 4.0 Variable not used since 1.6.0-beta8 + */ protected $_children = null; + /** + * Get the parent of the category + * + * @var array + * @since 1.6.0-beta1 + * @deprecated 4.0 Variable not used since 1.6.0-beta8 + */ protected $_parent = null; /** * The category that applies. * - * @access protected - * @var object + * @access protected + * @var object + * @deprecated 4.0 Variable not used ever */ protected $_category = null; /** - * The list of other cotnact categories. + * The list of other contact categories. * * @access protected - * @var array + * @var array + * @deprecated 4.0 Variable not used ever */ protected $_categories = null; /** * Constructor. * - * @param array An optional associative array of configuration settings. - * @see JController + * @param array $config An optional associative array of configuration settings. + * * @since 1.6 */ public function __construct($config = array()) @@ -100,6 +133,7 @@ public function getItems() * Method to build an SQL query to load the list data. * * @return string An SQL query + * * @since 1.6 */ protected function getListQuery() @@ -118,20 +152,24 @@ protected function getListQuery() ->where('a.featured=1') ->join('INNER', '#__categories AS c ON c.id = a.catid') ->where('c.access IN (' . $groups . ')'); + // Filter by category. if ($categoryId = $this->getState('category.id')) { $query->where('a.catid = ' . (int) $categoryId); } - //sqlsrv change... aliased c.published to cat_published + + // Change for sqlsrv... aliased c.published to cat_published // Join to check for category published state in parent categories up the tree $query->select('c.published as cat_published, CASE WHEN badcats.id is null THEN c.published ELSE 0 END AS parents_published'); $subquery = 'SELECT cat.id as id FROM #__categories AS cat JOIN #__categories AS parent '; $subquery .= 'ON cat.lft BETWEEN parent.lft AND parent.rgt '; $subquery .= 'WHERE parent.extension = ' . $db->quote('com_contact'); + // Find any up-path categories that are not published // If all categories are published, badcats.id will be null, and we just use the contact state $subquery .= ' AND parent.published != 1 GROUP BY cat.id '; + // Select state to unpublished if up-path category is unpublished $publishedWhere = 'CASE WHEN badcats.id is null THEN a.published ELSE 0 END'; $query->join('LEFT OUTER', '(' . $subquery . ') AS badcats ON badcats.id = c.id'); @@ -168,6 +206,11 @@ protected function getListQuery() * * Note. Calling getState in this method will result in recursion. * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) diff --git a/components/com_contact/router.php b/components/com_contact/router.php index b385ae41d6a84..604757723741a 100644 --- a/components/com_contact/router.php +++ b/components/com_contact/router.php @@ -259,6 +259,10 @@ public function parse(&$segments) * These functions are proxys for the new router interface * for old SEF extensions. * + * @param array &$query An array of URL arguments + * + * @return array The URL arguments to use to assemble the subsequent URL. + * * @deprecated 4.0 Use Class based routers instead */ function ContactBuildRoute(&$query) @@ -268,6 +272,18 @@ function ContactBuildRoute(&$query) return $router->build($query); } +/** + * Contact router functions + * + * These functions are proxys for the new router interface + * for old SEF extensions. + * + * @param array &$segments The segments of the URL to parse. + * + * @return array The URL attributes to be used by the application. + * + * @deprecated 4.0 Use Class based routers instead + */ function ContactParseRoute($segments) { $router = new ContactRouter; diff --git a/components/com_contact/views/category/tmpl/default_items.php b/components/com_contact/views/category/tmpl/default_items.php index bc63470005291..6a5f47c2de056 100644 --- a/components/com_contact/views/category/tmpl/default_items.php +++ b/components/com_contact/views/category/tmpl/default_items.php @@ -23,7 +23,7 @@
    params->get('filter_field') != 'hide') :?>
    - +
    diff --git a/components/com_contact/views/category/view.html.php b/components/com_contact/views/category/view.html.php index 1a7daa2cb6158..113dfa1f3e7f6 100644 --- a/components/com_contact/views/category/view.html.php +++ b/components/com_contact/views/category/view.html.php @@ -51,7 +51,7 @@ public function display($tpl = null) // Compute the contact slug. foreach ($this->items as $item) { - $item->slug = $item->alias ? ($item->id.':'.$item->alias) : $item->id; + $item->slug = $item->alias ? ($item->id . ':' . $item->alias) : $item->id; $temp = new JRegistry; $temp->loadString($item->params); $item->params = clone($this->params); diff --git a/components/com_contact/views/contact/tmpl/default.php b/components/com_contact/views/contact/tmpl/default.php index 872f86590fafa..c52fd87f09fd9 100644 --- a/components/com_contact/views/contact/tmpl/default.php +++ b/components/com_contact/views/contact/tmpl/default.php @@ -68,7 +68,7 @@ params->get('presentation_style') == 'plain'):?> - '. JText::_('COM_CONTACT_DETAILS').''; ?> + ' . JText::_('COM_CONTACT_DETAILS') . ''; ?> contact->image && $this->params->get('show_image')) : ?> @@ -89,7 +89,7 @@ params->get('allow_vcard')) : ?> - + @@ -109,7 +109,7 @@ params->get('presentation_style') == 'plain'):?> - '. JText::_('COM_CONTACT_EMAIL_FORM').''; ?> + ' . JText::_('COM_CONTACT_EMAIL_FORM') . ''; ?> loadTemplate('form'); ?> @@ -136,7 +136,7 @@ params->get('presentation_style') == 'plain'):?> - '. JText::_('JGLOBAL_ARTICLES').''; ?> + ' . JText::_('JGLOBAL_ARTICLES') . ''; ?> loadTemplate('articles'); ?> @@ -159,7 +159,7 @@ params->get('presentation_style') == 'plain'):?> - '. JText::_('COM_CONTACT_PROFILE').''; ?> + ' . JText::_('COM_CONTACT_PROFILE') . ''; ?> loadTemplate('profile'); ?> @@ -182,7 +182,7 @@ params->get('presentation_style') == 'plain'):?> - '. JText::_('COM_CONTACT_OTHER_INFORMATION').''; ?> + ' . JText::_('COM_CONTACT_OTHER_INFORMATION') . ''; ?>
    diff --git a/components/com_contact/views/contact/tmpl/default_address.php b/components/com_contact/views/contact/tmpl/default_address.php index 65239dd9cf99e..fcca63f7d16f5 100644 --- a/components/com_contact/views/contact/tmpl/default_address.php +++ b/components/com_contact/views/contact/tmpl/default_address.php @@ -10,7 +10,7 @@ defined('_JEXEC') or die; /** - * marker_class: Class based on the selection of text, none, or icons + * Marker_class: Class based on the selection of text, none, or icons * jicon-text, jicon-none, jicon-icon */ ?> @@ -28,7 +28,7 @@ contact->address && $this->params->get('show_street_address')) : ?>
    - contact->address .'
    '; ?> + contact->address . '
    '; ?>
    @@ -36,7 +36,7 @@ contact->suburb && $this->params->get('show_suburb')) : ?>
    - contact->suburb .'
    '; ?> + contact->suburb . '
    '; ?>
    @@ -50,14 +50,14 @@ contact->postcode && $this->params->get('show_postcode')) : ?>
    - contact->postcode .'
    '; ?> + contact->postcode . '
    '; ?>
    contact->country && $this->params->get('show_country')) : ?>
    - contact->country .'
    '; ?> + contact->country . '
    '; ?>
    diff --git a/components/com_contact/views/contact/tmpl/default_form.php b/components/com_contact/views/contact/tmpl/default_form.php index 383a3dbb3b591..fe52411d5b1f4 100644 --- a/components/com_contact/views/contact/tmpl/default_form.php +++ b/components/com_contact/views/contact/tmpl/default_form.php @@ -44,7 +44,7 @@
    form->getInput('contact_email_copy'); ?>
    - + form->getFieldsets() as $fieldset) : ?> name != 'contact') : ?> form->getFieldset($fieldset->name); ?> diff --git a/components/com_contact/views/contact/view.html.php b/components/com_contact/views/contact/view.html.php index f49a109082c5c..40063b584789d 100644 --- a/components/com_contact/views/contact/view.html.php +++ b/components/com_contact/views/contact/view.html.php @@ -20,12 +20,37 @@ */ class ContactViewContact extends JViewLegacy { + /** + * The item model state + * + * @var \Joomla\Registry\Registry + * @since 1.6 + */ protected $state; + /** + * The form object for the contact item + * + * @var JForm + * @since 1.6 + */ protected $form; + /** + * The item object details + * + * @var JObject + * @since 1.6 + */ protected $item; + /** + * The page to return to on sumission + * + * @var string + * @since 1.6 + * @deprecated 4.0 Variable not used + */ protected $return_page; /** @@ -133,7 +158,7 @@ public function display($tpl = null) } else { - $image1 = JHtml::_('image', 'contacts/'.$params->get('icon_address', 'con_address.png'), JText::_('COM_CONTACT_ADDRESS').": ", null, true); + $image1 = JHtml::_('image', 'contacts/' . $params->get('icon_address', 'con_address.png'), JText::_('COM_CONTACT_ADDRESS') . ": ", null, true); } if ($params->get('icon_email')) @@ -169,7 +194,11 @@ public function display($tpl = null) } else { - $image5 = JHtml::_('image', 'contacts/' . $params->get('icon_misc', 'con_info.png'), JText::_('COM_CONTACT_OTHER_INFORMATION') . ": ", null, true); + $image5 = JHtml::_( + 'image', + 'contacts/' . $params->get('icon_misc', 'con_info.png'), + JText::_('COM_CONTACT_OTHER_INFORMATION') . ": ", null, true + ); } if ($params->get('icon_mobile')) @@ -198,6 +227,7 @@ public function display($tpl = null) { $contact->link = JRoute::_(ContactHelperRoute::getContactRoute($contact->slug, $contact->catid)); } + $item->link = JRoute::_(ContactHelperRoute::getContactRoute($item->slug, $item->catid)); } diff --git a/components/com_contact/views/contact/view.vcf.php b/components/com_contact/views/contact/view.vcf.php index de9dfe4fcb2c2..0e3ada7d93920 100644 --- a/components/com_contact/views/contact/view.vcf.php +++ b/components/com_contact/views/contact/view.vcf.php @@ -10,13 +10,27 @@ defined('_JEXEC') or die; /** + * View to create a VCF for a contact item + * * @package Joomla.Site * @subpackage com_contact + * @since 1.6 */ class ContactViewContact extends JViewLegacy { + /** + * The item model state + * + * @var \Joomla\Registry\Registry + * @deprecated 4.0 Variable not used + */ protected $state; + /** + * The contact item + * + * @var JObject + */ protected $item; /** diff --git a/components/com_contact/views/featured/view.html.php b/components/com_contact/views/featured/view.html.php index 1f5a9c9738251..f31381a1debbc 100644 --- a/components/com_contact/views/featured/view.html.php +++ b/components/com_contact/views/featured/view.html.php @@ -10,7 +10,7 @@ defined('_JEXEC') or die; /** - * Frontpage View class + * Featured View class * * @package Joomla.Site * @subpackage com_contact @@ -18,19 +18,53 @@ */ class ContactViewFeatured extends JViewLegacy { + /** + * The item model state + * + * @var \Joomla\Registry\Registry + * @since 1.6.0 + */ protected $state; + /** + * The item details + * + * @var JObject + * @since 1.6.0 + */ protected $items; + /** + * Who knows what this variable was intended for - but it's never been used + * + * @var array + * @since 1.6.0 + * @deprecated 4.0 This variable has been null since 1.6.0-beta8 + */ protected $category; + /** + * Who knows what this variable was intended for - but it's never been used + * + * @var JObject Maybe. + * @since 1.6.0 + * @deprecated 4.0 This variable has never been used ever + */ protected $categories; + /** + * The pagination object + * + * @var JPagination + * @since 1.6.0 + */ protected $pagination; /** * Display the view * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * * @return mixed False on error, null otherwise. */ public function display($tpl = null) @@ -67,10 +101,13 @@ public function display($tpl = null) if ($item->params->get('show_email', 0) == 1) { $item->email_to = trim($item->email_to); + if (!empty($item->email_to) && JMailHelper::isEmailAddress($item->email_to)) { $item->email_to = JHtml::_('email.cloak', $item->email_to); - } else { + } + else + { $item->email_to = ''; } } @@ -96,6 +133,10 @@ public function display($tpl = null) /** * Prepares the document + * + * @return void + * + * @since 1.6 */ protected function _prepareDocument() { diff --git a/components/com_content/content.php b/components/com_content/content.php index 9896afed82023..ee8870d0fbf3c 100644 --- a/components/com_content/content.php +++ b/components/com_content/content.php @@ -9,8 +9,8 @@ defined('_JEXEC') or die; -require_once JPATH_COMPONENT.'/helpers/route.php'; -require_once JPATH_COMPONENT.'/helpers/query.php'; +require_once JPATH_COMPONENT . '/helpers/route.php'; +require_once JPATH_COMPONENT . '/helpers/query.php'; $controller = JControllerLegacy::getInstance('Content'); $controller->execute(JFactory::getApplication()->input->get('task')); diff --git a/components/com_content/controller.php b/components/com_content/controller.php index 4ccd604cd4bc0..a258f97615e5b 100644 --- a/components/com_content/controller.php +++ b/components/com_content/controller.php @@ -18,6 +18,15 @@ */ class ContentController extends JControllerLegacy { + /** + * Constructor. + * + * @param array $config An optional associative array of configuration settings. + * Recognized key values include 'name', 'default_task', 'model_path', and + * 'view_path' (this list is not meant to be comprehensive). + * + * @since 12.2 + */ public function __construct($config = array()) { $this->input = JFactory::getApplication()->input; @@ -40,34 +49,52 @@ public function __construct($config = array()) /** * Method to display a view. * - * @param boolean If true, the view output will be cached - * @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. + * @param boolean $cachable If true, the view output will be cached. + * @param boolean $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. + * + * @return JController This object to support chaining. * - * @return JController This object to support chaining. * @since 1.5 */ public function display($cachable = false, $urlparams = false) { $cachable = true; - // Set the default view name and format from the Request. - // Note we are using a_id to avoid collisions with the router and the return page. - // Frontend is a bit messier than the backend. + /** + * Set the default view name and format from the Request. + * Note we are using a_id to avoid collisions with the router and the return page. + * Frontend is a bit messier than the backend. + */ $id = $this->input->getInt('a_id'); $vName = $this->input->getCmd('view', 'categories'); $this->input->set('view', $vName); $user = JFactory::getUser(); - if ($user->get('id') || - ($this->input->getMethod() == 'POST' && - (($vName == 'category' && $this->input->get('layout') != 'blog') || $vName == 'archive' ))) + if ($user->get('id') + || ($this->input->getMethod() == 'POST' + && (($vName == 'category' && $this->input->get('layout') != 'blog') || $vName == 'archive' ))) { $cachable = false; } - $safeurlparams = array('catid' => 'INT', 'id' => 'INT', 'cid' => 'ARRAY', 'year' => 'INT', 'month' => 'INT', 'limit' => 'UINT', 'limitstart' => 'UINT', - 'showall' => 'INT', 'return' => 'BASE64', 'filter' => 'STRING', 'filter_order' => 'CMD', 'filter_order_Dir' => 'CMD', 'filter-search' => 'STRING', 'print' => 'BOOLEAN', 'lang' => 'CMD', 'Itemid' => 'INT'); + $safeurlparams = array( + 'catid' => 'INT', + 'id' => 'INT', + 'cid' => 'ARRAY', + 'year' => 'INT', + 'month' => 'INT', + 'limit' => 'UINT', + 'limitstart' => 'UINT', + 'showall' => 'INT', + 'return' => 'BASE64', + 'filter' => 'STRING', + 'filter_order' => 'CMD', + 'filter_order_Dir' => 'CMD', + 'filter-search' => 'STRING', + 'print' => 'BOOLEAN', + 'lang' => 'CMD', + 'Itemid' => 'INT'); // Check for edit form. if ($vName == 'form' && !$this->checkEditId('com_content.edit.article', $id)) diff --git a/components/com_content/controllers/article.php b/components/com_content/controllers/article.php index 4b9c0d68795ac..f9fdc28d9f5dc 100644 --- a/components/com_content/controllers/article.php +++ b/components/com_content/controllers/article.php @@ -73,7 +73,7 @@ protected function allowAdd($data = array()) if ($categoryId) { // If the category has been passed in the data or URL check it. - $allow = $user->authorise('core.create', 'com_content.category.'.$categoryId); + $allow = $user->authorise('core.create', 'com_content.category.' . $categoryId); } if ($allow === null) @@ -116,6 +116,7 @@ protected function allowEdit($data = array(), $key = 'id') { // Now test the owner is the user. $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; + if (empty($ownerId) && $recordId) { // Need to do a lookup from the model. @@ -212,25 +213,28 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'a_id') { // Need to override the parent method completely. $tmpl = $this->input->get('tmpl'); -// $layout = $this->input->get('layout', 'edit'); + $append = ''; // Setup redirect info. if ($tmpl) { - $append .= '&tmpl='.$tmpl; + $append .= '&tmpl=' . $tmpl; } // TODO This is a bandaid, not a long term solution. -// if ($layout) -// { -// $append .= '&layout=' . $layout; -// } + /** + * if ($layout) + * { + * $append .= '&layout=' . $layout; + * } + */ + $append .= '&layout=edit'; if ($recordId) { - $append .= '&'.$urlVar.'='.$recordId; + $append .= '&' . $urlVar . '=' . $recordId; } $itemId = $this->input->getInt('Itemid'); @@ -239,17 +243,17 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'a_id') if ($itemId) { - $append .= '&Itemid='.$itemId; + $append .= '&Itemid=' . $itemId; } if ($catId) { - $append .= '&catid='.$catId; + $append .= '&catid=' . $catId; } if ($return) { - $append .= '&return='.base64_encode($return); + $append .= '&return=' . base64_encode($return); } return $append; @@ -281,8 +285,8 @@ protected function getReturnPage() /** * Function that allows child controller access to model data after the data has been saved. * - * @param JModelLegacy $model The data model object. - * @param array $validData The validated data. + * @param JModelLegacy $model The data model object. + * @param array $validData The validated data. * * @return void * diff --git a/components/com_content/helpers/association.php b/components/com_content/helpers/association.php index 9d7779b57ade2..fafc5911e8e11 100644 --- a/components/com_content/helpers/association.php +++ b/components/com_content/helpers/association.php @@ -64,6 +64,5 @@ public static function getAssociations($id = 0, $view = null) } return array(); - } } diff --git a/components/com_content/helpers/category.php b/components/com_content/helpers/category.php index 05953fd8f4ea8..cc45328d78772 100644 --- a/components/com_content/helpers/category.php +++ b/components/com_content/helpers/category.php @@ -18,6 +18,13 @@ */ class ContentCategories extends JCategories { + /** + * Class constructor + * + * @param array $options Array of options + * + * @since 11.1 + */ public function __construct($options = array()) { $options['table'] = '#__content'; diff --git a/components/com_content/helpers/icon.php b/components/com_content/helpers/icon.php index 6508de09ff7bd..9afdbadadb3a5 100644 --- a/components/com_content/helpers/icon.php +++ b/components/com_content/helpers/icon.php @@ -127,6 +127,7 @@ public static function email($article, $params, $attribs = array(), $legacy = fa * @param boolean $legacy True to use legacy images, false to use icomoon based graphic * * @return string The HTML for the article edit icon. + * * @since 1.6 */ public static function edit($article, $params, $attribs = array(), $legacy = false) @@ -149,14 +150,18 @@ public static function edit($article, $params, $attribs = array(), $legacy = fal JHtml::_('bootstrap.tooltip'); // Show checked_out icon if the article is checked out by a different user - if (property_exists($article, 'checked_out') && property_exists($article, 'checked_out_time') && $article->checked_out > 0 && $article->checked_out != $user->get('id')) + if (property_exists($article, 'checked_out') + && property_exists($article, 'checked_out_time') + && $article->checked_out > 0 + && $article->checked_out != $user->get('id')) { $checkoutUser = JFactory::getUser($article->checked_out); $button = JHtml::_('image', 'system/checked_out.png', null, null, true); $date = JHtml::_('date', $article->checked_out_time); - $tooltip = JText::_('JLIB_HTML_CHECKED_OUT') . ' :: ' . JText::sprintf('COM_CONTENT_CHECKED_OUT_BY', $checkoutUser->name) . '
    ' . $date; + $tooltip = JText::_('JLIB_HTML_CHECKED_OUT') . ' :: ' . JText::sprintf('COM_CONTENT_CHECKED_OUT_BY', $checkoutUser->name) + . '
    ' . $date; - return '' . $button . ''; + return '' . $button . ''; } $url = 'index.php?option=com_content&task=article.edit&a_id=' . $article->id . '&return=' . base64_encode($uri); @@ -181,22 +186,28 @@ public static function edit($article, $params, $attribs = array(), $legacy = fal if ($legacy) { $icon = $article->state ? 'edit.png' : 'edit_unpublished.png'; + if (strtotime($article->publish_up) > strtotime(JFactory::getDate()) || ((strtotime($article->publish_down) < strtotime(JFactory::getDate())) && $article->publish_down != '0000-00-00 00:00:00')) { $icon = 'edit_unpublished.png'; } + $text = JHtml::_('image', 'system/' . $icon, JText::_('JGLOBAL_EDIT'), null, true); } else { $icon = $article->state ? 'edit' : 'eye-close'; + if (strtotime($article->publish_up) > strtotime(JFactory::getDate()) || ((strtotime($article->publish_down) < strtotime(JFactory::getDate())) && $article->publish_down != '0000-00-00 00:00:00')) { $icon = 'eye-close'; } - $text = ' ' . JText::_('JGLOBAL_EDIT') . ' '; + + $text = ' ' + . JText::_('JGLOBAL_EDIT') . ' '; } $output = JHtml::_('link', JRoute::_($url), $text, $attribs); @@ -225,7 +236,7 @@ public static function print_popup($article, $params, $attribs = array(), $legac $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no'; - // checks template image directory for image, if non found default are loaded + // Checks template image directory for image, if non found default are loaded if ($params->get('show_icons')) { if ($legacy) @@ -280,5 +291,4 @@ public static function print_screen($article, $params, $attribs = array(), $lega return '' . $text . ''; } - } diff --git a/components/com_content/helpers/query.php b/components/com_content/helpers/query.php index d52dd55603b95..4f36b588d1b6e 100644 --- a/components/com_content/helpers/query.php +++ b/components/com_content/helpers/query.php @@ -59,6 +59,7 @@ public static function orderbyPrimary($orderby) * @param string $orderDate The ordering code for the date. * * @return string The SQL field(s) to order by. + * * @since 1.5 */ public static function orderbySecondary($orderby, $orderDate = 'created') @@ -192,7 +193,7 @@ public static function buildVotingQuery($params = null) * desired article ordering is achieved down the columns. * * @param array &$articles Array of intro text articles - * @param integer $numColumns Number of columns in the layout + * @param integer $numColumns Number of columns in the layout * * @return array Reordered array to achieve desired ordering down columns * @@ -231,16 +232,19 @@ public static function orderDownColumns(&$articles, $numColumns = 1) // Put -1 in empty cells $index[$row][$col] = -1; } - else { + else + { // Put in zero as placeholder $index[$row][$col] = 0; } + $i++; } } // Layout the articles in column order, skipping empty cells $i = 0; + for ($col = 1; ($col <= $numColumns) && ($i < $count); $col++) { for ($row = 1; ($row <= $maxRows) && ($i < $count); $row++) @@ -257,6 +261,7 @@ public static function orderDownColumns(&$articles, $numColumns = 1) // so that they will actually be ordered down the columns (when read by row in the layout) $return = array(); $i = 0; + for ($row = 1; ($row <= $maxRows) && ($i < $count); $row++) { for ($col = 1; ($col <= $numColumns) && ($i < $count); $col++) @@ -266,6 +271,7 @@ public static function orderDownColumns(&$articles, $numColumns = 1) } } } + return $return; } } diff --git a/components/com_content/helpers/route.php b/components/com_content/helpers/route.php index aeefdc95bb17e..bccef8fd852b4 100644 --- a/components/com_content/helpers/route.php +++ b/components/com_content/helpers/route.php @@ -24,7 +24,15 @@ abstract class ContentHelperRoute protected static $lang_lookup = array(); /** - * @param integer The route of the content item + * Get the article route. + * + * @param integer $id The route of the content item. + * @param integer $catid The category ID. + * @param integer $language The language code. + * + * @return string The article route. + * + * @since 1.5 */ public static function getArticleRoute($id, $catid = 0, $language = 0) { @@ -67,6 +75,16 @@ public static function getArticleRoute($id, $catid = 0, $language = 0) return $link; } + /** + * Get the category route. + * + * @param integer $catid The category ID. + * @param integer $language The language code. + * + * @return string The article route. + * + * @since 1.5 + */ public static function getCategoryRoute($catid, $language = 0) { if ($catid instanceof JCategoryNode) @@ -96,7 +114,7 @@ public static function getCategoryRoute($catid, $language = 0) { self::buildLanguageLookup(); - if(isset(self::$lang_lookup[$language])) + if (isset(self::$lang_lookup[$language])) { $link .= '&lang=' . self::$lang_lookup[$language]; $needles['language'] = $language; @@ -112,6 +130,15 @@ public static function getCategoryRoute($catid, $language = 0) return $link; } + /** + * Get the form route. + * + * @param integer $id The form ID. + * + * @return string The article route. + * + * @since 1.5 + */ public static function getFormRoute($id) { // Create the link @@ -127,6 +154,13 @@ public static function getFormRoute($id) return $link; } + /** + * Look up language codes. + * + * @return void. + * + * @since 1.5 + */ protected static function buildLanguageLookup() { if (count(self::$lang_lookup) == 0) @@ -147,6 +181,15 @@ protected static function buildLanguageLookup() } } + /** + * Find an item ID. + * + * @param array $needles An array of language codes. + * + * @return mixed The ID found or null otherwise. + * + * @since 1.5 + */ protected static function _findItem($needles = null) { $app = JFactory::getApplication(); @@ -218,7 +261,9 @@ protected static function _findItem($needles = null) // Check if the active menuitem matches the requested language $active = $menus->getActive(); - if ($active && $active->component == 'com_content' && ($language == '*' || in_array($active->language, array('*', $language)) || !JLanguageMultilang::isEnabled())) + if ($active + && $active->component == 'com_content' + && ($language == '*' || in_array($active->language, array('*', $language)) || !JLanguageMultilang::isEnabled())) { return $active->id; } diff --git a/components/com_content/models/archive.php b/components/com_content/models/archive.php index e9af74dadadc1..99d1c8881009a 100644 --- a/components/com_content/models/archive.php +++ b/components/com_content/models/archive.php @@ -32,6 +32,11 @@ class ContentModelArchive extends ContentModelArticles * * Note. Calling getState in this method will result in recursion. * + * @param string $ordering The field to order on. + * @param string $direction The direction to order on. + * + * @return void. + * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) @@ -60,7 +65,11 @@ protected function populateState($ordering = null, $direction = null) } /** + * Get the master query for retrieving a list of articles subject to the model state. + * * @return JDatabaseQuery + * + * @since 1.6 */ protected function getListQuery() { @@ -77,18 +86,19 @@ protected function getListQuery() $orderby = $primary . ' ' . $secondary . ' a.created DESC '; $this->setState('list.ordering', $orderby); $this->setState('list.direction', ''); + // Create a new query object. $query = parent::getListQuery(); // Add routing for archive - //sqlsrv changes + // Sqlsrv changes $case_when = ' CASE WHEN '; $case_when .= $query->charLength('a.alias', '!=', '0'); $case_when .= ' THEN '; $a_id = $query->castAsChar('a.id'); $case_when .= $query->concatenate(array($a_id, 'a.alias'), ':'); $case_when .= ' ELSE '; - $case_when .= $a_id.' END as slug'; + $case_when .= $a_id . ' END as slug'; $query->select($case_when); @@ -98,7 +108,7 @@ protected function getListQuery() $c_id = $query->castAsChar('c.id'); $case_when .= $query->concatenate(array($c_id, 'c.alias'), ':'); $case_when .= ' ELSE '; - $case_when .= $c_id.' END as catslug'; + $case_when .= $c_id . ' END as catslug'; $query->select($case_when); // Filter on month, year @@ -107,16 +117,14 @@ protected function getListQuery() if ($month = $this->getState('filter.month')) { - $query->where('MONTH('. $queryDate . ') = ' . $month); + $query->where('MONTH(' . $queryDate . ') = ' . $month); } if ($year = $this->getState('filter.year')) { - $query->where('YEAR('. $queryDate . ') = ' . $year); + $query->where('YEAR(' . $queryDate . ') = ' . $year); } - //echo nl2br(str_replace('#__','jos_',$query)); - return $query; } @@ -148,12 +156,24 @@ public function getData() return $this->_data; } - // JModelLegacy override to add alternating value for $odd + /** + * JModelLegacy override to add alternating value for $odd + * + * @param string $query The query. + * @param integer $limitstart Offset. + * @param integer $limit The number of records. + * + * @return array An array of results. + * + * @since 12.2 + * @throws RuntimeException + */ protected function _getList($query, $limitstart=0, $limit=0) { $result = parent::_getList($query, $limitstart, $limit); $odd = 1; + foreach ($result as $k => $row) { $result[$k]->odd = $odd; diff --git a/components/com_content/models/article.php b/components/com_content/models/article.php index 9319dda67e190..0f6bd63e72de9 100644 --- a/components/com_content/models/article.php +++ b/components/com_content/models/article.php @@ -125,7 +125,8 @@ public function getItem($pk = null) ->where('a.id = ' . (int) $pk); - if ((!$user->authorise('core.edit.state', 'com_content')) && (!$user->authorise('core.edit', 'com_content'))) { + if ((!$user->authorise('core.edit.state', 'com_content')) && (!$user->authorise('core.edit', 'com_content'))) + { // Filter by start and end dates. $nullDate = $db->quote($db->getNullDate()); $date = JFactory::getDate(); diff --git a/components/com_content/models/articles.php b/components/com_content/models/articles.php index 5d1ef3d75e9cb..255775e830dca 100644 --- a/components/com_content/models/articles.php +++ b/components/com_content/models/articles.php @@ -448,8 +448,8 @@ protected function getListQuery() // Filter by start and end dates. if ((!$user->authorise('core.edit.state', 'com_content')) && (!$user->authorise('core.edit', 'com_content'))) { - $query ->where('(a.publish_up = '.$nullDate.' OR a.publish_up <= '.$nowDate.')') - ->where('(a.publish_down = '.$nullDate.' OR a.publish_down >= '.$nowDate.')'); + $query->where('(a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ')') + ->where('(a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ')'); } // Filter by Date Range or Relative Date diff --git a/components/com_content/models/categories.php b/components/com_content/models/categories.php index 93bc8b9f47754..ad7c006bf0c0b 100644 --- a/components/com_content/models/categories.php +++ b/components/com_content/models/categories.php @@ -41,6 +41,11 @@ class ContentModelCategories extends JModelList * * Note. Calling getState in this method will result in recursion. * + * @param string $ordering The field to order on. + * @param string $direction The direction to order on. + * + * @return void. + * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) @@ -66,17 +71,17 @@ protected function populateState($ordering = null, $direction = null) * different modules that might need different sets of data or different * ordering requirements. * - * @param string $id A prefix for the store id. + * @param string $id A prefix for the store id. * * @return string A store id. */ protected function getStoreId($id = '') { // Compile the store id. - $id .= ':'.$this->getState('filter.extension'); - $id .= ':'.$this->getState('filter.published'); - $id .= ':'.$this->getState('filter.access'); - $id .= ':'.$this->getState('filter.parentId'); + $id .= ':' . $this->getState('filter.extension'); + $id .= ':' . $this->getState('filter.published'); + $id .= ':' . $this->getState('filter.access'); + $id .= ':' . $this->getState('filter.parentId'); return parent::getStoreId($id); } @@ -84,9 +89,10 @@ protected function getStoreId($id = '') /** * Redefine the function an add some properties to make the styling more easy * - * @param bool $recursive True if you want to return children recursively. + * @param bool $recursive True if you want to return children recursively. * * @return mixed An array of data items on success, false on failure. + * * @since 1.6 */ public function getItems($recursive = false) @@ -112,7 +118,8 @@ public function getItems($recursive = false) { $this->_items = $this->_parent->getChildren($recursive); } - else { + else + { $this->_items = false; } } @@ -120,6 +127,13 @@ public function getItems($recursive = false) return $this->_items; } + /** + * Get the parent. + * + * @return object An array of data items on success, false on failure. + * + * @since 1.6 + */ public function getParent() { if (!is_object($this->_parent)) diff --git a/components/com_content/models/category.php b/components/com_content/models/category.php index 565ea128c21fa..75a5c8badc66d 100644 --- a/components/com_content/models/category.php +++ b/components/com_content/models/category.php @@ -60,8 +60,8 @@ class ContentModelCategory extends JModelList /** * Constructor. * - * @param array An optional associative array of configuration settings. - * @see JController + * @param array $config An optional associative array of configuration settings. + * * @since 1.6 */ public function __construct($config = array()) @@ -98,7 +98,11 @@ public function __construct($config = array()) * * Note. Calling getState in this method will result in recursion. * - * return void + * @param string $ordering The field to order on. + * @param string $direction The direction to order on. + * + * @return void. + * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) @@ -136,7 +140,7 @@ protected function populateState($ordering = null, $direction = null) if ((!$user->authorise('core.edit.state', $asset)) && (!$user->authorise('core.edit', $asset))) { - // limit to published for people who can't edit or edit.state. + // Limit to published for people who can't edit or edit.state. $this->setState('filter.published', 1); // Filter by start and end dates. @@ -151,7 +155,7 @@ protected function populateState($ordering = null, $direction = null) $this->setState('filter.published', array(0, 1, 2)); } - // process show_noauth parameter + // Process show_noauth parameter if (!$params->get('show_noauth')) { $this->setState('filter.access', true); @@ -164,26 +168,29 @@ protected function populateState($ordering = null, $direction = null) // Optional filter text $this->setState('list.filter', $app->input->getString('filter-search')); - // filter.order + // Filter.order $itemid = $app->input->get('id', 0, 'int') . ':' . $app->input->get('Itemid', 0, 'int'); $orderCol = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order', 'filter_order', '', 'string'); + if (!in_array($orderCol, $this->filter_fields)) { $orderCol = 'a.ordering'; } + $this->setState('list.ordering', $orderCol); - $listOrder = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order_Dir', - 'filter_order_Dir', '', 'cmd'); + $listOrder = $app->getUserStateFromRequest('com_content.category.list.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', '', 'cmd'); + if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', ''))) { $listOrder = 'ASC'; } + $this->setState('list.direction', $listOrder); $this->setState('list.start', $app->input->get('limitstart', 0, 'uint')); - // set limit for query. If list, use parameter. If blog, add blog parameters for limit. + // Set limit for query. If list, use parameter. If blog, add blog parameters for limit. if (($app->input->get('layout') == 'blog') || $params->get('layout_type') == 'blog') { $limit = $params->get('num_leading_articles') + $params->get('num_intro_articles') + $params->get('num_links'); @@ -196,7 +203,7 @@ protected function populateState($ordering = null, $direction = null) $this->setState('list.limit', $limit); - // set the depth of the category query based on parameter + // Set the depth of the category query based on parameter $showSubcategories = $params->get('show_subcategory_content', '0'); if ($showSubcategories) @@ -208,16 +215,16 @@ protected function populateState($ordering = null, $direction = null) $this->setState('filter.language', JLanguageMultilang::isEnabled()); $this->setState('layout', $app->input->getString('layout')); - } /** * Get the articles in the category * * @return mixed An array of articles or false if an error occurs. + * * @since 1.5 */ - function getItems() + public function getItems() { $limit = $this->getState('list.limit'); @@ -234,7 +241,8 @@ function getItems() $model->setState('list.limit', $limit); $model->setState('list.direction', $this->getState('list.direction')); $model->setState('list.filter', $this->getState('list.filter')); - // filter.subcategories indicates whether to include articles from subcategories in the list or blog + + // Filter.subcategories indicates whether to include articles from subcategories in the list or blog $model->setState('filter.subcategories', $this->getState('filter.subcategories')); $model->setState('filter.max_category_levels', $this->getState('filter.max_category_levels')); $model->setState('list.links', $this->getState('list.links')); @@ -263,6 +271,7 @@ function getItems() * Build the orderby for the query * * @return string $orderby portion of query + * * @since 1.5 */ protected function _buildContentOrderBy() @@ -301,34 +310,42 @@ protected function _buildContentOrderBy() return $orderby; } + /** + * Method to get a JPagination object for the data set. + * + * @return JPagination A JPagination object for the data set. + * + * @since 12.2 + */ public function getPagination() { if (empty($this->_pagination)) { return null; } + return $this->_pagination; } /** * Method to get category data for the current category * - * @param integer An optional ID - * * @return object + * * @since 1.5 */ public function getCategory() { if (!is_object($this->_item)) { - if ( isset( $this->state->params ) ) + if (isset( $this->state->params)) { $params = $this->state->params; $options = array(); $options['countItems'] = $params->get('show_cat_num_articles', 1) || !$params->get('show_empty_categories_cat', 0); } - else { + else + { $options['countItems'] = 0; } @@ -339,7 +356,7 @@ public function getCategory() if (is_object($this->_item)) { $user = JFactory::getUser(); - $asset = 'com_content.category.'.$this->_item->id; + $asset = 'com_content.category.' . $this->_item->id; // Check general create permission. if ($user->authorise('core.create', $asset)) @@ -359,7 +376,8 @@ public function getCategory() $this->_rightsibling = $this->_item->getSibling(); $this->_leftsibling = $this->_item->getSibling(false); } - else { + else + { $this->_children = false; $this->_parent = false; } @@ -371,9 +389,8 @@ public function getCategory() /** * Get the parent category. * - * @param integer An optional category id. If not supplied, the model state 'category.id' will be used. - * * @return mixed An array of categories or false if an error occurs. + * * @since 1.6 */ public function getParent() @@ -390,9 +407,10 @@ public function getParent() * Get the left sibling (adjacent) categories. * * @return mixed An array of categories or false if an error occurs. + * * @since 1.6 */ - function &getLeftSibling() + public function &getLeftSibling() { if (!is_object($this->_item)) { @@ -406,9 +424,10 @@ function &getLeftSibling() * Get the right sibling (adjacent) categories. * * @return mixed An array of categories or false if an error occurs. + * * @since 1.6 */ - function &getRightSibling() + public function &getRightSibling() { if (!is_object($this->_item)) { @@ -421,12 +440,11 @@ function &getRightSibling() /** * Get the child categories. * - * @param integer An optional category id. If not supplied, the model state 'category.id' will be used. - * * @return mixed An array of categories or false if an error occurs. + * * @since 1.6 */ - function &getChildren() + public function &getChildren() { if (!is_object($this->_item)) { @@ -437,10 +455,11 @@ function &getChildren() if (count($this->_children)) { $params = $this->getState()->get('params'); + if ($params->get('orderby_pri') == 'alpha' || $params->get('orderby_pri') == 'ralpha') { jimport('joomla.utilities.arrayhelper'); - JArrayHelper::sortObjects($this->_children, 'title', ($params->get('orderby_pri') == 'alpha') ? 1 : -1); + JArrayHelper::sortObjects($this->_children, 'title', ($params->get('orderby_pri') == 'alpha') ? 1 : (-1)); } } diff --git a/components/com_content/models/featured.php b/components/com_content/models/featured.php index 31e910dbafa0f..d6e328fb3c482 100644 --- a/components/com_content/models/featured.php +++ b/components/com_content/models/featured.php @@ -32,6 +32,11 @@ class ContentModelFeatured extends ContentModelArticles * * Note. Calling getState in this method will result in recursion. * + * @param string $ordering The field to order on. + * @param string $direction The direction to order on. + * + * @return void. + * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) @@ -52,8 +57,9 @@ protected function populateState($ordering = null, $direction = null) $this->setState('filter.frontpage', true); - if ((!$user->authorise('core.edit.state', 'com_content')) && (!$user->authorise('core.edit', 'com_content'))){ - // filter on published for those who do not have edit or edit.state rights. + if ((!$user->authorise('core.edit.state', 'com_content')) && (!$user->authorise('core.edit', 'com_content'))) + { + // Filter on published for those who do not have edit or edit.state rights. $this->setState('filter.published', 1); } else @@ -61,7 +67,7 @@ protected function populateState($ordering = null, $direction = null) $this->setState('filter.published', array(0, 1, 2)); } - // check for category selection + // Check for category selection if ($params->get('featured_categories') && implode(',', $params->get('featured_categories')) == true) { $featuredCategories = $params->get('featured_categories'); @@ -78,13 +84,15 @@ public function getItems() { $params = clone $this->getState('params'); $limit = $params->get('num_leading_articles') + $params->get('num_intro_articles') + $params->get('num_links'); + if ($limit > 0) { $this->setState('list.limit', $limit); + return parent::getItems(); } - return array(); + return array(); } /** @@ -94,7 +102,7 @@ public function getItems() * different modules that might need different sets of data or different * ordering requirements. * - * @param string $id A prefix for the store id. + * @param string $id A prefix for the store id. * * @return string A store id. */ @@ -107,6 +115,8 @@ protected function getStoreId($id = '') } /** + * Get the list of items. + * * @return JDatabaseQuery */ protected function getListQuery() diff --git a/components/com_content/models/form.php b/components/com_content/models/form.php index b98a4141575ec..5f8f91f0956ac 100644 --- a/components/com_content/models/form.php +++ b/components/com_content/models/form.php @@ -10,7 +10,7 @@ defined('_JEXEC') or die; // Base this model on the backend version. -require_once JPATH_ADMINISTRATOR.'/components/com_content/models/article.php'; +require_once JPATH_ADMINISTRATOR . '/components/com_content/models/article.php'; /** * Content Component Article Model diff --git a/components/com_content/router.php b/components/com_content/router.php index 860dd2bccede4..af9847da6978b 100644 --- a/components/com_content/router.php +++ b/components/com_content/router.php @@ -67,7 +67,10 @@ public function build(&$query) } // Are we dealing with an article or category that is attached to a menu item? - if (($menuItem instanceof stdClass) && $menuItem->query['view'] == $query['view'] && isset($query['id']) && $menuItem->query['id'] == (int) $query['id']) + if (($menuItem instanceof stdClass) + && $menuItem->query['view'] == $query['view'] + && isset($query['id']) + && $menuItem->query['id'] == (int) $query['id']) { unset($query['view']); @@ -389,6 +392,7 @@ public function parse(&$segments) if (!$category) { JError::raiseError(404, JText::_('COM_CONTENT_ERROR_PARENT_CATEGORY_NOT_FOUND')); + return $vars; } @@ -459,16 +463,33 @@ public function parse(&$segments) * These functions are proxys for the new router interface * for old SEF extensions. * + * @param array &$query An array of URL arguments + * + * @return array The URL arguments to use to assemble the subsequent URL. + * * @deprecated 4.0 Use Class based routers instead */ -function ContentBuildRoute(&$query) +function contentBuildRoute(&$query) { $router = new ContentRouter; return $router->build($query); } -function ContentParseRoute($segments) +/** + * Parse the segments of a URL. + * + * This function is a proxy for the new router interface + * for old SEF extensions. + * + * @param array $segments The segments of the URL to parse. + * + * @return array The URL attributes to be used by the application. + * + * @since 3.3 + * @deprecated 4.0 Use Class based routers instead + */ +function contentParseRoute($segments) { $router = new ContentRouter; diff --git a/components/com_content/views/archive/view.html.php b/components/com_content/views/archive/view.html.php index ecf0a989de5aa..dfef79bca25f7 100644 --- a/components/com_content/views/archive/view.html.php +++ b/components/com_content/views/archive/view.html.php @@ -82,6 +82,7 @@ public function display($tpl = null) } $form = new stdClass; + // Month Field $months = array( '' => JText::_('COM_CONTENT_MONTH'), @@ -108,13 +109,16 @@ public function display($tpl = null) 'option.key' => null ) ); + // Year Field $years = array(); $years[] = JHtml::_('select.option', null, JText::_('JYEAR')); + for ($year = date('Y'), $i = $year - 10; $i <= $year; $i++) { $years[] = JHtml::_('select.option', $i, $i); } + $form->yearField = JHtml::_( 'select.genericlist', $years, @@ -123,7 +127,7 @@ public function display($tpl = null) ); $form->limitField = $pagination->getLimitBox(); - //Escape strings for HTML output + // Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx')); $this->filter = $state->get('list.filter'); @@ -140,6 +144,8 @@ public function display($tpl = null) /** * Prepares the document + * + * @return void. */ protected function _prepareDocument() { @@ -150,6 +156,7 @@ protected function _prepareDocument() // Because the application sets a default page title, // we need to get it from the menu item itself $menu = $menus->getActive(); + if ($menu) { $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); diff --git a/components/com_content/views/article/view.html.php b/components/com_content/views/article/view.html.php index ae2df325c5bf1..4a3f9879cec26 100644 --- a/components/com_content/views/article/view.html.php +++ b/components/com_content/views/article/view.html.php @@ -50,6 +50,7 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseWarning(500, implode("\n", $errors)); + return false; } @@ -58,8 +59,8 @@ public function display($tpl = null) $item->tagLayout = new JLayoutFile('joomla.content.tags'); // Add router helpers. - $item->slug = $item->alias ? ($item->id.':'.$item->alias) : $item->id; - $item->catslug = $item->category_alias ? ($item->catid.':'.$item->category_alias) : $item->catid; + $item->slug = $item->alias ? ($item->id . ':' . $item->alias) : $item->id; + $item->catslug = $item->category_alias ? ($item->catid . ':' . $item->category_alias) : $item->catid; $item->parent_slug = $item->parent_alias ? ($item->parent_id . ':' . $item->parent_alias) : $item->parent_id; // No link for ROOT category @@ -75,7 +76,7 @@ public function display($tpl = null) // Otherwise, article params override menu item params $this->params = $this->state->get('params'); $active = $app->getMenu()->getActive(); - $temp = clone ($this->params); + $temp = clone $this->params; // Check to see which parameters should take priority if ($active) @@ -83,7 +84,7 @@ public function display($tpl = null) $currentLink = $active->link; // If the current view is the active item and an article view for this article, then the menu item params take priority - if (strpos($currentLink, 'view=article') && (strpos($currentLink, '&id='.(string) $item->id))) + if (strpos($currentLink, 'view=article') && (strpos($currentLink, '&id=' . (string) $item->id))) { // Load layout from active query (in case it is an alternative menu item) if (isset($active->query['layout'])) @@ -135,6 +136,7 @@ public function display($tpl = null) if ($item->params->get('access-view') == false && ($item->params->get('show_noauth', '0') == '0')) { JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR')); + return; } @@ -176,7 +178,7 @@ public function display($tpl = null) $model->hit(); } - //Escape strings for HTML output + // Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($this->item->params->get('pageclass_sfx')); $this->_prepareDocument(); @@ -185,7 +187,9 @@ public function display($tpl = null) } /** - * Prepares the document + * Prepares the document. + * + * @return void. */ protected function _prepareDocument() { @@ -211,7 +215,7 @@ protected function _prepareDocument() $id = (int) @$menu->query['id']; - // if the menu item does not concern this article + // If the menu item does not concern this article if ($menu && ($menu->query['option'] != 'com_content' || $menu->query['view'] != 'article' || $id != $this->item->id)) { // If this is not a single article menu item, set the page title to the article title @@ -219,6 +223,7 @@ protected function _prepareDocument() { $title = $this->item->title; } + $path = array(array('title' => $this->item->title, 'link' => '')); $category = JCategories::getInstance('Content')->get($this->item->catid); @@ -227,6 +232,7 @@ protected function _prepareDocument() $path[] = array('title' => $category->title, 'link' => ContentHelperRoute::getCategoryRoute($category->id)); $category = $category->getParent(); } + $path = array_reverse($path); foreach ($path as $item) @@ -253,6 +259,7 @@ protected function _prepareDocument() { $title = $this->item->title; } + $this->document->setTitle($title); if ($this->item->metadesc) @@ -297,7 +304,9 @@ protected function _prepareDocument() if (!empty($this->item->page_title)) { $this->item->title = $this->item->title . ' - ' . $this->item->page_title; - $this->document->setTitle($this->item->page_title . ' - ' . JText::sprintf('PLG_CONTENT_PAGEBREAK_PAGE_NUM', $this->state->get('list.offset') + 1)); + $this->document->setTitle( + $this->item->page_title . ' - ' . JText::sprintf('PLG_CONTENT_PAGEBREAK_PAGE_NUM', $this->state->get('list.offset') + 1) + ); } if ($this->print) diff --git a/components/com_content/views/category/view.html.php b/components/com_content/views/category/view.html.php index 31b61cffb9b1c..542b8638af327 100644 --- a/components/com_content/views/category/view.html.php +++ b/components/com_content/views/category/view.html.php @@ -91,7 +91,7 @@ public function display($tpl = null) $item->parent_slug = null; } - $item->catslug = $item->category_alias ? ($item->catid.':'.$item->category_alias) : $item->catid; + $item->catslug = $item->category_alias ? ($item->catid . ':' . $item->category_alias) : $item->catid; $item->event = new stdClass; $dispatcher = JEventDispatcher::getInstance(); @@ -145,8 +145,6 @@ public function display($tpl = null) // This makes it much easier for the designer to just interrogate the arrays. if (($params->get('layout_type') == 'blog') || ($this->getLayout() == 'blog')) { - //$max = count($this->items); - foreach ($this->items as $i => $item) { if ($i < $numLeading) @@ -175,7 +173,7 @@ public function display($tpl = null) if ($order == 0 && $this->columns > 1) { - // call order down helper + // Call order down helper $this->intro_items = ContentHelperQuery::orderDownColumns($this->intro_items, $this->columns); } } diff --git a/components/com_content/views/featured/view.feed.php b/components/com_content/views/featured/view.feed.php index a132d16fc896f..73b330a70236a 100644 --- a/components/com_content/views/featured/view.feed.php +++ b/components/com_content/views/featured/view.feed.php @@ -39,9 +39,10 @@ public function display($tpl = null) $app->input->set('limit', $app->get('feed_limit')); $categories = JCategories::getInstance('Content'); $rows = $this->get('Items'); + foreach ($rows as $row) { - // strip html from feed item title + // Strip html from feed item title $title = $this->escape($row->title); $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8'); @@ -60,7 +61,7 @@ public function display($tpl = null) $db->setQuery($query); $row->fulltext = $db->loadResult(); - $description = ($params->get('feed_summary', 0) ? $row->introtext.$row->fulltext : $row->introtext); + $description = ($params->get('feed_summary', 0) ? $row->introtext . $row->fulltext : $row->introtext); $author = $row->created_by_alias ? $row->created_by_alias : $row->author; // Load individual item creator class @@ -69,7 +70,9 @@ public function display($tpl = null) $item->link = $link; $item->date = $row->publish_up; $item->category = array(); - $item->category[] = JText::_('JFEATURED'); // All featured articles are categorized as "Featured" + + // All featured articles are categorized as "Featured" + $item->category[] = JText::_('JFEATURED'); for ($item_category = $categories->get($row->catid); $item_category !== null; $item_category = $item_category->getParent()) { @@ -98,7 +101,7 @@ public function display($tpl = null) } // Load item description and add div - $item->description = '
    '.$description.'
    '; + $item->description = '
    ' . $description . '
    '; // Loads item info into rss array $doc->addItem($item); diff --git a/components/com_content/views/featured/view.html.php b/components/com_content/views/featured/view.html.php index 28e16ee82aff1..1fa0a9b0ee3a3 100644 --- a/components/com_content/views/featured/view.html.php +++ b/components/com_content/views/featured/view.html.php @@ -53,6 +53,7 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseWarning(500, implode("\n", $errors)); + return false; } @@ -87,6 +88,7 @@ public function display($tpl = null) { $item->text = $item->introtext; } + JPluginHelper::importPlugin('content'); $dispatcher->trigger('onContentPrepare', array ('com_content.featured', &$item, &$item->params, 0)); @@ -109,6 +111,7 @@ public function display($tpl = null) // The first group is the leading articles. $limit = $numLeading; + for ($i = 0; $i < $limit && $i < $max; $i++) { $this->lead_items[$i] = &$items[$i]; @@ -116,6 +119,7 @@ public function display($tpl = null) // The second group is the intro articles. $limit = $numLeading + $numIntro; + // Order articles across, then down (or single column mode) for ($i = $numLeading; $i < $limit && $i < $max; $i++) { @@ -127,7 +131,7 @@ public function display($tpl = null) if ($order == 0 && $this->columns > 1) { - // call order down helper + // Call order down helper $this->intro_items = ContentHelperQuery::orderDownColumns($this->intro_items, $this->columns); } @@ -137,7 +141,7 @@ public function display($tpl = null) $this->link_items[$i] = &$items[$i]; } - //Escape strings for HTML output + // Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx')); $this->params = &$params; @@ -151,7 +155,9 @@ public function display($tpl = null) } /** - * Prepares the document + * Prepares the document. + * + * @return void. */ protected function _prepareDocument() { diff --git a/components/com_content/views/form/view.html.php b/components/com_content/views/form/view.html.php index 1a229add87ad9..35cbe877871f6 100644 --- a/components/com_content/views/form/view.html.php +++ b/components/com_content/views/form/view.html.php @@ -55,6 +55,7 @@ public function display($tpl = null) if ($authorised !== true) { JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR')); + return false; } @@ -80,13 +81,14 @@ public function display($tpl = null) if (count($errors = $this->get('Errors'))) { JError::raiseWarning(500, implode("\n", $errors)); + return false; } // Create a shortcut to the parameters. $params = &$this->state->params; - //Escape strings for HTML output + // Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx')); $this->params = $params; @@ -107,6 +109,8 @@ public function display($tpl = null) /** * Prepares the document + * + * @return void. */ protected function _prepareDocument() { diff --git a/components/com_mailto/controller.php b/components/com_mailto/controller.php index fc7e6840a75f0..13e334bac1605 100644 --- a/components/com_mailto/controller.php +++ b/components/com_mailto/controller.php @@ -17,9 +17,9 @@ class MailtoController extends JControllerLegacy { /** - * Show the form so that the user can send the link to someone + * Show the form so that the user can send the link to someone. * - * @access public + * @return void * * @since 1.5 */ @@ -34,8 +34,9 @@ public function mailto() /** * Send the message and display a notice * - * @access public - * @since 1.5 + * @return void + * + * @since 1.5 */ public function send() { @@ -111,6 +112,7 @@ public function send() // Check for a valid to address $error = false; + if (! $email || ! JMailHelper::isEmailAddress($email)) { $error = JText::sprintf('COM_MAILTO_EMAIL_INVALID', $email); diff --git a/components/com_mailto/helpers/mailto.php b/components/com_mailto/helpers/mailto.php index 1aa34878b0d4a..ac6eead5f3bd2 100644 --- a/components/com_mailto/helpers/mailto.php +++ b/components/com_mailto/helpers/mailto.php @@ -18,7 +18,8 @@ abstract class MailtoHelper /** * Adds a URL to the mailto system and returns the hash * - * @param string url + * @param string $url Url + * * @return URL hash */ public static function addLink($url) @@ -27,20 +28,24 @@ public static function addLink($url) self::cleanHashes(); $session = JFactory::getSession(); $mailto_links = $session->get('com_mailto.links', array()); + if (!isset($mailto_links[$hash])) { $mailto_links[$hash] = new stdClass; } + $mailto_links[$hash]->link = $url; $mailto_links[$hash]->expiry = time(); $session->set('com_mailto.links', $mailto_links); + return $hash; } /** * Checks if a URL is a Flash file * - * @param string + * @param string $hash File hash + * * @return URL */ public static function validateHash($hash) @@ -49,27 +54,35 @@ public static function validateHash($hash) $session = JFactory::getSession(); self::cleanHashes(); $mailto_links = $session->get('com_mailto.links', array()); + if (isset($mailto_links[$hash])) { $retval = $mailto_links[$hash]->link; } + return $retval; } /** * Cleans out old hashes * + * @param integer $lifetime How old are the hashes we want to remove + * + * @return void + * * @since 1.6.1 */ public static function cleanHashes($lifetime = 1440) { - // flag for if we've cleaned on this cycle + // Flag for if we've cleaned on this cycle static $cleaned = false; + if (!$cleaned) { $past = time() - $lifetime; $session = JFactory::getSession(); $mailto_links = $session->get('com_mailto.links', array()); + foreach ($mailto_links as $index => $link) { if ($link->expiry < $past) @@ -77,6 +90,7 @@ public static function cleanHashes($lifetime = 1440) unset($mailto_links[$index]); } } + $session->set('com_mailto.links', $mailto_links); $cleaned = true; } diff --git a/components/com_mailto/mailto.php b/components/com_mailto/mailto.php index 08b8c040403c0..a182e788ccd2a 100644 --- a/components/com_mailto/mailto.php +++ b/components/com_mailto/mailto.php @@ -9,11 +9,9 @@ defined('_JEXEC') or die; -require_once JPATH_COMPONENT.'/helpers/mailto.php'; -require_once JPATH_COMPONENT.'/controller.php'; +require_once JPATH_COMPONENT . '/helpers/mailto.php'; +require_once JPATH_COMPONENT . '/controller.php'; $controller = JControllerLegacy::getInstance('Mailto'); $controller->registerDefaultTask('mailto'); $controller->execute(JFactory::getApplication()->input->get('task')); - -//$controller->redirect(); diff --git a/components/com_mailto/views/mailto/view.html.php b/components/com_mailto/views/mailto/view.html.php index ff0d2920c1d01..8c870f3c7d510 100644 --- a/components/com_mailto/views/mailto/view.html.php +++ b/components/com_mailto/views/mailto/view.html.php @@ -17,11 +17,18 @@ class MailtoViewMailto extends JViewLegacy { /** - * @since 1.5 + * Execute and display a template script. + * + * @param string $tpl The name of the template file to parse; automatically searches through the template paths. + * + * @return mixed A string if successful, otherwise a Error object. + * + * @since 1.5 */ public function display($tpl = null) { $data = $this->getData(); + if ($data === false) { return false; @@ -29,13 +36,17 @@ public function display($tpl = null) $this->set('data', $data); - parent::display($tpl); + return parent::display($tpl); } /** + * Get the form data + * + * @return object + * * @since 1.5 */ - function &getData() + protected function &getData() { $user = JFactory::getUser(); $app = JFactory::getApplication(); @@ -48,8 +59,8 @@ function &getData() if ($data->link == '') { JError::raiseError(403, JText::_('COM_MAILTO_LINK_IS_MISSING')); - $false = false; - return $false; + + return false; } // Load with previous data, if it exists diff --git a/components/com_mailto/views/sent/view.html.php b/components/com_mailto/views/sent/view.html.php index c8a5d15bad41b..efb70a1405011 100644 --- a/components/com_mailto/views/sent/view.html.php +++ b/components/com_mailto/views/sent/view.html.php @@ -16,11 +16,4 @@ */ class MailtoViewSent extends JViewLegacy { - /** - * @since 1.5 - */ - public function display($tpl = null) - { - parent::display($tpl); - } } diff --git a/components/com_newsfeeds/controller.php b/components/com_newsfeeds/controller.php index 5122bca72942f..bcdbf0dad10b3 100644 --- a/components/com_newsfeeds/controller.php +++ b/components/com_newsfeeds/controller.php @@ -21,10 +21,11 @@ class NewsfeedsController extends JControllerLegacy /** * Method to show a newsfeeds view * - * @param boolean If true, the view output will be cached - * @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. + * @param boolean $cachable If true, the view output will be cached + * @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * * @return JController This object to support chaining. + * * @since 1.5 */ public function display($cachable = false, $urlparams = false) @@ -42,7 +43,8 @@ public function display($cachable = false, $urlparams = false) $cachable = false; } - $safeurlparams = array('id' => 'INT', 'limit' => 'UINT', 'limitstart' => 'UINT', 'filter_order' => 'CMD', 'filter_order_Dir' => 'CMD', 'lang' => 'CMD'); + $safeurlparams = array('id' => 'INT', 'limit' => 'UINT', 'limitstart' => 'UINT', + 'filter_order' => 'CMD', 'filter_order_Dir' => 'CMD', 'lang' => 'CMD'); parent::display($cachable, $safeurlparams); } diff --git a/components/com_newsfeeds/helpers/association.php b/components/com_newsfeeds/helpers/association.php index a3965ad3a8379..6792ba0a0c23d 100644 --- a/components/com_newsfeeds/helpers/association.php +++ b/components/com_newsfeeds/helpers/association.php @@ -64,6 +64,5 @@ public static function getAssociations($id = 0, $view = null) } return array(); - } } diff --git a/components/com_newsfeeds/helpers/category.php b/components/com_newsfeeds/helpers/category.php index f4cb6ee12ad00..e856c71299509 100644 --- a/components/com_newsfeeds/helpers/category.php +++ b/components/com_newsfeeds/helpers/category.php @@ -18,6 +18,11 @@ */ class NewsfeedsCategories extends JCategories { + /** + * Constructor + * + * @param array $options options + */ public function __construct($options = array()) { $options['table'] = '#__newsfeeds'; diff --git a/components/com_newsfeeds/helpers/route.php b/components/com_newsfeeds/helpers/route.php index e4da2cff9f0eb..9b83f0b42ef96 100644 --- a/components/com_newsfeeds/helpers/route.php +++ b/components/com_newsfeeds/helpers/route.php @@ -23,7 +23,13 @@ abstract class NewsfeedsHelperRoute protected static $lang_lookup = array(); /** - * @param integer The route of the newsfeed + * getNewsfeedRoute + * + * @param int $id menu itemid + * @param int $catid category id + * @param int $language language + * + * @return string */ public static function getNewsfeedRoute($id, $catid, $language = 0) { @@ -31,8 +37,8 @@ public static function getNewsfeedRoute($id, $catid, $language = 0) 'newsfeed' => array((int) $id) ); - //Create the link - $link = 'index.php?option=com_newsfeeds&view=newsfeed&id='. $id; + // Create the link + $link = 'index.php?option=com_newsfeeds&view=newsfeed&id=' . $id; if ((int) $catid > 1) { @@ -41,10 +47,10 @@ public static function getNewsfeedRoute($id, $catid, $language = 0) if ($category) { - //TODO Throw error that the category either not exists or is unpublished + // TODO Throw error that the category either not exists or is unpublished $needles['category'] = array_reverse($category->getPath()); $needles['categories'] = $needles['category']; - $link .= '&catid='.$catid; + $link .= '&catid=' . $catid; } } @@ -61,12 +67,20 @@ public static function getNewsfeedRoute($id, $catid, $language = 0) if ($item = self::_findItem($needles)) { - $link .= '&Itemid='.$item; + $link .= '&Itemid=' . $item; } return $link; } + /** + * getCategoryRoute + * + * @param int $catid category id + * @param int $language language + * + * @return string + */ public static function getCategoryRoute($catid, $language = 0) { if ($catid instanceof JCategoryNode) @@ -89,7 +103,7 @@ public static function getCategoryRoute($catid, $language = 0) $needles = array(); // Create the link - $link = 'index.php?option=com_newsfeeds&view=category&id='.$id; + $link = 'index.php?option=com_newsfeeds&view=category&id=' . $id; $catids = array_reverse($category->getPath()); $needles['category'] = $catids; @@ -108,13 +122,21 @@ public static function getCategoryRoute($catid, $language = 0) if ($item = self::_findItem($needles)) { - $link .= '&Itemid='.$item; + $link .= '&Itemid=' . $item; } } return $link; } + /** + * buildLanguageLookup + * + * @return void + * + * @throws Exception + */ + protected static function buildLanguageLookup() { if (count(self::$lang_lookup) == 0) @@ -135,6 +157,15 @@ protected static function buildLanguageLookup() } } + /** + * finditem + * + * @param null $needles what we are searching for + * + * @return int menu itemid + * + * @throws Exception + */ protected static function _findItem($needles = null) { $app = JFactory::getApplication(); @@ -164,16 +195,17 @@ protected static function _findItem($needles = null) if (isset($item->query) && isset($item->query['view'])) { $view = $item->query['view']; - if (!isset(self::$lookup[$language][$view])) + + if (!isset(self::$lookup[$language][$view])) { self::$lookup[$language][$view] = array(); } + if (isset($item->query['id'])) { - - // here it will become a bit tricky - // language != * can override existing entries - // language == * cannot override existing entries + /* Here it will become a bit tricky + language != * can override existing entries + language == * cannot override existing entries */ if (!isset(self::$lookup[$language][$view][$item->query['id']]) || $item->language != '*') { self::$lookup[$language][$view][$item->query['id']] = $item->id; @@ -202,6 +234,7 @@ protected static function _findItem($needles = null) // Check if the active menuitem matches the requested language $active = $menus->getActive(); + if ($active && ($language == '*' || in_array($active->language, array('*', $language)) || !JLanguageMultilang::isEnabled())) { return $active->id; @@ -209,6 +242,7 @@ protected static function _findItem($needles = null) // If not found, return language specific home link $default = $menus->getDefault($language); + return !empty($default->id) ? $default->id : null; } } diff --git a/components/com_newsfeeds/models/categories.php b/components/com_newsfeeds/models/categories.php index 605cbacc9c861..260524d2095f6 100644 --- a/components/com_newsfeeds/models/categories.php +++ b/components/com_newsfeeds/models/categories.php @@ -41,8 +41,16 @@ class NewsfeedsModelCategories extends JModelList * * Note. Calling getState in this method will result in recursion. * + * @param string $ordering An optional ordering field + * @param string $direction An optional direction [asc|desc] + * + * @return void + * + * @throws Exception + * * @since 1.6 */ + protected function populateState($ordering = null, $direction = null) { $app = JFactory::getApplication(); @@ -66,17 +74,17 @@ protected function populateState($ordering = null, $direction = null) * different modules that might need different sets of data or different * ordering requirements. * - * @param string $id A prefix for the store id. + * @param string $id A prefix for the store id. * * @return string A store id. */ protected function getStoreId($id = '') { // Compile the store id. - $id .= ':'.$this->getState('filter.extension'); - $id .= ':'.$this->getState('filter.published'); - $id .= ':'.$this->getState('filter.access'); - $id .= ':'.$this->getState('filter.parentId'); + $id .= ':' . $this->getState('filter.extension'); + $id .= ':' . $this->getState('filter.published'); + $id .= ':' . $this->getState('filter.access'); + $id .= ':' . $this->getState('filter.parentId'); return parent::getStoreId($id); } @@ -94,18 +102,23 @@ public function getItems() $menu = $app->getMenu(); $active = $menu->getActive(); $params = new JRegistry; + if ($active) { $params->loadString($active->params); } + $options = array(); $options['countItems'] = $params->get('show_cat_items_cat', 1) || !$params->get('show_empty_categories_cat', 0); $categories = JCategories::getInstance('Newsfeeds', $options); $this->_parent = $categories->get($this->getState('filter.parentId', 'root')); + if (is_object($this->_parent)) { $this->_items = $this->_parent->getChildren(); - } else { + } + else + { $this->_items = false; } } @@ -113,12 +126,18 @@ public function getItems() return $this->_items; } + /** + * get the Parent + * + * @return null + */ public function getParent() { if (!is_object($this->_parent)) { $this->getItems(); } + return $this->_parent; } } diff --git a/components/com_newsfeeds/models/category.php b/components/com_newsfeeds/models/category.php index a929635de9b33..8b585f4c88767 100644 --- a/components/com_newsfeeds/models/category.php +++ b/components/com_newsfeeds/models/category.php @@ -52,7 +52,8 @@ class NewsfeedsModelCategory extends JModelList /** * Constructor. * - * @param array An optional associative array of configuration settings. + * @param array $config An optional associative array of configuration settings. + * * @see JController * @since 1.6 */ @@ -104,6 +105,7 @@ public function getItems() * Method to build an SQL query to load the list data. * * @return string An SQL query + * * @since 1.6 */ protected function getListQuery() @@ -130,6 +132,7 @@ protected function getListQuery() // Filter by state $state = $this->getState('filter.published'); + if (is_numeric($state)) { $query->where('a.published = ' . (int) $state); @@ -148,6 +151,7 @@ protected function getListQuery() // Filter by search in title $search = $this->getState('list.filter'); + if (!empty($search)) { $search = $db->quote('%' . $db->escape($search, true) . '%'); @@ -171,7 +175,14 @@ protected function getListQuery() * * Note. Calling getState in this method will result in recursion. * + * @param string $ordering An optional ordering field + * @param string $direction An optional direction [asc|desc] + * + * @return void + * * @since 1.6 + * + * @throws Exception */ protected function populateState($ordering = null, $direction = null) { @@ -189,26 +200,31 @@ protected function populateState($ordering = null, $direction = null) $this->setState('list.filter', $app->input->getString('filter-search')); $orderCol = $app->input->get('filter_order', 'ordering'); + if (!in_array($orderCol, $this->filter_fields)) { $orderCol = 'ordering'; } + $this->setState('list.ordering', $orderCol); $listOrder = $app->input->get('filter_order_Dir', 'ASC'); + if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', ''))) { $listOrder = 'ASC'; } + $this->setState('list.direction', $listOrder); $id = $app->input->get('id', 0, 'int'); $this->setState('category.id', $id); $user = JFactory::getUser(); + if ((!$user->authorise('core.edit.state', 'com_newsfeeds')) && (!$user->authorise('core.edit', 'com_newsfeeds'))) { - // limit to published for people who can't edit or edit.state. + // Limit to published for people who can't edit or edit.state. $this->setState('filter.published', 1); // Filter by start and end dates. @@ -224,9 +240,8 @@ protected function populateState($ordering = null, $direction = null) /** * Method to get category data for the current category * - * @param integer An optional ID - * * @return object + * * @since 1.5 */ public function getCategory() @@ -247,14 +262,17 @@ public function getCategory() $options['countItems'] = $params->get('show_cat_items', 1) || $params->get('show_empty_categories', 0); $categories = JCategories::getInstance('Newsfeeds', $options); $this->_item = $categories->get($this->getState('category.id', 'root')); + if (is_object($this->_item)) { $this->_children = $this->_item->getChildren(); $this->_parent = false; + if ($this->_item->getParent()) { $this->_parent = $this->_item->getParent(); } + $this->_rightsibling = $this->_item->getSibling(); $this->_leftsibling = $this->_item->getSibling(false); } @@ -271,8 +289,6 @@ public function getCategory() /** * Get the parent category. * - * @param integer An optional category id. If not supplied, the model state 'category.id' will be used. - * * @return mixed An array of categories or false if an error occurs. */ public function getParent() @@ -281,6 +297,7 @@ public function getParent() { $this->getCategory(); } + return $this->_parent; } @@ -289,32 +306,37 @@ public function getParent() * * @return mixed An array of categories or false if an error occurs. */ - function &getLeftSibling() + public function &getLeftSibling() { if (!is_object($this->_item)) { $this->getCategory(); } + return $this->_leftsibling; } - function &getRightSibling() + /** + * Get the sibling (adjacent) categories. + * + * @return mixed An array of categories or false if an error occurs. + */ + public function &getRightSibling() { if (!is_object($this->_item)) { $this->getCategory(); } + return $this->_rightsibling; } /** * Get the child categories. * - * @param integer An optional category id. If not supplied, the model state 'category.id' will be used. - * * @return mixed An array of categories or false if an error occurs. */ - function &getChildren() + public function &getChildren() { if (!is_object($this->_item)) { diff --git a/components/com_newsfeeds/models/newsfeed.php b/components/com_newsfeeds/models/newsfeed.php index 98812f7707891..4088cf9fa5f83 100644 --- a/components/com_newsfeeds/models/newsfeed.php +++ b/components/com_newsfeeds/models/newsfeed.php @@ -32,6 +32,7 @@ class NewsfeedsModelNewsfeed extends JModelItem * Note. Calling getState in this method will result in recursion. * * @return void + * * @since 1.6 */ protected function populateState() @@ -50,7 +51,9 @@ protected function populateState() $this->setState('params', $params); $user = JFactory::getUser(); - if ((!$user->authorise('core.edit.state', 'com_newsfeeds')) && (!$user->authorise('core.edit', 'com_newsfeeds'))){ + + if ((!$user->authorise('core.edit.state', 'com_newsfeeds')) && (!$user->authorise('core.edit', 'com_newsfeeds'))) + { $this->setState('filter.published', 1); $this->setState('filter.archived', 2); } @@ -59,9 +62,10 @@ protected function populateState() /** * Method to get newsfeed data. * - * @param integer The id of the newsfeed. + * @param integer $pk The id of the newsfeed. * * @return mixed Menu item data object on success, false on failure. + * * @since 1.6 */ public function &getItem($pk = null) @@ -103,6 +107,7 @@ public function &getItem($pk = null) // Filter by published state. $published = $this->getState('filter.published'); $archived = $this->getState('filter.archived'); + if (is_numeric($published)) { $query->where('(a.published = ' . (int) $published . ' OR a.published =' . (int) $archived . ')') @@ -121,6 +126,7 @@ public function &getItem($pk = null) } // Check for published state if filter set. + if (((is_numeric($published)) || (is_numeric($archived))) && (($data->published != $published) && ($data->published != $archived))) { JError::raiseError(404, JText::_('COM_NEWSFEEDS_ERROR_FEED_NOT_FOUND')); @@ -137,14 +143,16 @@ public function &getItem($pk = null) $data->metadata = $registry; // Compute access permissions. + if ($access = $this->getState('filter.access')) { // If the access filter has been set, we already know this user can view. $data->params->set('access-view', true); } - else { + else + { // If no access filter is set, the layout takes some responsibility for display of limited information. - $user = JFactory::getUser(); + $user = JFactory::getUser(); $groups = $user->getAuthorisedViewLevels(); $data->params->set('access-view', in_array($data->access, $groups) && in_array($data->category_access, $groups)); } diff --git a/components/com_newsfeeds/router.php b/components/com_newsfeeds/router.php index d3c4c97416a46..85b5c7b03f2d2 100644 --- a/components/com_newsfeeds/router.php +++ b/components/com_newsfeeds/router.php @@ -252,21 +252,34 @@ public function parse(&$segments) } /** - * Newsfeeds router functions + * newsfeedsBuildRoute * * These functions are proxys for the new router interface * for old SEF extensions. * + * @param array &$query The segments of the URL to parse. + * + * @return array + * * @deprecated 4.0 Use Class based routers instead */ -function NewsfeedsBuildRoute(&$query) +function newsfeedsBuildRoute(&$query) { $router = new NewsfeedsRouter; return $router->build($query); } -function NewsfeedsParseRoute($segments) +/** + * newsfeedsParseRoute + * + * @param array $segments The segments of the URL to parse. + * + * @return array + * + * @deprecated 4.0 Use Class based routers instead + */ +function newsfeedsParseRoute($segments) { $router = new NewsfeedsRouter; diff --git a/components/com_newsfeeds/views/category/view.html.php b/components/com_newsfeeds/views/category/view.html.php index fa6e2515ea919..f97fc0a64f2c8 100644 --- a/components/com_newsfeeds/views/category/view.html.php +++ b/components/com_newsfeeds/views/category/view.html.php @@ -51,10 +51,10 @@ public function display($tpl = null) // Compute the newsfeed slug. foreach ($this->items as $item) { - $item->slug = $item->alias ? ($item->id.':'.$item->alias) : $item->id; + $item->slug = $item->alias ? ($item->id . ':' . $item->alias) : $item->id; $temp = new JRegistry; $temp->loadString($item->params); - $item->params = clone($this->params); + $item->params = clone $this->params; $item->params->merge($temp); } diff --git a/components/com_newsfeeds/views/newsfeed/view.html.php b/components/com_newsfeeds/views/newsfeed/view.html.php index eac3fd48e758b..fe2483c69bc75 100644 --- a/components/com_newsfeeds/views/newsfeed/view.html.php +++ b/components/com_newsfeeds/views/newsfeed/view.html.php @@ -83,12 +83,13 @@ public function display($tpl = null) $item->catslug = $item->category_alias ? ($item->catid . ':' . $item->category_alias) : $item->catid; $item->parent_slug = $item->category_alias ? ($item->parent_id . ':' . $item->parent_alias) : $item->parent_id; - // check if cache directory is writeable + // Check if cache directory is writeable $cacheDir = JPATH_CACHE . '/'; if (!is_writable($cacheDir)) { JError::raiseNotice('0', JText::_('COM_NEWSFEEDS_CACHE_DIRECTORY_UNWRITABLE')); + return; } @@ -97,7 +98,7 @@ public function display($tpl = null) $params = $state->get('params'); $newsfeed_params = clone $item->params; $active = $app->getMenu()->getActive(); - $temp = clone ($params); + $temp = clone $params; // Check to see which parameters should take priority if ($active) @@ -105,7 +106,7 @@ public function display($tpl = null) $currentLink = $active->link; // If the current view is the active item and an newsfeed view for this feed, then the menu item params take priority - if (strpos($currentLink, 'view=newsfeed') && (strpos($currentLink, '&id='.(string) $item->id))) + if (strpos($currentLink, 'view=newsfeed') && (strpos($currentLink, '&id=' . (string) $item->id))) { // $item->params are the newsfeed params, $temp are the menu item params // Merge so that the menu item params take priority @@ -151,6 +152,7 @@ public function display($tpl = null) if (!in_array($item->access, $levels) or ((in_array($item->access, $levels) and (!in_array($item->category_access, $levels))))) { JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR')); + return; } @@ -183,12 +185,13 @@ public function display($tpl = null) } $feed_display_order = $params->get('feed_display_order', 'des'); + if ($feed_display_order == 'asc') { $newsfeed->items = array_reverse($newsfeed->items); } - //Escape strings for HTML output + // Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx')); $this->assignRef('params', $params); @@ -196,10 +199,12 @@ public function display($tpl = null) $this->assignRef('state', $state); $this->assignRef('item', $item); $this->assignRef('user', $user); + if (!empty($msg)) { $this->assignRef('msg', $msg); } + $this->print = $print; $item->tags = new JHelperTags; @@ -218,6 +223,7 @@ public function display($tpl = null) * Prepares the document * * @return void + * * @since 1.6 */ protected function _prepareDocument() @@ -244,7 +250,7 @@ protected function _prepareDocument() $id = (int) @$menu->query['id']; - // if the menu item does not concern this newsfeed + // If the menu item does not concern this newsfeed if ($menu && ($menu->query['option'] != 'com_newsfeeds' || $menu->query['view'] != 'newsfeed' || $id != $this->item->id)) { // If this is not a single newsfeed menu item, set the page title to the newsfeed title @@ -255,12 +261,15 @@ protected function _prepareDocument() $path = array(array('title' => $this->item->name, 'link' => '')); $category = JCategories::getInstance('Newsfeeds')->get($this->item->catid); + while (($menu->query['option'] != 'com_newsfeeds' || $menu->query['view'] == 'newsfeed' || $id != $category->id) && $category->id > 1) { $path[] = array('title' => $category->title, 'link' => NewsfeedsHelperRoute::getCategoryRoute($category->id)); $category = $category->getParent(); } + $path = array_reverse($path); + foreach ($path as $item) { $pathway->addItem($item['title'], $item['link']); @@ -279,10 +288,12 @@ protected function _prepareDocument() { $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename')); } + if (empty($title)) { $title = $this->item->name; } + $this->document->setTitle($title); if ($this->item->metadesc) @@ -319,6 +330,7 @@ protected function _prepareDocument() } $mdata = $this->item->metadata->toArray(); + foreach ($mdata as $k => $v) { if ($v) diff --git a/components/com_search/controller.php b/components/com_search/controller.php index 69f6d08111a19..3e5e2b2e460b3 100644 --- a/components/com_search/controller.php +++ b/components/com_search/controller.php @@ -21,25 +21,35 @@ class SearchController extends JControllerLegacy /** * Method to display a view. * - * @param boolean If true, the view output will be cached - * @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. + * @param bool $cachable If true, the view output will be cached + * @param bool $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. + * + * @return JControllerLegacy This object to support chaining. * - * @return JController This object to support chaining. * @since 1.5 */ public function display($cachable = false, $urlparams = false) { - $this->input->set('view', 'search'); // force it to be the search view + // Force it to be the search view + $this->input->set('view', 'search'); return parent::display($cachable, $urlparams); } + /** + * Search + * + * @return void + * + * @throws Exception + */ public function search() { - // slashes cause errors, <> get stripped anyway later on. # causes problems. + // Slashes cause errors, <> get stripped anyway later on. # causes problems. $badchars = array('#', '>', '<', '\\'); $searchword = trim(str_replace($badchars, '', $this->input->getString('searchword', null, 'post'))); - // if searchword enclosed in double quotes, strip quotes and do exact match + + // If searchword enclosed in double quotes, strip quotes and do exact match if (substr($searchword, 0, 1) == '"' && substr($searchword, -1) == '"') { $post['searchword'] = substr($searchword, 1, -1); @@ -49,6 +59,7 @@ public function search() { $post['searchword'] = $searchword; } + $post['ordering'] = $this->input->getWord('ordering', null, 'post'); $post['searchphrase'] = $this->input->getWord('searchphrase', 'all', 'post'); $post['limit'] = $this->input->getUInt('limit', null, 'post'); @@ -59,6 +70,7 @@ public function search() } $areas = $this->input->post->get('areas', null, 'array'); + if ($areas) { foreach ($areas as $area) @@ -95,6 +107,6 @@ public function search() $uri->setQuery($post); $uri->setVar('option', 'com_search'); - $this->setRedirect(JRoute::_('index.php'.$uri->toString(array('query', 'fragment')), false)); + $this->setRedirect(JRoute::_('index.php' . $uri->toString(array('query', 'fragment')), false)); } } diff --git a/components/com_search/models/search.php b/components/com_search/models/search.php index 32b85b877e010..bfe41ea2fd835 100644 --- a/components/com_search/models/search.php +++ b/components/com_search/models/search.php @@ -55,7 +55,7 @@ public function __construct() { parent::__construct(); - //Get configuration + // Get configuration $app = JFactory::getApplication(); $config = JFactory::getConfig(); @@ -85,7 +85,7 @@ public function __construct() $ordering = $app->input->get('ordering', $params->get('ordering', 'newest'), 'word'); $this->setSearch($keyword, $match, $ordering); - //Set the search areas + // Set the search areas $areas = $app->input->get('areas', null, 'array'); $this->setAreas($areas); } @@ -93,10 +93,13 @@ public function __construct() /** * Method to set the search parameters * + * @param string $keyword string search string + * @param string $match matching option, exact|any|all + * @param string $ordering option, newest|oldest|popular|alpha|category + * + * @return void + * * @access public - * @param string search string - * @param string mathcing option, exact|any|all - * @param string ordering option, newest|oldest|popular|alpha|category */ public function setSearch($keyword, $match = 'all', $ordering = 'newest') { @@ -123,19 +126,6 @@ public function setSearch($keyword, $match = 'all', $ordering = 'newest') } } - /** - * Method to set the search areas - * - * @access public - * @param array Active areas - * @param array Search areas - */ - public function setAreas($active = array(), $search = array()) - { - $this->_areas['active'] = $active; - $this->_areas['search'] = $search; - } - /** * Method to get weblink item data for the category * @@ -159,16 +149,20 @@ public function getData() ); $rows = array(); + foreach ($results as $result) { $rows = array_merge((array) $rows, (array) $result); } $this->_total = count($rows); + if ($this->getState('limit') > 0) { - $this->_data = array_splice($rows, $this->getState('limitstart'), $this->getState('limit')); - } else { + $this->_data = array_splice($rows, $this->getState('limitstart'), $this->getState('limit')); + } + else + { $this->_data = $rows; } } @@ -187,6 +181,22 @@ public function getTotal() return $this->_total; } + /** + * Method to set the search areas + * + * @param array $active areas + * @param array $search areas + * + * @return void + * + * @access public + */ + public function setAreas($active = array(), $search = array()) + { + $this->_areas['active'] = $active; + $this->_areas['search'] = $search; + } + /** * Method to get a pagination object of the weblink items for the category * @@ -207,6 +217,8 @@ public function getPagination() /** * Method to get the search areas * + * @return int + * * @since 1.5 */ public function getAreas() diff --git a/components/com_search/router.php b/components/com_search/router.php index 9f2fa81eb614d..b1e68ef2e83a9 100644 --- a/components/com_search/router.php +++ b/components/com_search/router.php @@ -78,22 +78,39 @@ public function parse(&$segments) } } + /** - * Search router functions + * searchBuildRoute * - * These functions are proxys for the new router interface + * These functions are proxies for the new router interface * for old SEF extensions. * + * @param array &$query An array of URL arguments + * + * @return array + * * @deprecated 4.0 Use Class based routers instead */ -function SearchBuildRoute(&$query) +function searchBuildRoute(&$query) { $router = new SearchRouter; return $router->build($query); } -function SearchParseRoute($segments) +/** + * searchParseRoute + * + * These functions are proxies for the new router interface + * for old SEF extensions. + * + * @param array $segments The segments of the URL to parse. + * + * @return array + * + * @deprecated 4.0 Use Class based routers instead + */ +function searchParseRoute($segments) { $router = new SearchRouter; diff --git a/components/com_search/views/search/view.html.php b/components/com_search/views/search/view.html.php index 2ac1a05616d15..0bd34080a2d29 100644 --- a/components/com_search/views/search/view.html.php +++ b/components/com_search/views/search/view.html.php @@ -198,7 +198,8 @@ public function display($tpl = null) $ChkRow = mb_substr($row, 0, $pos); $sChkRowLen = mb_strlen(strtolower(SearchHelper::remove_accents($ChkRow))); $ChkRowLen = mb_strlen($ChkRow); - // correct $pos + + // Correct $pos $pos -= ($sChkRowLen - $ChkRowLen); } @@ -210,7 +211,7 @@ public function display($tpl = null) { if (($pos = JString::strpos($srow, strtolower(SearchHelper::remove_accents($hlword)))) !== false) { - // iconv transliterates '€' to 'EUR' + // Iconv transliterates '€' to 'EUR' // TODO: add other expanding translations? $eur_compensation = $pos > 0 ? substr_count($row, "\xE2\x82\xAC", 0, $pos) * 2 : 0; $pos -= $eur_compensation; @@ -221,6 +222,7 @@ public function display($tpl = null) $ChkRow = JString::substr($row, 0, $pos); $sChkRowLen = JString::strlen(strtolower(SearchHelper::remove_accents($ChkRow))); $ChkRowLen = JString::strlen($ChkRow); + // Correct $pos $pos -= ($sChkRowLen - $ChkRowLen); } @@ -241,10 +243,11 @@ public function display($tpl = null) foreach ($posCollector as $pos => $hlword) { $pos += $cnt * $highlighterLen; - // Avoid overlapping/corrupted highlighter-spans - // TODO $chkOverlap could be used to highlight remaining part - // of searchword outside last highlighter-span. - // At the moment no additional highlighter is set. + + /* Avoid overlapping/corrupted highlighter-spans + * TODO $chkOverlap could be used to highlight remaining part + * of searchword outside last highlighter-span. + * At the moment no additional highlighter is set.*/ $chkOverlap = $pos - $lastHighlighterEnd; if ($chkOverlap >= 0) @@ -258,7 +261,8 @@ public function display($tpl = null) else { $hlwordLen = JString::strlen($hlword); - $row = JString::substr($row, 0, $pos) . $hl1 . JString::substr($row, $pos, JString::strlen($hlword)) . $hl2 . JString::substr($row, $pos + JString::strlen($hlword)); + $row = JString::substr($row, 0, $pos) . $hl1 . JString::substr($row, $pos, JString::strlen($hlword)) + . $hl2 . JString::substr($row, $pos + JString::strlen($hlword)); } $cnt++; diff --git a/components/com_search/views/search/view.opensearch.php b/components/com_search/views/search/view.opensearch.php index 41c58c8a1a781..1cee87d9183dd 100644 --- a/components/com_search/views/search/view.opensearch.php +++ b/components/com_search/views/search/view.opensearch.php @@ -18,6 +18,15 @@ */ class SearchViewSearch extends JViewLegacy { + /** + * Execute and display a template script. + * + * @param string $tpl name of the template + * + * @throws Exception + * @return mixed A string if successful, otherwise a Error object. + */ + public function display($tpl = null) { $doc = JFactory::getDocument(); diff --git a/components/com_tags/views/tag/view.html.php b/components/com_tags/views/tag/view.html.php index 30ff5bc7e4901..9fc7ed74efe92 100644 --- a/components/com_tags/views/tag/view.html.php +++ b/components/com_tags/views/tag/view.html.php @@ -238,7 +238,7 @@ protected function _prepareDocument() { $this->document->setDescription($itemElement->metadesc); } - elseif ($itemElement->metadesc && $this->params->get('menu-meta_description')) + elseif (!$itemElement->metadesc && $this->params->get('menu-meta_description')) { $this->document->setDescription($this->params->get('menu-meta_description')); } diff --git a/components/com_tags/views/tags/view.html.php b/components/com_tags/views/tags/view.html.php index 3160a5a20dd4b..dbb08003d980d 100644 --- a/components/com_tags/views/tags/view.html.php +++ b/components/com_tags/views/tags/view.html.php @@ -164,6 +164,22 @@ protected function _prepareDocument() $this->params->set('page_subheading', $menu->title); } + // Set metadata for all tags menu item + if ($this->params->get('menu-meta_description')) + { + $this->document->setDescription($this->params->get('menu-meta_description')); + } + + if ($this->params->get('menu-meta_keywords')) + { + $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); + } + + if ($this->params->get('robots')) + { + $this->document->setMetadata('robots', $this->params->get('robots')); + } + // If this is not a single tag menu item, set the page title to the tag titles $title = ''; @@ -177,6 +193,7 @@ protected function _prepareDocument() { $title .= ', '; } + $title .= $itemElement->title; } } @@ -202,7 +219,7 @@ protected function _prepareDocument() { $this->document->setDescription($this->item->metadesc); } - elseif ($itemElement->metadesc && $this->params->get('menu-meta_description')) + elseif (!$itemElement->metadesc && $this->params->get('menu-meta_description')) { $this->document->setDescription($this->params->get('menu-meta_description')); } diff --git a/components/com_wrapper/router.php b/components/com_wrapper/router.php index 71c908314d3f3..0206c3901c45c 100644 --- a/components/com_wrapper/router.php +++ b/components/com_wrapper/router.php @@ -83,7 +83,7 @@ public function parse(&$segments) * * @deprecated 4.0 Use Class based routers instead */ -function WrapperBuildRoute(&$query) +function wrapperBuildRoute(&$query) { $router = new WrapperRouter; @@ -102,7 +102,7 @@ function WrapperBuildRoute(&$query) * * @deprecated 4.0 Use Class based routers instead */ -function WrapperParseRoute($segments) +function wrapperParseRoute($segments) { $router = new WrapperRouter; diff --git a/installation/application/web.php b/installation/application/web.php index 2b1ae2d2d9b24..a78928b269677 100644 --- a/installation/application/web.php +++ b/installation/application/web.php @@ -10,7 +10,7 @@ defined('_JEXEC') or die; /** - * Joomla! Installation Application class + * Joomla! Installation Application class. * * @package Joomla.Installation * @subpackage Application @@ -25,10 +25,10 @@ final class InstallationApplicationWeb extends JApplicationCms */ public function __construct() { - // Run the parent constructor + // Run the parent constructor. parent::__construct(); - // Load and set the dispatcher + // Load and set the dispatcher. $this->loadDispatcher(); // Enable sessions by default. @@ -48,23 +48,23 @@ public function __construct() { $this->loadSession(); - // Register the session with JFactory + // Register the session with JFactory. JFactory::$session = $this->getSession(); } - // Store the debug value to config based on the JDEBUG flag + // Store the debug value to config based on the JDEBUG flag. $this->config->set('debug', JDEBUG); - // Register the config to JFactory + // Register the config to JFactory. JFactory::$config = $this->config; - // Register the application to JFactory + // Register the application to JFactory. JFactory::$application = $this; - // Register the application name + // Register the application name. $this->_name = 'installation'; - // Register the client ID + // Register the client ID. $this->_clientId = 2; // Set the root in the URI one level up. @@ -74,9 +74,9 @@ public function __construct() } /** - * Method to display errors in language parsing + * Method to display errors in language parsing. * - * @return string Language debug output + * @return string Language debug output. * * @since 3.1 */ @@ -112,11 +112,13 @@ public function debugLanguage() ksort($orphans, SORT_STRING); $guesses = array(); + foreach ($orphans as $key => $occurance) { $guess = str_replace('_', ' ', $key); $parts = explode(' ', $guess); + if (count($parts) > 1) { array_shift($parts); @@ -129,7 +131,7 @@ public function debugLanguage() $key = preg_replace('#\s+#', '_', $key); $key = preg_replace('#\W#', '', $key); - // Prepare the text + // Prepare the text. $guesses[] = $key . '="' . $guess . '"'; } @@ -146,7 +148,7 @@ public function debugLanguage() } /** - * Dispatch the application + * Dispatch the application. * * @return void * @@ -156,13 +158,13 @@ public function dispatch() { try { - // Load the document to the API + // Load the document to the API. $this->loadDocument(); // Set up the params $document = $this->getDocument(); - // Register the document object with JFactory + // Register the document object with JFactory. JFactory::$document = $document; if ($document->getType() == 'html') @@ -171,7 +173,7 @@ public function dispatch() $document->setTitle(JText::_('INSTL_PAGE_TITLE')); } - // Define component path + // Define component path. define('JPATH_COMPONENT', JPATH_BASE); define('JPATH_COMPONENT_SITE', JPATH_SITE); define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR); @@ -188,7 +190,7 @@ public function dispatch() $this->close($e->getCode()); } - // If debug language is set, append its output to the contents + // If debug language is set, append its output to the contents. if ($this->config->get('debug_lang')) { $contents .= $this->debugLanguage(); @@ -215,10 +217,10 @@ public function dispatch() */ protected function doExecute() { - // Initialise the application + // Initialise the application. $this->initialiseApp(); - // Dispatch the application + // Dispatch the application. $this->dispatch(); } @@ -258,7 +260,7 @@ protected function fetchController($task) $task = 'default'; } - // Set the controller class name based on the task + // Set the controller class name based on the task. $class = 'InstallationController' . ucfirst($task); // If the requested controller exists let's use it. @@ -288,7 +290,7 @@ public function getLocalise() return false; } - // Check that it's a localise file + // Check that it's a localise file. if ($xml->getName() != 'localise') { return false; @@ -308,19 +310,19 @@ public function getLocalise() * Returns the installed language files in the administrative and * front-end area. * - * @param mixed $db JDatabaseDriver instance + * @param mixed $db JDatabaseDriver instance. * - * @return array Array with installed language packs in admin and site area + * @return array Array with installed language packs in admin and site area. * * @since 3.1 */ public function getLocaliseAdmin($db = false) { - // Read the files in the admin area + // Read the files in the admin area. $path = JLanguage::getLanguagePath(JPATH_ADMINISTRATOR); $langfiles['admin'] = JFolder::folders($path); - // Read the files in the site area + // Read the files in the site area. $path = JLanguage::getLanguagePath(JPATH_SITE); $langfiles['site'] = JFolder::folders($path); @@ -341,7 +343,7 @@ public function getLocaliseAdmin($db = false) { switch ($lang->client_id) { - // Site + // Site. case 0: if (in_array($lang->element, $langfiles_disk['site'])) { @@ -350,7 +352,7 @@ public function getLocaliseAdmin($db = false) break; - // Administrator + // Administrator. case 1: if (in_array($lang->element, $langfiles_disk['admin'])) { @@ -381,6 +383,7 @@ public function getTemplate($params = false) $template = new stdClass; $template->template = 'template'; $template->params = new JRegistry; + return $template; } @@ -405,6 +408,7 @@ protected function initialiseApp($options = array()) if (empty($options['language'])) { $requestLang = $this->input->getCmd('lang', null); + if (!is_null($requestLang)) { $options['language'] = $requestLang; @@ -440,13 +444,13 @@ protected function initialiseApp($options = array()) } } - // Give the user English + // Give the user English. if (empty($options['language'])) { $options['language'] = 'en-GB'; } - // Check for custom helpurl + // Check for custom helpurl. if (empty($forced['helpurl'])) { $options['helpurl'] = 'http://help.joomla.org/proxy/index.php?option=com_help&keyref=Help{major}{minor}:{keyref}'; @@ -456,10 +460,10 @@ protected function initialiseApp($options = array()) $options['helpurl'] = $forced['helpurl']; } - // Store helpurl in the session + // Store helpurl in the session. $this->getSession()->set('setup.helpurl', $options['helpurl']); - // Set the language in the class + // Set the language in the class. $this->config->set('language', $options['language']); $this->config->set('debug_lang', $forced['debug']); $this->config->set('sampledata', $forced['sampledata']); @@ -497,7 +501,7 @@ public function loadDocument(JDocument $document = null) $document = JDocument::getInstance($type, $attributes); - // Register the instance to JFactory + // Register the instance to JFactory. JFactory::$document = $document; } @@ -552,7 +556,7 @@ public function loadSession(JSession $session = null) if (!$session->get('registry') instanceof JRegistry) { - // Registry has been corrupted somehow + // Registry has been corrupted somehow. $session->set('registry', new JRegistry('session')); } @@ -622,7 +626,7 @@ public function sendJsonResponse($response) } /** - * Set configuration values + * Set configuration values. * * @param array $vars Array of configuration values * @param string $namespace The namespace diff --git a/installation/controller/install/database_backup.php b/installation/controller/install/database_backup.php index 598efb7657389..1c56a6ed93e0d 100644 --- a/installation/controller/install/database_backup.php +++ b/installation/controller/install/database_backup.php @@ -27,7 +27,7 @@ class InstallationControllerInstallDatabase_backup extends JControllerBase */ public function execute() { - // Get the application + // Get the application. /* @var InstallationApplicationWeb $app */ $app = $this->getApplication(); @@ -37,7 +37,7 @@ public function execute() // Get the setup model. $model = new InstallationModelSetup; - // Get the options from the session + // Get the options from the session. $options = $model->getOptions(); // Get the database model. @@ -49,7 +49,7 @@ public function execute() $r = new stdClass; $r->view = 'install'; - // Check if the database was initialised + // Check if the database was initialised. if (!$return) { $r->view = 'database'; diff --git a/installation/controller/removefolder.php b/installation/controller/removefolder.php index d25eedb62d8b8..4d82244f40ad1 100644 --- a/installation/controller/removefolder.php +++ b/installation/controller/removefolder.php @@ -27,7 +27,7 @@ class InstallationControllerRemovefolder extends JControllerBase */ public function execute() { - // Get the application + // Get the application. /* @var InstallationApplicationWeb $app */ $app = $this->getApplication(); @@ -36,26 +36,27 @@ public function execute() $path = JPATH_INSTALLATION; - // Check whether the folder still exists + // Check whether the folder still exists. if (!file_exists($path)) { $app->sendJsonResponse(new Exception(JText::sprintf('INSTL_COMPLETE_ERROR_FOLDER_ALREADY_REMOVED'), 500)); } - // Check whether we need to use FTP + // Check whether we need to use FTP. $useFTP = false; + if ((file_exists($path) && !is_writable($path))) { $useFTP = true; } - // Check for safe mode + // Check for safe mode. if (ini_get('safe_mode')) { $useFTP = true; } - // Enable/Disable override + // Enable/Disable override. if (!isset($options->ftpEnable) || ($options->ftpEnable != 1)) { $useFTP = false; @@ -63,25 +64,26 @@ public function execute() if ($useFTP == true) { - // Connect the FTP client + // Connect the FTP client. $ftp = JClientFtp::getInstance($options->ftp_host, $options->ftp_port); $ftp->login($options->ftp_user, $options->ftp_pass); - // Translate path for the FTP account + // Translate path for the FTP account. $file = JPath::clean(str_replace(JPATH_CONFIGURATION, $options->ftp_root, $path), '/'); $return = $ftp->delete($file); - // Delete the extra XML file while we're at it + // Delete the extra XML file while we're at it. if ($return) { $file = JPath::clean($options->ftp_root . '/joomla.xml'); + if (file_exists($file)) { $return = $ftp->delete($file); } } - // Rename the robots.txt.dist file to robots.txt + // Rename the robots.txt.dist file to robots.txt. if ($return) { $robotsFile = JPath::clean($options->ftp_root . '/robots.txt'); @@ -125,7 +127,7 @@ public function execute() $r->text = JText::_('INSTL_COMPLETE_FOLDER_REMOVED'); /* - * Send the response + * Send the response. * This is a hack since by now, the rest of the folder is deleted and we can't make a new request */ $this->sendJsonResponse($r); @@ -183,13 +185,13 @@ public function __construct($data) // The old token is invalid so send a new one. $this->token = JSession::getFormToken(true); - // Get the language and send it's tag along + // Get the language and send it's tag along. $this->lang = JFactory::getLanguage()->getTag(); // Get the message queue $messages = JFactory::getApplication()->getMessageQueue(); - // Build the sorted message list + // Build the sorted message list. if (is_array($messages) && count($messages)) { foreach ($messages as $msg) @@ -201,7 +203,7 @@ public function __construct($data) } } - // If messages exist add them to the output + // If messages exist add them to the output. if (isset($lists) && is_array($lists)) { $this->messages = $lists; diff --git a/installation/helper/html/installation.php b/installation/helper/html/installation.php index a671e61862692..c871df31989b4 100644 --- a/installation/helper/html/installation.php +++ b/installation/helper/html/installation.php @@ -17,15 +17,14 @@ class JHtmlInstallation { /** - * Method to generate the side bar + * Method to generate the side bar. * - * @return string Markup for the side bar + * @return string Markup for the side bar. * * @since 1.6 */ public static function stepbar() { - // Determine if the configuration file path is writable. $path = JPATH_CONFIGURATION . '/configuration.php'; $useftp = (file_exists($path)) ? !is_writable($path) : !is_writable(JPATH_CONFIGURATION . '/'); @@ -33,32 +32,36 @@ public static function stepbar() $tabs = array(); $tabs[] = 'site'; $tabs[] = 'database'; + if ($useftp) { $tabs[] = 'ftp'; } + $tabs[] = 'summary'; $html = array(); $html[] = ''; + return implode('', $html); } /** - * Method to generate the side bar + * Method to generate the side bar. * - * @return string Markup for the side bar + * @return string Markup for the side bar. * * @since 3.1 */ public static function stepbarlanguages() { - $tabs = array(); $tabs[] = 'languages'; $tabs[] = 'defaultlanguage'; @@ -66,22 +69,24 @@ public static function stepbarlanguages() $html = array(); $html[] = ''; return implode('', $html); } /** - * Method to generate the navigation tab + * Method to generate the navigation tab. * - * @param string $id The container ID - * @param array $tabs The navigation tabs + * @param string $id The container ID. + * @param array $tabs The navigation tabs. * - * @return string Markup for the tab + * @return string Markup for the tab. * * @since 3.1 */ @@ -109,12 +114,12 @@ private static function getTab($id, $tabs) } /** - * Method to determine the tab (step) number + * Method to determine the tab (step) number. * - * @param string $id The container ID - * @param array $tabs The navigation tabs + * @param string $id The container ID. + * @param array $tabs The navigation tabs. * - * @return integer Tab number in navigation sequence + * @return integer Tab number in navigation sequence. * * @since 3.1 */ diff --git a/installation/language/sk-SK/sk-SK.ini b/installation/language/sk-SK/sk-SK.ini index c31d5def0a893..036e7985862ca 100644 --- a/installation/language/sk-SK/sk-SK.ini +++ b/installation/language/sk-SK/sk-SK.ini @@ -133,8 +133,8 @@ INSTL_LANGUAGES_COLUMN_HEADER_LANGUAGE="Jazyk" INSTL_LANGUAGES_COLUMN_HEADER_VERSION="Verzia" INSTL_LANGUAGES_DESC="Rozhranie systému Joomla je dostupné v množstve jazykov. Vyberte si požadované jazyky kliknutím na zaškrtávacie polia a nainštalujte ich kliknutím na tlačidlo Ďalej.
    Pozn.: táto operácia zaberie približne 10 sekúnd na stiahnutie a inštaláciu každého z jazykov. Prosím, nevyberajte viac než 3 jazyky pre predídenie 'zamrznutiu'." INSTL_LANGUAGES_MESSAGE_PLEASE_WAIT="Dokončenie tejto operácie zaberie približne 10 sekúnd na jeden jazyk.
    Prosím, počkajte kým sa jazyky stiahnu a nainštalujú..." -INSTL_LANGUAGES_MORE_LANGUAGES="Ak chcete nainštalovať viac jazykov, kliknite na tlačidlo 'Predchádzajúci'." -INSTL_LANGUAGES_NO_LANGUAGE_SELECTED="Nebol nainštalovaný žiadny jazyk. Ak potrebujete nainštalovať viac jazykov, kliknite na tlačidlo 'Predchádzajúci' a zo zoznamu vyberte požadované jazyky." +INSTL_LANGUAGES_MORE_LANGUAGES="Ak chcete nainštalovať viac jazykov, kliknite na tlačidlo 'Späť'." +INSTL_LANGUAGES_NO_LANGUAGE_SELECTED="Nebol nainštalovaný žiadny jazyk. Ak potrebujete nainštalovať viac jazykov, kliknite na tlačidlo 'Späť' a zo zoznamu vyberte požadované jazyky." INSTL_LANGUAGES_WARNING_NO_INTERNET="Joomla! sa nemôže spojiť so serverom s jazykovými balíčkami. Dokončite, prosím, proces inštalácie." INSTL_LANGUAGES_WARNING_NO_INTERNET2="Pozn.: Možnosť pridať ďalšie jazyky máte aj neskôr v správcovskom rozhraní Joomla!" INSTL_LANGUAGES_WARNING_BACK_BUTTON="Späť k poslednému kroku inštalácie" diff --git a/installation/model/configuration.php b/installation/model/configuration.php index 83cbbf5f63d88..577688f322c4b 100644 --- a/installation/model/configuration.php +++ b/installation/model/configuration.php @@ -56,12 +56,12 @@ public function setup($options) * * @since 3.1 */ - function _createConfiguration($options) + public function _createConfiguration($options) { // Create a new registry to build the configuration options. $registry = new JRegistry; - /* Site Settings */ + // Site settings. $registry->set('offline', $options->site_offline); $registry->set('offline_message', JText::_('INSTL_STD_OFFLINE_MSG')); $registry->set('display_offline_message', 1); @@ -72,11 +72,11 @@ function _createConfiguration($options) $registry->set('list_limit', 20); $registry->set('access', 1); - /* Debug Settings */ + // Debug settings. $registry->set('debug', 0); $registry->set('debug_lang', 0); - /* Database Settings */ + // Database settings. $registry->set('dbtype', $options->db_type); $registry->set('host', $options->db_host); $registry->set('user', $options->db_user); @@ -84,7 +84,7 @@ function _createConfiguration($options) $registry->set('db', $options->db_name); $registry->set('dbprefix', $options->db_prefix); - /* Server Settings */ + // Server settings. $registry->set('live_site', ''); $registry->set('secret', JUserHelper::genRandomPassword(16)); $registry->set('gzip', 0); @@ -97,10 +97,10 @@ function _createConfiguration($options) $registry->set('ftp_root', (isset($options->ftp_save) && $options->ftp_save && isset($options->ftp_root)) ? $options->ftp_root : ''); $registry->set('ftp_enable', isset($options->ftp_host) ? $options->ftp_enable : ''); - /* Locale Settings */ + // Locale settings. $registry->set('offset', 'UTC'); - /* Mail Settings */ + // Mail settings. $registry->set('mailonline', 1); $registry->set('mailer', 'mail'); $registry->set('mailfrom', $options->admin_email); @@ -113,12 +113,12 @@ function _createConfiguration($options) $registry->set('smtpsecure', 'none'); $registry->set('smtpport', '25'); - /* Cache Settings */ + // Cache settings. $registry->set('caching', 0); $registry->set('cache_handler', 'file'); $registry->set('cachetime', 15); - /* Meta Settings */ + // Meta settings. $registry->set('MetaDesc', $options->site_metadesc); $registry->set('MetaKeys', ''); $registry->set('MetaTitle', 1); @@ -126,18 +126,18 @@ function _createConfiguration($options) $registry->set('MetaVersion', 0); $registry->set('robots', ''); - /* SEO Settings */ + // SEO settings. $registry->set('sef', 1); $registry->set('sef_rewrite', 0); $registry->set('sef_suffix', 0); $registry->set('unicodeslugs', 0); - /* Feed Settings */ + // Feed settings. $registry->set('feed_limit', 10); $registry->set('log_path', JPATH_ROOT . '/logs'); $registry->set('tmp_path', JPATH_ROOT . '/tmp'); - /* Session Setting */ + // Session setting. $registry->set('lifetime', 15); $registry->set('session_handler', 'database'); @@ -159,7 +159,7 @@ function _createConfiguration($options) /* * If the file exists but isn't writable OR if the file doesn't exist and the parent directory - * is not writable we need to use FTP + * is not writable we need to use FTP. */ $useFTP = false; @@ -168,13 +168,13 @@ function _createConfiguration($options) $useFTP = true; } - // Check for safe mode + // Check for safe mode. if (ini_get('safe_mode')) { $useFTP = true; } - // Enable/Disable override + // Enable/Disable override. if (!isset($options->ftpEnable) || ($options->ftpEnable != 1)) { $useFTP = false; @@ -182,14 +182,14 @@ function _createConfiguration($options) if ($useFTP == true) { - // Connect the FTP client + // Connect the FTP client. $ftp = JClientFtp::getInstance($options->ftp_host, $options->ftp_port); $ftp->login($options->ftp_user, $options->ftp_pass); - // Translate path for the FTP account + // Translate path for the FTP account. $file = JPath::clean(str_replace(JPATH_CONFIGURATION, $options->ftp_root, $path), '/'); - // Use FTP write buffer to file + // Use FTP write buffer to file. if (!$ftp->write($file, $buffer)) { // Set the config string to the session. @@ -219,11 +219,11 @@ function _createConfiguration($options) } /** - * Method to create the root user for the site + * Method to create the root user for the site. * - * @param object $options The session options + * @param object $options The session options. * - * @return boolean True on success + * @return boolean True on success. * * @since 3.1 */ @@ -236,7 +236,14 @@ private function _createRootUser($options) // Get a database object. try { - $db = InstallationHelperDatabase::getDBO($options->db_type, $options->db_host, $options->db_user, $options->db_pass, $options->db_name, $options->db_prefix); + $db = InstallationHelperDatabase::getDBO( + $options->db_type, + $options->db_host, + $options->db_user, + $options->db_pass, + $options->db_name, + $options->db_prefix + ); } catch (RuntimeException $e) { @@ -247,18 +254,18 @@ private function _createRootUser($options) $cryptpass = JUserHelper::hashPassword($options->admin_password); - // Take the admin user id + // Take the admin user id. $userId = InstallationModelDatabase::getUserId(); - // We don't need the randUserId in the session any longer, let's remove it + // We don't need the randUserId in the session any longer, let's remove it. InstallationModelDatabase::resetRandUserId(); - // Create the admin user + // Create the admin user. date_default_timezone_set('UTC'); $installdate = date('Y-m-d H:i:s'); $nullDate = $db->getNullDate(); - // Sqlsrv change + // Sqlsrv change. $query = $db->getQuery(true) ->select($db->quoteName('id')) ->from($db->quoteName('#__users')) @@ -284,20 +291,27 @@ private function _createRootUser($options) } else { - $columns = array($db->quoteName('id'), $db->quoteName('name'), $db->quoteName('username'), - $db->quoteName('email'), $db->quoteName('password'), - $db->quoteName('block'), - $db->quoteName('sendEmail'), $db->quoteName('registerDate'), - $db->quoteName('lastvisitDate'), $db->quoteName('activation'), $db->quoteName('params')); + $columns = array( + $db->quoteName('id'), $db->quoteName('name'), + $db->quoteName('username'), + $db->quoteName('email'), + $db->quoteName('password'), + $db->quoteName('block'), + $db->quoteName('sendEmail'), + $db->quoteName('registerDate'), + $db->quoteName('lastvisitDate'), + $db->quoteName('activation'), + $db->quoteName('params') + ); $query->clear() ->insert('#__users', true) ->columns($columns) ->values( - $db->quote($userId) . ', ' . $db->quote('Super User') . ', ' . $db->quote(trim($options->admin_user)) . ', ' . - $db->quote($options->admin_email) . ', ' . $db->quote($cryptpass) . ', ' . - $db->quote('0') . ', ' . $db->quote('1') . ', ' . $db->quote($installdate) . ', ' . $db->quote($nullDate) . ', ' . - $db->quote('0') . ', ' . $db->quote('') - ); + $db->quote($userId) . ', ' . $db->quote('Super User') . ', ' . $db->quote(trim($options->admin_user)) . ', ' . + $db->quote($options->admin_email) . ', ' . $db->quote($cryptpass) . ', ' . + $db->quote('0') . ', ' . $db->quote('1') . ', ' . $db->quote($installdate) . ', ' . $db->quote($nullDate) . ', ' . + $db->quote('0') . ', ' . $db->quote('') + ); } $db->setQuery($query); @@ -309,6 +323,7 @@ private function _createRootUser($options) catch (RuntimeException $e) { $app->enqueueMessage($e->getMessage(), 'notice'); + return false; } @@ -344,6 +359,7 @@ private function _createRootUser($options) catch (RuntimeException $e) { $app->enqueueMessage($e->getMessage(), 'notice'); + return false; } diff --git a/installation/model/database.php b/installation/model/database.php index da6d6be24ee87..34080e29b3da8 100644 --- a/installation/model/database.php +++ b/installation/model/database.php @@ -18,7 +18,7 @@ class InstallationModelDatabase extends JModelBase { /** - * The generated user ID + * The generated user ID. * * @var integer * @since 3.1 @@ -26,9 +26,9 @@ class InstallationModelDatabase extends JModelBase protected static $userId = 0; /** - * Generates the user ID + * Generates the user ID. * - * @return integer The user ID + * @return integer The user ID. * * @since 3.1 */ @@ -39,7 +39,7 @@ protected static function generateRandUserId() if (empty($randUserId)) { - // Create the ID for the root user only once and store in session + // Create the ID for the root user only once and store in session. $randUserId = mt_rand(1, 1000); $session->set('randUserId', $randUserId); } @@ -48,7 +48,7 @@ protected static function generateRandUserId() } /** - * Resets the user ID + * Resets the user ID. * * @return void * @@ -62,9 +62,9 @@ public static function resetRandUserId() } /** - * Retrieves the default user ID and sets it if necessary + * Retrieves the default user ID and sets it if necessary. * - * @return integer The user ID + * @return integer The user ID. * * @since 3.1 */ @@ -79,24 +79,24 @@ public static function getUserId() } /** - * Method to initialise the database + * Method to initialise the database. * - * @param array $options The options to use for configuration + * @param array $options The options to use for configuration. * - * @return boolean True on success + * @return boolean True on success. * * @since 3.1 */ public function initialise($options) { - // Get the application + // Get the application. /* @var InstallationApplicationWeb $app */ $app = JFactory::getApplication(); // Get the options as a object for easier handling. $options = JArrayHelper::toObject($options); - // Load the back-end language files so that the DB error messages work + // Load the back-end language files so that the DB error messages work. $lang = JFactory::getLanguage(); $currentLang = $lang->getTag(); @@ -105,7 +105,7 @@ public function initialise($options) { $lang->load('joomla', JPATH_ADMINISTRATOR, $currentLang, true); } - // Pre-load en-GB in case the chosen language files do not exist + // Pre-load en-GB in case the chosen language files do not exist. else { $lang->load('joomla', JPATH_ADMINISTRATOR, 'en-GB', true); @@ -115,6 +115,7 @@ public function initialise($options) if (empty($options->db_type)) { $app->enqueueMessage(JText::_('INSTL_DATABASE_INVALID_TYPE'), 'notice'); + return false; } @@ -122,6 +123,7 @@ public function initialise($options) if (empty($options->db_host) || empty($options->db_user)) { $app->enqueueMessage(JText::_('INSTL_DATABASE_INVALID_DB_DETAILS'), 'notice'); + return false; } @@ -129,6 +131,7 @@ public function initialise($options) if (empty($options->db_name)) { $app->enqueueMessage(JText::_('INSTL_DATABASE_EMPTY_NAME'), 'notice'); + return false; } @@ -136,6 +139,7 @@ public function initialise($options) if (!preg_match('#^[a-zA-Z]+[a-zA-Z0-9_]*$#', $options->db_prefix)) { $app->enqueueMessage(JText::_('INSTL_DATABASE_PREFIX_MSG'), 'notice'); + return false; } @@ -143,6 +147,7 @@ public function initialise($options) if (strlen($options->db_prefix) > 15) { $app->enqueueMessage(JText::_('INSTL_DATABASE_FIX_TOO_LONG'), 'notice'); + return false; } @@ -150,6 +155,7 @@ public function initialise($options) if (strlen($options->db_name) > 64) { $app->enqueueMessage(JText::_('INSTL_DATABASE_NAME_TOO_LONG'), 'notice'); + return false; } @@ -163,6 +169,7 @@ public function initialise($options) catch (RuntimeException $e) { $app->enqueueMessage(JText::sprintf('INSTL_DATABASE_COULD_NOT_CONNECT', $e->getMessage()), 'notice'); + return false; } } @@ -178,17 +185,18 @@ public function initialise($options) */ public function createDatabase($options) { - // Get the application + // Get the application. /* @var InstallationApplicationWeb $app */ $app = JFactory::getApplication(); - // Disable autoselect database before it's created + // Disable autoselect database before it's created. $tmpSelect = true; if (isset($options['db_select'])) { $tmpSelect = $options['db_select']; } + $options['db_select'] = false; if (!$db = $this->initialise($options)) @@ -209,36 +217,41 @@ public function createDatabase($options) catch (RuntimeException $e) { $app->enqueueMessage(JText::sprintf('INSTL_DATABASE_COULD_NOT_CONNECT', $e->getMessage()), 'notice'); + return false; } if (!$db->isMinimumVersion()) { $app->enqueueMessage(JText::sprintf('INSTL_DATABASE_INVALID_' . strtoupper($type) . '_VERSION', $db_version), 'notice'); + return false; } if (($type == 'mysql') || ($type == 'mysqli')) { - // @internal MySQL versions pre 5.1.6 forbid . / or \ or NULL + // @internal MySQL versions pre 5.1.6 forbid . / or \ or NULL. if ((preg_match('#[\\\/\.\0]#', $options->db_name)) && (!version_compare($db_version, '5.1.6', '>='))) { $app->enqueueMessage(JText::sprintf('INSTL_DATABASE_INVALID_NAME', $db_version), 'notice'); + return false; } } - // @internal Check for spaces in beginning or end of name + // @internal Check for spaces in beginning or end of name. if (strlen(trim($options->db_name)) <> strlen($options->db_name)) { $app->enqueueMessage(JText::_('INSTL_DATABASE_NAME_INVALID_SPACES'), 'notice'); + return false; } - // @internal Check for asc(00) Null in name + // @internal Check for asc(00) Null in name. if (strpos($options->db_name, chr(00)) !== false) { $app->enqueueMessage(JText::_('INSTL_DATABASE_NAME_INVALID_CHAR'), 'notice'); + return false; } @@ -249,10 +262,10 @@ public function createDatabase($options) $db->execute(); } - // Get database's UTF support + // Get database's UTF support. $utfSupport = $db->hasUTFSupport(); - // Try to select the database + // Try to select the database. try { $db->select($options->db_name); @@ -267,13 +280,14 @@ public function createDatabase($options) else { $app->enqueueMessage(JText::sprintf('INSTL_DATABASE_ERROR_CREATE', $options->db_name), 'notice'); + return false; } } $options = (array) $options; - // Remove *_errors value + // Remove *_errors value. foreach ($options as $i => $option) { if (isset($i['1']) && $i['1'] == '*') @@ -282,9 +296,10 @@ public function createDatabase($options) break; } } + $options = array_merge(array('db_created' => 1), $options); - // Restore autoselect value after database creation + // Restore autoselect value after database creation. $options['db_select'] = $tmpSelect; $session = JFactory::getSession(); @@ -294,11 +309,11 @@ public function createDatabase($options) } /** - * Method to process the old database + * Method to process the old database. * - * @param array $options The options array + * @param array $options The options array. * - * @return boolean True on success + * @return boolean True on success. * * @since 3.1 */ @@ -343,17 +358,17 @@ public function handleOldDatabase($options) } /** - * Method to create the database tables + * Method to create the database tables. * - * @param array $options The options array + * @param array $options The options array. * - * @return boolean True on success + * @return boolean True on success. * * @since 3.1 */ public function createTables($options) { - // Get the application + // Get the application. /* @var InstallationApplicationWeb $app */ $app = JFactory::getApplication(); @@ -394,6 +409,7 @@ public function createTables($options) if (!is_file($schema)) { $app->enqueueMessage(JText::sprintf('INSTL_ERROR_DB', JText::_('INSTL_DATABASE_NO_SCHEMA')), 'notice'); + return false; } @@ -418,13 +434,16 @@ public function createTables($options) { $pathPart .= $type . '/'; } + $files = JFolder::files($pathPart, '\.sql$'); if (empty($files)) { $app->enqueueMessage(JText::_('INSTL_ERROR_INITIALISE_SCHEMA'), 'notice'); + return false; } + $version = ''; foreach ($files as $file) @@ -434,6 +453,7 @@ public function createTables($options) $version = JFile::stripExt($file); } } + $query = $db->getQuery(true) ->insert($db->quoteName('#__schemas')) ->columns( @@ -452,10 +472,11 @@ public function createTables($options) catch (RuntimeException $e) { $app->enqueueMessage($e->getMessage(), 'notice'); + return false; } - // Attempt to refresh manifest caches + // Attempt to refresh manifest caches. $query->clear() ->select('*') ->from('#__extensions'); @@ -481,11 +502,12 @@ public function createTables($options) if (!$installer->refreshManifestCache($extension->extension_id)) { $app->enqueueMessage(JText::sprintf('INSTL_DATABASE_COULD_NOT_REFRESH_MANIFEST_CACHE', $extension->name), 'notice'); + return false; } } - // Load the localise.sql for translating the data in joomla.sql + // Load the localise.sql for translating the data in joomla.sql. if ($type == 'mysqli' || $type == 'mysql') { $dblocalise = 'sql/mysql/localise.sql'; @@ -516,7 +538,7 @@ public function createTables($options) // Build the language parameters for the language manager. $params = array(); - // Set default administrator/site language to sample data values: + // Set default administrator/site language to sample data values. $params['administrator'] = 'en-GB'; $params['site'] = 'en-GB'; @@ -529,6 +551,7 @@ public function createTables($options) { $params['site'] = $options->language; } + $params = json_encode($params); // Update the language settings in the language manager. @@ -553,17 +576,17 @@ public function createTables($options) } /** - * Method to install the sample data + * Method to install the sample data. * - * @param array $options The options array + * @param array $options The options array. * - * @return boolean True on success + * @return boolean True on success. * * @since 3.1 */ public function installSampleData($options) { - // Get the application + // Get the application. /* @var InstallationApplicationWeb $app */ $app = JFactory::getApplication(); @@ -600,6 +623,7 @@ public function installSampleData($options) if (!file_exists($data)) { $app->enqueueMessage(JText::sprintf('INSTL_DATABASE_FILE_DOES_NOT_EXIST', $data), 'notice'); + return false; } elseif (!$this->populateDatabase($db, $data)) @@ -614,9 +638,9 @@ public function installSampleData($options) } /** - * Method to update the user id of the sample data content to the new rand user id + * Method to update the user id of the sample data content to the new rand user id. * - * @param JDatabaseDriver $db Database connector object $db* + * @param JDatabaseDriver $db Database connector object $db*. * * @return void * @@ -624,11 +648,11 @@ public function installSampleData($options) */ protected function postInstallSampleData($db) { - // Create the ID for the root user + // Create the ID for the root user. $userId = self::getUserId(); // Update all created_by field of the tables with the random user id - // categories (created_user_id), contact_details, content, newsfeeds, weblinks + // categories (created_user_id), contact_details, content, newsfeeds, weblinks. $updates_array = array( 'categories' => 'created_user_id', 'contact_details' => 'created_by', @@ -798,6 +822,7 @@ public function populateDatabase($db, $schema) if (!($buffer = file_get_contents($schema))) { $app->enqueueMessage($db->getErrorMsg(), 'notice'); + return false; } @@ -881,10 +906,10 @@ protected function _splitQueries($query) // Remove PostgreSQL comment lines. $query = preg_replace("/\n\--[^\n]*/", '', "\n" . $query); - // Find function + // Find function. $funct = explode('CREATE OR REPLACE FUNCTION', $query); - // Save sql before function and parse it + // Save sql before function and parse it. $query = $funct[0]; // Parse the schema file to break up queries. @@ -905,10 +930,12 @@ protected function _splitQueries($query) { $in_string = $query[$i]; } + if (isset ($buffer[1])) { $buffer[0] = $buffer[1]; } + $buffer[1] = $query[$i]; } @@ -918,7 +945,7 @@ protected function _splitQueries($query) $queries[] = $query; } - // Add function part as is + // Add function part as is. for ($f = 1; $f < count($funct); $f++) { $queries[] = 'CREATE OR REPLACE FUNCTION ' . $funct[$f]; diff --git a/installation/model/fields/prefix.php b/installation/model/fields/prefix.php index d64ca11d7135d..872714f498b79 100644 --- a/installation/model/fields/prefix.php +++ b/installation/model/fields/prefix.php @@ -40,26 +40,27 @@ protected function getInput() $readonly = ((string) $this->element['readonly'] == 'true') ? ' readonly="readonly"' : ''; $disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : ''; - // Make sure somebody doesn't put in a too large prefix size value: + // Make sure somebody doesn't put in a too large prefix size value. if ($size > 10) { $size = 10; } - // If a prefix is already set, use it instead + // If a prefix is already set, use it instead. $session = JFactory::getSession()->get('setup.options', array()); + if (empty($session['db_prefix'])) { - // Create the random prefix: + // Create the random prefix. $prefix = ''; $chars = range('a', 'z'); $numbers = range(0, 9); - // We want the fist character to be a random letter: + // We want the fist character to be a random letter. shuffle($chars); $prefix .= $chars[0]; - // Next we combine the numbers and characters to get the other characters: + // Next we combine the numbers and characters to get the other characters. $symbols = array_merge($numbers, $chars); shuffle($symbols); @@ -68,7 +69,7 @@ protected function getInput() $prefix .= $symbols[$i]; } - // Add in the underscore: + // Add in the underscore. $prefix .= '_'; } else diff --git a/installation/model/ftp.php b/installation/model/ftp.php index d339fe4db0d21..a64f302fa4f1c 100644 --- a/installation/model/ftp.php +++ b/installation/model/ftp.php @@ -29,7 +29,7 @@ class InstallationModelFtp extends JModelBase */ public function detectFtpRoot($options) { - // Get the application + // Get the application. /* @var InstallationApplicationWeb $app */ $app = JFactory::getApplication(); @@ -44,29 +44,36 @@ public function detectFtpRoot($options) if (!$ftp->isConnected()) { $app->enqueueMessage($options->get('ftp_host') . ':' . $options->get('ftp_port') . ' ' . JText::_('INSTL_FTP_NOCONNECT'), 'error'); + return false; } if (!$ftp->login($options->get('ftp_user'), $options->get('ftp_pass'))) { $app->enqueueMessage(JText::_('INSTL_FTP_NOLOGIN'), 'error'); + return false; } // Get the current working directory from the FTP server. $cwd = $ftp->pwd(); + if ($cwd === false) { $app->enqueueMessage(JText::_('INSTL_FTP_NOPWD'), 'error'); + return false; } + $cwd = rtrim($cwd, '/'); // Get a list of folders in the current working directory. $cwdFolders = $ftp->listDetails(null, 'folders'); + if ($cwdFolders === false || count($cwdFolders) == 0) { $app->enqueueMessage(JText::_('INSTL_FTP_NODIRECTORYLISTING'), 'error'); + return false; } @@ -79,6 +86,7 @@ public function detectFtpRoot($options) // Check to see if Joomla is installed at the FTP current working directory. $paths = array(); $known = array('administrator', 'components', 'installation', 'language', 'libraries', 'plugins'); + if (count(array_diff($known, $cwdFolders)) == 0) { $paths[] = $cwd . '/'; @@ -87,9 +95,11 @@ public function detectFtpRoot($options) // Search through the segments of JPATH_SITE looking for root possibilities. $parts = explode(DIRECTORY_SEPARATOR, JPATH_SITE); $tmp = ''; + for ($i = count($parts) - 1; $i >= 0; $i--) { $tmp = '/' . $parts[$i] . $tmp; + if (in_array($parts[$i], $cwdFolders)) { $paths[] = $cwd . $tmp; @@ -99,11 +109,13 @@ public function detectFtpRoot($options) // Check all possible paths for the real Joomla installation by comparing version files. $rootPath = false; $checkValue = file_get_contents(JPATH_LIBRARIES . '/cms/version/version.php'); + foreach ($paths as $tmp) { $filePath = rtrim($tmp, '/') . '/libraries/cms/version/version.php'; $buffer = null; @ $ftp->read($filePath, $buffer); + if ($buffer == $checkValue) { $rootPath = $tmp; @@ -118,6 +130,7 @@ public function detectFtpRoot($options) if ($rootPath === false) { $app->enqueueMessage(JText::_('INSTL_FTP_UNABLE_DETECT_ROOT_FOLDER'), 'error'); + return false; } @@ -135,7 +148,7 @@ public function detectFtpRoot($options) */ public function verifyFtpSettings($options) { - // Get the application + // Get the application. /* @var InstallationApplicationWeb $app */ $app = JFactory::getApplication(); @@ -149,12 +162,15 @@ public function verifyFtpSettings($options) if (!$ftp->isConnected()) { $app->enqueueMessage(JText::_('INSTL_FTP_NOCONNECT'), 'error'); + return false; } + if (!$ftp->login($options->get('ftp_user'), $options->get('ftp_pass'))) { $ftp->quit(); $app->enqueueMessage(JText::_('INSTL_FTP_NOLOGIN'), 'error'); + return false; } @@ -162,106 +178,122 @@ public function verifyFtpSettings($options) // we want to test with the same value as well. $root = rtrim($options->get('ftp_root'), '/'); - // Verify PWD function + // Verify PWD function. if ($ftp->pwd() === false) { $ftp->quit(); $app->enqueueMessage(JText::_('INSTL_FTP_NOPWD'), 'error'); + return false; } - // Verify root path exists + // Verify root path exists. if (!$ftp->chdir($root)) { $ftp->quit(); $app->enqueueMessage(JText::_('INSTL_FTP_NOROOT'), 'error'); + return false; } - // Verify NLST function + // Verify NLST function. if (($rootList = $ftp->listNames()) === false) { $ftp->quit(); $app->enqueueMessage(JText::_('INSTL_FTP_NONLST'), 'error'); + return false; } - // Verify LIST function + // Verify LIST function. if ($ftp->listDetails() === false) { $ftp->quit(); $app->enqueueMessage(JText::_('INSTL_FTP_NOLIST'), 'error'); + return false; } - // Verify SYST function + // Verify SYST function. if ($ftp->syst() === false) { $ftp->quit(); $app->enqueueMessage(JText::_('INSTL_FTP_NOSYST'), 'error'); + return false; } - // Verify valid root path, part one + // Verify valid root path, part one. $checkList = array('robots.txt', 'index.php'); + if (count(array_diff($checkList, $rootList))) { $ftp->quit(); $app->enqueueMessage(JText::_('INSTL_FTP_INVALIDROOT'), 'error'); + return false; } // Verify RETR function $buffer = null; + if ($ftp->read($root . '/libraries/cms/version/version.php', $buffer) === false) { $ftp->quit(); $app->enqueueMessage(JText::_('INSTL_FTP_NORETR'), 'error'); + return false; } - // Verify valid root path, part two + // Verify valid root path, part two. $checkValue = file_get_contents(JPATH_ROOT . '/libraries/cms/version/version.php'); + if ($buffer !== $checkValue) { $ftp->quit(); $app->enqueueMessage(JText::_('INSTL_FTP_INVALIDROOT'), 'error'); + return false; } - // Verify STOR function + // Verify STOR function. if ($ftp->create($root . '/ftp_testfile') === false) { $ftp->quit(); $app->enqueueMessage(JText::_('INSTL_FTP_NOSTOR'), 'error'); + return false; } - // Verify DELE function + // Verify DELE function. if ($ftp->delete($root . '/ftp_testfile') === false) { $ftp->quit(); $app->enqueueMessage(JText::_('INSTL_FTP_NODELE'), 'error'); + return false; } - // Verify MKD function + // Verify MKD function. if ($ftp->mkdir($root . '/ftp_testdir') === false) { $ftp->quit(); $app->enqueueMessage(JText::_('INSTL_FTP_NOMKD'), 'error'); + return false; } - // Verify RMD function + // Verify RMD function. if ($ftp->delete($root . '/ftp_testdir') === false) { $ftp->quit(); $app->enqueueMessage(JText::_('INSTL_FTP_NORMD'), 'error'); + return false; } $ftp->quit(); + return true; } } diff --git a/installation/model/languages.php b/installation/model/languages.php index 64fec19046577..c83c01cf2d4c5 100644 --- a/installation/model/languages.php +++ b/installation/model/languages.php @@ -22,31 +22,31 @@ class InstallationModelLanguages extends JModelBase { /** - * @var object Client object + * @var object Client object. * @since 3.1 */ protected $client = null; /** - * @var array Languages description + * @var array Languages description. * @since 3.1 */ protected $data = null; /** - * @var string Language path + * @var string Language path. * @since 3.1 */ protected $path = null; /** - * @var integer Total number of languages installed + * @var integer Total number of languages installed. * @since 3.1 */ protected $langlist = null; /** - * @var Admin Id, author of all generated content + * @var Admin Id, author of all generated content. * @since 3.1 */ protected $adminId = null; @@ -58,7 +58,7 @@ class InstallationModelLanguages extends JModelBase */ public function __construct() { - // Overrides application config and set the configuration.php file so tokens and database works + // Overrides application config and set the configuration.php file so tokens and database works. JFactory::$config = null; JFactory::getConfig(JPATH_SITE . '/configuration.php'); JFactory::$session = null; @@ -67,9 +67,9 @@ public function __construct() } /** - * Generate a list of language choices to install in the Joomla CMS + * Generate a list of language choices to install in the Joomla CMS. * - * @return boolean True if successful + * @return boolean True if successful. * * @since 3.1 */ @@ -79,14 +79,14 @@ public function getItems() /* * The following function uses extension_id 600, that is the English language extension id. - * In #__update_sites_extensions you should have 600 linked to the Accredited Translations Repo + * In #__update_sites_extensions you should have 600 linked to the Accredited Translations Repo. */ $updater->findUpdates(array(600), 0); $db = JFactory::getDbo(); $query = $db->getQuery(true); - // Select the required fields from the updates table + // Select the required fields from the updates table. $query->select('update_id, name, version') ->from('#__updates') ->order('name'); @@ -105,7 +105,7 @@ public function getItems() /** * Method that installs in Joomla! the selected languages in the Languages View of the installer. * - * @param array $lids List of the update_id value of the languages to install + * @param array $lids List of the update_id value of the languages to install. * * @return boolean True if successful */ @@ -115,51 +115,51 @@ public function install($lids) $app = JFactory::getApplication(); $installer = JInstaller::getInstance(); - // Loop through every selected language + // Loop through every selected language. foreach ($lids as $id) { - // Loads the update database object that represents the language + // Loads the update database object that represents the language. $language = JTable::getInstance('update'); $language->load($id); - // Get the url to the XML manifest file of the selected language + // Get the url to the XML manifest file of the selected language. $remote_manifest = $this->getLanguageManifest($id); if (!$remote_manifest) { - // Could not find the url, the information in the update server may be corrupt + // Could not find the url, the information in the update server may be corrupt. $message = JText::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_INSTALL_LANGUAGE', $language->name); $message .= ' ' . JText::_('INSTL_DEFAULTLANGUAGE_TRY_LATER'); $app->enqueueMessage($message); continue; } - // Based on the language XML manifest get the url of the package to download + // Based on the language XML manifest get the url of the package to download. $package_url = $this->getPackageUrl($remote_manifest); if (!$package_url) { - // Could not find the url , maybe the url is wrong in the update server, or there is not internet access + // Could not find the url , maybe the url is wrong in the update server, or there is not internet access. $message = JText::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_INSTALL_LANGUAGE', $language->name); $message .= ' ' . JText::_('INSTL_DEFAULTLANGUAGE_TRY_LATER'); $app->enqueueMessage($message); continue; } - // Download the package to the tmp folder + // Download the package to the tmp folder. $package = $this->downloadPackage($package_url); - // Install the package + // Install the package. if (!$installer->install($package['dir'])) { - // There was an error installing the package + // There was an error installing the package. $message = JText::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_INSTALL_LANGUAGE', $language->name); $message .= ' ' . JText::_('INSTL_DEFAULTLANGUAGE_TRY_LATER'); $app->enqueueMessage($message); continue; } - // Cleanup the install files in tmp folder + // Cleanup the install files in tmp folder. if (!is_file($package['packagefile'])) { $config = JFactory::getConfig(); @@ -168,7 +168,7 @@ public function install($lids) JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']); - // Delete the installed language from the list + // Delete the installed language from the list. $language->delete($id); } @@ -178,7 +178,7 @@ public function install($lids) /** * Gets the manifest file of a selected language from a the language list in a update server. * - * @param integer $uid The id of the language in the #__updates table + * @param integer $uid The id of the language in the #__updates table. * * @return string * @@ -196,7 +196,7 @@ protected function getLanguageManifest($uid) /** * Finds the url of the package to download. * - * @param string $remote_manifest Url to the manifest XML file of the remote package + * @param string $remote_manifest Url to the manifest XML file of the remote package. * * @return string|bool * @@ -214,15 +214,15 @@ protected function getPackageUrl($remote_manifest) /** * Download a language package from a URL and unpack it in the tmp folder. * - * @param string $url Url of the package + * @param string $url Url of the package. * - * @return array|bool Package details or false on failure + * @return array|bool Package details or false on failure. * * @since 3.1 */ protected function downloadPackage($url) { - // Download the package from the given URL + // Download the package from the given URL. $p_file = JInstallerHelper::downloadPackage($url); // Was the package downloaded? @@ -236,14 +236,14 @@ protected function downloadPackage($url) $config = JFactory::getConfig(); $tmp_dest = $config->get('tmp_path'); - // Unpack the downloaded package file + // Unpack the downloaded package file. $package = JInstallerHelper::unpack($tmp_dest . '/' . $p_file); return $package; } /** - * Get Languages item data for the Administrator + * Get Languages item data for the Administrator. * * @return array * @@ -255,9 +255,9 @@ public function getInstalledlangsAdministrator() } /** - * Get Languages item data for the Frontend + * Get Languages item data for the Frontend. * - * @return array List of installed languages in the frontend application + * @return array List of installed languages in the frontend application. * * @since 3.1 */ @@ -267,9 +267,9 @@ public function getInstalledlangsFrontend() } /** - * Get Languages item data + * Get Languages item data. * - * @param string $cms_client Name of the cms client + * @param string $cms_client Name of the cms client. * * @return array * @@ -277,12 +277,12 @@ public function getInstalledlangsFrontend() */ protected function getInstalledlangs($cms_client = 'administrator') { - // Get information + // Get information. $path = $this->getPath(); $client = $this->getClient($cms_client); $langlist = $this->getLanguageList($client->id); - // Compute all the languages + // Compute all the languages. $data = array(); foreach ($langlist as $lang) @@ -302,7 +302,7 @@ protected function getInstalledlangs($cms_client = 'administrator') $row->$key = $value; } - // If current then set published + // If current then set published. $params = JComponentHelper::getParams('com_languages'); if ($params->get($client->name, 'en-GB') == $row->language) @@ -326,9 +326,9 @@ protected function getInstalledlangs($cms_client = 'administrator') /** * Get installed languages data. * - * @param integer $client_id The client ID to retrieve data for + * @param integer $client_id The client ID to retrieve data for. * - * @return object The language data + * @return object The language data. * * @since 3.1 */ @@ -356,8 +356,8 @@ protected function getLanguageList($client_id = 1) /** * Compare two languages in order to sort them. * - * @param object $lang1 The first language - * @param object $lang2 The second language + * @param object $lang1 The first language. + * @param object $lang2 The second language. * * @return integer * @@ -371,7 +371,7 @@ protected function compareLanguages($lang1, $lang2) /** * Get the languages folder path. * - * @return string The path to the languages folders + * @return string The path to the languages folders. * * @since 3.1 */ @@ -389,7 +389,7 @@ protected function getPath() /** * Get the client object of Administrator or Frontend. * - * @param string $client Name of the client object + * @param string $client Name of the client object. * * @return object * @@ -405,8 +405,8 @@ protected function getClient($client = 'administrator') /** * Set the default language. * - * @param string $language The language to be set as default - * @param string $cms_client The name of the CMS client + * @param string $language The language to be set as default. + * @param string $cms_client The name of the CMS client. * * @return boolean * @@ -414,7 +414,7 @@ protected function getClient($client = 'administrator') */ public function setDefault($language, $cms_client = 'administrator') { - // Get the application + // Get the application. /* @var InstallationApplicationWeb $app */ $app = JFactory::getApplication(); @@ -436,7 +436,7 @@ public function setDefault($language, $cms_client = 'administrator') $table->params = (string) $params; - // Pre-save checks + // Pre-save checks. if (!$table->check()) { $app->enqueueMessage($table->getError(), 'warning'); @@ -444,7 +444,7 @@ public function setDefault($language, $cms_client = 'administrator') return false; } - // Save the changes + // Save the changes. if (!$table->store()) { $app->enqueueMessage($table->getError(), 'warning'); @@ -473,7 +473,7 @@ public function getOptions() /** * Get the model form. * - * @param string $view The view being processed + * @param string $view The view being processed. * * @return mixed JForm object on success, false on failure. * @@ -518,9 +518,9 @@ public function getForm($view = null) } /** - * Enable a Joomla plugin + * Enable a Joomla plugin. * - * @param string $pluginName The name of plugin + * @param string $pluginName The name of plugin. * * @return boolean * @@ -546,7 +546,7 @@ public function enablePlugin($pluginName) return false; } - // Store language filter plugin parameters + // Store language filter plugin parameters. if ($pluginName == 'plg_system_languagefilter') { $params = '{' @@ -626,9 +626,9 @@ public function addModuleLanguageSwitcher() } /** - * Add a Module in Module menus + * Add a Module in Module menus. * - * @param integer $moduleId The Id of module + * @param integer $moduleId The Id of module. * * @return boolean * @@ -640,7 +640,7 @@ public function addModuleInModuleMenu($moduleId) $db = JFactory::getDbo(); $query = $db->getQuery(true); - // Add Module in Module menus + // Add Module in Module menus. $query->clear() ->insert('#__modules_menu') ->columns(array($db->quoteName('moduleid'), $db->quoteName('menuid'))) @@ -660,15 +660,15 @@ public function addModuleInModuleMenu($moduleId) } /** - * Gets a unique language SEF string + * Gets a unique language SEF string. * * This function checks other existing language with the same code, if they exist provides a unique SEF name. * For instance: en-GB, en-US and en-AU will share the same SEF code by default: www.mywebsite.com/en/ * To avoid this conflict, this function creates an specific SEF in case of existing conflict: * For example: www.mywebsite.com/en-au/ * - * @param stdClass $itemLanguage Language Object - * @param stdClass[] $siteLanguages All Language Objects + * @param stdClass $itemLanguage Language Object. + * @param stdClass[] $siteLanguages All Language Objects. * * @return string * @@ -680,6 +680,7 @@ public function getSefString($itemLanguage, $siteLanguages) $prefixToFind = $langs[0]; $numberPrefixesFound = 0; + foreach ($siteLanguages as $siteLang) { $langs = explode('-', $siteLang->language); @@ -695,14 +696,15 @@ public function getSefString($itemLanguage, $siteLanguages) { return $prefixToFind; } + return strtolower($itemLanguage->language); } /** - * Add a Content Language + * Add a Content Language. * - * @param stdClass $itemLanguage Language Object - * @param string $sefLangString String to use for SEF so it doesn't conflict + * @param stdClass $itemLanguage Language Object. + * @param string $sefLangString String to use for SEF so it doesn't conflict. * * @return boolean * @@ -714,11 +716,11 @@ public function addLanguage($itemLanguage, $sefLangString) $flag = strtolower(str_replace('-', '_', $itemLanguage->language)); - // Load the native language name + // Load the native language name. $installationLocalisedIni = new JLanguage($itemLanguage->language, false); $nativeLanguageName = $installationLocalisedIni->_('INSTL_DEFAULTLANGUAGE_NATIVE_LANGUAGE_NAME'); - // If the local name do not exist in the translation file we use the international standard name + // If the local name do not exist in the translation file we use the international standard name. if ($nativeLanguageName == 'INSTL_DEFAULTLANGUAGE_NATIVE_LANGUAGE_NAME') { $nativeLanguageName = $itemLanguage->name; @@ -763,9 +765,9 @@ public function addLanguage($itemLanguage, $sefLangString) } /** - * Add Menu Group + * Add Menu Group. * - * @param stdClass $itemLanguage Language Object + * @param stdClass $itemLanguage Language Object. * * @return boolean * @@ -773,11 +775,11 @@ public function addLanguage($itemLanguage, $sefLangString) */ public function addMenuGroup($itemLanguage) { - // Add menus + // Add menus. JLoader::registerPrefix('J', JPATH_PLATFORM . '/legacy'); JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_menus/tables/'); - // Add Menu Group + // Add Menu Group. $tableMenu = JTable::getInstance('Type', 'JTableMenu'); $menuData = array( @@ -811,7 +813,7 @@ public function addMenuGroup($itemLanguage) /** * Add Menu Item. * - * @param stdClass $itemLanguage Language Object + * @param stdClass $itemLanguage Language Object. * * @return boolean * @@ -819,7 +821,7 @@ public function addMenuGroup($itemLanguage) */ public function addMenuItem($itemLanguage) { - // Add Menu Item + // Add Menu Item. $tableItem = JTable::getInstance('Menu', 'MenusTable'); $newlanguage = new JLanguage($itemLanguage->language, false); @@ -882,9 +884,9 @@ public function addMenuItem($itemLanguage) } /** - * Add Module Menu + * Add Module Menu. * - * @param stdClass $itemLanguage Language Object + * @param stdClass $itemLanguage Language Object. * * @return boolean * @@ -934,7 +936,7 @@ public function addModuleMenu($itemLanguage) } /** - * Disable Default Main Menu Module + * Disable Default Main Menu Module. * * @return boolean * @@ -946,7 +948,7 @@ public function disableModuleMainMenu() $db = JFactory::getDbo(); $query = $db->getQuery(true); - // Add Module in Module menus + // Add Module in Module menus. $query ->clear() ->update($db->quoteName('#__modules')) @@ -966,9 +968,9 @@ public function disableModuleMainMenu() } /** - * Enable a module + * Enable a module. * - * @param string $moduleName The Name of the module to activate + * @param string $moduleName The Name of the module to activate. * * @return boolean * @@ -996,11 +998,11 @@ public function enableModule($moduleName) } /** - * Method create a category for a specific language + * Method create a category for a specific language. * - * @param stdClass $itemLanguage Language Object + * @param stdClass $itemLanguage Language Object. * - * @return JTable Category Object + * @return JTable Category Object. * * @since 3.2 */ @@ -1010,7 +1012,7 @@ public function addCategory($itemLanguage) $newlanguage->load('joomla', JPATH_ADMINISTRATOR, $itemLanguage->language, true); $title = $newlanguage->_('JCATEGORY'); - // Initialize a new category + // Initialize a new category. $category = JTable::getInstance('Category'); $category->extension = 'com_content'; $category->title = $title . ' (' . strtolower($itemLanguage->language) . ')'; @@ -1022,32 +1024,32 @@ public function addCategory($itemLanguage) $category->created_time = JFactory::getDate()->toSql(); $category->language = $itemLanguage->language; - // Set the location in the tree + // Set the location in the tree. $category->setLocation(1, 'last-child'); - // Check to make sure our data is valid + // Check to make sure our data is valid. if (!$category->check()) { return false; } - // Store the category + // Store the category. if (!$category->store(true)) { return false; } - // Build the path for our category + // Build the path for our category. $category->rebuildPath($category->id); return $category; } /** - * Create an article in a specific language + * Create an article in a specific language. * - * @param stdClass $itemLanguage Language Object - * @param int $categoryId The id of the category where we want to add the article + * @param stdClass $itemLanguage Language Object. + * @param int $categoryId The id of the category where we want to add the article. * * @return JTable Category Object * @@ -1083,19 +1085,19 @@ public function addArticle($itemLanguage, $categoryId) $article->language = $itemLanguage->language; $article->featured = 1; - // Check to make sure our data is valid + // Check to make sure our data is valid. if (!$article->check()) { return false; } - // Now store the category + // Now store the category. if (!$article->store(true)) { return false; } - // Get the new item ID + // Get the new item ID. $newId = $article->get('id'); $query = $db->getQuery(true) @@ -1115,7 +1117,7 @@ public function addArticle($itemLanguage, $categoryId) /** * Retrieve the admin user id. * - * @return int|bool One Administrator ID + * @return int|bool One Administrator ID. * * @since 3.2 */ @@ -1123,14 +1125,14 @@ private function getAdminId() { if ($this->adminId) { - // Return local cached admin ID + // Return local cached admin ID. return $this->adminId; } $db = JFactory::getDbo(); $query = $db->getQuery(true); - // Select the required fields from the updates table + // Select the required fields from the updates table. $query ->clear() ->select('u.id') diff --git a/installation/model/setup.php b/installation/model/setup.php index fd315b581883c..4ce4a088aa558 100644 --- a/installation/model/setup.php +++ b/installation/model/setup.php @@ -21,7 +21,7 @@ class InstallationModelSetup extends JModelBase /** * Get the current setup options from the session. * - * @return array An array of options from the session + * @return array An array of options from the session. * * @since 3.1 */ @@ -36,9 +36,9 @@ public function getOptions() /** * Store the current setup options in the session. * - * @param array $options The installation options + * @param array $options The installation options. * - * @return array An array of options from the session + * @return array An array of options from the session. * * @since 3.1 */ @@ -66,7 +66,7 @@ public function storeOptions($options) /** * Method to get the form. * - * @param string $view The view being processed + * @param string $view The view being processed. * * @return mixed JForm object on success, false on failure. * @@ -94,6 +94,7 @@ public function getForm($view = null) catch (Exception $e) { $app->enqueueMessage($e->getMessage(), 'error'); + return false; } @@ -110,11 +111,11 @@ public function getForm($view = null) } /** - * Method to check the form data + * Method to check the form data. * - * @param string $page The view being checked + * @param string $page The view being checked. * - * @return array Validated form data + * @return array Validated form data. * * @since 3.1 */ @@ -128,7 +129,7 @@ public function checkForm($page = 'site') $data = $app->input->post->get('jform', array(), 'array'); $return = $this->validate($data, $page); - // Attempt to save the data before validation + // Attempt to save the data before validation. $form = $this->getForm(); $data = $form->filter($data); unset($data['admin_password2']); @@ -152,9 +153,9 @@ public function checkForm($page = 'site') } /** - * Generate a panel of language choices for the user to select their language + * Generate a panel of language choices for the user to select their language. * - * @return boolean True if successful + * @return boolean True if successful. * * @since 3.1 */ @@ -193,7 +194,7 @@ public function getLanguages() /** * Checks the availability of the parse_ini_file and parse_ini_string functions. * - * @return boolean True if the method exists + * @return boolean True if the method exists. * * @since 3.1 */ @@ -203,7 +204,7 @@ public function getIniParserAvailability() if (!empty($disabled_functions)) { - // Attempt to detect them in the disable_functions black list + // Attempt to detect them in the disable_functions black list. $disabled_functions = explode(',', trim($disabled_functions)); $number_of_disabled_functions = count($disabled_functions); @@ -297,14 +298,14 @@ public function getPhpOptions() $options[] = $option; } - // Check for a missing native parse_ini_file implementation + // Check for a missing native parse_ini_file implementation. $option = new stdClass; $option->label = JText::_('INSTL_PARSE_INI_FILE_AVAILABLE'); $option->state = $this->getIniParserAvailability(); $option->notice = null; $options[] = $option; - // Check for missing native json_encode / json_decode support + // Check for missing native json_encode / json_decode support. $option = new stdClass; $option->label = JText::_('INSTL_JSON_SUPPORT_AVAILABLE'); $option->state = function_exists('json_encode') && function_exists('json_decode'); @@ -325,9 +326,9 @@ public function getPhpOptions() } /** - * Checks if all of the mandatory PHP options are met + * Checks if all of the mandatory PHP options are met. * - * @return boolean True on success + * @return boolean True on success. * * @since 3.1 */ @@ -400,7 +401,7 @@ public function getPhpSettings() $setting->recommended = false; $settings[] = $setting; - // Check for native ZIP support + // Check for native ZIP support. $setting = new stdClass; $setting->label = JText::_('INSTL_ZIP_SUPPORT_AVAILABLE'); $setting->state = function_exists('zip_open') && function_exists('zip_read'); @@ -442,6 +443,7 @@ public function validate($data, $view = null) if ($return instanceof Exception) { $app->enqueueMessage($return->getMessage(), 'warning'); + return false; } diff --git a/installation/view/preinstall/html.php b/installation/view/preinstall/html.php index 6dec48734202b..0aacd6a0dbdaf 100644 --- a/installation/view/preinstall/html.php +++ b/installation/view/preinstall/html.php @@ -19,17 +19,17 @@ class InstallationViewPreinstallHtml extends InstallationViewDefault { /** - * Array of PHP config options - * - * @var array + * Array of PHP config options. + * + * @var array * @since 3.1 */ protected $options; /** * Array of PHP settings - * - * @var array + * + * @var array * @since 3.1 */ protected $settings; diff --git a/libraries/cms/form/field/media.php b/libraries/cms/form/field/media.php index 30b5eabf94420..1ebfbe93a7a11 100644 --- a/libraries/cms/form/field/media.php +++ b/libraries/cms/form/field/media.php @@ -379,7 +379,8 @@ protected function getInput() : 'index.php?option=com_media&view=images&tmpl=component&asset=' . $asset . '&author=' . $this->form->getValue($this->authorField)) . '&fieldid=' . $this->id . '&folder=' . $folder) . '"' . ' rel="{handler: \'iframe\', size: {x: 800, y: 500}}">'; - $html[] = JText::_('JLIB_FORM_BUTTON_SELECT') . ''; diff --git a/libraries/cms/form/field/moduleposition.php b/libraries/cms/form/field/moduleposition.php index 9ada467c8852f..72235bd8de3db 100644 --- a/libraries/cms/form/field/moduleposition.php +++ b/libraries/cms/form/field/moduleposition.php @@ -133,28 +133,48 @@ public function setup(SimpleXMLElement $element, $value, $group = null) */ protected function getInput() { - // Load the modal behavior script. - JHtml::_('behavior.modal', 'a.modal'); + // Include jQuery + JHtml::_('jquery.framework'); + JHtml::_('bootstrap.modal'); // Build the script. $script = array(); $script[] = ' function jSelectPosition_' . $this->id . '(name) {'; $script[] = ' document.getElementById("' . $this->id . '").value = name;'; - $script[] = ' SqueezeBox.close();'; + $script[] = ' jQuery("#moduleModal").modal("hide");'; $script[] = ' }'; + // Add normalized style. + $style = '@media only screen and (min-width : 768px) { + #userModal { + width: 80% !important; + margin-left:-40% !important; + height:auto; + } + #userModal #userModal-container .modal-body iframe { + margin:0; + padding:0; + display:block; + width:100%; + height:400px !important; + border:none; + } + }'; + // Add the script to the document head. JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); + JFactory::getDocument()->addStyleDeclaration($style); // Setup variables for display. $html = array(); - $link = 'index.php?option=com_modules&view=positions&layout=modal&tmpl=component&function=jSelectPosition_' . $this->id . '&client_id=' . $this->clientId; + $link = 'index.php?option=com_modules&view=positions&layout=modal&tmpl=component&function=jSelectPosition_' . $this->id + . '&client_id=' . $this->clientId; // The current user display field. $html[] = '
    '; $html[] = parent::getInput() - . '' - . JText::_('COM_MODULES_CHANGE_POSITION_BUTTON') . ''; + . '' . JText::_('COM_MODULES_CHANGE_POSITION_BUTTON') . ''; + $html[] = JHtmlBootstrap::renderModal('moduleModal', array( 'url' => $link, 'title' => JText::_('COM_MODULES_CHANGE_POSITION_TITLE'),'height' => '800', 'width' => '600'), ''); $html[] = '
    '; return implode("\n", $html); diff --git a/libraries/cms/form/field/user.php b/libraries/cms/form/field/user.php index 923e91f7d9edf..ce7bb4506995b 100644 --- a/libraries/cms/form/field/user.php +++ b/libraries/cms/form/field/user.php @@ -57,7 +57,8 @@ protected function getInput() $script[] = ' if (old_id != id) {'; $script[] = ' document.getElementById("' . $this->id . '_id").value = id;'; $script[] = ' document.getElementById("' . $this->id . '").value = title;'; - $script[] = ' document.getElementById("' . $this->id . '").className = document.getElementById("' . $this->id . '").className.replace(" invalid" , "");'; + $script[] = ' document.getElementById("' + . $this->id . '").className = document.getElementById("' . $this->id . '").className.replace(" invalid" , "");'; $script[] = ' ' . $this->onchange; $script[] = ' }'; $script[] = ' SqueezeBox.close();'; diff --git a/libraries/cms/helper/media.php b/libraries/cms/helper/media.php index 6f81871b79aff..e5c9825ee214d 100644 --- a/libraries/cms/helper/media.php +++ b/libraries/cms/helper/media.php @@ -102,6 +102,7 @@ public function canUpload($file, $component = 'com_media') if (!empty($check)) { $app->enqueueMessage(JText::_('JLIB_MEDIA_ERROR_WARNFILETYPE'), 'notice'); + return false; } @@ -291,15 +292,15 @@ public function countFiles($dir) } /** - * Small helper function that properly converts any - * configuration options to their byte representation. - * - * @param string|integer $val The value to be converted to bytes. - * - * @return integer The calculated bytes value from the input. - * - * @since 3.3 - */ + * Small helper function that properly converts any + * configuration options to their byte representation. + * + * @param string|integer $val The value to be converted to bytes. + * + * @return integer The calculated bytes value from the input. + * + * @since 3.3 + */ public function toBytes($val) { switch ($val[strlen($val) - 1]) diff --git a/libraries/cms/helper/route.php b/libraries/cms/helper/route.php index 73a15f430baf1..d80b2b64f7081 100644 --- a/libraries/cms/helper/route.php +++ b/libraries/cms/helper/route.php @@ -246,9 +246,17 @@ protected function findItem($needles = array()) * @return string * * @since 3.2 + * + * @throws InvalidArgumentException */ - public static function getCategoryRoute($catid, $language = 0, $extension) + public static function getCategoryRoute($catid, $language = 0, $extension = '') { + // Note: $extension is required but has to be an optional argument in the function call due to argument order + if (empty($extension)) + { + throw new InvalidArgumentException('$extension is a required argument in JHelperRoute::getCategoryRoute'); + } + if ($catid instanceof JCategoryNode) { $id = $catid->id; diff --git a/libraries/cms/helper/tags.php b/libraries/cms/helper/tags.php index d8004beb14d15..3fad9efdf6e5d 100644 --- a/libraries/cms/helper/tags.php +++ b/libraries/cms/helper/tags.php @@ -72,11 +72,27 @@ public function addTagMapping($ucmId, JTableInterface $table, $tags = array()) $query = $db->getQuery(true); $query->insert('#__contentitem_tag_map'); - $query->columns(array($db->quoteName('type_alias'), $db->quoteName('core_content_id'), $db->quoteName('content_item_id'), $db->quoteName('tag_id'), $db->quoteName('tag_date'), $db->quoteName('type_id'))); + $query->columns( + array( + $db->quoteName('type_alias'), + $db->quoteName('core_content_id'), + $db->quoteName('content_item_id'), + $db->quoteName('tag_id'), + $db->quoteName('tag_date'), + $db->quoteName('type_id') + ) + ); foreach ($tags as $tag) { - $query->values($db->quote($this->typeAlias) . ', ' . (int) $ucmId . ', ' . (int) $item . ', ' . $db->quote($tag) . ', ' . $query->currentTimestamp() . ', ' . (int) $typeId); + $query->values( + $db->quote($this->typeAlias) + . ', ' . (int) $ucmId + . ', ' . (int) $item + . ', ' . $db->quote($tag) + . ', ' . $query->currentTimestamp() + . ', ' . (int) $typeId + ); } $db->setQuery($query); @@ -522,9 +538,21 @@ public function getTagItemsQuery($tagId, $typesr = null, $includeChildren = fals JArrayHelper::toInteger($stateFilters); // M is the mapping table. C is the core_content table. Ct is the content_types table. - $query->select('m.type_alias, m.content_item_id, m.core_content_id, count(m.tag_id) AS match_count, MAX(m.tag_date) as tag_date, MAX(c.core_title) AS core_title') + $query + ->select( + 'm.type_alias' + . ', ' . 'm.content_item_id' + . ', ' . 'm.core_content_id' + . ', ' . 'count(m.tag_id) AS match_count' + . ', ' . 'MAX(m.tag_date) as tag_date' + . ', ' . 'MAX(c.core_title) AS core_title' + ) ->select('MAX(c.core_alias) AS core_alias, MAX(c.core_body) AS core_body, MAX(c.core_state) AS core_state, MAX(c.core_access) AS core_access') - ->select('MAX(c.core_metadata) AS core_metadata, MAX(c.core_created_user_id) AS core_created_user_id, MAX(c.core_created_by_alias) AS core_created_by_alias') + ->select( + 'MAX(c.core_metadata) AS core_metadata' + . ', ' . 'MAX(c.core_created_user_id) AS core_created_user_id' + . ', ' . 'MAX(c.core_created_by_alias) AS core_created_by_alias' + ) ->select('MAX(c.core_created_time) as core_created_time, MAX(c.core_images) as core_images') ->select('CASE WHEN c.core_modified_time = ' . $nullDate . ' THEN c.core_created_time ELSE c.core_modified_time END as core_modified_time') ->select('MAX(c.core_language) AS core_language, MAX(c.core_catid) AS core_catid') @@ -532,7 +560,14 @@ public function getTagItemsQuery($tagId, $typesr = null, $includeChildren = fals ->select('MAX(ct.type_title) AS content_type_title, MAX(ct.router) AS router') ->from('#__contentitem_tag_map AS m') - ->join('INNER', '#__ucm_content AS c ON m.type_alias = c.core_type_alias AND m.core_content_id = c.core_content_id AND c.core_state IN (' . implode(',', $stateFilters) . ')' . (in_array('0', $stateFilters) ? '' : ' AND (c.core_publish_up = ' . $nullDate . ' OR c.core_publish_up <= ' . $nowDate . ') AND (c.core_publish_down = ' . $nullDate . ' OR c.core_publish_down >= ' . $nowDate . ')')) + ->join( + 'INNER', + '#__ucm_content AS c ON m.type_alias = c.core_type_alias AND m.core_content_id = c.core_content_id AND c.core_state IN (' + . implode(',', $stateFilters) . ')' + . (in_array('0', $stateFilters) ? '' : ' AND (c.core_publish_up = ' . $nullDate + . ' OR c.core_publish_up <= ' . $nowDate . ') ' + . ' AND (c.core_publish_down = ' . $nullDate . ' OR c.core_publish_down >= ' . $nowDate . ')') + ) ->join('INNER', '#__content_types AS ct ON ct.type_alias = m.type_alias') // Join over the users for the author and email diff --git a/libraries/cms/html/email.php b/libraries/cms/html/email.php index 1b8e1a8a72e6b..f65adda8de8db 100644 --- a/libraries/cms/html/email.php +++ b/libraries/cms/html/email.php @@ -73,11 +73,13 @@ public static function cloak($mail, $mailto = true, $text = '', $email = true) $replacement .= "\n var addy_text" . $rand . " = '" . $text . "';"; } - $replacement .= "\n document.getElementById('cloak$rand').innerHTML += ''+addy_text" . $rand . "+'<\/a>';"; + $replacement .= "\n document.getElementById('cloak$rand').innerHTML += ''+addy_text" . $rand . "+'<\/a>';"; } else { - $replacement .= "\n document.getElementById('cloak$rand').innerHTML += '' +addy" . $rand . "+'<\/a>';"; + $replacement .= "\n document.getElementById('cloak$rand').innerHTML += '' +addy" . $rand . "+'<\/a>';"; } } else diff --git a/libraries/cms/html/formbehavior.php b/libraries/cms/html/formbehavior.php index ce356c25ae258..45aed8376c2ec 100644 --- a/libraries/cms/html/formbehavior.php +++ b/libraries/cms/html/formbehavior.php @@ -55,11 +55,30 @@ public static function chosen($selector = '.advancedSelect', $debug = null, $opt } // Default settings - $options['disable_search_threshold'] = isset($options['disable_search_threshold']) ? $options['disable_search_threshold'] : 10; - $options['allow_single_deselect'] = isset($options['allow_single_deselect']) ? $options['allow_single_deselect'] : true; - $options['placeholder_text_multiple'] = isset($options['placeholder_text_multiple']) ? $options['placeholder_text_multiple']: JText::_('JGLOBAL_SELECT_SOME_OPTIONS'); - $options['placeholder_text_single'] = isset($options['placeholder_text_single']) ? $options['placeholder_text_single'] : JText::_('JGLOBAL_SELECT_AN_OPTION'); - $options['no_results_text'] = isset($options['no_results_text']) ? $options['no_results_text'] : JText::_('JGLOBAL_SELECT_NO_RESULTS_MATCH'); + if (!isset($options['disable_search_threshold'])) + { + $options['disable_search_threshold'] = 10; + } + + if (!isset($options['allow_single_deselect'])) + { + $options['allow_single_deselect'] = true; + } + + if (!isset($options['placeholder_text_multiple'])) + { + $options['placeholder_text_multiple'] = JText::_('JGLOBAL_SELECT_SOME_OPTIONS'); + } + + if (!isset($options['placeholder_text_single'])) + { + $options['placeholder_text_single'] = JText::_('JGLOBAL_SELECT_AN_OPTION'); + } + + if (!isset($options['no_results_text'])) + { + $options['no_results_text'] = JText::_('JGLOBAL_SELECT_NO_RESULTS_MATCH'); + } // Options array to json options string $options_str = json_encode($options, ($debug && defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : false)); diff --git a/libraries/cms/html/grid.php b/libraries/cms/html/grid.php index c4fe2b439dfdd..edb3cb22f20a2 100644 --- a/libraries/cms/html/grid.php +++ b/libraries/cms/html/grid.php @@ -126,7 +126,8 @@ public static function checkall($name = 'checkall-toggle', $tip = 'JGLOBAL_CHECK { JHtml::_('bootstrap.tooltip'); - return ''; + return ''; } /** @@ -271,7 +272,8 @@ public static function state($filter_state = '*', $published = 'Published', $unp */ public static function order($rows, $image = 'filesave.png', $task = 'saveorder') { - return ''; } diff --git a/libraries/cms/html/searchtools.php b/libraries/cms/html/searchtools.php index 69224c41b44a1..b1e1939c867c5 100644 --- a/libraries/cms/html/searchtools.php +++ b/libraries/cms/html/searchtools.php @@ -134,7 +134,8 @@ private static function options2Jregistry($options) * * @return string */ - public static function sort($title, $order, $direction = 'asc', $selected = 0, $task = null, $new_direction = 'asc', $tip = '', $icon = null, $formName = 'adminForm') + public static function sort($title, $order, $direction = 'asc', $selected = 0, $task = null, $new_direction = 'asc', $tip = '', $icon = null, + $formName = 'adminForm') { $direction = strtolower($direction); $orderIcons = array('icon-arrow-up-3', 'icon-arrow-down-3'); diff --git a/libraries/cms/html/sortablelist.php b/libraries/cms/html/sortablelist.php index 69169028988b9..aac399a644628 100644 --- a/libraries/cms/html/sortablelist.php +++ b/libraries/cms/html/sortablelist.php @@ -37,8 +37,10 @@ abstract class JHtmlSortablelist * @return void * * @since 3.0 + * + * @throws InvalidArgumentException */ - public static function sortable($tableId, $formId, $sortDir = 'asc', $saveOrderingUrl, $proceedSaveOrderButton = true, $nestedList = false) + public static function sortable($tableId, $formId, $sortDir = 'asc', $saveOrderingUrl = null, $proceedSaveOrderButton = true, $nestedList = false) { // Only load once if (isset(static::$loaded[__METHOD__])) @@ -46,6 +48,12 @@ public static function sortable($tableId, $formId, $sortDir = 'asc', $saveOrderi return; } + // Note: $i is required but has to be an optional argument in the function call due to argument order + if (null === $saveOrderingUrl) + { + throw new InvalidArgumentException('$saveOrderingUrl is a required argument in JHtmlSortablelist::sortable'); + } + // Depends on jQuery UI JHtml::_('jquery.ui', array('core', 'sortable')); @@ -56,7 +64,8 @@ public static function sortable($tableId, $formId, $sortDir = 'asc', $saveOrderi JFactory::getDocument()->addScriptDeclaration(" (function ($){ $(document).ready(function (){ - var sortableList = new $.JSortableList('#" . $tableId . " tbody','" . $formId . "','" . $sortDir . "' , '" . $saveOrderingUrl . "','','" . $nestedList . "'); + var sortableList = new $.JSortableList('#" + . $tableId . " tbody','" . $formId . "','" . $sortDir . "' , '" . $saveOrderingUrl . "','','" . $nestedList . "'); }); })(jQuery); " diff --git a/libraries/cms/language/associations.php b/libraries/cms/language/associations.php index 1c7bdcc713be3..0bd0d04fd9e2b 100644 --- a/libraries/cms/language/associations.php +++ b/libraries/cms/language/associations.php @@ -65,7 +65,10 @@ public static function getAssociations($extension, $tablename, $context, $id, $p // Use catid field ? if (!empty($catField)) { - $query->join('INNER', $db->quoteName('#__categories', 'ca') . ' ON ' . $db->quoteName('c2.' . $catField) . ' = ca.id AND ca.extension = ' . $db->quote($extension)) + $query->join( + 'INNER', + $db->quoteName('#__categories', 'ca') . ' ON ' . $db->quoteName('c2.' . $catField) . ' = ca.id AND ca.extension = ' . $db->quote($extension) + ) ->select( $query->concatenate( array('ca.id', 'ca.alias'), diff --git a/libraries/cms/table/contenthistory.php b/libraries/cms/table/contenthistory.php index e6c1d97ee0e42..8bbe5427f047e 100644 --- a/libraries/cms/table/contenthistory.php +++ b/libraries/cms/table/contenthistory.php @@ -47,7 +47,16 @@ class JTableContenthistory extends JTable public function __construct($db) { parent::__construct('#__ucm_history', 'version_id', $db); - $this->ignoreChanges = array('modified_by', 'modified_user_id', 'modified', 'modified_time', 'checked_out', 'checked_out_time', 'version', 'hits', 'path'); + $this->ignoreChanges = array( + 'modified_by', + 'modified_user_id', + 'modified', + 'modified_time', + 'checked_out', + 'checked_out_time', + 'version', + 'hits', + 'path'); $this->convertToInt = array('publish_up', 'publish_down', 'ordering', 'featured'); } diff --git a/libraries/cms/table/contenttype.php b/libraries/cms/table/contenttype.php index a697f54b268e1..1e5c8d4b74c79 100644 --- a/libraries/cms/table/contenttype.php +++ b/libraries/cms/table/contenttype.php @@ -121,6 +121,8 @@ public function getTypeId($typeAlias) * @return mixed JTable object on success, otherwise false. * * @since 3.2 + * + * @throws RuntimeException */ public function getContentTable() { @@ -137,8 +139,6 @@ public function getContentTable() { // This isn't an instance of JTableInterface. Abort. throw new RuntimeException('Class must be an instance of JTableInterface'); - - return false; } $result = $class::getInstance($tableInfo->special->type, $tableInfo->special->prefix); diff --git a/libraries/cms/table/corecontent.php b/libraries/cms/table/corecontent.php index 506c7c6cb49b4..c03a36b86bb0f 100644 --- a/libraries/cms/table/corecontent.php +++ b/libraries/cms/table/corecontent.php @@ -186,6 +186,7 @@ public function deleteByContentId($contentItemId = null, $typeAlias = null) { throw new UnexpectedValueException('Null content item key not allowed.'); } + if ($typeAlias === null) { throw new UnexpectedValueException('Null type alias not allowed.'); @@ -355,7 +356,11 @@ public function publish($pks = null, $state = 1, $userId = 0) if (property_exists($this, 'core_checked_out_user_id') && property_exists($this, 'core_checked_out_time')) { $checkin = true; - $query->where(' (' . $this->_db->quoteName('core_checked_out_user_id') . ' = 0 OR ' . $this->_db->quoteName('core_checked_out_user_id') . ' = ' . (int) $userId . ')'); + $query->where( + ' (' + . $this->_db->quoteName('core_checked_out_user_id') . ' = 0 OR ' . $this->_db->quoteName('core_checked_out_user_id') . ' = ' . (int) $userId + . ')' + ); } $this->_db->setQuery($query); diff --git a/libraries/import.legacy.php b/libraries/import.legacy.php index 1615ab6ca7e0c..db23b2962e71d 100644 --- a/libraries/import.legacy.php +++ b/libraries/import.legacy.php @@ -22,6 +22,7 @@ { define('IS_WIN', ($os === 'WIN') ? true : false); } + if (!defined('IS_UNIX')) { define('IS_UNIX', (($os !== 'MAC') && ($os !== 'WIN')) ? true : false); diff --git a/libraries/import.php b/libraries/import.php index ab757f3204031..2456d09f1091d 100644 --- a/libraries/import.php +++ b/libraries/import.php @@ -22,6 +22,7 @@ { define('IS_WIN', ($os === 'WIN') ? true : false); } + if (!defined('IS_UNIX')) { define('IS_UNIX', (IS_WIN === false) ? true : false); diff --git a/libraries/joomla/access/rule.php b/libraries/joomla/access/rule.php index 233e09dbb7b2a..7b6a26aa51476 100644 --- a/libraries/joomla/access/rule.php +++ b/libraries/joomla/access/rule.php @@ -155,7 +155,6 @@ public function allow($identities) break; } } - } } diff --git a/libraries/joomla/access/rules.php b/libraries/joomla/access/rules.php index 7a99dd59647ab..1492bdbcc25c8 100644 --- a/libraries/joomla/access/rules.php +++ b/libraries/joomla/access/rules.php @@ -194,6 +194,7 @@ public function getAllowed($identity) $allowed->set($name, true); } } + return $allowed; } diff --git a/libraries/joomla/application/daemon.php b/libraries/joomla/application/daemon.php index c3005e5031c75..089ac6e314fa5 100644 --- a/libraries/joomla/application/daemon.php +++ b/libraries/joomla/application/daemon.php @@ -564,7 +564,6 @@ protected function daemonize() // Attempt to change the identity of user running the process. if (!$this->changeIdentity()) { - // If the identity change was required then we need to return false. if ($this->config->get('application_require_identity')) { diff --git a/libraries/joomla/application/web.php b/libraries/joomla/application/web.php index e9dd0fa7254f7..b22e4d5fe3213 100644 --- a/libraries/joomla/application/web.php +++ b/libraries/joomla/application/web.php @@ -1154,6 +1154,7 @@ protected function loadSystemUris($requestUri = null) // Remove the index.php portion of the path. $path = substr_replace($path, '', strpos($path, 'index.php'), 9); } + $path = rtrim($path, '/\\'); // Set the base URI both as just a path and as the full URI. diff --git a/libraries/joomla/database/driver.php b/libraries/joomla/database/driver.php index 7dea0801ccfb1..d356f361fd342 100644 --- a/libraries/joomla/database/driver.php +++ b/libraries/joomla/database/driver.php @@ -265,7 +265,6 @@ public static function getInstance($options = array()) // If we already have a database connector instance for these options then just use that. if (empty(self::$instances[$signature])) { - // Derive the class name from the driver. $class = 'JDatabaseDriver' . ucfirst(strtolower($options['driver'])); @@ -607,6 +606,7 @@ protected function getCreateDatabaseQuery($options, $utf) { return 'CREATE DATABASE ' . $this->quoteName($options->db_name) . ' CHARACTER SET `utf8`'; } + return 'CREATE DATABASE ' . $this->quoteName($options->db_name); } @@ -920,6 +920,7 @@ abstract public function getTableList(); public function getUTFSupport() { JLog::add('JDatabaseDriver::getUTFSupport() is deprecated. Use JDatabaseDriver::hasUTFSupport() instead.', JLog::WARNING, 'deprecated'); + return $this->hasUTFSupport(); } @@ -1606,6 +1607,7 @@ public function replacePrefix($sql, $prefix = '#__') { break; } + $l = $k - 1; while ($l >= 0 && $sql{$l} == '\\') diff --git a/libraries/joomla/database/driver/mysqli.php b/libraries/joomla/database/driver/mysqli.php index 96647dbbc5e42..83ea00deb4df9 100644 --- a/libraries/joomla/database/driver/mysqli.php +++ b/libraries/joomla/database/driver/mysqli.php @@ -105,8 +105,9 @@ public function connect() * have to extract them from the host string. */ $port = isset($this->options['port']) ? $this->options['port'] : 3306; + $regex = '/^(?P((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(:(?P.+))?$/'; - if (preg_match('/^(?P((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(:(?P.+))?$/', $this->options['host'], $matches)) + if (preg_match($regex, $this->options['host'], $matches)) { // It's an IPv4 address with ot without port $this->options['host'] = $matches['host']; @@ -362,6 +363,7 @@ public function getTableCreate($tables) // Sanitize input to an array and iterate over the list. settype($tables, 'array'); + foreach ($tables as $table) { // Set the query to get the table CREATE statement. @@ -571,7 +573,11 @@ public function execute() $this->callStacks[] = debug_backtrace(); } - $this->callStacks[count($this->callStacks) - 1][0]['memory'] = array($memoryBefore, memory_get_usage(), is_object($this->cursor) ? $this->getNumRows() : null); + $this->callStacks[count($this->callStacks) - 1][0]['memory'] = array( + $memoryBefore, + memory_get_usage(), + is_object($this->cursor) ? $this->getNumRows() : null + ); } // If an error occurred handle it. diff --git a/libraries/joomla/database/driver/oracle.php b/libraries/joomla/database/driver/oracle.php index 712fbf44756f3..f48a520e1b24f 100644 --- a/libraries/joomla/database/driver/oracle.php +++ b/libraries/joomla/database/driver/oracle.php @@ -176,16 +176,16 @@ public function getConnectedQuery() } /** - * Returns the current date format - * This method should be useful in the case that - * somebody actually wants to use a different - * date format and needs to check what the current - * one is to see if it needs to be changed. - * - * @return string The current date format - * - * @since 12.1 - */ + * Returns the current date format + * This method should be useful in the case that + * somebody actually wants to use a different + * date format and needs to check what the current + * one is to see if it needs to be changed. + * + * @return string The current date format + * + * @since 12.1 + */ public function getDateFormat() { return $this->dateformat; @@ -216,6 +216,7 @@ public function getTableCreate($tables) // Sanitize input to an array and iterate over the list. settype($tables, 'array'); + foreach ($tables as $table) { $query->bind(':tableName', $table); @@ -342,6 +343,7 @@ public function getTableList($databaseName = null, $includeDatabaseName = false) } $query->from('all_tables'); + if ($databaseName) { $query->where('owner = :database') @@ -398,19 +400,19 @@ public function select($database) } /** - * Sets the Oracle Date Format for the session - * Default date format for Oracle is = DD-MON-RR - * The default date format for this driver is: - * 'RRRR-MM-DD HH24:MI:SS' since it is the format - * that matches the MySQL one used within most Joomla - * tables. - * - * @param string $dateFormat Oracle Date Format String - * - * @return boolean - * - * @since 12.1 - */ + * Sets the Oracle Date Format for the session + * Default date format for Oracle is = DD-MON-RR + * The default date format for this driver is: + * 'RRRR-MM-DD HH24:MI:SS' since it is the format + * that matches the MySQL one used within most Joomla + * tables. + * + * @param string $dateFormat Oracle Date Format String + * + * @return boolean + * + * @since 12.1 + */ public function setDateFormat($dateFormat = 'DD-MON-RR') { $this->connect(); @@ -423,6 +425,7 @@ public function setDateFormat($dateFormat = 'DD-MON-RR') } $this->setQuery("ALTER SESSION SET NLS_TIMESTAMP_FORMAT = '$dateFormat'"); + if (!$this->execute()) { return false; @@ -536,6 +539,7 @@ public function replacePrefix($query, $prefix = '#__') while ($startPos < $n) { $ip = strpos($query, $prefix, $startPos); + if ($ip === false) { break; @@ -563,31 +567,39 @@ public function replacePrefix($query, $prefix = '#__') { $k = strpos($query, $quoteChar, $j); $escaped = false; + if ($k === false) { break; } + $l = $k - 1; + while ($l >= 0 && $query{$l} == '\\') { $l--; $escaped = !$escaped; } + if ($escaped) { $j = $k + 1; continue; } + break; } + if ($k === false) { // Error in the query - no end quote; ignore it break; } + $literal .= substr($query, $startPos, $k - $startPos + 1); $startPos = $k + 1; } + if ($startPos < $n) { $literal .= substr($query, $startPos, $n - $startPos); diff --git a/libraries/joomla/database/driver/pdo.php b/libraries/joomla/database/driver/pdo.php index aab088e0f5f92..b9122823fabbf 100644 --- a/libraries/joomla/database/driver/pdo.php +++ b/libraries/joomla/database/driver/pdo.php @@ -396,12 +396,14 @@ public function execute() // Execute the query. $this->executed = false; + if ($this->prepared instanceof PDOStatement) { // Bind the variables: if ($this->sql instanceof JDatabaseQueryPreparable) { - $bounded =& $this->sql->getBounded(); + $bounded = $this->sql->getBounded(); + foreach ($bounded as $key => $obj) { $this->prepared->bindParam($key, $obj->value, $obj->dataType, $obj->length, $obj->driverOptions); @@ -414,6 +416,7 @@ public function execute() if ($this->debug) { $this->timings[] = microtime(true); + if (defined('DEBUG_BACKTRACE_IGNORE_ARGS')) { $this->callStacks[] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); @@ -800,6 +803,7 @@ protected function fetchArray($cursor = null) { return $cursor->fetch(PDO::FETCH_NUM); } + if ($this->prepared instanceof PDOStatement) { return $this->prepared->fetch(PDO::FETCH_NUM); @@ -821,6 +825,7 @@ protected function fetchAssoc($cursor = null) { return $cursor->fetch(PDO::FETCH_ASSOC); } + if ($this->prepared instanceof PDOStatement) { return $this->prepared->fetch(PDO::FETCH_ASSOC); @@ -843,6 +848,7 @@ protected function fetchObject($cursor = null, $class = 'stdClass') { return $cursor->fetchObject($class); } + if ($this->prepared instanceof PDOStatement) { return $this->prepared->fetchObject($class); @@ -867,6 +873,7 @@ protected function freeResult($cursor = null) $cursor->closeCursor(); $cursor = null; } + if ($this->prepared instanceof PDOStatement) { $this->prepared->closeCursor(); diff --git a/libraries/joomla/database/driver/sqlsrv.php b/libraries/joomla/database/driver/sqlsrv.php index d7b1c61a44324..99f716b046606 100644 --- a/libraries/joomla/database/driver/sqlsrv.php +++ b/libraries/joomla/database/driver/sqlsrv.php @@ -614,6 +614,7 @@ public function execute() if ($this->debug) { $this->timings[] = microtime(true); + if (defined('DEBUG_BACKTRACE_IGNORE_ARGS')) { $this->callStacks[] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); @@ -1048,6 +1049,7 @@ public function renameTable($oldTable, $newTable, $backup = null, $prefix = null { $constraints = $this->getTableConstraints($oldTable); } + if (!empty($constraints)) { $this->renameConstraints($constraints, $prefix, $backup); diff --git a/libraries/joomla/database/query.php b/libraries/joomla/database/query.php index d533c0bfb7bc3..cabbd67c65127 100644 --- a/libraries/joomla/database/query.php +++ b/libraries/joomla/database/query.php @@ -1137,6 +1137,7 @@ public function join($type, $conditions) { $this->join = array(); } + $this->join[] = new JDatabaseQueryElement(strtoupper($type) . ' JOIN', $conditions); return $this; @@ -1560,7 +1561,6 @@ public function union($query, $distinct = false, $glue = '') { $glue = ')' . PHP_EOL . 'UNION ('; $name = 'UNION ()'; - } // Get the JDatabaseQueryElement if it does not exist diff --git a/libraries/joomla/database/query/sqlsrv.php b/libraries/joomla/database/query/sqlsrv.php index 8c0a2d067ce13..4982e2770b9d1 100644 --- a/libraries/joomla/database/query/sqlsrv.php +++ b/libraries/joomla/database/query/sqlsrv.php @@ -98,7 +98,6 @@ public function __toString() if ($this instanceof JDatabaseQueryLimitable && ($this->limit > 0 || $this->offset > 0)) { - $query = $this->processLimit($query, $this->limit, $this->offset); } diff --git a/libraries/joomla/feed/link.php b/libraries/joomla/feed/link.php index db3c268cad53c..4511f18e1e5fc 100644 --- a/libraries/joomla/feed/link.php +++ b/libraries/joomla/feed/link.php @@ -92,6 +92,7 @@ public function __construct($uri = null, $relation = null, $type = null, $langua { throw new InvalidArgumentException('Length must be numeric.'); } + $this->length = (int) $length; } } diff --git a/libraries/joomla/feed/parser.php b/libraries/joomla/feed/parser.php index 13c2353acaf29..4951b3c3f6758 100644 --- a/libraries/joomla/feed/parser.php +++ b/libraries/joomla/feed/parser.php @@ -103,6 +103,7 @@ public function parse() // Skip over this element's children since it has been processed. $this->moveToClosingElement(); } + while ($this->moveToNextElement()); return $feed; diff --git a/libraries/joomla/feed/parser/rss/itunes.php b/libraries/joomla/feed/parser/rss/itunes.php index 1dcb824844c4d..a45af1a9fbfb4 100644 --- a/libraries/joomla/feed/parser/rss/itunes.php +++ b/libraries/joomla/feed/parser/rss/itunes.php @@ -31,7 +31,7 @@ class JFeedParserRssItunes implements JFeedParserNamespace */ public function processElementForFeed(JFeed $feed, SimpleXMLElement $el) { - + return; } /** @@ -46,6 +46,6 @@ public function processElementForFeed(JFeed $feed, SimpleXMLElement $el) */ public function processElementForFeedEntry(JFeedEntry $entry, SimpleXMLElement $el) { - + return; } } diff --git a/libraries/joomla/feed/parser/rss/media.php b/libraries/joomla/feed/parser/rss/media.php index b58b33f53c14e..eb314ab1ed61a 100644 --- a/libraries/joomla/feed/parser/rss/media.php +++ b/libraries/joomla/feed/parser/rss/media.php @@ -31,7 +31,7 @@ class JFeedParserRssMedia implements JFeedParserNamespace */ public function processElementForFeed(JFeed $feed, SimpleXMLElement $el) { - + return; } /** @@ -46,6 +46,6 @@ public function processElementForFeed(JFeed $feed, SimpleXMLElement $el) */ public function processElementForFeedEntry(JFeedEntry $entry, SimpleXMLElement $el) { - + return; } } diff --git a/libraries/joomla/filter/input.php b/libraries/joomla/filter/input.php index af29284aae840..5fea9b4b904ec 100644 --- a/libraries/joomla/filter/input.php +++ b/libraries/joomla/filter/input.php @@ -283,6 +283,7 @@ public function clean($source, $type = 'string') $source[$key] = $this->_remove($this->_decode($value)); } } + $result = $source; } else @@ -491,6 +492,7 @@ protected function _cleanTags($source) $fromSpace = substr($fromSpace, $attribEnd + 1); } } + if (strpos($fromSpace, '=') !== false) { // If the attribute value is wrapped in quotes we need to grab the substring from diff --git a/libraries/joomla/github/package/data.php b/libraries/joomla/github/package/data.php index 1855fd26332e9..1cbed7ac4f8dc 100644 --- a/libraries/joomla/github/package/data.php +++ b/libraries/joomla/github/package/data.php @@ -17,37 +17,36 @@ * @package Joomla.Platform * @subpackage GitHub.Data * @since 12.3 - + * * http://developer.github.com/v3/git/ -Git DB API - -The Git Database API gives you access to read and write raw Git objects to your Git database on GitHub and to list - * and update your references (branch heads and tags). - -This basically allows you to reimplement a lot of Git functionality over our API - by creating raw objects - * directly into the database and updating branch references you could technically do just about anything that - * Git can do without having Git installed. - -Git DB API functions will return a 409 if the git repo for a Repository is empty or unavailable. - * This typically means it is being created still. Contact Support if this response status persists. - -git db - -For more information on the Git object database, please read the Git Internals chapter of the Pro Git book. - -As an example, if you wanted to commit a change to a file in your repository, you would: - - get the current commit object - retrieve the tree it points to - retrieve the content of the blob object that tree has for that particular file path - change the content somehow and post a new blob object with that new content, getting a blob SHA back - post a new tree object with that file path pointer replaced with your new blob SHA getting a tree SHA back - create a new commit object with the current commit SHA as the parent and the new tree SHA, getting a commit SHA back - update the reference of your branch to point to the new commit SHA - -It might seem complex, but it’s actually pretty simple when you understand the model and it opens up a ton of + * Git DB API + * + * The Git Database API gives you access to read and write raw Git objects to your Git database on GitHub and to list + * * and update your references (branch heads and tags). + * + * This basically allows you to reimplement a lot of Git functionality over our API - by creating raw objects + * * directly into the database and updating branch references you could technically do just about anything that + * * Git can do without having Git installed. + * + * Git DB API functions will return a 409 if the git repo for a Repository is empty or unavailable. + * * This typically means it is being created still. Contact Support if this response status persists. + * + * git db + * + * For more information on the Git object database, please read the Git Internals chapter of the Pro Git book. + * + * As an example, if you wanted to commit a change to a file in your repository, you would: + * + * get the current commit object + * retrieve the tree it points to + * retrieve the content of the blob object that tree has for that particular file path + * change the content somehow and post a new blob object with that new content, getting a blob SHA back + * post a new tree object with that file path pointer replaced with your new blob SHA getting a tree SHA back + * create a new commit object with the current commit SHA as the parent and the new tree SHA, getting a commit SHA back + * update the reference of your branch to point to the new commit SHA + * + * It might seem complex, but it’s actually pretty simple when you understand the model and it opens up a ton of * things you could potentially do with the API. - */ class JGithubPackageData extends JGithubPackage { diff --git a/libraries/joomla/github/package/repositories/contents.php b/libraries/joomla/github/package/repositories/contents.php index c70653ad5e07f..6fcbe662f57c3 100644 --- a/libraries/joomla/github/package/repositories/contents.php +++ b/libraries/joomla/github/package/repositories/contents.php @@ -27,34 +27,34 @@ class JGithubPackageRepositoriesContents extends JGithubPackage * Get the README * * This method returns the preferred README for a repository. - - GET /repos/:owner/:repo/readme - - Parameters - - ref - Optional string - The String name of the Commit/Branch/Tag. Defaults to master. - - Response - - Status: 200 OK - X-RateLimit-Limit: 5000 - X-RateLimit-Remaining: 4999 - - { - "type": "file", - "encoding": "base64", - "_links": { - "git": "https://api.github.com/repos/pengwynn/octokit/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1", - "self": "https://api.github.com/repos/pengwynn/octokit/contents/README.md", - "html": "https://github.com/pengwynn/octokit/blob/master/README.md" - }, - "size": 5362, - "name": "README.md", - "path": "README.md", - "content": "encoded content ...", - "sha": "3d21ec53a331a6f037a91c368710b99387d012c1" - } + * + * GET /repos/:owner/:repo/readme + * + * Parameters + * + * ref + * Optional string - The String name of the Commit/Branch/Tag. Defaults to master. + * + * Response + * + * Status: 200 OK + * X-RateLimit-Limit: 5000 + * X-RateLimit-Remaining: 4999 + * + * { + * "type": "file", + * "encoding": "base64", + * "_links": { + * "git": "https://api.github.com/repos/pengwynn/octokit/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1", + * "self": "https://api.github.com/repos/pengwynn/octokit/contents/README.md", + * "html": "https://github.com/pengwynn/octokit/blob/master/README.md" + * }, + * "size": 5362, + * "name": "README.md", + * "path": "README.md", + * "content": "encoded content ...", + * "sha": "3d21ec53a331a6f037a91c368710b99387d012c1" + * } * * @param string $owner The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. @@ -81,40 +81,39 @@ public function getReadme($owner, $repo, $ref = '') } /** - - Get contents - - This method returns the contents of any file or directory in a repository. - - GET /repos/:owner/:repo/contents/:path - - Parameters - - path - Optional string - The content path. - ref - Optional string - The String name of the Commit/Branch/Tag. Defaults to master. - - Response - - Status: 200 OK - X-RateLimit-Limit: 5000 - X-RateLimit-Remaining: 4999 - - { - "type": "file", - "encoding": "base64", - "_links": { - "git": "https://api.github.com/repos/pengwynn/octokit/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1", - "self": "https://api.github.com/repos/pengwynn/octokit/contents/README.md", - "html": "https://github.com/pengwynn/octokit/blob/master/README.md" - }, - "size": 5362, - "name": "README.md", - "path": "README.md", - "content": "encoded content ...", - "sha": "3d21ec53a331a6f037a91c368710b99387d012c1" - } + * Get contents + * + * This method returns the contents of any file or directory in a repository. + * + * GET /repos/:owner/:repo/contents/:path + * + * Parameters + * + * path + * Optional string - The content path. + * ref + * Optional string - The String name of the Commit/Branch/Tag. Defaults to master. + * + * Response + * + * Status: 200 OK + * X-RateLimit-Limit: 5000 + * X-RateLimit-Remaining: 4999 + * + * { + * "type": "file", + * "encoding": "base64", + * "_links": { + * "git": "https://api.github.com/repos/pengwynn/octokit/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1", + * "self": "https://api.github.com/repos/pengwynn/octokit/contents/README.md", + * "html": "https://github.com/pengwynn/octokit/blob/master/README.md" + * }, + * "size": 5362, + * "name": "README.md", + * "path": "README.md", + * "content": "encoded content ...", + * "sha": "3d21ec53a331a6f037a91c368710b99387d012c1" + * } * * @param string $owner The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. @@ -144,33 +143,32 @@ public function get($owner, $repo, $path, $ref = '') } /** - - Get archive link - - This method will return a 302 to a URL to download a tarball or zipball archive for a repository. + * Get archive link + * + * This method will return a 302 to a URL to download a tarball or zipball archive for a repository. * Please make sure your HTTP framework is configured to follow redirects or you will need to use the Location header to make a second GET request. - - Note: For private repositories, these links are temporary and expire quickly. - - GET /repos/:owner/:repo/:archive_format/:ref - - Parameters - - archive_format - Either tarball or zipball - ref - Optional string - valid Git reference, defaults to master - - Response - - Status: 302 Found - Location: http://github.com/me/myprivate/tarball/master?SSO=thistokenexpires - X-RateLimit-Limit: 5000 - X-RateLimit-Remaining: 4999 - - To follow redirects with curl, use the -L switch: - - curl -L https://api.github.com/repos/pengwynn/octokit/tarball > octokit.tar.gz + * + * Note: For private repositories, these links are temporary and expire quickly. + * + * GET /repos/:owner/:repo/:archive_format/:ref + * + * Parameters + * + * archive_format + * Either tarball or zipball + * ref + * Optional string - valid Git reference, defaults to master + * + * Response + * + * Status: 302 Found + * Location: http://github.com/me/myprivate/tarball/master?SSO=thistokenexpires + * X-RateLimit-Limit: 5000 + * X-RateLimit-Remaining: 4999 + * + * To follow redirects with curl, use the -L switch: + * + * curl -L https://api.github.com/repos/pengwynn/octokit/tarball > octokit.tar.gz * * @param string $owner The name of the owner of the GitHub repository. * @param string $repo The name of the GitHub repository. diff --git a/libraries/joomla/http/transport/stream.php b/libraries/joomla/http/transport/stream.php index fd05d93ff0840..ab0a1fc4e7468 100644 --- a/libraries/joomla/http/transport/stream.php +++ b/libraries/joomla/http/transport/stream.php @@ -184,7 +184,6 @@ public function request($method, JUri $uri, $data = null, array $headers = null, } return $this->getResponse($headers, $content); - } /** diff --git a/libraries/joomla/image/image.php b/libraries/joomla/image/image.php index cd486d81c4d3f..6343c8c1a30d8 100644 --- a/libraries/joomla/image/image.php +++ b/libraries/joomla/image/image.php @@ -698,11 +698,33 @@ public function resize($width, $height, $createNew = true, $scaleMethod = self:: imagecolortransparent($handle, $color); imagefill($handle, 0, 0, $color); - imagecopyresized($handle, $this->handle, $offset->x, $offset->y, 0, 0, $dimensions->width, $dimensions->height, $this->getWidth(), $this->getHeight()); + imagecopyresized( + $handle, + $this->handle, + $offset->x, + $offset->y, + 0, + 0, + $dimensions->width, + $dimensions->height, + $this->getWidth(), + $this->getHeight() + ); } else { - imagecopyresampled($handle, $this->handle, $offset->x, $offset->y, 0, 0, $dimensions->width, $dimensions->height, $this->getWidth(), $this->getHeight()); + imagecopyresampled( + $handle, + $this->handle, + $offset->x, + $offset->y, + 0, + 0, + $dimensions->width, + $dimensions->height, + $this->getWidth(), + $this->getHeight() + ); } // If we are resizing to a new image, create a new JImage object. @@ -733,7 +755,7 @@ public function resize($width, $height, $createNew = true, $scaleMethod = self:: * * @param integer $width The desired width of the image in pixels or a percentage. * @param integer $height The desired height of the image in pixels or a percentage. - * @param integer $createNew If true the current image will be cloned, resized, cropped and returned. + * @param boolean $createNew If true the current image will be cloned, resized, cropped and returned. * * @return object JImage Object for chaining. * diff --git a/libraries/joomla/language/transliterate.php b/libraries/joomla/language/transliterate.php index 72d5432b9e4b7..83df5cda8da52 100644 --- a/libraries/joomla/language/transliterate.php +++ b/libraries/joomla/language/transliterate.php @@ -23,7 +23,7 @@ class JLanguageTransliterate * Returns strings transliterated from UTF-8 to Latin * * @param string $string String to transliterate - * @param boolean $case Optionally specify upper or lower case. Default to null. + * @param integer $case Optionally specify upper or lower case. Default to null. * * @return string Transliterated string * @@ -258,6 +258,7 @@ public static function utf8_latin_to_ascii($string, $case = 0) 'Ĕ' => 'E', 'Œ' => 'Oe'); } + $string = str_replace(array_keys($UTF8_UPPER_ACCENTS), array_values($UTF8_UPPER_ACCENTS), $string); } diff --git a/libraries/joomla/linkedin/companies.php b/libraries/joomla/linkedin/companies.php index 2877a9b5f64bb..52418147b867f 100644 --- a/libraries/joomla/linkedin/companies.php +++ b/libraries/joomla/linkedin/companies.php @@ -201,6 +201,7 @@ public function search($fields = null, $keywords = null, $hq = false, $facets = if ($facet) { $data['facet'] = array(); + for ($i = 0; $i < count($facet); $i++) { if ($facet[$i]) @@ -209,22 +210,27 @@ public function search($fields = null, $keywords = null, $hq = false, $facets = { $data['facet'][] = 'location,' . $facet[$i]; } + if ($i == 1) { $data['facet'][] = 'industry,' . $facet[$i]; } + if ($i == 2) { $data['facet'][] = 'network,' . $facet[$i]; } + if ($i == 3) { $data['facet'][] = 'company-size,' . $facet[$i]; } + if ($i == 4) { $data['facet'][] = 'num-followers-range,' . $facet[$i]; } + if ($i == 5) { $data['facet'][] = 'fortune,' . $facet[$i]; diff --git a/libraries/joomla/linkedin/jobs.php b/libraries/joomla/linkedin/jobs.php index 41cfd7fb6342e..9ebf9cc7ea713 100644 --- a/libraries/joomla/linkedin/jobs.php +++ b/libraries/joomla/linkedin/jobs.php @@ -311,6 +311,7 @@ public function search($fields = null, $keywords = null, $company_name = null, $ if ($facet) { $data['facet'] = array(); + for ($i = 0; $i < count($facet); $i++) { if ($facet[$i]) @@ -319,22 +320,27 @@ public function search($fields = null, $keywords = null, $company_name = null, $ { $data['facet'][] = 'company,' . $this->oauth->safeEncode($facet[$i]); } + if ($i == 1) { $data['facet'][] = 'date-posted,' . $facet[$i]; } + if ($i == 2) { $data['facet'][] = 'location,' . $facet[$i]; } + if ($i == 3) { $data['facet'][] = 'job-function,' . $this->oauth->safeEncode($facet[$i]); } + if ($i == 4) { $data['facet'][] = 'industry,' . $facet[$i]; } + if ($i == 5) { $data['facet'][] = 'salary,' . $facet[$i]; diff --git a/libraries/joomla/linkedin/oauth.php b/libraries/joomla/linkedin/oauth.php index 5f5feeb4ae260..be92cadba230e 100644 --- a/libraries/joomla/linkedin/oauth.php +++ b/libraries/joomla/linkedin/oauth.php @@ -20,9 +20,9 @@ class JLinkedinOauth extends JOAuth1Client { /** - * @var JRegistry Options for the JLinkedinOauth object. - * @since 13.1 - */ + * @var JRegistry Options for the JLinkedinOauth object. + * @since 13.1 + */ protected $options; /** diff --git a/libraries/joomla/linkedin/people.php b/libraries/joomla/linkedin/people.php index 970d7df2e5a65..7c750cf9eb1d5 100644 --- a/libraries/joomla/linkedin/people.php +++ b/libraries/joomla/linkedin/people.php @@ -75,6 +75,7 @@ public function getProfile($id = null, $url = null, $fields = null, $type = 'sta // Check if language is specified. $header = array(); + if ($language) { $header = array('Accept-Language' => $language); @@ -290,6 +291,7 @@ public function search($fields = null, $keywords = null, $first_name = null, $la if ($facet) { $data['facet'] = array(); + for ($i = 0; $i < count($facet); $i++) { if ($facet[$i]) @@ -298,26 +300,32 @@ public function search($fields = null, $keywords = null, $first_name = null, $la { $data['facet'][] = 'location,' . $facet[$i]; } + if ($i == 1) { $data['facet'][] = 'industry,' . $facet[$i]; } + if ($i == 2) { $data['facet'][] = 'network,' . $facet[$i]; } + if ($i == 3) { $data['facet'][] = 'language,' . $facet[$i]; } + if ($i == 4) { $data['facet'][] = 'current-company,' . $facet[$i]; } + if ($i == 5) { $data['facet'][] = 'past-company,' . $facet[$i]; } + if ($i == 6) { $data['facet'][] = 'school,' . $facet[$i]; diff --git a/libraries/joomla/log/entry.php b/libraries/joomla/log/entry.php index 4c2e9b2f179d7..9497582553c3c 100644 --- a/libraries/joomla/log/entry.php +++ b/libraries/joomla/log/entry.php @@ -85,6 +85,7 @@ public function __construct($message, $priority = JLog::INFO, $category = '', $d { $priority = JLog::INFO; } + $this->priority = $priority; // Sanitize category if it exists. diff --git a/libraries/joomla/log/log.php b/libraries/joomla/log/log.php index 638febf0294db..fe7e4f5491d57 100644 --- a/libraries/joomla/log/log.php +++ b/libraries/joomla/log/log.php @@ -178,6 +178,7 @@ public static function addLogger(array $options, $priorities = self::ALL, $categ { $options['logger'] = 'formattedtext'; } + $options['logger'] = strtolower($options['logger']); // Special case - if a Closure object is sent as the callback (in case of JLogLoggerCallback) @@ -247,7 +248,6 @@ protected function addLogEntry(JLogEntry $entry) // Attempt to instantiate the logger object if it doesn't already exist. if (empty($this->loggers[$signature])) { - $class = 'JLogLogger' . ucfirst($this->configurations[$signature]['logger']); if (class_exists($class)) @@ -261,7 +261,7 @@ protected function addLogEntry(JLogEntry $entry) } // Add the entry to the logger. - $this->loggers[$signature]->addEntry(clone($entry)); + $this->loggers[$signature]->addEntry(clone $entry); } } diff --git a/libraries/joomla/log/logger/formattedtext.php b/libraries/joomla/log/logger/formattedtext.php index f18d5839e7602..a17dedfc7025e 100644 --- a/libraries/joomla/log/logger/formattedtext.php +++ b/libraries/joomla/log/logger/formattedtext.php @@ -125,7 +125,6 @@ public function addEntry(JLogEntry $entry) // Set some default field values if not already set. if (!isset($entry->clientIP)) { - // Check for proxies as well. if (isset($_SERVER['REMOTE_ADDR'])) { @@ -144,7 +143,6 @@ public function addEntry(JLogEntry $entry) // If the time field is missing or the date field isn't only the date we need to rework it. if ((strlen($entry->date) != 10) || !isset($entry->time)) { - // Get the date and time strings in GMT. $entry->datetime = $entry->date->toISO8601(); $entry->time = $entry->date->format('H:i:s', false); @@ -192,6 +190,7 @@ protected function generateFileHeader() $head[] = '#'; $head[] = '#'; } + $head[] = '#Date: ' . gmdate('Y-m-d H:i:s') . ' UTC'; $head[] = '#Software: ' . JPlatform::getLongVersion(); $head[] = ''; @@ -218,7 +217,6 @@ protected function initFile() // If the file doesn't already exist we need to create it and generate the file header. if (!is_file($this->path)) { - // Make sure the folder exists in which to create the log file. JFolder::create(dirname($this->path)); @@ -235,6 +233,7 @@ protected function initFile() { throw new RuntimeException('Cannot open file for writing log'); } + if ($head) { if (!fwrite($this->file, $head)) diff --git a/libraries/joomla/log/logger/syslog.php b/libraries/joomla/log/logger/syslog.php index c8b2da44bd93c..a8a6aed890f30 100644 --- a/libraries/joomla/log/logger/syslog.php +++ b/libraries/joomla/log/logger/syslog.php @@ -82,6 +82,7 @@ public function __construct(array &$options) { $sysOptions = $sysOptions | LOG_PID; } + if ($this->options['sys_use_stderr']) { $sysOptions = $sysOptions | LOG_PERROR; diff --git a/libraries/joomla/mediawiki/http.php b/libraries/joomla/mediawiki/http.php index 8636e2abeec7c..ca0d31b059b6e 100644 --- a/libraries/joomla/mediawiki/http.php +++ b/libraries/joomla/mediawiki/http.php @@ -19,13 +19,13 @@ class JMediawikiHttp extends JHttp { /** - * Constructor. - * - * @param JRegistry $options Client options object. - * @param JHttpTransport $transport The HTTP transport object. - * - * @since 12.3 - */ + * Constructor. + * + * @param JRegistry $options Client options object. + * @param JHttpTransport $transport The HTTP transport object. + * + * @since 12.3 + */ public function __construct(JRegistry $options = null, JHttpTransport $transport = null) { // Override the JHttp contructor to use JHttpTransportStream. diff --git a/libraries/joomla/mediawiki/images.php b/libraries/joomla/mediawiki/images.php index 4786da46ac06c..a81577e1e5704 100644 --- a/libraries/joomla/mediawiki/images.php +++ b/libraries/joomla/mediawiki/images.php @@ -18,20 +18,19 @@ */ class JMediawikiImages extends JMediawikiObject { - /** - * Method to get all images contained on the given page(s). - * - * @param array $titles Page titles to retrieve images. - * @param integer $imagelimit How many images to return. - * @param boolean $imagecontinue When more results are available, use this to continue. - * @param integer $imimages Only list these images. - * @param string $imdir The direction in which to list. - * - * @return object - * - * @since 12.3 - */ + * Method to get all images contained on the given page(s). + * + * @param array $titles Page titles to retrieve images. + * @param integer $imagelimit How many images to return. + * @param boolean $imagecontinue When more results are available, use this to continue. + * @param integer $imimages Only list these images. + * @param string $imdir The direction in which to list. + * + * @return object + * + * @since 12.3 + */ public function getImages(array $titles, $imagelimit = null, $imagecontinue = null, $imimages = null, $imdir = null) { // Build the request. @@ -67,14 +66,14 @@ public function getImages(array $titles, $imagelimit = null, $imagecontinue = nu } /** - * Method to get all images contained on the given page(s). - * - * @param array $titles Page titles to retrieve links. - * - * @return object - * - * @since 12.3 - */ + * Method to get all images contained on the given page(s). + * + * @param array $titles Page titles to retrieve links. + * + * @return object + * + * @since 12.3 + */ public function getImagesUsed(array $titles) { // Build the request. @@ -90,22 +89,22 @@ public function getImagesUsed(array $titles) } /** - * Method to get all image information and upload history. - * - * @param array $liprop What image information to get. - * @param integer $lilimit How many image revisions to return. - * @param string $listart Timestamp to start listing from. - * @param string $liend Timestamp to stop listing at. - * @param integer $liurlwidth URL to an image scaled to this width will be returned.. - * @param integer $liurlheight URL to an image scaled to this height will be returned. - * @param string $limetadataversion Version of metadata to use. - * @param string $liurlparam A handler specific parameter string. - * @param boolean $licontinue When more results are available, use this to continue. - * - * @return object - * - * @since 12.3 - */ + * Method to get all image information and upload history. + * + * @param array $liprop What image information to get. + * @param integer $lilimit How many image revisions to return. + * @param string $listart Timestamp to start listing from. + * @param string $liend Timestamp to stop listing at. + * @param integer $liurlwidth URL to an image scaled to this width will be returned.. + * @param integer $liurlheight URL to an image scaled to this height will be returned. + * @param string $limetadataversion Version of metadata to use. + * @param string $liurlparam A handler specific parameter string. + * @param boolean $licontinue When more results are available, use this to continue. + * + * @return object + * + * @since 12.3 + */ public function getImageInfo(array $liprop = null, $lilimit = null, $listart = null, $liend = null, $liurlwidth = null, $liurlheight = null, $limetadataversion = null, $liurlparam = null, $licontinue = null) { @@ -164,24 +163,24 @@ public function getImageInfo(array $liprop = null, $lilimit = null, $listart = n } /** - * Method to enumerate all images. - * - * @param string $aifrom The image title to start enumerating from. - * @param string $aito The image title to stop enumerating at. - * @param string $aiprefix Search for all image titles that begin with this value. - * @param integer $aiminsize Limit to images with at least this many bytes. - * @param integer $aimaxsize Limit to images with at most this many bytes. - * @param integer $ailimit How many images in total to return. - * @param string $aidir The direction in which to list. - * @param string $aisha1 SHA1 hash of image. - * @param string $aisha1base36 SHA1 hash of image in base 36. - * @param array $aiprop What image information to get. - * @param string $aimime What MIME type to search for. - * - * @return object - * - * @since 12.3 - */ + * Method to enumerate all images. + * + * @param string $aifrom The image title to start enumerating from. + * @param string $aito The image title to stop enumerating at. + * @param string $aiprefix Search for all image titles that begin with this value. + * @param integer $aiminsize Limit to images with at least this many bytes. + * @param integer $aimaxsize Limit to images with at most this many bytes. + * @param integer $ailimit How many images in total to return. + * @param string $aidir The direction in which to list. + * @param string $aisha1 SHA1 hash of image. + * @param string $aisha1base36 SHA1 hash of image in base 36. + * @param array $aiprop What image information to get. + * @param string $aimime What MIME type to search for. + * + * @return object + * + * @since 12.3 + */ public function enumerateImages($aifrom = null, $aito = null, $aiprefix = null, $aiminsize = null, $aimaxsize = null, $ailimit = null, $aidir = null, $aisha1 = null, $aisha1base36 = null, array $aiprop = null, $aimime = null) { @@ -222,6 +221,7 @@ public function enumerateImages($aifrom = null, $aito = null, $aiprefix = null, { $path .= '&aidir=' . $aidir; } + if (isset($aisha1)) { $path .= '&aisha1=' . $aisha1; diff --git a/libraries/joomla/mediawiki/links.php b/libraries/joomla/mediawiki/links.php index 79c2d8ac17ba8..d3fc82433e7be 100644 --- a/libraries/joomla/mediawiki/links.php +++ b/libraries/joomla/mediawiki/links.php @@ -18,21 +18,20 @@ */ class JMediawikiLinks extends JMediawikiObject { - /** - * Method to return all links from the given page(s). - * - * @param array $titles Page titles to retrieve links. - * @param array $plnamespace Namespaces to get links. - * @param string $pllimit Number of links to return. - * @param string $plcontinue Continue when more results are available. - * @param array $pltitles List links to these titles. - * @param string $pldir Direction of listing. - * - * @return object - * - * @since 12.3 - */ + * Method to return all links from the given page(s). + * + * @param array $titles Page titles to retrieve links. + * @param array $plnamespace Namespaces to get links. + * @param string $pllimit Number of links to return. + * @param string $plcontinue Continue when more results are available. + * @param array $pltitles List links to these titles. + * @param string $pldir Direction of listing. + * + * @return object + * + * @since 12.3 + */ public function getLinks(array $titles, array $plnamespace = null, $pllimit = null, $plcontinue = null, array $pltitles = null, $pldir = null) { // Build the request. @@ -73,14 +72,14 @@ public function getLinks(array $titles, array $plnamespace = null, $pllimit = nu } /** - * Method to return info about the link pages. - * - * @param array $titles Page titles to retrieve links. - * - * @return object - * - * @since 12.3 - */ + * Method to return info about the link pages. + * + * @param array $titles Page titles to retrieve links. + * + * @return object + * + * @since 12.3 + */ public function getLinksUsed(array $titles) { // Build the request. @@ -96,20 +95,20 @@ public function getLinksUsed(array $titles) } /** - * Method to return all interwiki links from the given page(s). - * - * @param array $titles Page titles to retrieve links. - * @param boolean $iwurl Whether to get the full url. - * @param integer $iwlimit Number of interwiki links to return. - * @param boolean $iwcontinue When more results are available, use this to continue. - * @param string $iwprefix Prefix for the interwiki. - * @param string $iwtitle Interwiki link to search for. - * @param string $iwdir The direction in which to list. - * - * @return object - * - * @since 12.3 - */ + * Method to return all interwiki links from the given page(s). + * + * @param array $titles Page titles to retrieve links. + * @param boolean $iwurl Whether to get the full url. + * @param integer $iwlimit Number of interwiki links to return. + * @param boolean $iwcontinue When more results are available, use this to continue. + * @param string $iwprefix Prefix for the interwiki. + * @param string $iwtitle Interwiki link to search for. + * @param string $iwdir The direction in which to list. + * + * @return object + * + * @since 12.3 + */ public function getIWLinks(array $titles, $iwurl = false, $iwlimit = null, $iwcontinue = false, $iwprefix = null, $iwtitle = null, $iwdir = null) { // Build the request. @@ -155,20 +154,20 @@ public function getIWLinks(array $titles, $iwurl = false, $iwlimit = null, $iwco } /** - * Method to return all interlanguage links from the given page(s). - * - * @param array $titles Page titles to retrieve links. - * @param integer $lllimit Number of langauge links to return. - * @param boolean $llcontinue When more results are available, use this to continue. - * @param string $llurl Whether to get the full URL. - * @param string $lllang Language code. - * @param string $lltitle Link to search for. - * @param string $lldir The direction in which to list. - * - * @return object - * - * @since 12.3 - */ + * Method to return all interlanguage links from the given page(s). + * + * @param array $titles Page titles to retrieve links. + * @param integer $lllimit Number of langauge links to return. + * @param boolean $llcontinue When more results are available, use this to continue. + * @param string $llurl Whether to get the full URL. + * @param string $lllang Language code. + * @param string $lltitle Link to search for. + * @param string $lldir The direction in which to list. + * + * @return object + * + * @since 12.3 + */ public function getLangLinks(array $titles, $lllimit = null, $llcontinue = false, $llurl = null, $lllang = null, $lltitle = null, $lldir = null) { // Build the request. @@ -214,18 +213,18 @@ public function getLangLinks(array $titles, $lllimit = null, $llcontinue = false } /** - * Method to return all external urls from the given page(s). - * - * @param array $titles Page titles to retrieve links. - * @param integer $ellimit Number of links to return. - * @param string $eloffset When more results are available, use this to continue. - * @param string $elprotocol Protocol of the url. - * @param string $elquery Search string without protocol. - * - * @return object - * - * @since 12.3 - */ + * Method to return all external urls from the given page(s). + * + * @param array $titles Page titles to retrieve links. + * @param integer $ellimit Number of links to return. + * @param string $eloffset When more results are available, use this to continue. + * @param string $elprotocol Protocol of the url. + * @param string $elquery Search string without protocol. + * + * @return object + * + * @since 12.3 + */ public function getExtLinks(array $titles, $ellimit = null, $eloffset = null, $elprotocol = null, $elquery = null) { // Build the request. @@ -261,21 +260,21 @@ public function getExtLinks(array $titles, $ellimit = null, $eloffset = null, $e } /** - * Method to enumerate all links that point to a given namespace. - * - * @param boolean $alcontinue When more results are available, use this to continue. - * @param string $alfrom Start listing at this title. The title need not exist. - * @param string $alto The page title to stop enumerating at. - * @param string $alprefix Search for all page titles that begin with this value. - * @param string $alunique Only show unique links. - * @param array $alprop What pieces of information to include. - * @param string $alnamespace The namespace to enumerate. - * @param integer $allimit Number of links to return. - * - * @return object - * - * @since 12.3 - */ + * Method to enumerate all links that point to a given namespace. + * + * @param boolean $alcontinue When more results are available, use this to continue. + * @param string $alfrom Start listing at this title. The title need not exist. + * @param string $alto The page title to stop enumerating at. + * @param string $alprefix Search for all page titles that begin with this value. + * @param string $alunique Only show unique links. + * @param array $alprop What pieces of information to include. + * @param string $alnamespace The namespace to enumerate. + * @param integer $allimit Number of links to return. + * + * @return object + * + * @since 12.3 + */ public function enumerateLinks($alcontinue = false, $alfrom = null, $alto = null, $alprefix = null, $alunique = null, array $alprop = null, $alnamespace = null, $allimit = null) { diff --git a/libraries/joomla/mediawiki/mediawiki.php b/libraries/joomla/mediawiki/mediawiki.php index 979ebe1868a1a..cb66a6c147d08 100644 --- a/libraries/joomla/mediawiki/mediawiki.php +++ b/libraries/joomla/mediawiki/mediawiki.php @@ -81,13 +81,13 @@ class JMediawiki protected $search; /** - * Constructor. - * - * @param JRegistry $options MediaWiki options object. - * @param JMediawikiHttp $client The HTTP client object. - * - * @since 12.3 - */ + * Constructor. + * + * @param JRegistry $options MediaWiki options object. + * @param JMediawikiHttp $client The HTTP client object. + * + * @since 12.3 + */ public function __construct(JRegistry $options = null, JMediawikiHttp $client = null) { $this->options = isset($options) ? $options : new JRegistry; @@ -95,15 +95,15 @@ public function __construct(JRegistry $options = null, JMediawikiHttp $client = } /** - * Magic method to lazily create API objects - * - * @param string $name Name of property to retrieve - * - * @return JMediaWikiObject MediaWiki API object (users, reviews, etc). - * - * @since 12.3 - * @throws InvalidArgumentException - */ + * Magic method to lazily create API objects + * + * @param string $name Name of property to retrieve + * + * @return JMediaWikiObject MediaWiki API object (users, reviews, etc). + * + * @since 12.3 + * @throws InvalidArgumentException + */ public function __get($name) { $name = strtolower($name); @@ -132,29 +132,29 @@ public function __get($name) } /** - * Get an option from the JMediawiki instance. - * - * @param string $key The name of the option to get. - * - * @return mixed The option value. - * - * @since 12.3 - */ + * Get an option from the JMediawiki instance. + * + * @param string $key The name of the option to get. + * + * @return mixed The option value. + * + * @since 12.3 + */ public function getOption($key) { return $this->options->get($key); } /** - * Set an option for the JMediawiki instance. - * - * @param string $key The name of the option to set. - * @param mixed $value The option value to set. - * - * @return JMediawiki This object for method chaining. - * - * @since 12.3 - */ + * Set an option for the JMediawiki instance. + * + * @param string $key The name of the option to set. + * @param mixed $value The option value to set. + * + * @return JMediawiki This object for method chaining. + * + * @since 12.3 + */ public function setOption($key, $value) { $this->options->set($key, $value); diff --git a/libraries/joomla/mediawiki/object.php b/libraries/joomla/mediawiki/object.php index 1450225a432ca..e0d7c61e440f6 100644 --- a/libraries/joomla/mediawiki/object.php +++ b/libraries/joomla/mediawiki/object.php @@ -18,7 +18,6 @@ */ abstract class JMediawikiObject { - /** * @var JRegistry Options for the MediaWiki object. * @since 12.3 @@ -32,13 +31,13 @@ abstract class JMediawikiObject protected $client; /** - * Constructor. - * - * @param JRegistry $options Mediawiki options object. - * @param JMediawikiHttp $client The HTTP client object. - * - * @since 12.3 - */ + * Constructor. + * + * @param JRegistry $options Mediawiki options object. + * @param JMediawikiHttp $client The HTTP client object. + * + * @since 12.3 + */ public function __construct(JRegistry $options = null, JMediawikiHttp $client = null) { $this->options = isset($options) ? $options : new JRegistry; @@ -46,14 +45,14 @@ public function __construct(JRegistry $options = null, JMediawikiHttp $client = } /** - * Method to build and return a full request URL for the request. - * - * @param string $path URL to inflect - * - * @return string The request URL. - * - * @since 12.3 - */ + * Method to build and return a full request URL for the request. + * + * @param string $path URL to inflect + * + * @return string The request URL. + * + * @since 12.3 + */ protected function fetchUrl($path) { // Append the path with output format @@ -75,14 +74,14 @@ protected function fetchUrl($path) } /** - * Method to build request parameters from a string array. - * - * @param array $params string array that contains the parameters - * - * @return string request parameter - * - * @since 12.3 - */ + * Method to build request parameters from a string array. + * + * @param array $params string array that contains the parameters + * + * @return string request parameter + * + * @since 12.3 + */ public function buildParameter(array $params) { $path = ''; @@ -101,14 +100,16 @@ public function buildParameter(array $params) } /** - * Method to validate response for errors - * - * @param JHttpresponse $response reponse from the mediawiki server - * - * @return Object - * - * @since 12.3 - */ + * Method to validate response for errors + * + * @param JHttpresponse $response reponse from the mediawiki server + * + * @return Object + * + * @since 12.3 + * + * @throws DomainException + */ public function validateResponse($response) { $xml = simplexml_load_string($response->body); @@ -125,5 +126,4 @@ public function validateResponse($response) return $xml; } - } diff --git a/libraries/joomla/mediawiki/pages.php b/libraries/joomla/mediawiki/pages.php index 70c0cc3a83864..5b06ed27537ea 100644 --- a/libraries/joomla/mediawiki/pages.php +++ b/libraries/joomla/mediawiki/pages.php @@ -19,18 +19,18 @@ class JMediawikiPages extends JMediawikiObject { /** - * Method to edit a page. + * Method to edit a page. * * @param string $title Page title. * @param int $section Section number. * @param string $sectiontitle The title for a new section. * @param string $text Page content. * @param string $summary Title of the page you want to delete. - * - * @return object - * - * @since 12.3 - */ + * + * @return object + * + * @since 12.3 + */ public function editPage($title, $section = null, $sectiontitle = null, $text = null, $summary = null) { // Get the token. @@ -126,17 +126,17 @@ public function deletePageByID($pageid, $reason = null, $watchlist = null, $old } /** - * Method to restore certain revisions of a deleted page. + * Method to restore certain revisions of a deleted page. * * @param string $title Title of the page you want to restore. * @param string $reason Reason for restoring (optional). * @param string $timestamp Timestamps of the revisions to restore. * @param string $watchlist Unconditionally add or remove the page from your watchlist. - * - * @return object - * - * @since 12.3 - */ + * + * @return object + * + * @since 12.3 + */ public function undeletePage($title, $reason = null, $timestamp = null, $watchlist = null) { // Get the token. @@ -161,7 +161,7 @@ public function undeletePage($title, $reason = null, $timestamp = null, $watchli } /** - * Method to move a page. + * Method to move a page. * * @param string $from Title of the page you want to move. * @param string $to Title you want to rename the page to. @@ -171,11 +171,11 @@ public function undeletePage($title, $reason = null, $timestamp = null, $watchli * @param boolean $noredirect Don't create a redirect. * @param string $watchlist Unconditionally add or remove the page from your watchlist. * @param boolean $ignorewarnings Ignore any warnings. - * - * @return object - * - * @since 12.3 - */ + * + * @return object + * + * @since 12.3 + */ public function movePageByName($from, $to, $reason = null, $movetalk = null, $movesubpages = null, $noredirect = null, $watchlist =null, $ignorewarnings = null) { @@ -249,18 +249,18 @@ public function movePageByID($fromid, $to, $reason = null, $movetalk = null, $mo } /** - * Method to undo the last edit to the page. + * Method to undo the last edit to the page. * * @param string $title Title of the page you want to rollback. * @param string $user Name of the user whose edits are to be rolled back. * @param string $summary Custom edit summary. If not set, default summary will be used. * @param string $markbot Mark the reverted edits and the revert as bot edits. * @param string $watchlist Unconditionally add or remove the page from your watchlist. - * - * @return object - * - * @since 12.3 - */ + * + * @return object + * + * @since 12.3 + */ public function rollback($title, $user, $summary = null, $markbot = null, $watchlist = null) { // Get the token. @@ -286,7 +286,7 @@ public function rollback($title, $user, $summary = null, $markbot = null, $watch } /** - * Method to change the protection level of a page. + * Method to change the protection level of a page. * * @param string $title Title of the page you want to (un)protect. * @param string $protections Pipe-separated list of protection levels. @@ -294,11 +294,11 @@ public function rollback($title, $user, $summary = null, $markbot = null, $watch * @param string $reason Reason for (un)protecting (optional). * @param string $cascade Enable cascading protection. * @param string $watchlist Unconditionally add or remove the page from your watchlist. - * - * @return object - * - * @since 12.3 - */ + * + * @return object + * + * @since 12.3 + */ public function changeProtection($title, $protections, $expiry = null, $reason = null, $cascade = null, $watchlist = null) { // Get the token. @@ -325,17 +325,17 @@ public function changeProtection($title, $protections, $expiry = null, $reason = } /** - * Method to get basic page information. - * - * @param array $titles Page titles to retrieve info. - * @param array $inprop Which additional properties to get. - * @param array $intoken Request a token to perform a data-modifying action on a page - * @param boolean $incontinue When more results are available, use this to continue. - * - * @return object - * - * @since 12.3 - */ + * Method to get basic page information. + * + * @param array $titles Page titles to retrieve info. + * @param array $inprop Which additional properties to get. + * @param array $intoken Request a token to perform a data-modifying action on a page + * @param boolean $incontinue When more results are available, use this to continue. + * + * @return object + * + * @since 12.3 + */ public function getPageInfo(array $titles, array $inprop = null, array $intoken = null, $incontinue = null) { // Build the request @@ -366,16 +366,16 @@ public function getPageInfo(array $titles, array $inprop = null, array $intoken } /** - * Method to get various properties defined in the page content. - * - * @param array $titles Page titles to retrieve properties. - * @param boolean $ppcontinue When more results are available, use this to continue. - * @param string $ppprop Page prop to look on the page for. - * - * @return object - * - * @since 12.3 - */ + * Method to get various properties defined in the page content. + * + * @param array $titles Page titles to retrieve properties. + * @param boolean $ppcontinue When more results are available, use this to continue. + * @param string $ppprop Page prop to look on the page for. + * + * @return object + * + * @since 12.3 + */ public function getPageProperties(array $titles, $ppcontinue = null, $ppprop = null) { // Build the request @@ -401,17 +401,17 @@ public function getPageProperties(array $titles, $ppcontinue = null, $ppprop = n } /** - * Method to get a list of revisions. - * + * Method to get a list of revisions. + * * @param array $titles Page titles to retrieve revisions. * @param array $rvprop Which properties to get for each revision. * @param boolean $rvparse Parse revision content. * @param int $rvlimit Limit how many revisions will be returned. * - * @return object - * - * @since 12.3 - */ + * @return object + * + * @since 12.3 + */ public function getRevisions(array $titles, array $rvprop = null, $rvparse = null, $rvlimit = null) { // Build the request @@ -442,19 +442,19 @@ public function getRevisions(array $titles, array $rvprop = null, $rvparse = nul } /** - * Method to get all page templates from the given page. - * - * @param array $titles Page titles to retrieve templates. - * @param array $tlnamespace Show templates in this namespace(s) only. - * @param integer $tllimit How many templates to return. - * @param boolean $tlcontinue When more results are available, use this to continue. - * @param string $tltemplates Only list these templates. - * @param string $tldir The direction in which to list. - * - * @return object - * - * @since 12.3 - */ + * Method to get all page templates from the given page. + * + * @param array $titles Page titles to retrieve templates. + * @param array $tlnamespace Show templates in this namespace(s) only. + * @param integer $tllimit How many templates to return. + * @param boolean $tlcontinue When more results are available, use this to continue. + * @param string $tltemplates Only list these templates. + * @param string $tldir The direction in which to list. + * + * @return object + * + * @since 12.3 + */ public function getPageTemplates(array $titles, array $tlnamespace = null, $tllimit = null, $tlcontinue = null, $tltemplates = null, $tldir = null) { // Build the request. @@ -495,20 +495,20 @@ public function getPageTemplates(array $titles, array $tlnamespace = null, $tlli } /** - * Method to get all pages that link to the given page. - * - * @param string $bltitle Title to search. - * @param integer $blpageid Pageid to search. - * @param boolean $blcontinue When more results are available, use this to continue. - * @param array $blnamespace The namespace to enumerate. - * @param string $blfilterredirect How to filter for redirects.. - * @param integer $bllimit How many total pages to return. - * @param boolean $blredirect If linking page is a redirect, find all pages that link to that redirect as well. - * - * @return object - * - * @since 12.3 - */ + * Method to get all pages that link to the given page. + * + * @param string $bltitle Title to search. + * @param integer $blpageid Pageid to search. + * @param boolean $blcontinue When more results are available, use this to continue. + * @param array $blnamespace The namespace to enumerate. + * @param string $blfilterredirect How to filter for redirects.. + * @param integer $bllimit How many total pages to return. + * @param boolean $blredirect If linking page is a redirect, find all pages that link to that redirect as well. + * + * @return object + * + * @since 12.3 + */ public function getBackLinks($bltitle, $blpageid = null, $blcontinue = null, array $blnamespace = null, $blfilterredirect = null, $bllimit = null, $blredirect = null) { @@ -557,18 +557,18 @@ public function getBackLinks($bltitle, $blpageid = null, $blcontinue = null, arr } /** - * Method to get all pages that link to the given interwiki link. - * - * @param string $iwbltitle Interwiki link to search for. Must be used with iwblprefix. - * @param string $iwblprefix Prefix for the interwiki. - * @param boolean $iwblcontinue When more results are available, use this to continue. - * @param integer $iwbllimit How many total pages to return. - * @param array $iwblprop Which properties to get. - * - * @return object - * - * @since 12.3 - */ + * Method to get all pages that link to the given interwiki link. + * + * @param string $iwbltitle Interwiki link to search for. Must be used with iwblprefix. + * @param string $iwblprefix Prefix for the interwiki. + * @param boolean $iwblcontinue When more results are available, use this to continue. + * @param integer $iwbllimit How many total pages to return. + * @param array $iwblprop Which properties to get. + * + * @return object + * + * @since 12.3 + */ public function getIWBackLinks($iwbltitle, $iwblprefix = null, $iwblcontinue = null, $iwbllimit = null, array $iwblprop = null) { // Build the request diff --git a/libraries/joomla/mediawiki/search.php b/libraries/joomla/mediawiki/search.php index 63cc0c749c7f9..9bd13624cc922 100644 --- a/libraries/joomla/mediawiki/search.php +++ b/libraries/joomla/mediawiki/search.php @@ -18,23 +18,22 @@ */ class JMediawikiSearch extends JMediawikiObject { - /** - * Method to perform a full text search. - * - * @param string $srsearch Search for all page titles (or content) that has this value. - * @param array $srnamespace The namespace(s) to enumerate. - * @param string $srwhat Search inside the text or titles. - * @param array $srinfo What metadata to return. - * @param array $srprop What properties to return. - * @param boolean $srredirects Include redirect pages in the search. - * @param integer $sroffest Use this value to continue paging. - * @param integer $srlimit How many total pages to return. - * - * @return object - * - * @since 12.3 - */ + * Method to perform a full text search. + * + * @param string $srsearch Search for all page titles (or content) that has this value. + * @param array $srnamespace The namespace(s) to enumerate. + * @param string $srwhat Search inside the text or titles. + * @param array $srinfo What metadata to return. + * @param array $srprop What properties to return. + * @param boolean $srredirects Include redirect pages in the search. + * @param integer $sroffest Use this value to continue paging. + * @param integer $srlimit How many total pages to return. + * + * @return object + * + * @since 12.3 + */ public function search($srsearch, array $srnamespace = null, $srwhat = null, array $srinfo = null, array $srprop = null, $srredirects = null, $sroffest = null, $srlimit = null) { @@ -88,18 +87,18 @@ public function search($srsearch, array $srnamespace = null, $srwhat = null, arr } /** - * Method to search the wiki using opensearch protocol. - * - * @param string $search Search string. + * Method to search the wiki using opensearch protocol. + * + * @param string $search Search string. * @param integer $limit Maximum amount of results to return. - * @param array $namespace Namespaces to search. - * @param string $suggest Do nothing if $wgEnableOpenSearchSuggest is false. - * @param string $format Output format. - * - * @return object - * - * @since 12.3 - */ + * @param array $namespace Namespaces to search. + * @param string $suggest Do nothing if $wgEnableOpenSearchSuggest is false. + * @param string $format Output format. + * + * @return object + * + * @since 12.3 + */ public function openSearch($search, $limit = null, array $namespace = null, $suggest = null, $format = null) { // Build the request. diff --git a/libraries/joomla/mediawiki/sites.php b/libraries/joomla/mediawiki/sites.php index c588cb3833ceb..b32330ed7ca5b 100644 --- a/libraries/joomla/mediawiki/sites.php +++ b/libraries/joomla/mediawiki/sites.php @@ -19,18 +19,18 @@ class JMediawikiSites extends JMediawikiObject { /** - * Method to get site information. - * - * @param array $siprop The sysinfo properties to get. - * @param string $sifilteriw Only local or only non local entries to return. - * @param boolean $sishowalldb List all database servers. - * @param boolean $sinumberingroup List the number of users in usergroups. - * @param array $siinlanguagecode Language code for localized languages. - * - * @return object - * - * @since 12.3 - */ + * Method to get site information. + * + * @param array $siprop The sysinfo properties to get. + * @param string $sifilteriw Only local or only non local entries to return. + * @param boolean $sishowalldb List all database servers. + * @param boolean $sinumberingroup List the number of users in usergroups. + * @param array $siinlanguagecode Language code for localized languages. + * + * @return object + * + * @since 12.3 + */ public function getSiteInfo(array $siprop = null, $sifilteriw = null, $sishowalldb = false, $sinumberingroup = false, array $siinlanguagecode = null) { // Build the request. @@ -68,24 +68,24 @@ public function getSiteInfo(array $siprop = null, $sifilteriw = null, $sishowall } /** - * Method to get events from logs. - * - * @param array $leprop List of properties to get. - * @param string $letype Filter log actions to only this type. - * @param string $leaction Filter log actions to only this type. - * @param string $letitle Filter entries to those related to a page. - * @param string $leprefix Filter entries that start with this prefix. - * @param string $letag Filter entries with tag. - * @param string $leuser Filter entries made by the given user. - * @param string $lestart Starting timestamp. - * @param string $leend Ending timestamp. - * @param string $ledir Direction of enumeration. - * @param integer $lelimit Event limit to return. - * - * @return object - * - * @since 12.3 - */ + * Method to get events from logs. + * + * @param array $leprop List of properties to get. + * @param string $letype Filter log actions to only this type. + * @param string $leaction Filter log actions to only this type. + * @param string $letitle Filter entries to those related to a page. + * @param string $leprefix Filter entries that start with this prefix. + * @param string $letag Filter entries with tag. + * @param string $leuser Filter entries made by the given user. + * @param string $lestart Starting timestamp. + * @param string $leend Ending timestamp. + * @param string $ledir Direction of enumeration. + * @param integer $lelimit Event limit to return. + * + * @return object + * + * @since 12.3 + */ public function getEvents(array $leprop = null, $letype = null, $leaction = null, $letitle = null, $leprefix = null, $letag = null, $leuser = null, $lestart = null, $leend = null, $ledir = null, $lelimit = null) { @@ -154,26 +154,26 @@ public function getEvents(array $leprop = null, $letype = null, $leaction = null } /** - * Method to get recent changes on a site. - * - * @param string $rcstart Starting timestamp. - * @param string $rcend Ending timestamp. - * @param string $rcdir Direction of enumeration. - * @param array $rcnamespace Filter changes to only this namespace(s). - * @param string $rcuser Filter changes by this user. - * @param string $rcexcludeuser Filter changes to exclude changes by this user. - * @param string $rctag Filter changes by this tag. - * @param array $rcprop Filter log actions to only this type. - * @param array $rctoken Which token to obtain for each change. - * @param array $rcshow Filter changes by this criteria. - * @param string $rclimit Changes limit to return. - * @param string $rctype Filter event by type of changes. - * @param string $rctoponly Filter changes which are latest revision. - * - * @return object - * - * @since 12.3 - */ + * Method to get recent changes on a site. + * + * @param string $rcstart Starting timestamp. + * @param string $rcend Ending timestamp. + * @param string $rcdir Direction of enumeration. + * @param array $rcnamespace Filter changes to only this namespace(s). + * @param string $rcuser Filter changes by this user. + * @param string $rcexcludeuser Filter changes to exclude changes by this user. + * @param string $rctag Filter changes by this tag. + * @param array $rcprop Filter log actions to only this type. + * @param array $rctoken Which token to obtain for each change. + * @param array $rcshow Filter changes by this criteria. + * @param string $rclimit Changes limit to return. + * @param string $rctype Filter event by type of changes. + * @param string $rctoponly Filter changes which are latest revision. + * + * @return object + * + * @since 12.3 + */ public function getRecentChanges($rcstart = null, $rcend = null, $rcdir = null, array $rcnamespace = null, $rcuser = null, $rcexcludeuser = null, $rctag = null, array $rcprop = null, array $rctoken = null, array $rcshow = null, $rclimit = null, $rctype = null, $rctoponly = null) { @@ -252,20 +252,20 @@ public function getRecentChanges($rcstart = null, $rcend = null, $rcdir = null, } /** - * Method to get protected titles on a site. - * - * @param array $ptnamespace Only list titles in this namespace. - * @param array $ptlevel Only list titles with these protection level. - * @param integer $ptlimit Limit of pages to return. - * @param string $ptdir Direction of enumeration. - * @param string $ptstart Starting timestamp. - * @param string $ptend Ending timestamp. - * @param array $ptprop List of properties to get. - * - * @return object - * - * @since 12.3 - */ + * Method to get protected titles on a site. + * + * @param array $ptnamespace Only list titles in this namespace. + * @param array $ptlevel Only list titles with these protection level. + * @param integer $ptlimit Limit of pages to return. + * @param string $ptdir Direction of enumeration. + * @param string $ptstart Starting timestamp. + * @param string $ptend Ending timestamp. + * @param array $ptprop List of properties to get. + * + * @return object + * + * @since 12.3 + */ public function getProtectedTitles(array $ptnamespace = null, array $ptlevel = null, $ptlimit = null, $ptdir = null, $ptstart = null, $ptend = null, array $ptprop = null) { diff --git a/libraries/joomla/mediawiki/users.php b/libraries/joomla/mediawiki/users.php index eb86cea8c6b92..706ef3c6442a0 100644 --- a/libraries/joomla/mediawiki/users.php +++ b/libraries/joomla/mediawiki/users.php @@ -19,16 +19,16 @@ class JMediawikiUsers extends JMediawikiObject { /** - * Method to login and get authentication tokens. - * - * @param string $lgname User Name. - * @param string $lgpassword Password. - * @param string $lgdomain Domain (optional). - * - * @return object - * - * @since 12.3 - */ + * Method to login and get authentication tokens. + * + * @param string $lgname User Name. + * @param string $lgpassword Password. + * @param string $lgdomain Domain (optional). + * + * @return object + * + * @since 12.3 + */ public function login($lgname, $lgpassword, $lgdomain = null) { // Build the request path. @@ -91,15 +91,15 @@ public function logout() } /** - * Method to get user information. + * Method to get user information. * * @param array $ususers A list of users to obtain the same information for. * @param array $usprop What pieces of information to include. * - * @return object - * - * @since 12.3 - */ + * @return object + * + * @since 12.3 + */ public function getUserInfo(array $ususers, array $usprop = null) { // Build the request path. @@ -120,14 +120,14 @@ public function getUserInfo(array $ususers, array $usprop = null) } /** - * Method to get current user information. + * Method to get current user information. * * @param array $uiprop What pieces of information to include. - * - * @return object - * - * @since 12.3 - */ + * + * @return object + * + * @since 12.3 + */ public function getCurrentUserInfo(array $uiprop = null) { // Build the request path. @@ -145,25 +145,25 @@ public function getCurrentUserInfo(array $uiprop = null) } /** - * Method to get user contributions. - * - * @param string $ucuser The users to retrieve contributions for. + * Method to get user contributions. + * + * @param string $ucuser The users to retrieve contributions for. * @param string $ucuserprefix Retrieve contibutions for all users whose names begin with this value. - * @param integer $uclimit The users to retrieve contributions for. - * @param string $ucstart The start timestamp to return from. - * @param string $ucend The end timestamp to return to. - * @param boolean $uccontinue When more results are available, use this to continue. - * @param string $ucdir In which direction to enumerate. - * @param array $ucnamespace Only list contributions in these namespaces. - * @param array $ucprop Include additional pieces of information. - * @param array $ucshow Show only items that meet this criteria. - * @param string $uctag Only list revisions tagged with this tag. - * @param string $uctoponly Only list changes which are the latest revision - * - * @return object - * - * @since 12.3 - */ + * @param integer $uclimit The users to retrieve contributions for. + * @param string $ucstart The start timestamp to return from. + * @param string $ucend The end timestamp to return to. + * @param boolean $uccontinue When more results are available, use this to continue. + * @param string $ucdir In which direction to enumerate. + * @param array $ucnamespace Only list contributions in these namespaces. + * @param array $ucprop Include additional pieces of information. + * @param array $ucshow Show only items that meet this criteria. + * @param string $uctag Only list revisions tagged with this tag. + * @param string $uctoponly Only list changes which are the latest revision + * + * @return object + * + * @since 12.3 + */ public function getUserContribs($ucuser = null, $ucuserprefix = null, $uclimit = null, $ucstart = null, $ucend = null, $uccontinue = null, $ucdir = null, array $ucnamespace = null, array $ucprop = null, array $ucshow = null, $uctag = null, $uctoponly = null) { @@ -237,7 +237,7 @@ public function getUserContribs($ucuser = null, $ucuserprefix = null, $uclimit = } /** - * Method to block a user. + * Method to block a user. * * @param string $user Username, IP address or IP range you want to block. * @param string $expiry Relative expiry time, Default: never. @@ -250,11 +250,11 @@ public function getUserContribs($ucuser = null, $ucuserprefix = null, $uclimit = * @param boolean $allowusertalk Allow the user to edit their own talk page. * @param boolean $reblock If the user is already blocked, overwrite the existing block. * @param boolean $watchuser Watch the user/IP's user and talk pages. - * - * @return object - * - * @since 12.3 - */ + * + * @return object + * + * @since 12.3 + */ public function blockUser($user, $expiry = null, $reason = null, $anononly = null, $nocreate = null, $autoblock = null, $noemail = null, $hidename = null, $allowusertalk = null, $reblock = null, $watchuser = null) { @@ -287,15 +287,15 @@ public function blockUser($user, $expiry = null, $reason = null, $anononly = nul } /** - * Method to unblock a user. + * Method to unblock a user. * * @param string $user Username, IP address or IP range you want to unblock. * @param string $reason Reason for unblock (optional). - * - * @return object - * - * @since 12.3 - */ + * + * @return object + * + * @since 12.3 + */ public function unBlockUserByName($user, $reason = null) { // Get the token. @@ -350,17 +350,17 @@ public function unBlockUserByID($id, $reason = null) } /** - * Method to assign a user to a group. + * Method to assign a user to a group. * * @param string $username User name. * @param array $add Add the user to these groups. * @param array $remove Remove the user from these groups. * @param string $reason Reason for the change. - * - * @return object - * - * @since 12.3 - */ + * + * @return object + * + * @since 12.3 + */ public function assignGroup($username, $add = null, $remove = null, $reason = null) { // Get the token. @@ -385,17 +385,17 @@ public function assignGroup($username, $add = null, $remove = null, $reason = nu } /** - * Method to email a user. + * Method to email a user. * * @param string $target User to send email to. * @param string $subject Subject header. * @param string $text Mail body. * @param boolean $ccme Send a copy of this mail to me. - * - * @return object - * - * @since 12.3 - */ + * + * @return object + * + * @since 12.3 + */ public function emailUser($target, $subject = null, $text = null, $ccme = null) { // Get the token. diff --git a/libraries/joomla/oauth2/client.php b/libraries/joomla/oauth2/client.php index cccda9270505f..8f79595c27841 100644 --- a/libraries/joomla/oauth2/client.php +++ b/libraries/joomla/oauth2/client.php @@ -80,7 +80,6 @@ public function authenticate() if ($response->code >= 200 && $response->code < 400) { - if ($response->headers['Content-Type'] == 'application/json') { $token = array_merge(json_decode($response->body, true), array('created' => time())); @@ -105,6 +104,7 @@ public function authenticate() { $this->application->redirect($this->createUrl()); } + return false; } @@ -214,6 +214,7 @@ public function query($url, $data = null, $headers = array(), $method = 'get', $ { return false; } + $token = $this->refreshToken($token['refresh_token']); } @@ -231,6 +232,7 @@ public function query($url, $data = null, $headers = array(), $method = 'get', $ { $url .= '?'; } + $url .= $this->getOption('getparam') ? $this->getOption('getparam') : 'access_token'; $url .= '=' . $token['access_token']; } @@ -256,6 +258,7 @@ public function query($url, $data = null, $headers = array(), $method = 'get', $ { throw new RuntimeException('Error code ' . $response->code . ' received requesting data: ' . $response->body . '.'); } + return $response; } @@ -318,6 +321,7 @@ public function setToken($value) $value['expires_in'] = $value['expires']; unset($value['expires']); } + $this->setOption('accesstoken', $value); return $this; @@ -349,8 +353,10 @@ public function refreshToken($token = null) { throw new RuntimeException('No refresh token is available.'); } + $token = $token['refresh_token']; } + $data['grant_type'] = 'refresh_token'; $data['refresh_token'] = $token; $data['client_id'] = $this->getOption('clientid'); diff --git a/libraries/joomla/object/object.php b/libraries/joomla/object/object.php index 8ce16d69dbebf..2eccee7080ebb 100644 --- a/libraries/joomla/object/object.php +++ b/libraries/joomla/object/object.php @@ -73,6 +73,7 @@ public function __toString() public function def($property, $default = null) { $value = $this->get($property, $default); + return $this->set($property, $value); } @@ -94,6 +95,7 @@ public function get($property, $default = null) { return $this->$property; } + return $default; } @@ -111,6 +113,7 @@ public function get($property, $default = null) public function getProperties($public = true) { $vars = get_object_vars($this); + if ($public) { foreach ($vars as $key => $value) @@ -192,6 +195,7 @@ public function set($property, $value = null) { $previous = isset($this->$property) ? $this->$property : null; $this->$property = $value; + return $previous; } @@ -215,6 +219,7 @@ public function setProperties($properties) // Use the set function which might be overridden. $this->set($k, $v); } + return true; } diff --git a/libraries/joomla/openstreetmap/info.php b/libraries/joomla/openstreetmap/info.php index b3ba0600202e0..b3a29edda4c95 100644 --- a/libraries/joomla/openstreetmap/info.php +++ b/libraries/joomla/openstreetmap/info.php @@ -15,7 +15,7 @@ * @package Joomla.Platform * @subpackage Openstreetmap * @since 13.1 -*/ + */ class JOpenstreetmapInfo extends JOpenstreetmapObject { /** diff --git a/libraries/joomla/openstreetmap/user.php b/libraries/joomla/openstreetmap/user.php index 8798daecefbd1..7e09d1b37c92f 100644 --- a/libraries/joomla/openstreetmap/user.php +++ b/libraries/joomla/openstreetmap/user.php @@ -15,7 +15,7 @@ * @package Joomla.Platform * @subpackage Openstreetmap * @since 13.1 -*/ + */ class JOpenstreetmapUser extends JOpenstreetmapObject { /** diff --git a/libraries/joomla/session/session.php b/libraries/joomla/session/session.php index d636d40ddb17d..248a69b9f1a83 100644 --- a/libraries/joomla/session/session.php +++ b/libraries/joomla/session/session.php @@ -158,6 +158,7 @@ public function __get($name) if ($name === 'state' || $name === 'expire') { $property = '_' . $name; + return $this->$property; } } @@ -257,6 +258,7 @@ public function hasToken($tCheck, $forceExpire = true) { $this->_state = 'expired'; } + return false; } @@ -321,6 +323,7 @@ public static function checkToken($method = 'post') if (!$app->input->$method->get($token, '', 'alnum')) { $session = JFactory::getSession(); + if ($session->isNew()) { // Redirect to login screen. @@ -352,6 +355,7 @@ public function getName() // @TODO : raise error return null; } + return session_name(); } @@ -369,6 +373,7 @@ public function getId() // @TODO : raise error return null; } + return session_id(); } @@ -439,6 +444,7 @@ public function isActive() public function isNew() { $counter = $this->get('session.counter'); + return (bool) ($counter === 1); } @@ -478,6 +484,7 @@ public function get($name, $default = null, $namespace = 'default') { // @TODO :: generated error here $error = null; + return $error; } @@ -485,6 +492,7 @@ public function get($name, $default = null, $namespace = 'default') { return $_SESSION[$namespace][$name]; } + return $default; } @@ -570,6 +578,7 @@ public function clear($name, $namespace = 'default') } $value = null; + if (isset($_SESSION[$namespace][$name])) { $value = $_SESSION[$namespace][$name]; @@ -698,6 +707,7 @@ public function destroy() session_destroy(); $this->_state = 'destroyed'; + return true; } @@ -712,6 +722,7 @@ public function destroy() public function restart() { $this->destroy(); + if ($this->_state !== 'destroyed') { // @TODO :: generated error here @@ -799,6 +810,7 @@ public function close() protected function _setCookieParams() { $cookie = session_get_cookie_params(); + if ($this->_force_ssl) { $cookie['secure'] = true; @@ -815,6 +827,7 @@ protected function _setCookieParams() { $cookie['path'] = $config->get('cookie_path'); } + session_set_cookie_params($cookie['lifetime'], $cookie['path'], $cookie['domain'], $cookie['secure'], true); } @@ -833,6 +846,7 @@ protected function _createToken($length = 32) $max = strlen($chars) - 1; $token = ''; $name = session_name(); + for ($i = 0; $i < $length; ++$i) { $token .= $chars[(rand(0, $max))]; @@ -854,6 +868,7 @@ protected function _setCounter() ++$counter; $this->set('session.counter', $counter); + return true; } @@ -966,6 +981,7 @@ protected function _validate($restart = false) if ($maxTime < $curTime) { $this->_state = 'expired'; + return false; } } @@ -988,6 +1004,7 @@ protected function _validate($restart = false) elseif ($_SERVER['REMOTE_ADDR'] !== $ip) { $this->_state = 'error'; + return false; } } diff --git a/libraries/joomla/session/storage/apc.php b/libraries/joomla/session/storage/apc.php index 5ac829747a663..7725d6e1a415d 100644 --- a/libraries/joomla/session/storage/apc.php +++ b/libraries/joomla/session/storage/apc.php @@ -50,6 +50,7 @@ public function __construct($options = array()) public function read($id) { $sess_id = 'sess_' . $id; + return (string) apc_fetch($sess_id); } @@ -66,6 +67,7 @@ public function read($id) public function write($id, $session_data) { $sess_id = 'sess_' . $id; + return apc_store($sess_id, $session_data, ini_get("session.gc_maxlifetime")); } @@ -81,6 +83,7 @@ public function write($id, $session_data) public function destroy($id) { $sess_id = 'sess_' . $id; + return apc_delete($sess_id); } diff --git a/libraries/joomla/session/storage/database.php b/libraries/joomla/session/storage/database.php index 073a5d49bc919..8283695490018 100644 --- a/libraries/joomla/session/storage/database.php +++ b/libraries/joomla/session/storage/database.php @@ -82,6 +82,7 @@ public function write($id, $data) // Try to update the session data in the database table. $db->setQuery($query); + if (!$db->execute()) { return false; diff --git a/libraries/joomla/session/storage/xcache.php b/libraries/joomla/session/storage/xcache.php index b6447b601dc60..61204bf09aabc 100644 --- a/libraries/joomla/session/storage/xcache.php +++ b/libraries/joomla/session/storage/xcache.php @@ -71,6 +71,7 @@ public function read($id) public function write($id, $session_data) { $sess_id = 'sess_' . $id; + return xcache_set($sess_id, $session_data, ini_get("session.gc_maxlifetime")); } diff --git a/libraries/joomla/string/punycode.php b/libraries/joomla/string/punycode.php index 85786c2cb4fb1..b120a6e2f0cc5 100644 --- a/libraries/joomla/string/punycode.php +++ b/libraries/joomla/string/punycode.php @@ -54,7 +54,6 @@ public static function fromPunycode($punycodeString) $idn = new idna_convert; return $idn->decode($punycodeString); - } /** diff --git a/libraries/joomla/string/string.php b/libraries/joomla/string/string.php index 620f501b7d933..f280290a76e7b 100644 --- a/libraries/joomla/string/string.php +++ b/libraries/joomla/string/string.php @@ -157,9 +157,9 @@ public static function increment($string, $style = 'default', $n = 0) * * Find position of first occurrence of a string. * - * @param string $str String being examined - * @param string $search String being searched for - * @param integer $offset Optional, specifies the position from which the search should be performed + * @param string $str String being examined + * @param string $search String being searched for + * @param mixed $offset Optional, specifies the position from which the search should be performed * * @return mixed Number of characters before the first match or FALSE on failure * @@ -202,7 +202,7 @@ public static function strrpos($str, $search, $offset = 0) * * @param string $str String being processed * @param integer $offset Number of UTF-8 characters offset (from left) - * @param integer $length Optional length in UTF-8 characters from offset + * @param mixed $length Optional length in UTF-8 characters from offset * * @return mixed string or FALSE if failure * @@ -582,7 +582,7 @@ public static function substr_replace($str, $repl, $start, $length = null) * work normally on a UTF-8 string * * @param string $str The string to be trimmed - * @param string $charlist The optional charlist of additional characters to trim + * @param mixed $charlist The optional charlist of additional characters to trim * * @return string The trimmed string * @@ -616,7 +616,7 @@ public static function ltrim($str, $charlist = false) * work normally on a UTF-8 string * * @param string $str The string to be trimmed - * @param string $charlist The optional charlist of additional characters to trim + * @param mixed $charlist The optional charlist of additional characters to trim * * @return string The trimmed string * @@ -650,7 +650,7 @@ public static function rtrim($str, $charlist = false) * work normally on a UTF-8 string * * @param string $str The string to be trimmed - * @param string $charlist The optional charlist of additional characters to trim + * @param mixed $charlist The optional charlist of additional characters to trim * * @return string The trimmed string * @@ -705,6 +705,7 @@ public static function ucfirst($str, $delimiter = null, $newDelimiter = null) { $newDelimiter = $delimiter; } + return implode($newDelimiter, array_map('utf8_ucfirst', explode($delimiter, $str))); } } @@ -844,7 +845,6 @@ public static function valid($str) $mUcs4 = ($mUcs4 & 1) << 30; $mState = 5; $mBytes = 6; - } else { diff --git a/libraries/joomla/table/extension.php b/libraries/joomla/table/extension.php index 2cd6ae8032e8f..b789c104ea181 100644 --- a/libraries/joomla/table/extension.php +++ b/libraries/joomla/table/extension.php @@ -48,6 +48,7 @@ public function check() return false; } + return true; } diff --git a/libraries/joomla/table/nested.php b/libraries/joomla/table/nested.php index 6d178fd248b64..d6d209549c07a 100644 --- a/libraries/joomla/table/nested.php +++ b/libraries/joomla/table/nested.php @@ -559,6 +559,7 @@ public function delete($pk = null, $children = true) return false; } + $asset->_unlock(); } else @@ -1322,6 +1323,7 @@ public function rebuild($parentId = null, $leftId = 0, $level = 0, $path = '') { $query->order('parent_id, lft'); } + $this->_cache['rebuild.sql'] = (string) $query; } @@ -1679,8 +1681,10 @@ protected function _logtable($showData = true, $showQuery = true) { $buffer .= sprintf("\n| %4s | %4s | %4s | %4s |", $row[0], $row[1], $row[2], $row[3]); } + $buffer .= $sep; } + echo $buffer; } diff --git a/libraries/joomla/table/observer/tags.php b/libraries/joomla/table/observer/tags.php index 8f3f14f402b79..7e4a642a9504f 100644 --- a/libraries/joomla/table/observer/tags.php +++ b/libraries/joomla/table/observer/tags.php @@ -103,6 +103,7 @@ public static function createObserver(JObservableInterface $observableObject, $p public function onBeforeStore($updateNulls, $tableKey) { $this->parseTypeAlias(); + if (empty($this->table->tagsHelper->tags)) { $this->tagsHelper->preStoreProcess($this->table); diff --git a/libraries/joomla/table/table.php b/libraries/joomla/table/table.php index 48df5f8cab8a2..85fe20f78fb87 100644 --- a/libraries/joomla/table/table.php +++ b/libraries/joomla/table/table.php @@ -688,6 +688,7 @@ public function load($keys = null, $reset = true) { throw new InvalidArgumentException('Table has multiple primary keys specified, only one primary key value provided.'); } + $keys = array($this->getKeyName() => $keys); } else @@ -969,6 +970,7 @@ public function delete($pk = null) { throw new UnexpectedValueException('Null primary key not allowed.'); } + $this->$key = $pk[$key]; } diff --git a/libraries/joomla/table/update.php b/libraries/joomla/table/update.php index 6e931e34cde89..0c7931a5c7c91 100644 --- a/libraries/joomla/table/update.php +++ b/libraries/joomla/table/update.php @@ -48,6 +48,7 @@ public function check() return false; } + return true; } diff --git a/libraries/joomla/table/user.php b/libraries/joomla/table/user.php index c7837beefe880..8406eb843c6ba 100644 --- a/libraries/joomla/table/user.php +++ b/libraries/joomla/table/user.php @@ -150,7 +150,6 @@ public function bind($array, $ignore = '') // Set the titles for the user groups. $this->groups = $this->_db->loadAssocList('id', 'id'); - } return $return; diff --git a/libraries/joomla/twitter/friends.php b/libraries/joomla/twitter/friends.php index 33847cebd274c..84575e323ad1f 100644 --- a/libraries/joomla/twitter/friends.php +++ b/libraries/joomla/twitter/friends.php @@ -363,10 +363,12 @@ public function getFriendshipsLookup($screen_name = null, $id = null) { $data['user_id'] = $id; } + if ($screen_name) { $data['screen_name'] = $screen_name; } + if ($id == null && $screen_name == null) { // We don't have a valid entry diff --git a/libraries/joomla/twitter/lists.php b/libraries/joomla/twitter/lists.php index 021af90e2b713..33d158eb0dcff 100644 --- a/libraries/joomla/twitter/lists.php +++ b/libraries/joomla/twitter/lists.php @@ -151,7 +151,6 @@ public function getStatuses($list, $owner = null, $since_id = 0, $max_id = 0, $c // Send the request. return $this->sendRequest($path, 'GET', $data); - } /** @@ -227,7 +226,6 @@ public function getSubscribers($list, $owner = null, $cursor = null, $entities = // Send the request. return $this->sendRequest($path, 'GET', $data); - } /** @@ -279,10 +277,12 @@ public function deleteMembers($list, $user_id = null, $screen_name = null, $owne { $data['user_id'] = $user_id; } + if ($screen_name) { $data['screen_name'] = $screen_name; } + if ($user_id == null && $screen_name == null) { // We don't have a valid entry @@ -620,10 +620,12 @@ public function addMembers($list, $user_id = null, $screen_name = null, $owner = { $data['user_id'] = $user_id; } + if ($screen_name) { $data['screen_name'] = $screen_name; } + if ($user_id == null && $screen_name == null) { // We don't have a valid entry @@ -703,7 +705,6 @@ public function getMembers($list, $owner = null, $entities = null, $skip_status // Send the request. return $this->sendRequest($path, 'GET', $data); - } /** diff --git a/libraries/joomla/twitter/oauth.php b/libraries/joomla/twitter/oauth.php index 9267f2055ff20..bb856a81a4e1b 100644 --- a/libraries/joomla/twitter/oauth.php +++ b/libraries/joomla/twitter/oauth.php @@ -20,9 +20,9 @@ class JTwitterOAuth extends JOAuth1Client { /** - * @var JRegistry Options for the JTwitterOauth object. - * @since 12.3 - */ + * @var JRegistry Options for the JTwitterOauth object. + * @since 12.3 + */ protected $options; /** diff --git a/libraries/joomla/twitter/users.php b/libraries/joomla/twitter/users.php index 5d1d3a64ade45..5f077e4b06182 100644 --- a/libraries/joomla/twitter/users.php +++ b/libraries/joomla/twitter/users.php @@ -41,10 +41,12 @@ public function getUsersLookup($screen_name = null, $id = null, $entities = null { $data['user_id'] = $id; } + if ($screen_name) { $data['screen_name'] = $screen_name; } + if ($id == null && $screen_name == null) { // We don't have a valid entry diff --git a/libraries/joomla/updater/adapters/collection.php b/libraries/joomla/updater/adapters/collection.php index e3f1518d62193..1d56ab99d5133 100644 --- a/libraries/joomla/updater/adapters/collection.php +++ b/libraries/joomla/updater/adapters/collection.php @@ -118,19 +118,23 @@ public function _startElement($parser, $name, $attrs = array()) case 'EXTENSION': $update = JTable::getInstance('update'); $update->set('update_site_id', $this->updateSiteId); + foreach ($this->updatecols as $col) { // Reset the values if it doesn't exist if (!array_key_exists($col, $attrs)) { $attrs[$col] = ''; + if ($col == 'CLIENT') { $attrs[$col] = 'site'; } } } + $client = JApplicationHelper::getClientInfo($attrs['CLIENT'], 1); + if (isset($client->id)) { $attrs['CLIENT_ID'] = $client->id; @@ -190,6 +194,7 @@ public function _startElement($parser, $name, $attrs = array()) protected function _endElement($parser, $name) { array_pop($this->stack); + switch ($name) { case 'CATEGORY': @@ -231,6 +236,7 @@ public function findUpdate($options) { $url .= '/'; } + $url .= 'update.xml'; } @@ -257,6 +263,7 @@ public function findUpdate($options) if (!$appendExtension && (substr($url, -4) != '.xml')) { $options['append_extension'] = true; + return $this->findUpdate($options); } @@ -284,6 +291,7 @@ public function findUpdate($options) if (!$appendExtension && (substr($url, -4) != '.xml')) { $options['append_extension'] = true; + return $this->findUpdate($options); } diff --git a/libraries/joomla/updater/adapters/extension.php b/libraries/joomla/updater/adapters/extension.php index fc139c090cdbc..b57ad61ac1a31 100644 --- a/libraries/joomla/updater/adapters/extension.php +++ b/libraries/joomla/updater/adapters/extension.php @@ -61,10 +61,12 @@ protected function _startElement($parser, $name, $attrs = array()) $name = strtolower($name); $this->currentUpdate->$name = ''; } + if ($name == 'TARGETPLATFORM') { $this->currentUpdate->targetplatform = $attrs; } + if ($name == 'PHP_MINIMUM') { $this->currentUpdate->php_minimum = ''; @@ -205,6 +207,7 @@ public function findUpdate($options) { $url .= '/'; } + $url .= 'extension.xml'; } @@ -228,6 +231,7 @@ public function findUpdate($options) if (!$appendExtension && (substr($url, -4) != '.xml')) { $options['append_extension'] = true; + return $this->findUpdate($options); } @@ -256,6 +260,7 @@ public function findUpdate($options) if (!$appendExtension && (substr($url, -4) != '.xml')) { $options['append_extension'] = true; + return $this->findUpdate($options); } diff --git a/libraries/joomla/updater/update.php b/libraries/joomla/updater/update.php index 0b42a16d97de7..2164fda778c57 100644 --- a/libraries/joomla/updater/update.php +++ b/libraries/joomla/updater/update.php @@ -252,6 +252,7 @@ public function _startElement($parser, $name, $attrs = array()) { $this->currentUpdate->$name = new stdClass; } + $this->currentUpdate->$name->_data = ''; foreach ($attrs as $key => $data) @@ -277,6 +278,7 @@ public function _startElement($parser, $name, $attrs = array()) public function _endElement($parser, $name) { array_pop($this->stack); + switch ($name) { // Closing update, find the latest version and check @@ -325,6 +327,7 @@ public function _endElement($parser, $name) { $this->$key = $val; } + unset($this->latest); unset($this->currentUpdate); } @@ -357,6 +360,7 @@ public function _characterData($parser, $data) // Throw the data for this item together $tag = strtolower($tag); + if (isset($this->currentUpdate->$tag)) { $this->currentUpdate->$tag->_data .= $data; diff --git a/libraries/joomla/updater/updater.php b/libraries/joomla/updater/updater.php index f585d8a62af1f..1950c79e291fd 100644 --- a/libraries/joomla/updater/updater.php +++ b/libraries/joomla/updater/updater.php @@ -55,6 +55,7 @@ public static function getInstance() { self::$instance = new JUpdater; } + return self::$instance; } @@ -97,15 +98,18 @@ public function findUpdates($eid = 0, $cacheTimeout = 0) $results = $db->loadAssocList(); $result_count = count($results); $now = time(); + for ($i = 0; $i < $result_count; $i++) { $result = &$results[$i]; $this->setAdapter($result['type']); + if (!isset($this->_adapters[$result['type']])) { // Ignore update sites requiring adapters we don't have installed continue; } + if ($cacheTimeout > 0) { if (isset($result['last_check_timestamp']) && ($now - $result['last_check_timestamp'] <= $cacheTimeout)) @@ -116,7 +120,9 @@ public function findUpdates($eid = 0, $cacheTimeout = 0) continue; } } + $update_result = $this->_adapters[$result['type']]->findUpdate($result); + if (is_array($update_result)) { if (array_key_exists('update_sites', $update_result) && count($update_result['update_sites'])) @@ -159,6 +165,7 @@ public function findUpdates($eid = 0, $cacheTimeout = 0) // We have an installed extension, check the update is actually newer $extension->load($eid); $data = json_decode($extension->manifest_cache, true); + if (version_compare($current_update->version, $data['version'], '>') == 1) { $current_update->extension_id = $eid; @@ -193,6 +200,7 @@ public function findUpdates($eid = 0, $cacheTimeout = 0) $db->setQuery($query); $db->execute(); } + return $retval; } @@ -210,11 +218,12 @@ public function update($id) $updaterow = JTable::getInstance('update'); $updaterow->load($id); $update = new JUpdate; + if ($update->loadFromXML($updaterow->detailsurl)) { return $update->install(); } + return false; } - } diff --git a/libraries/joomla/user/authentication.php b/libraries/joomla/user/authentication.php index 9ac3000f4fd23..1b05e07318744 100644 --- a/libraries/joomla/user/authentication.php +++ b/libraries/joomla/user/authentication.php @@ -292,6 +292,7 @@ public function authenticate($credentials, $options = array()) { $response->type = isset($plugin->_name) ? $plugin->_name : $plugin->name; } + break; } } diff --git a/libraries/joomla/user/helper.php b/libraries/joomla/user/helper.php index 4b3a1b0bd5471..c6baa346e26b3 100644 --- a/libraries/joomla/user/helper.php +++ b/libraries/joomla/user/helper.php @@ -450,6 +450,7 @@ public static function getCryptedPassword($plaintext, $salt = '', $encryption = { $context .= substr($binary, 0, ($i > 16 ? 16 : $i)); } + for ($i = $length; $i > 0; $i >>= 1) { $context .= ($i & 1) ? chr(0) : $plaintext[0]; @@ -465,10 +466,12 @@ public static function getCryptedPassword($plaintext, $salt = '', $encryption = { $new .= $salt; } + if ($i % 7) { $new .= $plaintext; } + $new .= ($i & 1) ? substr($binary, 0, 16) : $plaintext; $binary = static::_bin(md5($new)); } @@ -484,6 +487,7 @@ public static function getCryptedPassword($plaintext, $salt = '', $encryption = { $j = 5; } + $p[] = static::_toAPRMD5((ord($binary[$i]) << 16) | (ord($binary[$k]) << 8) | (ord($binary[$j])), 5); } @@ -683,6 +687,7 @@ protected static function _toAPRMD5($value, $count) $aprmd5 .= $APRMD5[$value & 0x3f]; $value >>= 6; } + return $aprmd5; } @@ -705,6 +710,7 @@ private static function _bin($hex) $tmp = sscanf(substr($hex, $i, 2), '%x'); $bin .= chr(array_shift($tmp)); } + return $bin; } diff --git a/libraries/joomla/user/user.php b/libraries/joomla/user/user.php index bea0e420865be..95bebe4658f58 100644 --- a/libraries/joomla/user/user.php +++ b/libraries/joomla/user/user.php @@ -570,6 +570,7 @@ public function bind(&$array) return false; } + $this->password_clear = JArrayHelper::getValue($array, 'password', '', 'string'); $array['password'] = JUserHelper::hashPassword($array['password']); diff --git a/libraries/joomla/view/html.php b/libraries/joomla/view/html.php index 29441b9a036f7..20b8c7f43b74d 100644 --- a/libraries/joomla/view/html.php +++ b/libraries/joomla/view/html.php @@ -107,7 +107,7 @@ public function getPath($layout) $file = JPath::clean($layout . '.php'); // Find the layout file path. - $path = JPath::find(clone($this->paths), $file); + $path = JPath::find(clone $this->paths, $file); return $path; } diff --git a/libraries/legacy/base/node.php b/libraries/legacy/base/node.php index 3bacfad6a321a..3ad307dbd03ce 100644 --- a/libraries/legacy/base/node.php +++ b/libraries/legacy/base/node.php @@ -87,14 +87,17 @@ public function setParent(&$parent) if ($parent instanceof JNode || is_null($parent)) { $hash = spl_object_hash($this); + if (!is_null($this->_parent)) { unset($this->_parent->children[$hash]); } + if (!is_null($parent)) { $parent->_children[$hash] = & $this; } + $this->_parent = & $parent; } } diff --git a/libraries/legacy/base/tree.php b/libraries/legacy/base/tree.php index 1f5322f352191..09b5aceef6ce9 100644 --- a/libraries/legacy/base/tree.php +++ b/libraries/legacy/base/tree.php @@ -64,6 +64,7 @@ public function addChild(&$node, $setCurrent = false) JLog::add('JTree::addChild() is deprecated.', JLog::WARNING, 'deprecated'); $this->_current->addChild($node); + if ($setCurrent) { $this->_current = &$node; diff --git a/libraries/legacy/categories/categories.php b/libraries/legacy/categories/categories.php index e41c82ffaa693..fe15a4ddf88e9 100644 --- a/libraries/legacy/categories/categories.php +++ b/libraries/legacy/categories/categories.php @@ -138,6 +138,7 @@ public static function getInstance($extension, $options = array()) if (!class_exists($classname)) { $path = JPATH_SITE . '/components/' . $component . '/helpers/category.php'; + if (is_file($path)) { include_once $path; @@ -664,6 +665,7 @@ public function __construct($category = null, $constructor = null) if ($category) { $this->setProperties($category); + if ($constructor) { $this->_constructor = $constructor; @@ -709,6 +711,7 @@ public function setParent($parent) { $this->_path = $parent->getPath(); } + $this->_path[] = $this->id . ':' . $this->alias; } @@ -769,6 +772,7 @@ public function &getChildren($recursive = false) if (!$this->_allChildrenloaded) { $temp = $this->_constructor->get($this->id, true); + if ($temp) { $this->_children = $temp->getChildren(); @@ -781,11 +785,13 @@ public function &getChildren($recursive = false) if ($recursive) { $items = array(); + foreach ($this->_children as $child) { $items[] = $child; $items = array_merge($items, $child->getChildren(true)); } + return $items; } @@ -960,6 +966,7 @@ public function getAuthor($modified_user = false) public function setAllLoaded() { $this->_allChildrenloaded = true; + foreach ($this->_children as $child) { $child->setAllLoaded(); diff --git a/libraries/legacy/controller/admin.php b/libraries/legacy/controller/admin.php index ce2f592164bda..24a2dceef64f2 100644 --- a/libraries/legacy/controller/admin.php +++ b/libraries/legacy/controller/admin.php @@ -90,10 +90,12 @@ public function __construct($config = array()) if (empty($this->view_list)) { $r = null; + if (!preg_match('/(.*)Controller(.*)/i', get_class($this), $r)) { throw new Exception(JText::_('JLIB_APPLICATION_ERROR_CONTROLLER_GET_NAME'), 500); } + $this->view_list = strtolower($r[2]); } } @@ -223,14 +225,15 @@ public function publish() { $ntext = $this->text_prefix . '_N_ITEMS_TRASHED'; } + $this->setMessage(JText::plural($ntext, count($cid))); } catch (Exception $e) { $this->setMessage($e->getMessage(), 'error'); } - } + $extension = $this->input->get('extension'); $extensionURL = ($extension) ? '&extension=' . $extension : ''; $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $extensionURL, false)); @@ -253,11 +256,13 @@ public function reorder() $model = $this->getModel(); $return = $model->reorder($ids, $inc); + if ($return === false) { // Reorder failed. $message = JText::sprintf('JLIB_APPLICATION_ERROR_REORDER_FAILED', $model->getError()); $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false), $message, 'error'); + return false; } else @@ -265,6 +270,7 @@ public function reorder() // Reorder succeeded. $message = JText::_('JLIB_APPLICATION_SUCCESS_ITEM_REORDERED'); $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false), $message); + return true; } } @@ -300,6 +306,7 @@ public function saveorder() // Reorder failed $message = JText::sprintf('JLIB_APPLICATION_ERROR_REORDER_FAILED', $model->getError()); $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false), $message, 'error'); + return false; } else @@ -307,6 +314,7 @@ public function saveorder() // Reorder succeeded. $this->setMessage(JText::_('JLIB_APPLICATION_SUCCESS_ORDERING_SAVED')); $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false)); + return true; } } @@ -327,11 +335,13 @@ public function checkin() $model = $this->getModel(); $return = $model->checkin($ids); + if ($return === false) { // Checkin failed. $message = JText::sprintf('JLIB_APPLICATION_ERROR_CHECKIN_FAILED', $model->getError()); $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false), $message, 'error'); + return false; } else @@ -339,6 +349,7 @@ public function checkin() // Checkin succeeded. $message = JText::plural($this->text_prefix . '_N_ITEMS_CHECKED_IN', count($ids)); $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false), $message); + return true; } } diff --git a/libraries/legacy/controller/form.php b/libraries/legacy/controller/form.php index bd0253ebf85de..897244b87e430 100644 --- a/libraries/legacy/controller/form.php +++ b/libraries/legacy/controller/form.php @@ -88,10 +88,12 @@ public function __construct($config = array()) if (empty($this->context)) { $r = null; + if (!preg_match('/(.*)Controller(.*)/i', get_class($this), $r)) { throw new Exception(JText::_('JLIB_APPLICATION_ERROR_CONTROLLER_GET_NAME'), 500); } + $this->context = strtolower($r[2]); } @@ -191,6 +193,7 @@ public function add() protected function allowAdd($data = array()) { $user = JFactory::getUser(); + return ($user->authorise('core.create', $this->option) || count($user->getAuthorisedCategories($this->option, 'core.create'))); } @@ -253,6 +256,7 @@ public function batch($model) // Build an array of item contexts to check $contexts = array(); + foreach ($cid as $id) { // If we're coming from com_categories, we need to use extension vs. option @@ -264,6 +268,7 @@ public function batch($model) { $option = $this->option; } + $contexts[$id] = $option . '.' . $this->context . '.' . $id; } diff --git a/libraries/legacy/controller/legacy.php b/libraries/legacy/controller/legacy.php index b7f2ab02cf2b2..fe660e7732e83 100644 --- a/libraries/legacy/controller/legacy.php +++ b/libraries/legacy/controller/legacy.php @@ -439,7 +439,6 @@ public function __construct($config = array()) { $this->default_view = $this->getName(); } - } /** @@ -711,6 +710,7 @@ public function execute($task) $this->task = $task; $task = strtolower($task); + if (isset($this->taskMap[$task])) { $doTask = $this->taskMap[$task]; @@ -773,6 +773,7 @@ public function getModel($name = '', $prefix = '', $config = array()) } } } + return $model; } @@ -792,10 +793,12 @@ public function getName() if (empty($this->name)) { $r = null; + if (!preg_match('/(.*)Controller/i', get_class($this), $r)) { throw new Exception(JText::_('JLIB_APPLICATION_ERROR_CONTROLLER_GET_NAME'), 500); } + $this->name = strtolower($r[1]); } @@ -1093,6 +1096,7 @@ protected function setPath($type, $path) public function setRedirect($url, $msg = null, $type = null) { $this->redirect = $url; + if ($msg !== null) { // Controller may have set this directly diff --git a/libraries/legacy/error/error.php b/libraries/legacy/error/error.php index f60b3023d539b..472a276c89317 100644 --- a/libraries/legacy/error/error.php +++ b/libraries/legacy/error/error.php @@ -116,6 +116,7 @@ public static function getError($unset = false) { $error = &self::$stack[0]; } + return $error; } @@ -176,6 +177,7 @@ public static function raise($level, $code, $msg, $info = null, $backtrace = fal // Build error object $exception = new JException($msg, $code, $level, $info, $backtrace); + return self::throwError($exception); } @@ -212,6 +214,7 @@ public static function throwError(&$exception) $handler = self::getErrorHandling($level); $function = 'handle' . ucfirst($handler['mode']); + if (is_callable(array('JError', $function))) { $reference = call_user_func_array(array('JError', $function), array(&$exception, (isset($handler['options'])) ? $handler['options'] : array())); @@ -375,6 +378,7 @@ public static function setErrorHandling($level, $mode, $options = null) if (!is_callable($options)) { $tmp = array('GLOBAL'); + if (is_array($options)) { $tmp[0] = $options[0]; @@ -396,6 +400,7 @@ public static function setErrorHandling($level, $mode, $options = null) // Save settings self::$handlers[$eLevel] = array('mode' => $mode); + if ($options != null) { self::$handlers[$eLevel]['options'] = $options; @@ -537,6 +542,7 @@ public static function handleEcho(&$error, $options) { $backtrace = $error->getTrace(); $trace = ''; + for ($i = count($backtrace) - 1; $i >= 0; $i--) { if (isset($backtrace[$i]['class'])) @@ -568,6 +574,7 @@ public static function handleEcho(&$error, $options) if (defined('STDERR')) { fwrite(STDERR, "J$level_human: " . $error->get('message') . "\n"); + if (defined('JDEBUG')) { fwrite(STDERR, $trace); @@ -576,6 +583,7 @@ public static function handleEcho(&$error, $options) else { echo "J$level_human: " . $error->get('message') . "\n"; + if (defined('JDEBUG')) { echo $trace; @@ -622,11 +630,11 @@ public static function handleVerbose(&$error, $options) { // Output as simple text echo "J$level_human: " . $error->get('message') . "\n"; + if ($info != null) { echo "\t" . $info . "\n"; } - } return $error; @@ -770,6 +778,7 @@ public static function customErrorPage(&$error) $app = JFactory::getApplication(); $document = JDocument::getInstance('error'); + if ($document) { $config = JFactory::getConfig(); @@ -810,6 +819,7 @@ public static function customErrorPage(&$error) // This is a common use case for Command Line Interface applications. self::handleEcho($error, array()); } + $app->close(0); } diff --git a/libraries/legacy/exception/exception.php b/libraries/legacy/exception/exception.php index 41d99837a63c8..affdaa7c6902f 100644 --- a/libraries/legacy/exception/exception.php +++ b/libraries/legacy/exception/exception.php @@ -132,32 +132,39 @@ public function __construct($msg, $code = 0, $level = null, $info = null, $backt for ($i = count($this->backtrace) - 1; $i >= 0; --$i) { ++$i; + if (isset($this->backtrace[$i]['file'])) { $this->file = $this->backtrace[$i]['file']; } + if (isset($this->backtrace[$i]['line'])) { $this->line = $this->backtrace[$i]['line']; } + if (isset($this->backtrace[$i]['class'])) { $this->class = $this->backtrace[$i]['class']; } + if (isset($this->backtrace[$i]['function'])) { $this->function = $this->backtrace[$i]['function']; } + if (isset($this->backtrace[$i]['type'])) { $this->type = $this->backtrace[$i]['type']; } $this->args = false; + if (isset($this->backtrace[$i]['args'])) { $this->args = $this->backtrace[$i]['args']; } + break; } } @@ -219,6 +226,7 @@ public function get($property, $default = null) { return $this->$property; } + return $default; } @@ -238,6 +246,7 @@ public function getProperties($public = true) JLog::add('JException::getProperties is deprecated.', JLog::WARNING, 'deprecated'); $vars = get_object_vars($this); + if ($public) { foreach ($vars as $key => $value) @@ -248,6 +257,7 @@ public function getProperties($public = true) } } } + return $vars; } @@ -326,6 +336,7 @@ public function set($property, $value = null) $previous = isset($this->$property) ? $this->$property : null; $this->$property = $value; + return $previous; } diff --git a/libraries/legacy/form/field/category.php b/libraries/legacy/form/field/category.php index 7586905c92a8d..c0319cd0b4d6d 100644 --- a/libraries/legacy/form/field/category.php +++ b/libraries/legacy/form/field/category.php @@ -61,7 +61,6 @@ protected function getOptions() // Verify permissions. If the action attribute is set, then we scan the options. if ((string) $this->element['action']) { - // Get the current user object. $user = JFactory::getUser(); @@ -77,7 +76,6 @@ protected function getOptions() unset($options[$i]); } } - } if (isset($this->element['show_root'])) diff --git a/libraries/legacy/form/field/componentlayout.php b/libraries/legacy/form/field/componentlayout.php index d79739984f4b5..3e7e90733d076 100644 --- a/libraries/legacy/form/field/componentlayout.php +++ b/libraries/legacy/form/field/componentlayout.php @@ -45,6 +45,7 @@ protected function getInput() { $clientId = $this->form->getValue('client_id'); } + $clientId = (int) $clientId; $client = JApplicationHelper::getClientInfo($clientId); @@ -78,7 +79,6 @@ protected function getInput() // If a template, extension and view are present build the options. if ($extn && $view && $client) { - // Load language file $lang = JFactory::getLanguage(); $lang->load($extn . '.sys', JPATH_ADMINISTRATOR, null, false, true) @@ -179,10 +179,12 @@ protected function getInput() // Files with corresponding XML files are alternate menu items, not alternate layout files // so we need to exclude these files from the list. $xml_files = JFolder::files($template_path, '^[^_]*\.xml$', false, true); + for ($j = 0, $count = count($xml_files); $j < $count; $j++) { $xml_files[$j] = basename($xml_files[$j], '.xml'); } + foreach ($files as $i => $file) { // Remove layout files that exist in the component folder or that have XML files @@ -192,6 +194,7 @@ protected function getInput() unset($files[$i]); } } + if (count($files)) { // Create the group for the template diff --git a/libraries/legacy/form/field/modulelayout.php b/libraries/legacy/form/field/modulelayout.php index d82e1de37de3e..a1a83ee0f9e51 100644 --- a/libraries/legacy/form/field/modulelayout.php +++ b/libraries/legacy/form/field/modulelayout.php @@ -44,6 +44,7 @@ protected function getInput() { $clientId = $this->form->getValue('client_id'); } + $clientId = (int) $clientId; $client = JApplicationHelper::getClientInfo($clientId); @@ -73,7 +74,6 @@ protected function getInput() // If an extension and view are present build the options. if ($module && $client) { - // Load language file $lang = JFactory::getLanguage(); $lang->load($module . '.sys', $client->path, null, false, true) @@ -195,7 +195,6 @@ protected function getInput() } else { - return ''; } } diff --git a/libraries/legacy/model/admin.php b/libraries/legacy/model/admin.php index 90e5affd3e253..d9312a5d0ad61 100644 --- a/libraries/legacy/model/admin.php +++ b/libraries/legacy/model/admin.php @@ -178,8 +178,8 @@ public function batch($commands, $pks, $contexts) { $type = new JUcmType; $this->type = $type->getTypeByAlias($this->typeAlias); - } + if ($this->type === false) { $type = new JUcmType; @@ -190,6 +190,7 @@ public function batch($commands, $pks, $contexts) { $typeAlias = $this->type->type_alias; } + $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); if (!empty($commands['category_id'])) @@ -250,6 +251,7 @@ public function batch($commands, $pks, $contexts) if (!$done) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); + return false; } @@ -675,13 +677,13 @@ public function checkin($pks = array()) { if ($table->load($pk)) { - if ($table->checked_out > 0) { if (!parent::checkin($pk)) { return false; } + $count++; } } @@ -733,13 +735,10 @@ public function delete(&$pks) // Iterate the items to delete each one. foreach ($pks as $i => $pk) { - if ($table->load($pk)) { - if ($this->canDelete($table)) { - $context = $this->option . '.' . $this->name; // Trigger the onContentBeforeDelete event. @@ -748,41 +747,44 @@ public function delete(&$pks) if (in_array(false, $result, true)) { $this->setError($table->getError()); + return false; } if (!$table->delete($pk)) { $this->setError($table->getError()); + return false; } // Trigger the onContentAfterDelete event. $dispatcher->trigger($this->event_after_delete, array($context, $table)); - } else { - // Prune items that you can't change. unset($pks[$i]); $error = $this->getError(); + if ($error) { JLog::add($error, JLog::WARNING, 'jerror'); + return false; } else { JLog::add(JText::_('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED'), JLog::WARNING, 'jerror'); + return false; } } - } else { $this->setError($table->getError()); + return false; } } @@ -808,6 +810,7 @@ protected function generateNewTitle($category_id, $alias, $title) { // Alter the title & alias $table = $this->getTable(); + while ($table->load(array('alias' => $alias, 'catid' => $category_id))) { $title = JString::increment($title); @@ -840,6 +843,7 @@ public function getItem($pk = null) if ($return === false && $table->getError()) { $this->setError($table->getError()); + return false; } } @@ -1093,6 +1097,7 @@ public function save($data) if (!$table->check()) { $this->setError($table->getError()); + return false; } @@ -1102,6 +1107,7 @@ public function save($data) if (in_array(false, $result, true)) { $this->setError($table->getError()); + return false; } @@ -1109,6 +1115,7 @@ public function save($data) if (!$table->store()) { $this->setError($table->getError()); + return false; } @@ -1129,6 +1136,7 @@ public function save($data) { $this->setState($this->getName() . '.id', $table->$key); } + $this->setState($this->getName() . '.new', $isNew); return true; @@ -1182,6 +1190,7 @@ public function saveorder($pks = null, $order = null) if (!$table->store()) { $this->setError($table->getError()); + return false; } @@ -1264,6 +1273,7 @@ protected function checkCategoryId($categoryId) { // Fatal error $this->setError($error); + return false; } else @@ -1278,6 +1288,7 @@ protected function checkCategoryId($categoryId) if (empty($categoryId)) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND')); + return false; } diff --git a/libraries/legacy/model/form.php b/libraries/legacy/model/form.php index 6654f38e2f5b3..f9c2a19050edd 100644 --- a/libraries/legacy/model/form.php +++ b/libraries/legacy/model/form.php @@ -51,6 +51,7 @@ public function checkin($pk = null) if (!$table->load($pk)) { $this->setError($table->getError()); + return false; } @@ -64,6 +65,7 @@ public function checkin($pk = null) if ($table->checked_out > 0 && $table->checked_out != $user->get('id') && !$user->authorise('core.admin', 'com_checkin')) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_CHECKIN_USER_MISMATCH')); + return false; } @@ -71,6 +73,7 @@ public function checkin($pk = null) if (!$table->checkin($pk)) { $this->setError($table->getError()); + return false; } } @@ -98,6 +101,7 @@ public function checkout($pk = null) if (!$table->load($pk)) { $this->setError($table->getError()); + return false; } @@ -113,6 +117,7 @@ public function checkout($pk = null) if ($table->checked_out > 0 && $table->checked_out != $user->get('id')) { $this->setError(JText::_('JLIB_APPLICATION_ERROR_CHECKOUT_USER_MISMATCH')); + return false; } @@ -120,6 +125,7 @@ public function checkout($pk = null) if (!$table->checkout($user->get('id'), $pk)) { $this->setError($table->getError()); + return false; } } @@ -193,11 +199,11 @@ protected function loadForm($name, $source = null, $options = array(), $clear = // Load the data into the form after the plugins have operated. $form->bind($data); - } catch (Exception $e) { $this->setError($e->getMessage()); + return false; } @@ -305,6 +311,7 @@ public function validate($form, $data, $group = null) if ($return instanceof Exception) { $this->setError($return->getMessage()); + return false; } diff --git a/libraries/legacy/model/legacy.php b/libraries/legacy/model/legacy.php index 769a99f4144c1..649795c0e30cd 100644 --- a/libraries/legacy/model/legacy.php +++ b/libraries/legacy/model/legacy.php @@ -150,8 +150,8 @@ protected static function _createFileName($type, $parts = array()) case 'model': $filename = strtolower($parts['name']) . '.php'; break; - } + return $filename; } @@ -175,10 +175,12 @@ public static function getInstance($type, $prefix = '', $config = array()) { jimport('joomla.filesystem.path'); $path = JPath::find(self::addIncludePath(null, $prefix), self::_createFileName('model', array('name' => $type))); + if (!$path) { $path = JPath::find(self::addIncludePath(null, ''), self::_createFileName('model', array('name' => $type))); } + if ($path) { require_once $path; @@ -186,6 +188,7 @@ public static function getInstance($type, $prefix = '', $config = array()) if (!class_exists($modelClass)) { JLog::add(JText::sprintf('JLIB_APPLICATION_ERROR_MODELCLASS_NOT_FOUND', $modelClass), JLog::WARNING, 'jerror'); + return false; } } @@ -280,7 +283,6 @@ public function __construct($config = array()) { $this->event_clean_cache = 'onContentCleanCache'; } - } /** @@ -324,6 +326,7 @@ protected function _getListCount($query) $query->clear('select')->clear('order')->clear('limit')->select('COUNT(*)'); $this->_db->setQuery($query); + return (int) $this->_db->loadResult(); } @@ -387,10 +390,12 @@ public function getName() if (empty($this->name)) { $r = null; + if (!preg_match('/Model(.*)/i', get_class($this), $r)) { throw new Exception(JText::_('JLIB_APPLICATION_ERROR_MODEL_GET_NAME'), 500); } + $this->name = strtolower($r[1]); } diff --git a/libraries/legacy/request/request.php b/libraries/legacy/request/request.php index a83bbd4cd5458..631f0cd109d77 100644 --- a/libraries/legacy/request/request.php +++ b/libraries/legacy/request/request.php @@ -49,6 +49,7 @@ class JRequest public static function getURI() { $uri = JUri::getInstance(); + return $uri->toString(array('path', 'query')); } @@ -64,6 +65,7 @@ public static function getURI() public static function getMethod() { $method = strtoupper($_SERVER['REQUEST_METHOD']); + return $method; } @@ -102,10 +104,12 @@ public static function getVar($name, $default = null, $hash = 'default', $type = { // Ensure hash and type are uppercase $hash = strtoupper($hash); + if ($hash === 'METHOD') { $hash = strtoupper($_SERVER['REQUEST_METHOD']); } + $type = strtoupper($type); $sig = $hash . $type . $mask; @@ -351,6 +355,7 @@ public static function setVar($name, $value = null, $hash = 'method', $overwrite // Get the request hash value $hash = strtoupper($hash); + if ($hash === 'METHOD') { $hash = strtoupper($_SERVER['REQUEST_METHOD']); @@ -549,6 +554,7 @@ protected static function _cleanVar($var, $mask = 0, $type = null) $noHtmlFilter = JFilterInput::getInstance(); $var = $noHtmlFilter->clean($var, $type); } + return $var; } } diff --git a/libraries/legacy/table/menu.php b/libraries/legacy/table/menu.php index 3149978d97254..37da80ca2c7f1 100644 --- a/libraries/legacy/table/menu.php +++ b/libraries/legacy/table/menu.php @@ -161,7 +161,14 @@ public function store($updateNulls = false) // Verify that the alias is unique $table = JTable::getInstance('Menu', 'JTable', array('dbo' => $this->getDbo())); - if ($table->load(array('alias' => $this->alias, 'parent_id' => $this->parent_id, 'client_id' => (int) $this->client_id, 'language' => $this->language)) + if ($table->load( + array( + 'alias' => $this->alias, + 'parent_id' => $this->parent_id, + 'client_id' => (int) $this->client_id, + 'language' => $this->language + ) + ) && ($table->id != $this->id || $this->id == 0)) { if ($this->menutype == $table->menutype) diff --git a/libraries/legacy/utilities/xmlelement.php b/libraries/legacy/utilities/xmlelement.php index b7b8e075ba917..e34715b13d41f 100644 --- a/libraries/legacy/utilities/xmlelement.php +++ b/libraries/legacy/utilities/xmlelement.php @@ -32,6 +32,7 @@ class JXMLElement extends SimpleXMLElement public function name() { JLog::add('JXMLElement::name() is deprecated, use SimpleXMLElement::getName() instead.', JLog::WARNING, 'deprecated'); + return (string) $this->getName(); } @@ -89,7 +90,6 @@ public function asFormattedXML($compressed = false, $indent = "\t", $level = 0) // Add the newline and indentation to go along with the close tag $out .= ($compressed) ? '' : "\n" . str_repeat($indent, $level); - } elseif ((string) $this) { diff --git a/libraries/legacy/view/category.php b/libraries/legacy/view/category.php index d249dfcef3442..890855fed8710 100644 --- a/libraries/legacy/view/category.php +++ b/libraries/legacy/view/category.php @@ -139,7 +139,7 @@ public function commonCategoryDisplay() // Setup the category parameters. $cparams = $category->getParams(); - $category->params = clone($params); + $category->params = clone $params; $category->params->merge($cparams); $children = array($category->id => $children); diff --git a/libraries/legacy/view/legacy.php b/libraries/legacy/view/legacy.php index f70569f958897..30a8523f119d4 100644 --- a/libraries/legacy/view/legacy.php +++ b/libraries/legacy/view/legacy.php @@ -209,6 +209,7 @@ public function __construct($config = array()) public function display($tpl = null) { $result = $this->loadTemplate($tpl); + if ($result instanceof Exception) { return $result; @@ -273,6 +274,7 @@ public function assign() $this->$key = $val; } } + return true; } @@ -286,6 +288,7 @@ public function assign() $this->$key = $val; } } + return true; } @@ -296,6 +299,7 @@ public function assign() if (is_string($arg0) && substr($arg0, 0, 1) != '_' && func_num_args() > 1) { $this->$arg0 = $arg1; + return true; } @@ -335,6 +339,7 @@ public function assignRef($key, &$val) if (is_string($key) && substr($key, 0, 1) != '_') { $this->$key = &$val; + return true; } @@ -396,9 +401,9 @@ public function get($property, $default = null) { // The method exists, let's call it and return what we get $result = $this->_models[$model]->$method(); + return $result; } - } // Degrade to JObject::get @@ -422,6 +427,7 @@ public function getModel($name = null) { $name = $this->_defaultModel; } + return $this->_models[strtolower($name)]; } @@ -497,6 +503,7 @@ public function setModel($model, $default = false) { $this->_defaultModel = $name; } + return $model; } @@ -512,6 +519,7 @@ public function setModel($model, $default = false) public function setLayout($layout) { $previous = $this->_layout; + if (strpos($layout, ':') === false) { $this->_layout = $layout; @@ -541,6 +549,7 @@ public function setLayout($layout) public function setLayoutExt($value) { $previous = $this->_layoutExt; + if ($value = preg_replace('#[^A-Za-z0-9]#', '', trim($value))) { $this->_layoutExt = $value; @@ -791,6 +800,7 @@ protected function _createFileName($type, $parts = array()) $filename = strtolower($parts['name']) . '.php'; break; } + return $filename; } @@ -807,6 +817,7 @@ public function getForm() { $this->form = $this->get('Form'); } + return $this->form; } } diff --git a/modules/mod_finder/mod_finder.php b/modules/mod_finder/mod_finder.php index ea8addc7e4d72..6e62bc7d38ace 100644 --- a/modules/mod_finder/mod_finder.php +++ b/modules/mod_finder/mod_finder.php @@ -19,6 +19,7 @@ { define('FINDER_PATH_INDEXER', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/indexer'); } + JLoader::register('FinderIndexerQuery', FINDER_PATH_INDEXER . '/query.php'); // Check for OpenSearch @@ -35,7 +36,6 @@ 'search', 'rel', array('title' => $ostitle, 'type' => 'application/opensearchdescription+xml') ); */ - } // Initialize module parameters. diff --git a/modules/mod_random_image/mod_random_image.php b/modules/mod_random_image/mod_random_image.php index 65c6d12fd7513..b5cc143aecd57 100644 --- a/modules/mod_random_image/mod_random_image.php +++ b/modules/mod_random_image/mod_random_image.php @@ -20,6 +20,7 @@ if (!count($images)) { echo JText::_('MOD_RANDOM_IMAGE_NO_IMAGES'); + return; } diff --git a/modules/mod_search/mod_search.php b/modules/mod_search/mod_search.php index f2e2702ce879b..1caed0320a755 100644 --- a/modules/mod_search/mod_search.php +++ b/modules/mod_search/mod_search.php @@ -47,5 +47,6 @@ { $img = ModSearchHelper::getSearchImage($button_text); } + $mitemid = $set_Itemid > 0 ? $set_Itemid : $app->input->get('Itemid'); require JModuleHelper::getLayoutPath('mod_search', $params->get('layout', 'default')); diff --git a/modules/mod_syndicate/helper.php b/modules/mod_syndicate/helper.php index 149489f67a1f2..3bc49f3a34064 100644 --- a/modules/mod_syndicate/helper.php +++ b/modules/mod_syndicate/helper.php @@ -40,6 +40,5 @@ public static function getLink(&$params) return $link; } } - } }