diff --git a/administrator/components/com_admin/postinstall/eaccelerator.php b/administrator/components/com_admin/postinstall/eaccelerator.php index 5734ee9598872..8cd6d37a4060e 100644 --- a/administrator/components/com_admin/postinstall/eaccelerator.php +++ b/administrator/components/com_admin/postinstall/eaccelerator.php @@ -60,7 +60,7 @@ function admin_postinstall_eaccelerator_action() // Attempt to make the file writeable if using FTP. if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0644')) { - JError::raiseNotice(500, JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE')); + JFactory::getApplication()->enqueueMessage(JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE'), 'notice'); } // Attempt to write the configuration file as a PHP class named JConfig. @@ -76,6 +76,6 @@ function admin_postinstall_eaccelerator_action() // Attempt to make the file unwriteable if using FTP. if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0444')) { - JError::raiseNotice(500, JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE')); + JFactory::getApplication()->enqueueMessage(JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE'), 'notice'); } } diff --git a/administrator/components/com_associations/Helper/AssociationsHelper.php b/administrator/components/com_associations/Helper/AssociationsHelper.php index 43e5d8c74aae2..76bc4a35017f6 100644 --- a/administrator/components/com_associations/Helper/AssociationsHelper.php +++ b/administrator/components/com_associations/Helper/AssociationsHelper.php @@ -669,7 +669,7 @@ public static function getLanguagefilterPluginId() } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } return $result; diff --git a/administrator/components/com_banners/Helper/BannersHelper.php b/administrator/components/com_banners/Helper/BannersHelper.php index d838dd58cbdee..9471024c55c62 100644 --- a/administrator/components/com_banners/Helper/BannersHelper.php +++ b/administrator/components/com_banners/Helper/BannersHelper.php @@ -85,7 +85,7 @@ public static function updateReset() } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); return false; } @@ -146,7 +146,7 @@ public static function updateReset() } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $db->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); return false; } @@ -180,7 +180,7 @@ public static function getClientOptions() } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } array_unshift($options, \JHtml::_('select.option', '0', \JText::_('COM_BANNERS_NO_CLIENT'))); diff --git a/administrator/components/com_banners/Model/Banner.php b/administrator/components/com_banners/Model/Banner.php index 337d08bb00f7f..5e0e6d08dcd8f 100644 --- a/administrator/components/com_banners/Model/Banner.php +++ b/administrator/components/com_banners/Model/Banner.php @@ -383,7 +383,7 @@ public function stick(&$pks, $value = 1) { // Prune items that you can't change. unset($pks[$i]); - \JError::raiseWarning(403, \JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED')); + \JFactory::getApplication()->enqueueMessage(\JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), 'error'); } } } diff --git a/administrator/components/com_banners/Model/Tracks.php b/administrator/components/com_banners/Model/Tracks.php index 99c1fb05f401c..c4f742c6ad0e3 100644 --- a/administrator/components/com_banners/Model/Tracks.php +++ b/administrator/components/com_banners/Model/Tracks.php @@ -255,7 +255,7 @@ public function delete() } else { - \JError::raiseWarning(403, \JText::_('JERROR_CORE_DELETE_NOT_PERMITTED')); + \JFactory::getApplication()->enqueueMessage(\JText::_('JERROR_CORE_DELETE_NOT_PERMITTED'), 'error'); } return true; diff --git a/administrator/components/com_banners/helpers/html/banner.php b/administrator/components/com_banners/helpers/html/banner.php index 323687441d4eb..8cae3f6d7dab6 100644 --- a/administrator/components/com_banners/helpers/html/banner.php +++ b/administrator/components/com_banners/helpers/html/banner.php @@ -67,7 +67,7 @@ public static function clientlist() } catch (RuntimeException $e) { - JError::raiseWarning(500, $e->getMessage()); + JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } return $options; diff --git a/administrator/components/com_categories/Field/CategoryeditField.php b/administrator/components/com_categories/Field/CategoryeditField.php index 6f3b6b70ad2cc..be7783db01ebb 100644 --- a/administrator/components/com_categories/Field/CategoryeditField.php +++ b/administrator/components/com_categories/Field/CategoryeditField.php @@ -219,7 +219,7 @@ protected function getOptions() } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } // Pad the option text with spaces using depth level as a multiplier. diff --git a/administrator/components/com_categories/Field/Modal/CategoryField.php b/administrator/components/com_categories/Field/Modal/CategoryField.php index 3085b74ca56cd..91120d723538f 100644 --- a/administrator/components/com_categories/Field/Modal/CategoryField.php +++ b/administrator/components/com_categories/Field/Modal/CategoryField.php @@ -118,7 +118,7 @@ function jSelectCategory_" . $this->id . "(id, title, object) { } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } } diff --git a/administrator/components/com_categories/Model/Category.php b/administrator/components/com_categories/Model/Category.php index d1c424db703b9..02db0d10b2347 100644 --- a/administrator/components/com_categories/Model/Category.php +++ b/administrator/components/com_categories/Model/Category.php @@ -607,7 +607,7 @@ public function save($data) if ($allLanguage && !empty($associations)) { - \JError::raiseNotice(403, \JText::_('COM_CATEGORIES_ERROR_ALL_LANGUAGE_ASSOCIATED')); + \JFactory::getApplication()->enqueueMessage(\JText::_('COM_CATEGORIES_ERROR_ALL_LANGUAGE_ASSOCIATED'), 'notice'); } // Get associationskey for edited item diff --git a/administrator/components/com_contact/Field/Modal/ContactField.php b/administrator/components/com_contact/Field/Modal/ContactField.php index d2af1d922a0ea..54868864bb7f6 100644 --- a/administrator/components/com_contact/Field/Modal/ContactField.php +++ b/administrator/components/com_contact/Field/Modal/ContactField.php @@ -108,7 +108,7 @@ function jSelectContact_" . $this->id . "(id, title, object) { } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } } diff --git a/administrator/components/com_content/Controller/Articles.php b/administrator/components/com_content/Controller/Articles.php index 53b81aab0a77d..e8a32f7fffc1e 100644 --- a/administrator/components/com_content/Controller/Articles.php +++ b/administrator/components/com_content/Controller/Articles.php @@ -73,13 +73,13 @@ public function featured() { // Prune items that you can't change. unset($ids[$i]); - \JError::raiseNotice(403, \JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED')); + \JFactory::getApplication()->enqueueMessage(\JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), 'notice'); } } if (empty($ids)) { - \JError::raiseWarning(500, \JText::_('JERROR_NO_ITEMS_SELECTED')); + \JFactory::getApplication()->enqueueMessage(\JText::_('JERROR_NO_ITEMS_SELECTED'), 'error'); } else { @@ -90,7 +90,7 @@ public function featured() // Publish the items. if (!$model->featured($ids, $value)) { - \JError::raiseWarning(500, $model->getError()); + \JFactory::getApplication()->enqueueMessage($model->getError(), 'error'); } if ($value == 1) diff --git a/administrator/components/com_content/Controller/Featured.php b/administrator/components/com_content/Controller/Featured.php index a3b140644cc6c..fdc504d3db131 100644 --- a/administrator/components/com_content/Controller/Featured.php +++ b/administrator/components/com_content/Controller/Featured.php @@ -40,13 +40,13 @@ public function delete() { // Prune items that you can't delete. unset($ids[$i]); - \JError::raiseNotice(403, \JText::_('JERROR_CORE_DELETE_NOT_PERMITTED')); + \JFactory::getApplication()->enqueueMessage(\JText::_('JERROR_CORE_DELETE_NOT_PERMITTED'), 'notice'); } } if (empty($ids)) { - \JError::raiseWarning(500, \JText::_('JERROR_NO_ITEMS_SELECTED')); + \JFactory::getApplication()->enqueueMessage(\JText::_('JERROR_NO_ITEMS_SELECTED'), 'error'); } else { @@ -57,7 +57,7 @@ public function delete() // Remove the items. if (!$model->featured($ids, 0)) { - \JError::raiseWarning(500, $model->getError()); + \JFactory::getApplication()->enqueueMessage($model->getError(), 'error'); } } diff --git a/administrator/components/com_content/Field/Modal/ArticleField.php b/administrator/components/com_content/Field/Modal/ArticleField.php index ca9f1234170d0..cfb056d4f4df4 100644 --- a/administrator/components/com_content/Field/Modal/ArticleField.php +++ b/administrator/components/com_content/Field/Modal/ArticleField.php @@ -111,7 +111,7 @@ function jSelectArticle_" . $this->id . "(id, title, catid, object, url, languag } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } } diff --git a/administrator/components/com_contenthistory/View/Preview/Html.php b/administrator/components/com_contenthistory/View/Preview/Html.php index e78c1f92b549e..efc2aa01baf00 100644 --- a/administrator/components/com_contenthistory/View/Preview/Html.php +++ b/administrator/components/com_contenthistory/View/Preview/Html.php @@ -51,7 +51,7 @@ public function display($tpl = null) { \JFactory::getLanguage()->load('com_content', JPATH_SITE, null, true); - \JError::raiseError(404, \JText::_('COM_CONTENT_ERROR_ARTICLE_NOT_FOUND')); + throw new \Exception(\JText::_('COM_CONTENT_ERROR_ARTICLE_NOT_FOUND'), 404); return false; } diff --git a/administrator/components/com_fields/Field/Modal/FieldField.php b/administrator/components/com_fields/Field/Modal/FieldField.php index abf43c129def2..9dbc3dee6258c 100644 --- a/administrator/components/com_fields/Field/Modal/FieldField.php +++ b/administrator/components/com_fields/Field/Modal/FieldField.php @@ -114,7 +114,7 @@ protected function getInput () } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } } diff --git a/administrator/components/com_fields/helpers/fields.php b/administrator/components/com_fields/helpers/fields.php index 688ef372a04bc..51269c57f1fa5 100644 --- a/administrator/components/com_fields/helpers/fields.php +++ b/administrator/components/com_fields/helpers/fields.php @@ -628,7 +628,7 @@ public static function getFieldsPluginId() } catch (RuntimeException $e) { - JError::raiseWarning(500, $e->getMessage()); + JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); $result = 0; } diff --git a/administrator/components/com_finder/Field/ContenttypesField.php b/administrator/components/com_finder/Field/ContenttypesField.php index 7993ccc4acdec..496736b6105ed 100644 --- a/administrator/components/com_finder/Field/ContenttypesField.php +++ b/administrator/components/com_finder/Field/ContenttypesField.php @@ -59,7 +59,7 @@ public function getOptions() } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $db->getMessage()); + \JFactory::getApplication()->enqueueMessage($db->getMessage(), 'error'); } // Translate. diff --git a/administrator/components/com_finder/Helper/FinderHelper.php b/administrator/components/com_finder/Helper/FinderHelper.php index b8c8318c65914..1215e9888ec74 100644 --- a/administrator/components/com_finder/Helper/FinderHelper.php +++ b/administrator/components/com_finder/Helper/FinderHelper.php @@ -78,7 +78,7 @@ public static function getFinderPluginId() } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } return $result; diff --git a/administrator/components/com_finder/helpers/html/finder.php b/administrator/components/com_finder/helpers/html/finder.php index 045eb508a2bdd..80869384bbda8 100644 --- a/administrator/components/com_finder/helpers/html/finder.php +++ b/administrator/components/com_finder/helpers/html/finder.php @@ -85,7 +85,7 @@ public static function mapslist() } catch (RuntimeException $e) { - JError::raiseWarning(500, $db->getMessage()); + JFactory::getApplication()->enqueueMessage($db->getMessage(), 'error'); } // Translate. diff --git a/administrator/components/com_installer/Model/Install.php b/administrator/components/com_installer/Model/Install.php index 3abb4fdbef0f3..ce1b993e37d88 100644 --- a/administrator/components/com_installer/Model/Install.php +++ b/administrator/components/com_installer/Model/Install.php @@ -249,7 +249,7 @@ protected function _getPackageFromUpload() // Make sure that file uploads are enabled in php. if (!(bool) ini_get('file_uploads')) { - \JError::raiseWarning('', \JText::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLFILE')); + \JFactory::getApplication()->enqueueMessage(\JText::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLFILE'), 'error'); return false; } @@ -257,7 +257,7 @@ protected function _getPackageFromUpload() // 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')); + \JFactory::getApplication()->enqueueMessage(\JText::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLZLIB'), 'error'); return false; } @@ -265,7 +265,7 @@ protected function _getPackageFromUpload() // If there is no uploaded file, we have a problem... if (!is_array($userfile)) { - \JError::raiseWarning('', \JText::_('COM_INSTALLER_MSG_INSTALL_NO_FILE_SELECTED')); + \JFactory::getApplication()->enqueueMessage(\JText::_('COM_INSTALLER_MSG_INSTALL_NO_FILE_SELECTED'), 'error'); return false; } @@ -273,9 +273,9 @@ protected function _getPackageFromUpload() // Is the PHP tmp directory missing? if ($userfile['error'] && ($userfile['error'] == UPLOAD_ERR_NO_TMP_DIR)) { - \JError::raiseWarning( - '', - \JText::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLUPLOADERROR') . '
' . \JText::_('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTSET') + \JFactory::getApplication()->enqueueMessage( + \JText::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLUPLOADERROR') . '
' . \JText::_('COM_INSTALLER_MSG_WARNINGS_PHPUPLOADNOTSET'), + 'error' ); return false; @@ -284,9 +284,9 @@ protected function _getPackageFromUpload() // Is the max upload size too small in php.ini? if ($userfile['error'] && ($userfile['error'] == UPLOAD_ERR_INI_SIZE)) { - \JError::raiseWarning( - '', - \JText::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLUPLOADERROR') . '
' . \JText::_('COM_INSTALLER_MSG_WARNINGS_SMALLUPLOADSIZE') + \JFactory::getApplication()->enqueueMessage( + \JText::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLUPLOADERROR') . '
' . \JText::_('COM_INSTALLER_MSG_WARNINGS_SMALLUPLOADSIZE'), + 'error' ); return false; @@ -295,7 +295,7 @@ protected function _getPackageFromUpload() // Check if there was a different problem uploading the file. if ($userfile['error'] || $userfile['size'] < 1) { - \JError::raiseWarning('', \JText::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLUPLOADERROR')); + \JFactory::getApplication()->enqueueMessage(\JText::_('COM_INSTALLER_MSG_INSTALL_WARNINSTALLUPLOADERROR'), 'error'); return false; } @@ -333,7 +333,7 @@ protected function _getPackageFromFolder() // Did you give us a valid directory? if (!is_dir($p_dir)) { - \JError::raiseWarning('', \JText::_('COM_INSTALLER_MSG_INSTALL_PLEASE_ENTER_A_PACKAGE_DIRECTORY')); + \JFactory::getApplication()->enqueueMessage(\JText::_('COM_INSTALLER_MSG_INSTALL_PLEASE_ENTER_A_PACKAGE_DIRECTORY'), 'error'); return false; } @@ -344,7 +344,7 @@ protected function _getPackageFromFolder() // Did you give us a valid package? if (!$type) { - \JError::raiseWarning('', \JText::_('COM_INSTALLER_MSG_INSTALL_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE')); + \JFactory::getApplication()->enqueueMessage(\JText::_('COM_INSTALLER_MSG_INSTALL_PATH_DOES_NOT_HAVE_A_VALID_PACKAGE'), 'error'); } $package['packagefile'] = null; @@ -372,7 +372,7 @@ protected function _getPackageFromUrl() // Did you give us a URL? if (!$url) { - \JError::raiseWarning('', \JText::_('COM_INSTALLER_MSG_INSTALL_ENTER_A_URL')); + \JFactory::getApplication()->enqueueMessage(\JText::_('COM_INSTALLER_MSG_INSTALL_ENTER_A_URL'), 'error'); return false; } @@ -399,7 +399,7 @@ protected function _getPackageFromUrl() // Was the package downloaded? if (!$p_file) { - \JError::raiseWarning('', \JText::_('COM_INSTALLER_MSG_INSTALL_INVALID_URL')); + \JFactory::getApplication()->enqueueMessage(\JText::_('COM_INSTALLER_MSG_INSTALL_INVALID_URL'), 'error'); return false; } diff --git a/administrator/components/com_installer/Model/Manage.php b/administrator/components/com_installer/Model/Manage.php index c343d30cf7840..ac9f8333b8662 100644 --- a/administrator/components/com_installer/Model/Manage.php +++ b/administrator/components/com_installer/Model/Manage.php @@ -94,7 +94,7 @@ public function publish(&$eid = array(), $value = 1) { if (!\JFactory::getUser()->authorise('core.edit.state', 'com_installer')) { - \JError::raiseWarning(403, \JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED')); + \JFactory::getApplication()->enqueueMessage(\JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), 'error'); return false; } @@ -124,7 +124,7 @@ public function publish(&$eid = array(), $value = 1) 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')); + \JFactory::getApplication()->enqueueMessage(\JText::_('COM_INSTALLER_ERROR_DISABLE_DEFAULT_TEMPLATE_NOT_PERMITTED'), 'notice'); unset($eid[$i]); continue; } @@ -133,7 +133,7 @@ public function publish(&$eid = array(), $value = 1) if ($table->protected == 1) { $result = false; - \JError::raiseWarning(403, \JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED')); + \JFactory::getApplication()->enqueueMessage(\JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), 'error'); } else { @@ -200,7 +200,7 @@ public function remove($eid = array()) { if (!\JFactory::getUser()->authorise('core.delete', 'com_installer')) { - \JError::raiseWarning(403, \JText::_('JERROR_CORE_DELETE_NOT_PERMITTED')); + \JFactory::getApplication()->enqueueMessage(\JText::_('JERROR_CORE_DELETE_NOT_PERMITTED'), 'error'); return false; } diff --git a/administrator/components/com_installer/Model/Update.php b/administrator/components/com_installer/Model/Update.php index aab05dc01da89..ba8d6a4a5d7d5 100644 --- a/administrator/components/com_installer/Model/Update.php +++ b/administrator/components/com_installer/Model/Update.php @@ -399,7 +399,7 @@ private function install($update) if (!isset($update->get('downloadurl')->_data)) { - \JError::raiseWarning('', \JText::_('COM_INSTALLER_INVALID_EXTENSION_UPDATE')); + \JFactory::getApplication()->enqueueMessage(\JText::_('COM_INSTALLER_INVALID_EXTENSION_UPDATE'), 'error'); return false; } @@ -417,7 +417,7 @@ private function install($update) // Was the package downloaded? if (!$p_file) { - \JError::raiseWarning('', \JText::sprintf('COM_INSTALLER_PACKAGE_DOWNLOAD_FAILED', $url)); + \JFactory::getApplication()->enqueueMessage(\JText::sprintf('COM_INSTALLER_PACKAGE_DOWNLOAD_FAILED', $url), 'error'); return false; } diff --git a/administrator/components/com_joomlaupdate/Model/Update.php b/administrator/components/com_joomlaupdate/Model/Update.php index af88ef62c2c22..e26b5313445ee 100644 --- a/administrator/components/com_joomlaupdate/Model/Update.php +++ b/administrator/components/com_joomlaupdate/Model/Update.php @@ -59,7 +59,7 @@ public function applyUpdateSite() } else { - return \JError::raiseWarning(403, \JText::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_CUSTOM_ERROR')); + return \JFactory::getApplication()->enqueueMessage(\JText::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_CUSTOM_ERROR'), 'error'); } break; diff --git a/administrator/components/com_languages/Model/Installed.php b/administrator/components/com_languages/Model/Installed.php index c9e2bb965c874..641e370fa3313 100644 --- a/administrator/components/com_languages/Model/Installed.php +++ b/administrator/components/com_languages/Model/Installed.php @@ -484,7 +484,7 @@ public function switchAdminLanguage($cid) } else { - \JError::raiseWarning(500, \JText::_('COM_LANGUAGES_ERR_NO_LANGUAGE_SELECTED')); + \JFactory::getApplication()->enqueueMessage(\JText::_('COM_LANGUAGES_ERR_NO_LANGUAGE_SELECTED'), 'error'); return false; } diff --git a/administrator/components/com_login/Model/Login.php b/administrator/components/com_login/Model/Login.php index 0693ab91409f9..e12a87c005ccb 100644 --- a/administrator/components/com_login/Model/Login.php +++ b/administrator/components/com_login/Model/Login.php @@ -173,14 +173,14 @@ protected static function _load($module) } catch (\JDatabaseExceptionExecuting $databaseException) { - \JError::raiseWarning(500, \JText::sprintf('JLIB_APPLICATION_ERROR_MODULE_LOAD', $databaseException->getMessage())); + \JFactory::getApplication()->enqueueMessage(\JText::sprintf('JLIB_APPLICATION_ERROR_MODULE_LOAD', $databaseException->getMessage()), 'error'); return array(); } } catch (\JDatabaseExceptionExecuting $databaseException) { - \JError::raiseWarning(500, \JText::sprintf('JLIB_APPLICATION_ERROR_MODULE_LOAD', $databaseException->getMessage())); + \JFactory::getApplication()->enqueueMessage(\JText::sprintf('JLIB_APPLICATION_ERROR_MODULE_LOAD', $databaseException->getMessage()), 'error'); return array(); } diff --git a/administrator/components/com_menus/Controller/Item.php b/administrator/components/com_menus/Controller/Item.php index d806388dd658a..a4f5efc9aef6a 100644 --- a/administrator/components/com_menus/Controller/Item.php +++ b/administrator/components/com_menus/Controller/Item.php @@ -327,7 +327,7 @@ public function save($key = null, $urlVar = null) if (!$form) { - \JError::raiseError(500, $model->getError()); + throw new \Exception($model->getError(), 500); return false; } diff --git a/administrator/components/com_menus/Controller/Menu.php b/administrator/components/com_menus/Controller/Menu.php index a9a62acdc8c22..388382fe7e776 100644 --- a/administrator/components/com_menus/Controller/Menu.php +++ b/administrator/components/com_menus/Controller/Menu.php @@ -77,7 +77,7 @@ public function save($key = null, $urlVar = null) if (!$form) { - \JError::raiseError(500, $model->getError()); + throw new \Exception($model->getError(), 500); return false; } diff --git a/administrator/components/com_menus/Field/MenuParentField.php b/administrator/components/com_menus/Field/MenuParentField.php index 6615112333152..97a90dbb85e7d 100644 --- a/administrator/components/com_menus/Field/MenuParentField.php +++ b/administrator/components/com_menus/Field/MenuParentField.php @@ -85,7 +85,7 @@ protected function getOptions() } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } // Pad the option text with spaces using depth level as a multiplier. diff --git a/administrator/components/com_menus/Field/MenuorderingField.php b/administrator/components/com_menus/Field/MenuorderingField.php index 113fecbd553f4..615ba66e99945 100644 --- a/administrator/components/com_menus/Field/MenuorderingField.php +++ b/administrator/components/com_menus/Field/MenuorderingField.php @@ -78,7 +78,7 @@ protected function getOptions() } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } // Allow translation of custom admin menus diff --git a/administrator/components/com_menus/Field/Modal/MenuField.php b/administrator/components/com_menus/Field/Modal/MenuField.php index 90d3154d19104..ca3654c07806f 100644 --- a/administrator/components/com_menus/Field/Modal/MenuField.php +++ b/administrator/components/com_menus/Field/Modal/MenuField.php @@ -217,7 +217,7 @@ function jSelectMenu_" . $this->id . "(id, title, object) { } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } } @@ -242,7 +242,7 @@ function jSelectMenu_" . $this->id . "(id, title, object) { { $html .= ''; } - + $html .= ''; if ($this->allowSelect || $this->allowNew || $this->allowEdit || $this->allowClear) diff --git a/administrator/components/com_menus/Helper/MenusHelper.php b/administrator/components/com_menus/Helper/MenusHelper.php index c497e4661483b..fc89d6769dfda 100644 --- a/administrator/components/com_menus/Helper/MenusHelper.php +++ b/administrator/components/com_menus/Helper/MenusHelper.php @@ -218,7 +218,7 @@ public static function getMenuLinks($menuType = null, $parentId = 0, $mode = 0, } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); return false; } @@ -245,7 +245,7 @@ public static function getMenuLinks($menuType = null, $parentId = 0, $mode = 0, } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); return false; } diff --git a/administrator/components/com_menus/Model/Item.php b/administrator/components/com_menus/Model/Item.php index 1f9aed560e667..ef622822dfd9e 100644 --- a/administrator/components/com_menus/Model/Item.php +++ b/administrator/components/com_menus/Model/Item.php @@ -1303,7 +1303,7 @@ public function rebuild() } catch (\RuntimeException $e) { - return \JError::raiseWarning(500, $e->getMessage()); + return \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } foreach ($items as &$item) @@ -1322,7 +1322,7 @@ public function rebuild() } catch (\RuntimeException $e) { - return \JError::raiseWarning(500, $e->getMessage()); + return \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } unset($registry); @@ -1476,7 +1476,7 @@ public function save($data) if ($all_language && !empty($associations)) { - \JError::raiseNotice(403, \JText::_('COM_MENUS_ERROR_ALL_LANGUAGE_ASSOCIATED')); + \JFactory::getApplication()->enqueueMessage(\JText::_('COM_MENUS_ERROR_ALL_LANGUAGE_ASSOCIATED'), 'notice'); } // Get associationskey for edited item @@ -1627,13 +1627,13 @@ public function setHome(&$pks, $value = 1) if ($table->home == $value) { unset($pks[$i]); - \JError::raiseNotice(403, \JText::_('COM_MENUS_ERROR_ALREADY_HOME')); + \JFactory::getApplication()->enqueueMessage(\JText::_('COM_MENUS_ERROR_ALREADY_HOME'), 'notice'); } elseif ($table->menutype == 'main') { // Prune items that you can't change. unset($pks[$i]); - \JError::raiseWarning(403, \JText::_('COM_MENUS_ERROR_MENUTYPE_HOME')); + \JFactory::getApplication()->enqueueMessage(\JText::_('COM_MENUS_ERROR_MENUTYPE_HOME'), 'error'); } else { @@ -1648,19 +1648,19 @@ public function setHome(&$pks, $value = 1) { // Prune items that you can't change. unset($pks[$i]); - \JError::raiseWarning(403, \JText::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED')); + \JFactory::getApplication()->enqueueMessage(\JText::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'error'); } elseif (!$table->check()) { // Prune the items that failed pre-save checks. unset($pks[$i]); - \JError::raiseWarning(403, $table->getError()); + \JFactory::getApplication()->enqueueMessage($table->getError(), 'error'); } elseif (!$table->store()) { // Prune the items that could not be stored. unset($pks[$i]); - \JError::raiseWarning(403, $table->getError()); + \JFactory::getApplication()->enqueueMessage($table->getError(), 'error'); } } } @@ -1671,7 +1671,7 @@ public function setHome(&$pks, $value = 1) if (!$onehome) { $onehome = true; - \JError::raiseNotice(403, \JText::sprintf('COM_MENUS_ERROR_ONE_HOME')); + \JFactory::getApplication()->enqueueMessage(\JText::sprintf('COM_MENUS_ERROR_ONE_HOME'), 'notice'); } } } @@ -1706,7 +1706,7 @@ public function publish(&$pks, $value = 1) if ($table->load($pk) && $table->home && $table->language == '*') { // Prune items that you can't change. - \JError::raiseWarning(403, \JText::_('JLIB_DATABASE_ERROR_MENU_UNPUBLISH_DEFAULT_HOME')); + \JFactory::getApplication()->enqueueMessage(\JText::_('JLIB_DATABASE_ERROR_MENU_UNPUBLISH_DEFAULT_HOME'), 'error'); unset($pks[$i]); break; } diff --git a/administrator/components/com_messages/Controller/Config.php b/administrator/components/com_messages/Controller/Config.php index 465d8e1865bff..e30a2b6b02145 100644 --- a/administrator/components/com_messages/Controller/Config.php +++ b/administrator/components/com_messages/Controller/Config.php @@ -40,7 +40,7 @@ public function save() if (!$form) { - \JError::raiseError(500, $model->getError()); + throw new \Exception($model->getError(), 500); return false; } diff --git a/administrator/components/com_messages/Field/UserMessagesField.php b/administrator/components/com_messages/Field/UserMessagesField.php index 1d3323e4bcbeb..e0f9f3e3375fc 100644 --- a/administrator/components/com_messages/Field/UserMessagesField.php +++ b/administrator/components/com_messages/Field/UserMessagesField.php @@ -53,7 +53,7 @@ protected function getGroups() } catch (\RuntimeException $e) { - \JError::raiseNotice(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'notice'); return null; } diff --git a/administrator/components/com_modules/Controller/Module.php b/administrator/components/com_modules/Controller/Module.php index 3836e851d4704..6c430842b5f2c 100644 --- a/administrator/components/com_modules/Controller/Module.php +++ b/administrator/components/com_modules/Controller/Module.php @@ -273,7 +273,7 @@ public function orderPosition() } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); return ''; } diff --git a/administrator/components/com_modules/Helper/ModulesHelper.php b/administrator/components/com_modules/Helper/ModulesHelper.php index 1e8a06f29f03a..92be70d5524b9 100644 --- a/administrator/components/com_modules/Helper/ModulesHelper.php +++ b/administrator/components/com_modules/Helper/ModulesHelper.php @@ -89,7 +89,7 @@ public static function getPositions($clientId, $editPositions = false) } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); return; } diff --git a/administrator/components/com_modules/Model/Module.php b/administrator/components/com_modules/Model/Module.php index 0ac2a0087a079..befe832d39335 100644 --- a/administrator/components/com_modules/Model/Module.php +++ b/administrator/components/com_modules/Model/Module.php @@ -338,7 +338,7 @@ public function delete(&$pks) // Access checks. if (!$user->authorise('core.delete', 'com_modules.module.' . (int) $pk) || $table->published != -2) { - \JError::raiseWarning(403, \JText::_('JERROR_CORE_DELETE_NOT_PERMITTED')); + \JFactory::getApplication()->enqueueMessage(\JText::_('JERROR_CORE_DELETE_NOT_PERMITTED'), 'error'); return; } @@ -463,7 +463,7 @@ public function duplicate(&$pks) } catch (\RuntimeException $e) { - return \JError::raiseWarning(500, $e->getMessage()); + return \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } } @@ -1075,7 +1075,7 @@ public function save($data) } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); return false; } diff --git a/administrator/components/com_modules/helpers/html/modules.php b/administrator/components/com_modules/helpers/html/modules.php index f7c37daaf3297..2811303091e64 100644 --- a/administrator/components/com_modules/helpers/html/modules.php +++ b/administrator/components/com_modules/helpers/html/modules.php @@ -228,7 +228,7 @@ public static function positionList($clientId = 0) } catch (RuntimeException $e) { - JError::raiseWarning(500, $e->getMessage()); + JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } // Pop the first item off the array if it's blank diff --git a/administrator/components/com_newsfeeds/Field/Modal/NewsfeedField.php b/administrator/components/com_newsfeeds/Field/Modal/NewsfeedField.php index f6a59145e4f4f..d0966305216a5 100644 --- a/administrator/components/com_newsfeeds/Field/Modal/NewsfeedField.php +++ b/administrator/components/com_newsfeeds/Field/Modal/NewsfeedField.php @@ -108,7 +108,7 @@ function jSelectNewsfeed_" . $this->id . "(id, title, object) { } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } } diff --git a/administrator/components/com_newsfeeds/Field/NewsfeedsField.php b/administrator/components/com_newsfeeds/Field/NewsfeedsField.php index 4aceae6928d3b..f7738f63adbf9 100644 --- a/administrator/components/com_newsfeeds/Field/NewsfeedsField.php +++ b/administrator/components/com_newsfeeds/Field/NewsfeedsField.php @@ -56,7 +56,7 @@ protected function getOptions() } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $db->getMessage()); + \JFactory::getApplication()->enqueueMessage($db->getMessage(), 'error'); } // Merge any additional options in the XML definition. diff --git a/administrator/components/com_plugins/Helper/PluginsHelper.php b/administrator/components/com_plugins/Helper/PluginsHelper.php index 8955c4a62d947..304cd4653ed04 100644 --- a/administrator/components/com_plugins/Helper/PluginsHelper.php +++ b/administrator/components/com_plugins/Helper/PluginsHelper.php @@ -68,7 +68,7 @@ public static function folderOptions() } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } return $options; diff --git a/administrator/components/com_redirect/Helper/RedirectHelper.php b/administrator/components/com_redirect/Helper/RedirectHelper.php index 49e0d1f5cd13e..b0326afc74368 100644 --- a/administrator/components/com_redirect/Helper/RedirectHelper.php +++ b/administrator/components/com_redirect/Helper/RedirectHelper.php @@ -79,7 +79,7 @@ public static function getRedirectPluginId() } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } return $result; diff --git a/administrator/components/com_templates/Controller/Styles.php b/administrator/components/com_templates/Controller/Styles.php index cfc36ae10c89a..5f4b7ef28f4dc 100644 --- a/administrator/components/com_templates/Controller/Styles.php +++ b/administrator/components/com_templates/Controller/Styles.php @@ -48,7 +48,7 @@ public function duplicate() } catch (\Exception $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } $this->setRedirect('index.php?option=com_templates&view=styles'); diff --git a/administrator/components/com_templates/Model/Style.php b/administrator/components/com_templates/Model/Style.php index 310df6ee5f67c..89468b74d0ee7 100644 --- a/administrator/components/com_templates/Model/Style.php +++ b/administrator/components/com_templates/Model/Style.php @@ -130,7 +130,7 @@ public function delete(&$pks) // You should not delete a default style if ($table->home != '0') { - \JError::raiseWarning(500, \JText::_('COM_TEMPLATES_STYLE_CANNOT_DELETE_DEFAULT_STYLE')); + \JFactory::getApplication()->enqueueMessage(\JText::_('COM_TEMPLATES_STYLE_CANNOT_DELETE_DEFAULT_STYLE'), 'error'); return false; } diff --git a/administrator/components/com_users/Model/Group.php b/administrator/components/com_users/Model/Group.php index e12a9f3ddf890..56bbb99ba4e5d 100644 --- a/administrator/components/com_users/Model/Group.php +++ b/administrator/components/com_users/Model/Group.php @@ -259,7 +259,7 @@ public function delete(&$pks) { if (in_array($pk, $groups)) { - \JError::raiseWarning(403, \JText::_('COM_USERS_DELETE_ERROR_INVALID_GROUP')); + \JFactory::getApplication()->enqueueMessage(\JText::_('COM_USERS_DELETE_ERROR_INVALID_GROUP'), 'error'); return false; } @@ -296,7 +296,7 @@ public function delete(&$pks) { // Prune items that you can't change. unset($pks[$i]); - \JError::raiseWarning(403, \JText::_('JERROR_CORE_DELETE_NOT_PERMITTED')); + \JFactory::getApplication()->enqueueMessage(\JText::_('JERROR_CORE_DELETE_NOT_PERMITTED'), 'error'); } } else diff --git a/administrator/components/com_users/Model/Levels.php b/administrator/components/com_users/Model/Levels.php index 6fc4b6e41a997..9015d122ac608 100644 --- a/administrator/components/com_users/Model/Levels.php +++ b/administrator/components/com_users/Model/Levels.php @@ -191,7 +191,7 @@ public function saveorder($pks, $order) if (empty($pks)) { - return \JError::raiseWarning(500, \JText::_('COM_USERS_ERROR_LEVELS_NOLEVELS_SELECTED')); + return \JFactory::getApplication()->enqueueMessage(\JText::_('COM_USERS_ERROR_LEVELS_NOLEVELS_SELECTED'), 'error'); } // Update ordering values @@ -206,7 +206,7 @@ public function saveorder($pks, $order) { // Prune items that you can't change. unset($pks[$i]); - \JError::raiseWarning(403, \JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED')); + \JFactory::getApplication()->enqueueMessage(\JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), 'error'); } elseif ($table->ordering != $order[$i]) { diff --git a/administrator/components/com_users/Model/User.php b/administrator/components/com_users/Model/User.php index 97ccdf3bb96f5..24dbe99790d54 100644 --- a/administrator/components/com_users/Model/User.php +++ b/administrator/components/com_users/Model/User.php @@ -404,7 +404,7 @@ public function delete(&$pks) { // Prune items that you can't change. unset($pks[$i]); - \JError::raiseWarning(403, \JText::_('JERROR_CORE_DELETE_NOT_PERMITTED')); + \JFactory::getApplication()->enqueueMessage(\JText::_('JERROR_CORE_DELETE_NOT_PERMITTED'), 'error'); } } else @@ -452,7 +452,7 @@ public function block(&$pks, $value = 1) { // Cannot block yourself. unset($pks[$i]); - \JError::raiseWarning(403, \JText::_('COM_USERS_USERS_ERROR_CANNOT_BLOCK_SELF')); + \JFactory::getApplication()->enqueueMessage(\JText::_('COM_USERS_USERS_ERROR_CANNOT_BLOCK_SELF'), 'error'); } elseif ($table->load($pk)) { @@ -526,7 +526,7 @@ public function block(&$pks, $value = 1) { // Prune items that you can't change. unset($pks[$i]); - \JError::raiseWarning(403, \JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED')); + \JFactory::getApplication()->enqueueMessage(\JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), 'error'); } } } @@ -616,7 +616,7 @@ public function activate(&$pks) { // Prune items that you can't change. unset($pks[$i]); - \JError::raiseWarning(403, \JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED')); + \JFactory::getApplication()->enqueueMessage(\JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), 'error'); } } } diff --git a/administrator/modules/mod_latest/Helper/ModLatestHelper.php b/administrator/modules/mod_latest/Helper/ModLatestHelper.php index 9b8f6a27fff95..3877ca5d9e952 100644 --- a/administrator/modules/mod_latest/Helper/ModLatestHelper.php +++ b/administrator/modules/mod_latest/Helper/ModLatestHelper.php @@ -83,7 +83,7 @@ public static function getList(Registry &$params, Articles $model) if ($error = $model->getError()) { - \JError::raiseError(500, $error); + throw new \Exception($error, 500); return false; } diff --git a/administrator/modules/mod_popular/Helper/PopularHelper.php b/administrator/modules/mod_popular/Helper/PopularHelper.php index 1b3f955a9c754..35f9d0f970165 100644 --- a/administrator/modules/mod_popular/Helper/PopularHelper.php +++ b/administrator/modules/mod_popular/Helper/PopularHelper.php @@ -73,7 +73,7 @@ public static function getList(Registry &$params, Articles $model) if ($error = $model->getError()) { - \JError::raiseError(500, $error); + throw new \Exception($error, 500); return false; } diff --git a/components/com_banners/Model/Banner.php b/components/com_banners/Model/Banner.php index 1ce2858a40287..75699398f51fa 100644 --- a/components/com_banners/Model/Banner.php +++ b/components/com_banners/Model/Banner.php @@ -54,7 +54,7 @@ public function click() } catch (\RuntimeException $e) { - \JError::raiseError(500, $e->getMessage()); + throw new \Exception($e->getMessage(), 500); } $item = $this->getItem(); @@ -92,7 +92,7 @@ public function click() } catch (\RuntimeException $e) { - \JError::raiseError(500, $e->getMessage()); + throw new \Exception($e->getMessage(), 500); } $count = $db->loadResult(); @@ -129,7 +129,7 @@ public function click() } catch (\RuntimeException $e) { - \JError::raiseError(500, $e->getMessage()); + throw new \Exception($e->getMessage(), 500); } } } diff --git a/components/com_banners/Model/Banners.php b/components/com_banners/Model/Banners.php index 16ae0c2b34f53..a2fc52cc72c08 100644 --- a/components/com_banners/Model/Banners.php +++ b/components/com_banners/Model/Banners.php @@ -251,7 +251,7 @@ public function impress() } catch (\JDatabaseExceptionExecuting $e) { - \JError::raiseError(500, $e->getMessage()); + throw new \Exception($e->getMessage(), 500); } foreach ($items as $item) @@ -289,7 +289,7 @@ public function impress() } catch (\JDatabaseExceptionExecuting $e) { - \JError::raiseError(500, $e->getMessage()); + throw new \Exception($e->getMessage(), 500); } if ($db->getAffectedRows() === 0) @@ -314,7 +314,7 @@ public function impress() } catch (\JDatabaseExceptionExecuting $e) { - \JError::raiseError(500, $e->getMessage()); + throw new \Exception($e->getMessage(), 500); } } } diff --git a/components/com_config/Model/Modules.php b/components/com_config/Model/Modules.php index a88a7d3155b52..de26d25452b74 100644 --- a/components/com_config/Model/Modules.php +++ b/components/com_config/Model/Modules.php @@ -196,7 +196,7 @@ public static function getActivePositions($clientId, $editPositions = false) } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); return; } diff --git a/components/com_contact/Controller/Contact.php b/components/com_contact/Controller/Contact.php index 5b84a5b4e5146..c0458a13aaf1a 100644 --- a/components/com_contact/Controller/Contact.php +++ b/components/com_contact/Controller/Contact.php @@ -86,7 +86,7 @@ public function submit() if (!$form) { - \JError::raiseError(500, $model->getError()); + throw new \Exception($model->getError(), 500); return false; } diff --git a/components/com_contact/Model/Contact.php b/components/com_contact/Model/Contact.php index 51f42db4ee7b4..bc41d52f7f7c0 100644 --- a/components/com_contact/Model/Contact.php +++ b/components/com_contact/Model/Contact.php @@ -215,13 +215,13 @@ public function getItem($pk = null) if (empty($data)) { - \JError::raiseError(404, \JText::_('COM_CONTACT_ERROR_CONTACT_NOT_FOUND')); + throw new \Exception(\JText::_('COM_CONTACT_ERROR_CONTACT_NOT_FOUND'), 404); } // 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_CONTACT_ERROR_CONTACT_NOT_FOUND')); + throw new \Exception(\JText::_('COM_CONTACT_ERROR_CONTACT_NOT_FOUND'), 404); } /** diff --git a/components/com_content/Controller/Controller.php b/components/com_content/Controller/Controller.php index 9beaec3e83f7b..e5502954bf12a 100644 --- a/components/com_content/Controller/Controller.php +++ b/components/com_content/Controller/Controller.php @@ -104,7 +104,7 @@ public function display($cachable = false, $urlparams = false) if ($vName === 'form' && !$this->checkEditId('com_content.edit.article', $id)) { // Somehow the person just went to the form - we don't allow that. - return \JError::raiseError(403, \JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); + throw new \Exception(\JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id), 403); } if ($vName === 'article') diff --git a/components/com_content/Model/Article.php b/components/com_content/Model/Article.php index a977476857ce1..9cc124111347b 100644 --- a/components/com_content/Model/Article.php +++ b/components/com_content/Model/Article.php @@ -153,13 +153,13 @@ public function getItem($pk = null) if (empty($data)) { - return \JError::raiseError(404, \JText::_('COM_CONTENT_ERROR_ARTICLE_NOT_FOUND')); + throw new \Exception(\JText::_('COM_CONTENT_ERROR_ARTICLE_NOT_FOUND'), 404); } // Check for published state if filter set. if ((is_numeric($published) || is_numeric($archived)) && (($data->state != $published) && ($data->state != $archived))) { - return \JError::raiseError(404, \JText::_('COM_CONTENT_ERROR_ARTICLE_NOT_FOUND')); + throw new \Exception(\JText::_('COM_CONTENT_ERROR_ARTICLE_NOT_FOUND'), 404); } // Convert parameter fields to objects. @@ -222,7 +222,7 @@ public function getItem($pk = null) if ($e->getCode() == 404) { // Need to go through the error handler to allow Redirect to work. - \JError::raiseError(404, $e->getMessage()); + throw new \Exception($e->getMessage(), 404); } else { @@ -292,7 +292,7 @@ public function storeVote($pk = 0, $rate = 0) } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); return false; } @@ -316,7 +316,7 @@ public function storeVote($pk = 0, $rate = 0) } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); return false; } @@ -343,7 +343,7 @@ public function storeVote($pk = 0, $rate = 0) } catch (\RuntimeException $e) { - \JError::raiseWarning(500, $e->getMessage()); + \JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); return false; } @@ -357,7 +357,7 @@ public function storeVote($pk = 0, $rate = 0) return true; } - \JError::raiseWarning(500, \JText::sprintf('COM_CONTENT_INVALID_RATING', $rate), "JModelArticle::storeVote($rate)"); + \JFactory::getApplication()->enqueueMessage(\JText::sprintf('COM_CONTENT_INVALID_RATING', $rate), 'error'); return false; } diff --git a/components/com_newsfeeds/Model/Newsfeed.php b/components/com_newsfeeds/Model/Newsfeed.php index 3d69642ebfd5b..9ad245f92c147 100644 --- a/components/com_newsfeeds/Model/Newsfeed.php +++ b/components/com_newsfeeds/Model/Newsfeed.php @@ -124,14 +124,14 @@ public function &getItem($pk = null) if (empty($data)) { - \JError::raiseError(404, \JText::_('COM_NEWSFEEDS_ERROR_FEED_NOT_FOUND')); + throw new \Exception(\JText::_('COM_NEWSFEEDS_ERROR_FEED_NOT_FOUND'), 404); } // 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')); + throw new \Exception(\JText::_('COM_NEWSFEEDS_ERROR_FEED_NOT_FOUND'), 404); } // Convert parameter fields to objects. diff --git a/components/com_tags/Model/Tag.php b/components/com_tags/Model/Tag.php index 5ffc87f593cf0..0619ad8f21ba4 100644 --- a/components/com_tags/Model/Tag.php +++ b/components/com_tags/Model/Tag.php @@ -314,7 +314,7 @@ public function getItem($pk = null) if (!$this->item) { - return \JError::raiseError(404, \JText::_('COM_TAGS_TAG_NOT_FOUND')); + throw new \Exception(\JText::_('COM_TAGS_TAG_NOT_FOUND'), 404); } return $this->item; @@ -345,7 +345,7 @@ public function hit($pk = 0) if (!$table->hasPrimaryKey()) { - \JError::raiseError(404, \JText::_('COM_TAGS_TAG_NOT_FOUND')); + throw new \Exception(\JText::_('COM_TAGS_TAG_NOT_FOUND'), 404); } } diff --git a/components/com_users/Controller/Registration.php b/components/com_users/Controller/Registration.php index 5a233f58a68c4..73ecd927f8ea1 100644 --- a/components/com_users/Controller/Registration.php +++ b/components/com_users/Controller/Registration.php @@ -43,7 +43,7 @@ public function activate() // If user registration or account activation is disabled, throw a 403. if ($uParams->get('useractivation') == 0 || $uParams->get('allowUserRegistration') == 0) { - \JError::raiseError(403, \JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN')); + throw new \Exception(\JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 403); return false; } @@ -55,7 +55,7 @@ public function activate() // Check that the token is in a valid format. if ($token === null || strlen($token) !== 32) { - \JError::raiseError(403, \JText::_('JINVALID_TOKEN')); + throw new \Exception(\JText::_('JINVALID_TOKEN'), 403); return false; } @@ -132,7 +132,7 @@ public function register() if (!$form) { - \JError::raiseError(500, $model->getError()); + throw new \Exception($model->getError(), 500); return false; } diff --git a/libraries/fof/form/field/rules.php b/libraries/fof/form/field/rules.php index 804a1af1e1fbc..f07f1d745c37d 100644 --- a/libraries/fof/form/field/rules.php +++ b/libraries/fof/form/field/rules.php @@ -140,7 +140,7 @@ protected function getInput25() if ($error = $db->getErrorMsg()) { - JError::raiseNotice(500, $error); + JFactory::getApplication()->enqueueMessage($error, 'notice'); } } else diff --git a/libraries/fof/integration/joomla/platform.php b/libraries/fof/integration/joomla/platform.php index c19397f9d6c9f..8298ccfe0fb90 100644 --- a/libraries/fof/integration/joomla/platform.php +++ b/libraries/fof/integration/joomla/platform.php @@ -49,14 +49,7 @@ public function checkExecution() public function raiseError($code, $message) { - if (version_compare($this->version, '3.0', 'ge')) - { - throw new Exception($message, $code); - } - else - { - return JError::raiseError($code, $message); - } + throw new Exception($message, $code); } /** diff --git a/libraries/fof/utils/installscript/installscript.php b/libraries/fof/utils/installscript/installscript.php index 435b966ae06a8..610b98abaaa8b 100644 --- a/libraries/fof/utils/installscript/installscript.php +++ b/libraries/fof/utils/installscript/installscript.php @@ -240,7 +240,7 @@ public function preflight($type, $parent) } else { - JError::raiseWarning(100, $msg); + JFactory::getApplication()->enqueueMessage($msg, 'error'); } return false; @@ -258,7 +258,7 @@ public function preflight($type, $parent) } else { - JError::raiseWarning(100, $msg); + JFactory::getApplication()->enqueueMessage($msg, 'error'); } return false; @@ -275,7 +275,7 @@ public function preflight($type, $parent) } else { - JError::raiseWarning(100, $msg); + JFactory::getApplication()->enqueueMessage($msg, 'error'); } return false; @@ -1784,7 +1784,7 @@ private function _createAdminMenus($parent) if (empty($menu_ids_level1)) { // Oops! Could not get the menu ID. Go back and rollback changes. - JError::raiseWarning(1, $table->getError()); + JFactory::getApplication()->enqueueMessage($table->getError(), 'error'); return false; } @@ -1821,7 +1821,7 @@ private function _createAdminMenus($parent) if (!$table->bind($data) || !$table->check() || !$table->store()) { // Install failed, warn user and rollback changes - JError::raiseWarning(1, $table->getError()); + JFactory::getApplication()->enqueueMessage($table->getError(), 'error'); return false; } diff --git a/libraries/src/CMS/Application/CMSApplication.php b/libraries/src/CMS/Application/CMSApplication.php index e78c3b2b86784..6bf4ca55d5904 100644 --- a/libraries/src/CMS/Application/CMSApplication.php +++ b/libraries/src/CMS/Application/CMSApplication.php @@ -883,13 +883,13 @@ public function login($credentials, $options = array()) switch ($authorisation->status) { case Authentication::STATUS_EXPIRED: - return \JError::raiseWarning('102002', \JText::_('JLIB_LOGIN_EXPIRED')); + return \JFactory::getApplication()->enqueueMessage(\JText::_('JLIB_LOGIN_EXPIRED'), 'error'); case Authentication::STATUS_DENIED: - return \JError::raiseWarning('102003', \JText::_('JLIB_LOGIN_DENIED')); + return \JFactory::getApplication()->enqueueMessage(\JText::_('JLIB_LOGIN_DENIED'), 'error'); default: - return \JError::raiseWarning('102004', \JText::_('JLIB_LOGIN_AUTHORISATION')); + return \JFactory::getApplication()->enqueueMessage(\JText::_('JLIB_LOGIN_AUTHORISATION'), 'error'); } } } diff --git a/libraries/src/CMS/Installer/Adapter/ComponentAdapter.php b/libraries/src/CMS/Installer/Adapter/ComponentAdapter.php index 5c1b7926212ad..3f2f7edfa983d 100644 --- a/libraries/src/CMS/Installer/Adapter/ComponentAdapter.php +++ b/libraries/src/CMS/Installer/Adapter/ComponentAdapter.php @@ -1080,7 +1080,7 @@ protected function _removeAdminMenus($id) { if (!$table->delete((int) $menuid)) { - \JError::raiseWarning(1, $table->getError()); + \JFactory::getApplication()->enqueueMessage($table->getError(), 'error'); $result = false; } @@ -1305,7 +1305,7 @@ protected function _createAdminMenuItem(array &$data, $parentId) if (!$menu_id) { // Oops! Could not get the menu ID. Go back and rollback changes. - \JError::raiseWarning(1, $table->getError()); + \JFactory::getApplication()->enqueueMessage($table->getError(), 'error'); return false; } @@ -1322,7 +1322,7 @@ protected function _createAdminMenuItem(array &$data, $parentId) if (!$table->bind($data) || !$table->check() || !$table->store()) { // Install failed, warn user and rollback changes - \JError::raiseWarning(1, $table->getError()); + \JFactory::getApplication()->enqueueMessage($table->getError(), 'error'); return false; } diff --git a/libraries/src/CMS/Model/Admin.php b/libraries/src/CMS/Model/Admin.php index 393ca71b41b82..58edcf97cf599 100644 --- a/libraries/src/CMS/Model/Admin.php +++ b/libraries/src/CMS/Model/Admin.php @@ -1300,7 +1300,7 @@ public function saveorder($pks = array(), $order = null) if (empty($pks)) { - return \JError::raiseWarning(500, \JText::_($this->text_prefix . '_ERROR_NO_ITEMS_SELECTED')); + return \JFactory::getApplication()->enqueueMessage(\JText::_($this->text_prefix . '_ERROR_NO_ITEMS_SELECTED'), 'error'); } $orderingField = $table->getColumnAlias('ordering'); diff --git a/libraries/src/CMS/View/Category.php b/libraries/src/CMS/View/Category.php index a565beb8fbc91..9458431ec58f3 100644 --- a/libraries/src/CMS/View/Category.php +++ b/libraries/src/CMS/View/Category.php @@ -138,7 +138,7 @@ public function commonCategoryDisplay() if (!in_array($category->access, $groups)) { - return \JError::raiseError(403, \JText::_('JERROR_ALERTNOAUTHOR')); + throw new \Exception(\JText::_('JERROR_ALERTNOAUTHOR'), 403); } // Check whether category access level allows access. diff --git a/libraries/src/CMS/View/CategoryFeed.php b/libraries/src/CMS/View/CategoryFeed.php index 2ab1e071f3758..bce6efa5b093d 100644 --- a/libraries/src/CMS/View/CategoryFeed.php +++ b/libraries/src/CMS/View/CategoryFeed.php @@ -71,7 +71,7 @@ public function display($tpl = null) // Don't display feed if category id missing or non existent if ($category == false || $category->alias === 'root') { - return \JError::raiseError(404, \JText::_('JGLOBAL_CATEGORY_NOT_FOUND')); + throw new \Exception(\JText::_('JGLOBAL_CATEGORY_NOT_FOUND'), 404); } foreach ($items as $item) diff --git a/plugins/content/joomla/joomla.php b/plugins/content/joomla/joomla.php index 80355508d895a..b78ae97ba1763 100644 --- a/plugins/content/joomla/joomla.php +++ b/plugins/content/joomla/joomla.php @@ -153,7 +153,7 @@ public function onContentBeforeDelete($context, $data) { $msg = JText::sprintf('COM_CATEGORIES_DELETE_NOT_ALLOWED', $data->get('title')) . JText::plural('COM_CATEGORIES_N_ITEMS_ASSIGNED', $count); - JError::raiseWarning(403, $msg); + JFactory::getApplication()->enqueueMessage($msg, 'error'); $result = false; } @@ -170,7 +170,7 @@ public function onContentBeforeDelete($context, $data) { $msg = JText::sprintf('COM_CATEGORIES_DELETE_NOT_ALLOWED', $data->get('title')) . JText::plural('COM_CATEGORIES_HAS_SUBCATEGORY_ITEMS', $count); - JError::raiseWarning(403, $msg); + JFactory::getApplication()->enqueueMessage($msg, 'error'); $result = false; } } @@ -207,7 +207,7 @@ private function _countItemsInCategory($table, $catid) } catch (RuntimeException $e) { - JError::raiseWarning(500, $e->getMessage()); + JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); return false; } @@ -258,7 +258,7 @@ private function _countItemsInChildren($table, $catid, $data) } catch (RuntimeException $e) { - JError::raiseWarning(500, $e->getMessage()); + JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); return false; } diff --git a/plugins/user/contactcreator/contactcreator.php b/plugins/user/contactcreator/contactcreator.php index 244ec4b2868de..2a65043229a79 100644 --- a/plugins/user/contactcreator/contactcreator.php +++ b/plugins/user/contactcreator/contactcreator.php @@ -69,7 +69,7 @@ public function onUserAfterSave($user, $isnew, $success, $msg) if (empty($categoryId)) { - JError::raiseWarning('', JText::_('PLG_CONTACTCREATOR_ERR_NO_CATEGORY')); + JFactory::getApplication()->enqueueMessage(JText::_('PLG_CONTACTCREATOR_ERR_NO_CATEGORY'), 'error'); return false; } @@ -122,7 +122,7 @@ public function onUserAfterSave($user, $isnew, $success, $msg) } } - JError::raiseWarning('', JText::_('PLG_CONTACTCREATOR_ERR_FAILED_CREATING_CONTACT')); + JFactory::getApplication()->enqueueMessage(JText::_('PLG_CONTACTCREATOR_ERR_FAILED_CREATING_CONTACT'), 'error'); return false; } diff --git a/templates/system/error.php b/templates/system/error.php index c6b33f03c5eaf..037f9d74718cc 100644 --- a/templates/system/error.php +++ b/templates/system/error.php @@ -13,7 +13,7 @@ if (!isset($this->error)) { - $this->error = JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + $this->error = JFactory::getApplication()->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); $this->debug = false; }