/** * Checks for a form token in the request. * Use in conjunction with JHtml::_('form.token') or JSession::getFormToken. * * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved. * @param string $method The request method in which to look for the token key. * * @return boolean True if found and valid, false otherwise. * * @since 12.1 */ public static function vmCheckToken($redirectMsg = 0) { $token = self::getFormToken(); if (!self::uword($token, FALSE)) { if ($rToken = self::uword('token', FALSE)) { if ($rToken == $token) { return true; } } $session = JFactory::getSession(); if ($session->isNew()) { // Redirect to login screen. $app = JFactory::getApplication(); $app->redirect(JRoute::_('index.php'), vmText::_('JLIB_ENVIRONMENT_SESSION_EXPIRED')); $app->close(); } else { if ($redirectMsg === 0) { $redirectMsg = 'Invalid Token, in ' . pbxRequest::getCmd('options') . ' view=' . pbxRequest::getCmd('view') . ' task=' . pbxRequest::getCmd('task'); //jexit('Invalid Token, in ' . pbxRequest::getCmd('options') .' view='.pbxRequest::getCmd('view'). ' task='.pbxRequest::getCmd('task')); } else { $redirectMsg = vmText::_($redirectMsg); } // Redirect to login screen. $app = JFactory::getApplication(); $session->close(); $app->redirect(JRoute::_('index.php'), vmText::_($redirectMsg)); $app->close(); return false; } } else { return false; } }
/** * URLS sent to Paybox must be less than 250 characters * @param $this * @return bool */ function getPayboxReturnUrls() { $urlLength = true; $test = false; if ($test) { $payboxURLs['url_effectue'] = JURI::root() . $this->getPayboxFileName($this->_method->virtuemart_paymentmethod_id) . '?pbx=ok&lang=' . pbxRequest::getCmd('lang', '') . '&Itemid=' . pbxRequest::getInt('Itemid'); $url_cancelled = JURI::root() . $this->getPayboxFileName($this->_method->virtuemart_paymentmethod_id) . '?pbx=ko&lang=' . pbxRequest::getCmd('lang', '') . '&Itemid=' . pbxRequest::getInt('Itemid'); $payboxURLs['url_annule'] = $url_cancelled; $payboxURLs['url_refuse'] = $url_cancelled; $payboxURLs['url_erreur'] = $url_cancelled; $payboxURLs['url_notification'] = JURI::root() . $this->getPayboxFileName($this->_method->virtuemart_paymentmethod_id) . '?pbx=no&lang=' . pbxRequest::getCmd('lang', ''); $payboxURLs['url_attente'] = JURI::root() . $this->getPayboxFileName($this->_method->virtuemart_paymentmethod_id) . '?pbx=no&lang=' . pbxRequest::getCmd('lang', ''); } else { $url_cancelled = JURI::root() . 'index.php?option=com_virtuemart&view=cart&lang=' . pbxRequest::getCmd('lang', '') . '&Itemid=' . pbxRequest::getInt('Itemid'); $payboxURLs['url_annule'] = $url_cancelled; $payboxURLs['url_refuse'] = $url_cancelled; $payboxURLs['url_erreur'] = $url_cancelled; $payboxURLs['url_notification'] = JURI::root() . 'index.php?option=com_virtuemart&format=raw&view=pluginresponse&task=pluginnotification&tmpl=component&pm=' . $this->_method->virtuemart_paymentmethod_id; $payboxURLs['url_effectue'] = $this->getUrlOk(); } foreach ($payboxURLs as $payboxURL) { //$this->plugin->debugLog($payboxURL, 'getPayboxReturnUrls','debug'); if (!$this->checkURLsLength($payboxURL)) { $urlLength = false; } } if ($urlLength) { return $payboxURLs; } else { $this->plugin->debugLog('FALSE', 'getPayboxReturnUrls', 'debug'); return false; } }