Ejemplo n.º 1
0
 /**
  * Redirect user to the first page of pagination
  *
  * @return string
  */
 public function redirectToFirst()
 {
     unset($_GET[$this->pdoTools->config['pageVarKey']]);
     unset($_GET[$this->modx->getOption('request_param_alias', null, 'q')]);
     $this->modx->sendRedirect($this->modx->makeUrl($this->modx->resource->id, $this->modx->context->key, $_GET, 'full'));
     return '';
 }
Ejemplo n.º 2
0
 /**
  * Redirect user to the first page of pagination
  *
  * @param $isAjax
  *
  * @return string
  */
 public function redirectToFirst($isAjax = false)
 {
     unset($_GET[$this->pdoTools->config['pageVarKey']]);
     unset($_GET[$this->modx->getOption('request_param_alias', null, 'q')]);
     if (!$isAjax) {
         $this->modx->sendRedirect($this->modx->makeUrl($this->modx->resource->id, $this->modx->context->key, $_GET, 'full'));
         return '';
     } else {
         $_GET[$this->pdoTools->config['pageVarKey']] = 1;
         $_REQUEST = $_GET;
         return $this->modx->runSnippet('pdoPage', $this->pdoTools->config);
     }
 }
Ejemplo n.º 3
0
 /**
  * Check to see if the redirect URL was set; if so, redirect
  * @return void
  */
 public function checkForRedirect()
 {
     $url = $this->formit->postHooks->getRedirectUrl();
     if (!empty($url) && !$this->formit->inTestMode) {
         $this->modx->sendRedirect($url);
     }
 }
Ejemplo n.º 4
0
 /**
  * Show the remembered list
  *
  * @param array $options Template options
  * @return string
  */
 public function showList($options)
 {
     $output = array();
     // Generate the list
     $list = array();
     foreach ($_SESSION['rememberThis'] as $element) {
         $list[] = $element['element']['identifier'];
     }
     $output['list'] = $list;
     // Generate the result
     if (!count($_SESSION['rememberThis'])) {
         if (!$this->getOption('notRememberRedirect')) {
             $output['result'] = $this->modx->getChunk($options['outerTpl'], array('wrapper' => $this->modx->getChunk($options['noResultsTpl']), 'count' => $this->getOption('showZeroCount') ? '0' : ''));
         } else {
             $this->modx->sendRedirect($this->modx->makeUrl($this->getOption('notRememberRedirect')));
         }
     } else {
         $output['result'] = $this->modx->getChunk($options['outerTpl'], array('wrapper' => $this->showElements($options['rowTpl']), 'count' => (string) count($_SESSION['rememberThis'])));
     }
     // Generate count
     $output['count'] = count($_SESSION['rememberThis']);
     // Generate debug informations
     if ($this->getOption('debug')) {
         $output['debug'] = '<pre>DEBUG: $_SESSION["rememberThis"] = ' . print_r($_SESSION['rememberThis'], TRUE) . '</pre>';
     }
     return $output;
 }
Ejemplo n.º 5
0
 /**
  * Cleans the resource identifier from the request params.
  *
  * @param string $identifier The raw identifier.
  * @return string|integer The cleansed identifier.
  */
 public function _cleanResourceIdentifier($identifier)
 {
     if (empty($identifier)) {
         $identifier = $this->modx->getOption('site_start', null, 1);
         $this->modx->resourceMethod = 'id';
     } elseif ($this->modx->getOption('friendly_urls', null, false) && ($this->modx->resourceMethod = 'alias')) {
         $containerSuffix = trim($this->modx->getOption('container_suffix', null, ''));
         if (!isset($this->modx->aliasMap[$identifier])) {
             if (!empty($containerSuffix)) {
                 $suffixPos = strpos($identifier, $containerSuffix);
                 $suffixLen = strlen($containerSuffix);
                 $identifierLen = strlen($identifier);
                 if (substr($identifier, $identifierLen - $suffixLen) === $containerSuffix) {
                     $identifier = substr($identifier, 0, $identifierLen - $suffixLen);
                 } elseif (isset($this->modx->aliasMap["{$identifier}{$containerSuffix}"])) {
                     $identifier = "{$identifier}{$containerSuffix}";
                 }
                 if (isset($this->modx->aliasMap[$identifier])) {
                     $url = $this->modx->makeUrl($this->modx->aliasMap[$identifier], '', '', 'full');
                     $this->modx->sendRedirect($url, array('responseCode' => 'HTTP/1.1 301 Moved Permanently'));
                 }
                 $this->modx->resourceMethod = 'alias';
             }
         } elseif ($this->modx->getOption('site_start', null, 1) == $this->modx->aliasMap[$identifier]) {
             $this->modx->sendRedirect($this->modx->getOption('site_url', null, MODX_SITE_URL), array('responseCode' => 'HTTP/1.1 301 Moved Permanently'));
         } else {
             $this->modx->resourceMethod = 'alias';
         }
     } else {
         $this->modx->resourceMethod = 'id';
     }
     return $identifier;
 }
 /**
  * Redirect to a specified URL.
  *
  * Properties needed:
  * - redirectTo - the ID of the Resource to redirect to.
  *
  * @param array $fields An array of cleaned POST fields
  * @return boolean False if unsuccessful.
  */
 public function redirect(array $fields = array())
 {
     if (empty($this->login->config['redirectTo'])) {
         return false;
     }
     $url = $this->modx->makeUrl($this->login->config['redirectTo'], '', '', 'abs');
     return $this->modx->sendRedirect($url);
 }
Ejemplo n.º 7
0
 /**
  * Cleans the resource identifier from the request params.
  *
  * @param string $identifier The raw identifier.
  * @return string|integer The cleansed identifier.
  */
 public function _cleanResourceIdentifier($identifier)
 {
     if (empty($identifier)) {
         if ($this->modx->getOption('base_url', null, MODX_BASE_URL) !== strtok($_SERVER["REQUEST_URI"], '?')) {
             $this->modx->sendRedirect($this->modx->getOption('site_url', null, MODX_SITE_URL), array('responseCode' => 'HTTP/1.1 301 Moved Permanently'));
         }
         $identifier = $this->modx->getOption('site_start', null, 1);
         $this->modx->resourceMethod = 'id';
     } elseif ($this->modx->getOption('friendly_urls', null, false) && $this->modx->resourceMethod == 'alias') {
         $containerSuffix = trim($this->modx->getOption('container_suffix', null, ''));
         $found = $this->modx->findResource($identifier);
         if ($found === false && !empty($containerSuffix)) {
             $suffixLen = strlen($containerSuffix);
             $identifierLen = strlen($identifier);
             if (substr($identifier, $identifierLen - $suffixLen) === $containerSuffix) {
                 $identifier = substr($identifier, 0, $identifierLen - $suffixLen);
                 $found = $this->modx->findResource($identifier);
             } else {
                 $identifier = "{$identifier}{$containerSuffix}";
                 $found = $this->modx->findResource("{$identifier}{$containerSuffix}");
             }
             if ($found) {
                 $parameters = $this->getParameters();
                 unset($parameters[$this->modx->getOption('request_param_alias')]);
                 $url = $this->modx->makeUrl($found, $this->modx->context->get('key'), $parameters, 'full');
                 $this->modx->sendRedirect($url, array('responseCode' => 'HTTP/1.1 301 Moved Permanently'));
             }
             $this->modx->resourceMethod = 'alias';
         } elseif ((int) $this->modx->getOption('site_start', null, 1) === $found) {
             $parameters = $this->getParameters();
             unset($parameters[$this->modx->getOption('request_param_alias')]);
             $url = $this->modx->makeUrl($this->modx->getOption('site_start', null, 1), $this->modx->context->get('key'), $parameters, 'full');
             $this->modx->sendRedirect($url, array('responseCode' => 'HTTP/1.1 301 Moved Permanently'));
         } else {
             if ($this->modx->getOption('friendly_urls_strict', null, false)) {
                 $requestUri = $_SERVER['REQUEST_URI'];
                 $qsPos = strpos($requestUri, '?');
                 if ($qsPos !== false) {
                     $requestUri = substr($requestUri, 0, $qsPos);
                 }
                 $fullId = $this->modx->getOption('base_url', null, MODX_BASE_URL) . $identifier;
                 $requestUri = urldecode($requestUri);
                 if ($fullId !== $requestUri && strpos($requestUri, $fullId) !== 0) {
                     $parameters = $this->getParameters();
                     unset($parameters[$this->modx->getOption('request_param_alias')]);
                     $url = $this->modx->makeUrl($found, $this->modx->context->get('key'), $parameters, 'full');
                     $this->modx->sendRedirect($url, array('responseCode' => 'HTTP/1.1 301 Moved Permanently'));
                 }
             }
             $this->modx->resourceMethod = 'alias';
         }
     } else {
         $this->modx->resourceMethod = 'id';
     }
     return $identifier;
 }
Ejemplo n.º 8
0
 /**
  * Checks authentication for the current MODX User / Session.
  * Sets hmRequest::authorized with a boolean value indicating authentication status.
  * Also processes logout and login.
  */
 public function checkAuthentication()
 {
     $this->authorized = $this->modx->user && $this->modx->user->hasSessionContext('mgr');
     /* If we are authorized, the $this->authorized variable will have a value
      ***/
     if ($this->authorized) {
         // Check if it needs to log out
         if ($_GET['hma'] == 'logout') {
             $return = $this->hm->runProcessor(array('action' => 'logout', 'location' => 'security'), $this->modx);
             if ($return['success'] == 1) {
                 $this->action = array('hma' => 'login', 'options' => array('message' => 'Successfully logged out.'));
                 $this->authorized = false;
                 // We redirect to make sure the session is available to other scripts.
                 return $this->modx->sendRedirect($this->hm->config['baseUrl']);
             } else {
                 $this->action = array('hma' => 'home', 'options' => array('message' => $return['message']));
             }
         } else {
             $this->action = $_GET['hma'] ? array('hma' => $_GET['hma'], 'options' => array('source' => 'get')) : array('hma' => 'home', 'options' => array('source' => 'default'));
         }
     } else {
         if (!$this->authorized) {
             // Check if there is a login attempt, and if so validate it
             if ($_POST['hm_action'] == 'login') {
                 $return = $this->hm->runProcessor(array('action' => 'login', 'location' => 'security'), $this->modx);
                 if ($return['success'] == 1) {
                     $this->action = array('hma' => 'home', 'options' => array('source' => 'login'));
                     // We redirect to make sure the session is available to other scripts.
                     return $this->modx->sendRedirect($this->hm->config['baseUrl']);
                 } else {
                     $msg = $return['message'];
                     $this->action = array('hma' => 'login', 'options' => array('message' => $msg));
                 }
                 // Show the "login" action -> a login form.
             } else {
                 $this->action = array('hma' => 'login', 'options' => array('source' => 'default'));
             }
         }
     }
 }
Ejemplo n.º 9
0
 /**
  * Render the controller.
  *
  * @return string
  */
 public function render()
 {
     if ($this->modx->getOption('discuss.debug', null, true)) {
         $this->modx->setLogTarget('ECHO');
         $this->startDebugTimer();
     }
     foreach ($this->config as $k => $v) {
         $this->setPlaceholder('controller.' . $k, $v);
     }
     foreach ($this->discuss->config as $k => $v) {
         $this->setPlaceholder('discuss.config.' . $k, $v);
     }
     $this->initialize();
     $allowed = $this->checkPermissions();
     if ($allowed !== true) {
         if (is_string($allowed)) {
             $this->modx->sendRedirect($allowed);
         } else {
             $this->discuss->sendUnauthorizedPage();
         }
     }
     $sessionPlace = $this->getSessionPlace();
     if (!empty($sessionPlace)) {
         $this->discuss->setSessionPlace($sessionPlace);
     }
     $this->handleActions();
     $this->process();
     if ($this->discuss->user->isLoggedIn) {
         $this->getUserTop();
     }
     if ($this->getOption('showStatistics', true)) {
         $this->getStatistics();
     }
     $title = $this->getPageTitle();
     if (!empty($title)) {
         $this->modx->setPlaceholder('discuss.pagetitle', $title);
     }
     $this->_renderBreadcrumbs();
     $this->_renderModules();
     $tpl = $this->getOption('pageTpl', false);
     $tpl = $tpl ? $this->discuss->config['pagesPath'] . $tpl . '.tpl' : $this->config['tpl'];
     $output = $this->_renderTemplate($tpl, $this->placeholders);
     $output = $this->afterRender($output);
     return $this->_output($output);
 }
Ejemplo n.º 10
0
 /**
  * Handle actions on thread view
  *
  * @param array $scriptProperties
  * @return boolean
  */
 public function handleThreadViewActions(array $scriptProperties)
 {
     if (!$this->xpdo->discuss->user->isLoggedIn) {
         return false;
     }
     /* mark unread if user clicks mark unread */
     if (isset($scriptProperties['unread'])) {
         if ($this->unread($this->xpdo->discuss->user->get('id'))) {
             $this->xpdo->sendRedirect($this->xpdo->discuss->request->makeUrl('board', array('board' => $this->get('board'))));
         }
     }
     if (!empty($scriptProperties['sticky']) && $this->canStick()) {
         if ($this->stick()) {
             $this->xpdo->sendRedirect($this->xpdo->discuss->request->makeUrl('board', array('board' => $this->get('board'))));
         }
     }
     if (isset($scriptProperties['sticky']) && $scriptProperties['sticky'] == 0 && $this->canUnstick()) {
         if ($this->unstick()) {
             $this->xpdo->sendRedirect($this->xpdo->discuss->request->makeUrl('board', array('board' => $this->get('board'))));
         }
     }
     if (!empty($scriptProperties['lock']) && $this->canLock()) {
         if ($this->lock()) {
             $this->xpdo->sendRedirect($this->xpdo->discuss->request->makeUrl('board', array('board' => $this->get('board'))));
         }
     }
     if (isset($scriptProperties['lock']) && $scriptProperties['lock'] == 0 && $this->canUnlock()) {
         if ($this->unlock()) {
             $this->xpdo->sendRedirect($this->xpdo->discuss->request->makeUrl('board', array('board' => $this->get('board'))));
         }
     }
     if (!empty($scriptProperties['subscribe']) && $this->canSubscribe()) {
         if ($this->addSubscription($this->xpdo->discuss->user->get('id'))) {
             $this->xpdo->sendRedirect($this->getUrl());
         }
     }
     if (!empty($scriptProperties['unsubscribe']) && $this->canUnsubscribe()) {
         if ($this->removeSubscription($this->xpdo->discuss->user->get('id'))) {
             $this->xpdo->sendRedirect($this->getUrl());
         }
     }
     return true;
 }
Ejemplo n.º 11
0
 /**
  * Send a redirect.
  *
  * @param $action
  * @param array $params
  */
 public function redirect($action, array $params = array())
 {
     $params['action'] = $action;
     $url = $this->hm->url . 'index.php?' . http_build_query($params);
     $this->modx->sendRedirect($url);
 }
Ejemplo n.º 12
0
 /**
  * @param $url
  * @param bool|false $options
  * @param string $type
  * @param string $responseCode
  */
 public function sendRedirect($url, $options = false, $type = '', $responseCode = '')
 {
     $this->modx->sendRedirect($url, $options, $type, $responseCode);
 }
Ejemplo n.º 13
0
 /**
  * @param array $data
  *
  * @return array|string
  */
 public function createPayment(array $data)
 {
     if (!$this->modx->user->isAuthenticated($this->modx->context->key)) {
         return $this->ms2->error($this->modx->lexicon('ms2_profile_err_auth'));
     }
     // Call system event
     $response = $this->ms2->invokeEvent('msOnSubmitOrder', array('data' => $data, 'order' => $this->ms2->order));
     if (!$response['success']) {
         return $this->ms2->error($response['message']);
     }
     if (!empty($response['data']['data'])) {
         $data = array_merge($data, $response['data']['data']);
         $this->ms2->order->set($data);
     }
     // Check required fields
     $errors = array();
     if (empty($data['sum']) || $data['sum'] < $this->config['minSum']) {
         $errors['sum'] = $this->modx->lexicon('ms2_profile_err_min_sum', array('min_sum' => $this->config['minSum']));
     } elseif (!empty($maxSum) && $data['sum'] > $this->config['maxSum']) {
         $errors['sum'] = $this->modx->lexicon('ms2_profile_err_max_sum', array('max_sum' => $this->config['maxSum']));
     }
     if (empty($data['payment'])) {
         $errors['payment'] = $this->modx->lexicon('ms2_profile_err_payment', array('min_sum' => $this->config['minSum']));
     }
     if (!empty($errors)) {
         return $this->ms2->error($this->modx->lexicon('ms2_profile_err_form'), $errors);
     }
     // Create new order
     /** @var msOrder $order */
     $order = $this->modx->newObject('msOrder', array('user_id' => $this->modx->user->id, 'createdon' => date('Y-m-d H:i:s'), 'num' => $this->ms2->order->getnum(), 'delivery' => 0, 'payment' => $data['payment'], 'cart_cost' => $data['sum'], 'weight' => 0, 'delivery_cost' => 0, 'cost' => $data['sum'], 'status' => 0, 'context' => $this->ms2->config['ctx'], 'properties' => array('account_charge' => true)));
     $products = array($this->modx->newObject('msOrderProduct', array('product_id' => 0, 'name' => $this->modx->lexicon('ms2_profile_charge'), 'price' => $data['sum'], 'cost' => $data['sum'])));
     $order->addMany($products);
     $response = $this->ms2->invokeEvent('msOnBeforeCreateOrder', array('msOrder' => $order, 'order' => $this->ms2->order));
     if (!$response['success']) {
         return $this->ms2->error($response['message']);
     }
     if ($order->save()) {
         $response = $this->ms2->invokeEvent('msOnCreateOrder', array('msOrder' => $order, 'order' => $this->ms2->order));
         if (!$response['success']) {
             return $this->ms2->error($response['message']);
         }
         if (empty($_SESSION['minishop2']['orders'])) {
             $_SESSION['minishop2']['orders'] = array();
         }
         $_SESSION['minishop2']['orders'][] = $order->get('id');
         // Trying to set status "new"
         $response = $this->ms2->changeOrderStatus($order->get('id'), 1);
         if ($response !== true) {
             return $this->ms2->error($response, array('msorder' => $order->get('id')));
         } elseif ($payment = $this->modx->getObject('msPayment', array('id' => $order->get('payment'), 'active' => 1))) {
             $response = $payment->send($order);
             if (!empty($response['data']['redirect'])) {
                 $this->modx->sendRedirect($response['data']['redirect']);
             } elseif (!empty($response['data']['msorder'])) {
                 $this->modx->sendRedirect($this->modx->context->makeUrl($this->modx->resource->id, array('msorder' => $response['data']['msorder'])));
             } else {
                 $this->modx->sendRedirect($this->modx->context->makeUrl($this->modx->resource->id));
             }
         } else {
             $this->modx->sendRedirect($this->modx->context->makeUrl($this->modx->resource->id, array('msorder' => $response['data']['msorder'])));
         }
     }
 }
<?php

require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/config.core.php';
require_once MODX_CORE_PATH . 'config/' . MODX_CONFIG_KEY . '.inc.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('web');
$snippet = $modx->getObject('modSnippet', array('name' => 'YandexMoney'));
$config = $snippet->getProperties();
$config['payStatusOut'] = $modx->getOption('yandexmoney.payStatusOut', null, 5);
if (!defined('YANDEXMONEY_PATH')) {
    define('YANDEXMONEY_PATH', MODX_CORE_PATH . "components/yandexmoney/");
}
if ($_GET['fail'] == 1) {
    if ($res = $modx->getObject('modResource', $config['fail_page_id'])) {
        $modx->sendRedirect($modx->makeUrl($config['fail_page_id'], '', '', 'full'));
    }
    exit;
} elseif ($_GET['success'] == 1) {
    if ($res = $modx->getObject('modResource', $config['success_page_id'])) {
        $modx->sendRedirect($modx->makeUrl($config['success_page_id'], '', '', 'full'));
    }
    exit;
}
require_once YANDEXMONEY_PATH . 'model/yandexmoney.class.php';
$ym = new Yandexmoney($modx, $config);
$order_id = $ym->ProcessResult();
if ($order_id) {
    $modx->addPackage('shopkeeper3', MODX_CORE_PATH . "components/shopkeeper3/model/");
    $order = $modx->getObject('shk_order', array('id' => $order_id));
    $order->set('status', $config['payStatusOut']);
Ejemplo n.º 15
0
 /** @inheritdoc} */
 public function submit($data = array())
 {
     $response = $this->ms2->invokeEvent('msOnSubmitOrder', array('data' => $data, 'order' => $this));
     if (!$response['success']) {
         return $this->error($response['message']);
     }
     if (!empty($response['data']['data'])) {
         $this->set($response['data']['data']);
     }
     $response = $this->getDeliveryRequiresFields();
     if ($this->ms2->config['json_response']) {
         $response = $this->modx->fromJSON($response);
     }
     $requires = $response['data']['requires'];
     $errors = array();
     foreach ($requires as $v) {
         if (!empty($v) && empty($this->order[$v])) {
             $errors[] = $v;
         }
     }
     if (!empty($errors)) {
         return $this->error('ms2_order_err_requires', $errors);
     }
     $user_id = $this->ms2->getCustomerId();
     $cart_status = $this->ms2->cart->status();
     $delivery_cost = $this->getCost(false, true);
     $createdon = date('Y-m-d H:i:s');
     /* @var msOrder $order */
     $order = $this->modx->newObject('msOrder');
     $order->fromArray(array('user_id' => $user_id, 'createdon' => $createdon, 'num' => $this->getnum(), 'delivery' => $this->order['delivery'], 'payment' => $this->order['payment'], 'cart_cost' => $cart_status['total_cost'], 'weight' => $cart_status['total_weight'], 'delivery_cost' => $delivery_cost, 'cost' => $cart_status['total_cost'] + $delivery_cost, 'status' => 0, 'context' => $this->ms2->config['ctx']));
     // Adding address
     /* @var msOrderAddress $address */
     $address = $this->modx->newObject('msOrderAddress');
     $address->fromArray(array_merge($this->order, array('user_id' => $user_id, 'createdon' => $createdon)));
     $order->addOne($address);
     // Adding products
     $cart = $this->ms2->cart->get();
     $products = array();
     foreach ($cart as $v) {
         /* @var msOrderProduct $product */
         $product = $this->modx->newObject('msOrderProduct');
         $product->fromArray(array_merge($v, array('product_id' => $v['id'], 'cost' => $v['price'] * $v['count'])));
         $products[] = $product;
     }
     $order->addMany($products);
     $response = $this->ms2->invokeEvent('msOnBeforeCreateOrder', array('msOrder' => $order, 'order' => $this));
     if (!$response['success']) {
         return $this->error($response['message']);
     }
     if ($order->save()) {
         $response = $this->ms2->invokeEvent('msOnCreateOrder', array('msOrder' => $order, 'order' => $this));
         if (!$response['success']) {
             return $this->error($response['message']);
         }
         $this->ms2->cart->clean();
         $this->clean();
         if (empty($_SESSION['minishop2']['orders'])) {
             $_SESSION['minishop2']['orders'] = array();
         }
         $_SESSION['minishop2']['orders'][] = $order->get('id');
         // Trying to set status "new"
         $response = $this->ms2->changeOrderStatus($order->get('id'), 1);
         if ($response !== true) {
             return $this->error($response, array('msorder' => $order->get('id')));
         } elseif ($payment = $this->modx->getObject('msPayment', array('id' => $order->get('payment'), 'active' => 1))) {
             $response = $payment->send($order);
             if ($this->config['json_response']) {
                 @session_write_close();
                 exit(is_array($response) ? $this->modx->toJSON($response) : $response);
             } else {
                 if (!empty($response['data']['redirect'])) {
                     $this->modx->sendRedirect($response['data']['redirect']);
                     exit;
                 } elseif (!empty($response['data']['msorder'])) {
                     $this->modx->sendRedirect($this->modx->makeUrl($this->modx->resource->id), array('msorder' => $response['data']['msorder']));
                     exit;
                 } else {
                     $this->modx->sendRedirect($this->modx->makeUrl($this->modx->resource->id));
                     exit;
                 }
             }
         } else {
             if ($this->ms2->config['json_response']) {
                 return $this->success('', array('msorder' => $order->get('id')));
             } else {
                 $this->modx->sendRedirect($this->modx->makeUrl($this->modx->resource->id), array('msorder' => $response['data']['msorder']));
                 exit;
             }
         }
     }
     return $this->error();
 }
Ejemplo n.º 16
-1
 public function handleRequest()
 {
     $requestParamAlias = $this->modx->getOption('request_param_alias', null, 'q');
     if (!isset($_REQUEST[$requestParamAlias])) {
         return true;
     }
     $this->pieces = explode('/', trim($_REQUEST[$requestParamAlias], ' '));
     $pieces = array_flip($this->pieces);
     $c = $this->modx->newQuery('TaggerGroup');
     $c->select($this->modx->getSelectColumns('TaggerGroup', '', '', array('alias')));
     $c->prepare();
     $c->stmt->execute();
     $this->groups = $c->stmt->fetchAll(PDO::FETCH_COLUMN, 0);
     foreach ($this->groups as $group) {
         if (isset($pieces[$group])) {
             $this->tags[$group] = $pieces[$group];
         }
     }
     if (count($this->tags) == 0) {
         return false;
     }
     asort($this->tags);
     if ($this->pieces[count($this->pieces) - 1] != '') {
         $this->modx->sendRedirect(MODX_SITE_URL . implode('/', $this->pieces) . '/', array('responseCode' => 'HTTP/1.1 301 Moved Permanently'));
     }
     if (count($this->pieces) == 0 || count($this->pieces) == 1 && $this->pieces[0] == '') {
         return false;
     }
     $this->processRequest();
     return true;
 }