connector.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * xBug
  4. *
  5. * Copyright 2010 by Shaun McCormick <shaun+xbug@modx.com>
  6. *
  7. * xBug is free software; you can redistribute it and/or modify it under the
  8. * terms of the GNU General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option) any later
  10. * version.
  11. *
  12. * xBug is distributed in the hope that it will be useful, but WITHOUT ANY
  13. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  14. * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along with
  17. * xBug; if not, write to the Free Software Foundation, Inc., 59 Temple
  18. * Place, Suite 330, Boston, MA 02111-1307 USA
  19. *
  20. * @package xbug
  21. */
  22. /**
  23. * xBug Connector
  24. *
  25. * @package xbug
  26. */
  27. require_once dirname(dirname(dirname(dirname(__FILE__)))).'/config.core.php';
  28. require_once MODX_CORE_PATH.'config/'.MODX_CONFIG_KEY.'.inc.php';
  29. require_once MODX_CONNECTORS_PATH.'index.php';
  30. @session_cache_limiter('nocache');
  31. $corePath = $modx->getOption('xbug.core_path',null,$modx->getOption('core_path').'components/xbug/');
  32. require_once $corePath.'model/xbug/xbug.class.php';
  33. $modx->xbug = new xBug($modx);
  34. if (!empty($_REQUEST['action'])) {
  35. define('MODX_REQP',false);
  36. }
  37. if ($modx->user->hasSessionContext($modx->context->get('key'))) {
  38. $_SERVER['HTTP_MODAUTH'] = $_SESSION["modx.{$modx->context->get('key')}.user.token"];
  39. $_REQUEST['HTTP_MODAUTH'] = $_SERVER['HTTP_MODAUTH'];
  40. } else { // Allow anonymous access
  41. $_SESSION["modx.{$modx->context->get('key')}.user.token"] = 0;
  42. $_SERVER['HTTP_MODAUTH'] = 0;
  43. }
  44. $modx->lexicon->load('xbug:default');
  45. /* handle request */
  46. $path = $modx->getOption('processorsPath',$modx->xbug->config,$corePath.'processors/');
  47. $modx->request->handleRequest(array(
  48. 'processors_path' => $path,
  49. 'location' => '',
  50. ));