Example #1
0
 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);
 }
Example #2
0
 */
require_once Koowa::getPath() . '/exception/interface.php';
require_once Koowa::getPath() . '/exception/exception.php';
/**
 * Indentifier Classes
 */
require_once Koowa::getPath() . '/identifier/interface.php';
require_once Koowa::getPath() . '/identifier/identifier.php';
require_once Koowa::getPath() . '/identifier/exception.php';
/**
 * Loader Classes
 */
require_once Koowa::getPath() . '/loader/adapter/interface.php';
require_once Koowa::getPath() . '/loader/adapter/exception.php';
require_once Koowa::getPath() . '/loader/adapter/abstract.php';
require_once Koowa::getPath() . '/loader/adapter/koowa.php';
//Instantiate the loader singleton
KLoader::instantiate();
/**
 * KLoader class
 *
 * @author      Johan Janssens <*****@*****.**>
 * @category    Koowa
 * @package     Koowa_Loader
 * @static
 */
class KLoader
{
    /**
     * The file container
     *
Example #3
0
jimport( 'joomla.user.user');
jimport( 'joomla.environment.uri' );
jimport( 'joomla.html.html' );
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);
Example #4
0
 /**
  * Intelligent file importer
  *
  * @package		Koowa
  * @param string $path A dot syntax path
  */
 public static function loadFile($path, $basepath = '')
 {
     $parts = explode('.', $path);
     $result = '';
     switch ($parts[0]) {
         case 'lib':
             if ($parts[1] == 'joomla') {
                 unset($parts[0]);
                 $path = implode('.', $parts);
                 $result = JLoader::import($path, null, 'libraries.');
             }
             if ($parts[1] == 'koowa') {
                 unset($parts[0]);
                 unset($parts[1]);
                 $path = implode('.', $parts);
                 $result = JLoader::import($path, Koowa::getPath());
             }
             break;
         default:
             if (strpos($parts[0], '::') !== false) {
                 $app = explode('::', $parts[0]);
                 $name = $app[0];
             } else {
                 $app = KFactory::get('lib.joomla.application');
                 $name = $app->getName();
             }
             $app = $name == 'site' ? JPATH_SITE : JPATH_ADMINISTRATOR;
             $com = $parts[1];
             unset($parts[0]);
             unset($parts[1]);
             $base = $app . DS . 'components' . DS . 'com_' . $com;
             $path = implode('.', $parts);
             $result = JLoader::import($path, $base, $com . '.');
             break;
     }
     return $result;
 }