PageRenderTime 37ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/src/administrator/includes/framework.php

https://github.com/bhar1red/anahita
PHP | 84 lines | 50 code | 17 blank | 17 comment | 2 complexity | b99b158b6405468dcee4dc3d8ea75e0c 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', dirname(JPATH_BASE));
  18. define( 'JPATH_SITE', JPATH_ROOT );
  19. define( 'JPATH_CONFIGURATION', JPATH_ROOT );
  20. define( 'JPATH_ADMINISTRATOR', JPATH_ROOT.DS.'administrator' );
  21. define( 'JPATH_XMLRPC', JPATH_ROOT.DS.'xmlrpc' );
  22. define( 'JPATH_LIBRARIES', JPATH_ROOT.DS.'libraries' );
  23. define( 'JPATH_PLUGINS', JPATH_ROOT.DS.'plugins' );
  24. define( 'JPATH_INSTALLATION', JPATH_ROOT.DS.'installation' );
  25. define( 'JPATH_THEMES', JPATH_BASE.DS.'templates' );
  26. define( 'JPATH_CACHE', JPATH_BASE.DS.'cache' );
  27. /*
  28. * Installation check, and check on removal of the install directory.
  29. */
  30. if (!file_exists( JPATH_CONFIGURATION.'/configuration.php' ) || (filesize( JPATH_CONFIGURATION.'/configuration.php' ) < 10) ) {
  31. echo 'No configuration file found. Exciting...';
  32. exit();
  33. }
  34. // Joomla : setup
  35. require_once(JPATH_LIBRARIES . '/joomla/import.php');
  36. jimport( 'joomla.application.application' );
  37. jimport( 'joomla.application.menu' );
  38. jimport( 'joomla.user.user');
  39. jimport( 'joomla.environment.uri' );
  40. jimport( 'joomla.html.html' );
  41. jimport( 'joomla.html.parameter' );
  42. jimport( 'joomla.utilities.utility' );
  43. jimport( 'joomla.event.event');
  44. jimport( 'joomla.event.dispatcher');
  45. jimport( 'joomla.language.language');
  46. jimport( 'joomla.utilities.string' );
  47. require_once JPATH_CONFIGURATION . '/configuration.php';
  48. require_once( JPATH_LIBRARIES.'/anahita/anahita.php');
  49. $config = new JConfig();
  50. //instantiate anahita and nooku
  51. Anahita::getInstance(array(
  52. 'cache_prefix' => md5($config->secret).'-cache-koowa',
  53. 'cache_enabled' => $config->caching
  54. ));
  55. KServiceIdentifier::setApplication('site' , JPATH_SITE);
  56. KServiceIdentifier::setApplication('admin', JPATH_ADMINISTRATOR);
  57. KLoader::addAdapter(new AnLoaderAdapterComponent(array('basepath'=>JPATH_BASE)));
  58. KServiceIdentifier::addLocator( KService::get('anahita:service.locator.component') );
  59. KLoader::addAdapter(new KLoaderAdapterModule(array('basepath' => JPATH_BASE)));
  60. KServiceIdentifier::addLocator( KService::get('anahita:service.locator.module') );
  61. KLoader::addAdapter(new KLoaderAdapterPlugin(array('basepath' => JPATH_ROOT)));
  62. KServiceIdentifier::addLocator(KService::get('koowa:service.locator.plugin'));
  63. KService::setAlias('koowa:database.adapter.mysqli', 'com://admin/default.database.adapter.mysqli');
  64. KService::setAlias('anahita:domain.store.database', 'com:base.domain.store.database');
  65. KService::setAlias('anahita:domain.space', 'com:base.domain.space');
  66. KLoader::getInstance()->loadIdentifier('com://admin/application.aliases');
  67. ?>