public function __construct($subject, $config = array()) { // Check if Koowa is active if (JFactory::getApplication()->getCfg('dbtype') != 'mysqli') { JError::raiseWarning(0, JText::_("Koowa plugin requires MySQLi Database Driver. Please change your database configuration settings to 'mysqli'")); return; } // Check for suhosin if (in_array('suhosin', get_loaded_extensions())) { //Attempt setting the whitelist value @ini_set('suhosin.executor.include.whitelist', 'tmpl://, file://'); //Checking if the whitelist is ok if (!@ini_get('suhosin.executor.include.whitelist') || strpos(@ini_get('suhosin.executor.include.whitelist'), 'tmpl://') === false) { JError::raiseWarning(0, sprintf(JText::_('Your server has Suhosin loaded. Please follow <a href="%s" target="_blank">this</a> tutorial.'), 'https://nooku.assembla.com/wiki/show/nooku-framework/Known_Issues')); return; } } //Set constants define('KDEBUG', JDEBUG); define('JPATH_IMAGES', JPATH_ROOT . '/images'); //Set exception handler set_exception_handler(array($this, 'exceptionHandler')); // Require the library loader JLoader::import('libraries.koowa.koowa', JPATH_ROOT); JLoader::import('libraries.koowa.loader.loader', JPATH_ROOT); //Setup the loader KLoader::addAdapter(new KLoaderAdapterKoowa(Koowa::getPath())); KLoader::addAdapter(new KLoaderAdapterJoomla(JPATH_LIBRARIES)); KLoader::addAdapter(new KLoaderAdapterModule(JPATH_BASE)); KLoader::addAdapter(new KLoaderAdapterPlugin(JPATH_ROOT)); KLoader::addAdapter(new KLoaderAdapterComponent(JPATH_BASE)); //Setup the factory KFactory::addAdapter(new KFactoryAdapterKoowa()); KFactory::addAdapter(new KFactoryAdapterJoomla()); KFactory::addAdapter(new KFactoryAdapterModule()); KFactory::addAdapter(new KFactoryAdapterPlugin()); KFactory::addAdapter(new KFactoryAdapterComponent()); //Setup the identifier application paths KIdentifier::registerApplication('site', JPATH_SITE); KIdentifier::registerApplication('admin', JPATH_ADMINISTRATOR); //Setup the request KRequest::root(str_replace('/' . JFactory::getApplication()->getName(), '', KRequest::base())); //Set factory identifier aliasses KFactory::map('lib.koowa.database.adapter.mysqli', 'admin::com.default.database.adapter.mysqli'); //Load the koowa plugins JPluginHelper::importPlugin('koowa', null, true, KFactory::get('lib.koowa.event.dispatcher')); //Bugfix : Set offset accoording to user's timezone if (!KFactory::get('lib.joomla.user')->guest) { if ($offset = KFactory::get('lib.joomla.user')->getParam('timezone')) { KFactory::get('lib.joomla.config')->setValue('config.offset', $offset); } } parent::__construct($subject, $config); }
jimport( 'joomla.html.parameter' ); jimport( 'joomla.utilities.utility' ); jimport( 'joomla.event.event'); jimport( 'joomla.event.dispatcher'); jimport( 'joomla.language.language'); jimport( 'joomla.utilities.string' ); jimport( 'joomla.plugin.helper' ); // Koowa : setup loader JLoader::import('libraries.koowa.koowa' , JPATH_ROOT); JLoader::import('libraries.koowa.loader.loader', JPATH_ROOT); KLoader::addAdapter(new KLoaderAdapterKoowa(Koowa::getPath())); KLoader::addAdapter(new KLoaderAdapterJoomla(JPATH_LIBRARIES)); KLoader::addAdapter(new KLoaderAdapterModule(JPATH_BASE)); KLoader::addAdapter(new KLoaderAdapterPlugin(JPATH_ROOT)); KLoader::addAdapter(new KLoaderAdapterComponent(JPATH_BASE)); // Koowa : setup factory KFactory::addAdapter(new KFactoryAdapterKoowa()); KFactory::addAdapter(new KFactoryAdapterJoomla()); KFactory::addAdapter(new KFactoryAdapterModule()); KFactory::addAdapter(new KFactoryAdapterPlugin()); KFactory::addAdapter(new KFactoryAdapterComponent()); //Koowa : register identifier application paths KIdentifier::registerApplication('site' , JPATH_SITE); KIdentifier::registerApplication('admin', JPATH_ADMINISTRATOR); //Koowa : setup factory mappings KFactory::map('koowa:database.adapter.mysqli', 'com://admin/default.database.adapter.mysqli');