getUserState('com_cpanel.mtupgrade.checked')) { // If it is not enabled, let's check to see if it is even installed. $db = &JFactory::getDBO(); $db->setQuery( 'SELECT id' . ' FROM #__plugins' . ' WHERE folder = "system"' . ' AND element = "mtupgrade"' ); $exists = (bool) $db->loadResult(); // If it is not installed, install it as disabled and raise a notice. if (!$exists) { $plg = & JTable::getInstance('plugin'); $plg->name = 'System - Mootools Upgrade'; $plg->ordering = 0; $plg->folder = 'system'; $plg->iscore = 0; $plg->access = 0; $plg->client_id = 0; $plg->element = 'mtupgrade'; $plg->published = 0; // If unable to store the plugin, raise a notice. if (!$plg->store()) { JError::raiseNotice(500, $plg->getError() /*JText::sprintf('Unable to auto-install the Mootools Upgrade plugin.', $plg->getError())*/); } // Show a message stating that the plugin is now available. else { //$app->enqueueMessage(JText::_('Mootools Upgrade plugin available.')); } } // Set the mtupgrade plugin checked flag for the session. $app->setUserState('com_cpanel.mtupgrade.checked', true); } } //set the component specific template file in the request JRequest::setVar('tmpl', 'cpanel'); HTML_cpanel::display(); } break; }