Skip to content
Permalink
Browse files

OTHER: Fixing Joomla framework deprecated and unsafe warnings

- Used JEDChecker to indentify and fix issues
- Fixing JRequest to JFactory::getApplication()->input
- Fixing JError is deprecated warnings
  • Loading branch information...
vasiljevski committed Jul 13, 2017
1 parent 1cf55a7 commit cacebaef3372e4d6c9e2e4d2ca696b8dd1b699cf
@@ -12,44 +12,49 @@
// no direct access
defined('_JEXEC') or die('Restricted access');
$ag_template = "default"; // Set template to default
$jinput = JFactory::getApplication()->input;
$resources_path = JURI::root() . 'administrator/components/com_admirorgallery/';
if (!JFactory::getUser()->authorise('core.manage', 'com_admirorgallery'))
{
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
}
// OUTPUT
// echo "POST: "."<br />"; print_r($_POST); echo "<hr />";
// echo "GET: "."<br />"; print_r($_GET); echo "<hr />";
$AG_template = "default"; // Set template to default
JRequest::setVar('AG_template', $AG_template);
$jinput->set('AG_template', $ag_template);
// Shared scripts for all views
$doc = JFactory::getDocument();
$doc->addScript(JURI::root() . 'plugins/content/admirorgallery/admirorgallery/AG_jQuery.js');
$doc->addScript(JURI::root() . 'administrator/components/com_admirorgallery/scripts/jquery.hotkeys-0.7.9.min.js');
$doc->addStyleSheet(JURI::root() . 'administrator/components/com_admirorgallery/templates/' . $AG_template . '/css/template.css');
$doc->addStyleSheet(JURI::root() . 'administrator/components/com_admirorgallery/templates/' . $AG_template . '/css/toolbar.css');
$doc->addScript(
JURI::root() . 'plugins/content/admirorgallery/admirorgallery/AG_jQuery.js');
$doc->addScript(
$resources_path. 'scripts/jquery.hotkeys-0.7.9.min.js');
$doc->addStyleSheet(
$resources_path. 'templates/' . $ag_template . '/css/template.css');
$doc->addStyleSheet(
$resources_path. 'templates/' . $ag_template . '/css/toolbar.css');
// Require the base controller
require_once (JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'controller.php');
// Require specific controller if requested
$controller = JRequest::getWord('controller');
if ($controller) {
$path = JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'controllers' . DIRECTORY_SEPARATOR . $controller . '.php';
$spec_controller = $jinput->get('controller');
if ($spec_controller) {
$path = JPATH_COMPONENT .
DIRECTORY_SEPARATOR .
'controllers' .
DIRECTORY_SEPARATOR .
$spec_controller . '.php';
if (file_exists($path)) {
require_once $path;
} else {
$controller = '';
$spec_controller = '';
}
}
// Create the controller
$classname = 'AdmirorgalleryController' . $controller;
$classname = 'AdmirorgalleryController' . $spec_controller;
$controller = new $classname( );
// Perform the Request task
$controller->execute(JRequest::getVar('task'));
// Redirect if set by the controller
$controller->redirect();
$controller->execute($jinput->get('task'));
$controller->redirect();
@@ -19,30 +19,30 @@
class AdmirorgalleryController extends JControllerLegacy {
function display($cachable = false, $urlparams = false) {
$jinput = JFactory::getApplication()->input;
require_once JPATH_COMPONENT . '/helpers/admirorgallery.php';
if (!is_dir(JPATH_SITE . '/plugins/content/admirorgallery/')) {
JError::raiseWarning('2', JText::_('COM_PLUGIN_NOT_INSTALLED'));
JFactory::getApplication()->enqueueMessage(
JText::_('COM_PLUGIN_NOT_INSTALLED'), 'warning');
}
AdmirorGalleryHelper::addSubmenu(JRequest::getCmd('view', 'control_panel'), JRequest::getCmd('AG_resourceType', ''));
AdmirorGalleryHelper::addSubmenu(
$jinput->getCmd('view', 'control_panel'), $jinput->getCmd('AG_resourceType', ''));
$doc = JFactory::getDocument();
$viewType = $doc->getType();
$viewName = $this->input->get('view', $this->default_view);
$viewLayout = $this->input->get('layout', 'default', 'string');
$viewName = $jinput->get('view', $this->default_view);
$viewLayout = $jinput->get('layout', 'default', 'string');
$view = $this->getView($viewName, $viewType, '', array('base_path' => $this->basePath, 'layout' => $viewLayout));
JToolBarHelper::help("", false, "http://www.admiror-design-studio.com/admiror-joomla-extensions/admiror-gallery/user-manuals");
if (JFactory::getUser()->authorise('core.admin', 'com_admirorgallery')) {
JToolbarHelper::preferences('com_admirorgallery');
if($viewName == 'resourcemanager')
{
if ($viewName == 'resourcemanager') {
JToolbarHelper::custom('ag_install', 'ag_install', 'ag_install', 'JTOOLBAR_INSTALL', false, false);
JToolbarHelper::deleteList('COM_ADMIRORGALLERY_ARE_YOU_SURE', 'ag_uninstall', 'JTOOLBAR_UNINSTALL');
}
else
{
} else {
JToolbarHelper::custom('AG_apply', 'publish', 'publish', 'COM_ADMIRORGALLERY_APPLY_DESC', false, false);
JToolbarHelper::custom('AG_reset', 'unpublish', 'unpublish', 'COM_ADMIRORGALLERY_RESET_DESC', false, false);
}
@@ -60,4 +60,4 @@ function display($cachable = false, $urlparams = false) {
parent::display();
}
}
}
@@ -46,7 +46,7 @@
//Display page heading
if($active->params->get('show_page_heading'))
{
$article->text = '<h1>'.JSite::getMenu()->getActive()->params->get('page_title').'</h1>';
$article->text = '<h1>'.$active->params->get('page_title').'</h1>';
}
$article->text .= '{AG '.$ag_inlineParams.' }'.$this->galleryName.'{/AG}';
$article->id = 0;

0 comments on commit cacebae

Please sign in to comment.
You can’t perform that action at this time.