示例#1
0
 public function callback($sGateway)
 {
     Phpfox::startLog('Callback started.');
     Phpfox::log('Request: ' . var_export($_REQUEST, true));
     if (empty($sGateway)) {
         Phpfox::log('Gateway is empty.');
         Phpfox::getService('api.gateway.process')->addLog(null, Phpfox::endLog());
         return false;
     }
     $aGateway = $this->database()->select('ag.*')->from($this->_sTable, 'ag')->where('ag.gateway_id = \'' . $this->database()->escape($sGateway) . '\' AND ag.is_active = 1')->execute('getRow');
     // http://www.phpfox.com/tracker/view/15424/
     if ($sGateway == 'activitypoints' && Phpfox::getParam('user.can_purchase_with_points') && Phpfox::getUserParam('user.can_purchase_with_points')) {
         Phpfox::log('Gateway successfully loaded.');
         Phpfox::log('Callback complete');
         Phpfox::getService('api.gateway.process')->addLog($aGateway['gateway_id'], Phpfox::endLog());
         return true;
     }
     if (!isset($aGateway['gateway_id'])) {
         Phpfox::log('"' . $sGateway . '" is not a valid gateway.');
         Phpfox::getService('api.gateway.process')->addLog(null, Phpfox::endLog());
         return false;
     }
     Phpfox::log('Attempting to load gateway: ' . $aGateway['gateway_id']);
     if (!($oGateway = Phpfox::getLib('gateway')->load($aGateway['gateway_id'], array_merge($_REQUEST, $aGateway)))) {
         Phpfox::log('Unable to load gateway.');
         Phpfox::getService('api.gateway.process')->addLog($aGateway['gateway_id'], Phpfox::endLog());
         return false;
     }
     Phpfox::log('Gateway successfully loaded.');
     $mReturn = $oGateway->callback();
     Phpfox::log('Callback complete');
     Phpfox::getService('api.gateway.process')->addLog($aGateway['gateway_id'], Phpfox::endLog());
     if ($mReturn == 'redirect') {
         Phpfox_Url::instance()->send('');
     }
 }
示例#2
0
	public function callback($sGateway)
	{
		Phpfox::startLog('Callback started.');
		Phpfox::log('Request: ' . var_export($_REQUEST, true));
		
		if (empty($sGateway))
		{
			Phpfox::log('Gateway is empty.');
			Phpfox::getService('api.gateway.process')->addLog(null, Phpfox::endLog());
			
			return false;
		}
		
		$aGateway = $this->database()->select('ag.*')
			->from($this->_sTable, 'ag')
			->where('ag.gateway_id = \'' . $this->database()->escape($sGateway) . '\' AND ag.is_active = 1')
			->execute('getRow');
			
		if (!isset($aGateway['gateway_id']))
		{
			Phpfox::log('"' . $sGateway . '" is not a valid gateway.');
			Phpfox::getService('api.gateway.process')->addLog(null, Phpfox::endLog());
			
			return false;
		}
		
		Phpfox::log('Attempting to load gateway: ' . $aGateway['gateway_id']);
		
		if (!($oGateway = Phpfox::getLib('gateway')->load($aGateway['gateway_id'], array_merge($_REQUEST, $aGateway))))
		{
			Phpfox::log('Unable to load gateway.');
			Phpfox::getService('api.gateway.process')->addLog($aGateway['gateway_id'], Phpfox::endLog());
			
			return false;
		}
		
		Phpfox::log('Gateway successfully loaded.');
		
		$mReturn = $oGateway->callback();
		
		Phpfox::log('Callback complete');
		
		Phpfox::getService('api.gateway.process')->addLog($aGateway['gateway_id'], Phpfox::endLog());
		
		if ($mReturn == 'redirect')
		{
			Phpfox::getLib('url')->send('');
		}
	}