PageRenderTime 52ms CodeModel.GetById 30ms RepoModel.GetById 0ms app.codeStats 0ms

/src/site/includes/framework.php

https://github.com/bhar1red/anahita
PHP | 95 lines | 58 code | 19 blank | 18 comment | 2 complexity | c1aca701ba5f0be1511c9bb287360e1a MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. <?php
  2. /**
  3. * LICENSE: ##LICENSE##
  4. *
  5. * @category Anahita
  6. * @author Arash Sanieyan <ash@anahitapolis.com>
  7. * @author Rastin Mehr <rastin@anahitapolis.com>
  8. * @copyright 2008 - 2010 rmdStudio Inc./Peerglobe Technology Inc
  9. * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl-3.0.html>
  10. * @version SVN: $Id: view.php 13650 2012-04-11 08:56:41Z asanieyan $
  11. * @link http://www.anahitapolis.com
  12. */
  13. // no direct access
  14. defined('JPATH_BASE') or die('Restricted access');
  15. defined('_JEXEC') or define('_JEXEC', 1);
  16. define('DS', DIRECTORY_SEPARATOR );
  17. define('JPATH_ROOT', JPATH_BASE );
  18. define('JPATH_SITE', JPATH_ROOT );
  19. define('JPATH_CONFIGURATION', JPATH_ROOT );
  20. define('JPATH_ADMINISTRATOR', JPATH_ROOT.'/administrator');
  21. define('JPATH_XMLRPC', JPATH_ROOT.'/xmlrpc');
  22. define('JPATH_LIBRARIES', JPATH_ROOT.'/libraries');
  23. define('JPATH_PLUGINS', JPATH_ROOT.'/plugins');
  24. define('JPATH_INSTALLATION', JPATH_ROOT.'/installation');
  25. define('JPATH_THEMES', JPATH_BASE.'/templates');
  26. define('JPATH_CACHE', JPATH_BASE.DS.'cache' );
  27. define('JPATH_VENDOR', JPATH_BASE.'/vendor');
  28. /*
  29. * Installation check, and check on removal of the install directory.
  30. */
  31. if (!file_exists( JPATH_CONFIGURATION.'/configuration.php') || (filesize( JPATH_CONFIGURATION.'/configuration.php') < 10) ) {
  32. echo 'No configuration file found. Exiting...';
  33. exit();
  34. }
  35. // Joomla : setup
  36. require_once(JPATH_LIBRARIES . '/joomla/import.php');
  37. jimport('joomla.application.application');
  38. jimport('joomla.application.router');
  39. jimport('joomla.application.menu');
  40. jimport('joomla.user.user');
  41. jimport('joomla.environment.uri');
  42. jimport('joomla.html.html');
  43. jimport('joomla.html.parameter');
  44. jimport('joomla.utilities.utility');
  45. jimport('joomla.event.event');
  46. jimport('joomla.event.dispatcher');
  47. jimport('joomla.language.language');
  48. jimport('joomla.utilities.string');
  49. jimport('joomla.plugin.helper');
  50. require_once JPATH_CONFIGURATION . '/configuration.php';
  51. require_once( JPATH_LIBRARIES.'/anahita/anahita.php');
  52. $config = new JConfig();
  53. //instantiate anahita and nooku
  54. Anahita::getInstance(array(
  55. 'cache_prefix' => md5($config->secret).'-cache-koowa',
  56. 'cache_enabled' => $config->caching
  57. ));
  58. KServiceIdentifier::setApplication('site' , JPATH_SITE);
  59. KServiceIdentifier::setApplication('admin', JPATH_ADMINISTRATOR);
  60. KLoader::addAdapter(new AnLoaderAdapterComponent(array('basepath'=>JPATH_BASE)));
  61. KServiceIdentifier::addLocator( KService::get('anahita:service.locator.component') );
  62. KLoader::addAdapter(new KLoaderAdapterModule(array('basepath' => JPATH_BASE)));
  63. KServiceIdentifier::addLocator( KService::get('anahita:service.locator.module') );
  64. KLoader::addAdapter(new KLoaderAdapterPlugin(array('basepath' => JPATH_ROOT)));
  65. KServiceIdentifier::addLocator(KService::get('koowa:service.locator.plugin'));
  66. KLoader::addAdapter(new AnLoaderAdapterTemplate(array('basepath'=>JPATH_BASE)));
  67. KServiceIdentifier::addLocator( KService::get('anahita:service.locator.template') );
  68. KService::setAlias('koowa:database.adapter.mysqli', 'com://admin/default.database.adapter.mysqli');
  69. KService::setAlias('anahita:domain.store.database', 'com:base.domain.store.database');
  70. KService::setAlias('anahita:domain.space', 'com:base.domain.space');
  71. //make sure for the autoloader to be reigstered after nooku
  72. $autoloader = require_once( JPATH_VENDOR.'/autoload.php' );
  73. $autoloader->unregister();
  74. $autoloader->register();
  75. KLoader::getInstance()->loadIdentifier('com://site/application.aliases');
  76. ?>