connector.php 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. require_once dirname(dirname(dirname(dirname(__FILE__)))).'/config.core.php';
  3. require_once MODX_CORE_PATH.'config/'.MODX_CONFIG_KEY.'.inc.php';
  4. require_once MODX_CONNECTORS_PATH.'index.php';
  5. $basePath = $modx->getOption('gatewaymanager.core_path', $config, $modx->getOption('core_path').'components/gatewaymanager/');
  6. require_once $basePath.'model/gatewaymanager/gatewaymanager.class.php';
  7. $modx->gatewaymanager = new GatewayManager($modx);
  8. $modx->lexicon->load('gatewaymanager:default');
  9. // when not is in a manager context; and action isset, set some params to give access
  10. if($modx->context->get('key') != 'mgr' && !empty($_REQUEST['action'])) {
  11. $_SERVER['HTTP_MODAUTH'] = $modx->site_id;
  12. $_SESSION['modx.'.$modx->context->get('key').'.user.token'] = $modx->site_id;
  13. }
  14. // figure out wich path we want to load the action from
  15. $cp = 'processorsPath';
  16. if(isset($_REQUEST['cp']) && !empty($_REQUEST['cp']) && array_key_exists($_REQUEST['cp'], $modx->gatewaymanager->config)) {
  17. $cp = $_REQUEST['cp'];
  18. }
  19. /* handle request */
  20. $path = $modx->getOption($cp, $modx->gatewaymanager->config, $basePath.'processors/');
  21. $modx->request->handleRequest(array(
  22. 'processors_path' => $path,
  23. 'location' => '',
  24. ));
  25. ?>