/var
/www
/boston
/public_html
/packages
/community_store_tsys
/controllers
/single_page
/voidorder.php
<?php
namespace Concrete\Package\CommunityStoreTsys\Controller\SinglePage;
use Concrete\Core\Page\Controller\PageController;
use Concrete\Package\CommunityStoreTsys\Src\Tsys\Helper;
use Symfony\Component\HttpFoundation\JsonResponse;
use \Concrete\Package\CommunityStoreTsys\Src\CommunityStore\Tsys\Payment as TsysPayment;
use \Concrete\Package\CommunityStore\Src\CommunityStore\Order\Order;
use Concrete\Core\Support\Facade\DatabaseORM as dbORM;
use Config;
class Voidorder extends PageController {
public function getOrder($refNo) {
$em = dbORM::entityManager();
return $em->getRepository(Order::class)->findOneBy(['transactionReference' => $refNo]);
}
public function view($refNo) {
$deviceId = Config::get('community_store_tsys.deviceID');
$mid = Config::get('community_store_tsys.mid');
$userId = Config::get('community_store_tsys.userID');
$password = Config::get('community_store_tsys.password');
//$transKey = Config::get('community_store_tsys.transKey');
$helper = new Helper();
$transactionKey = Config::get('community_store_tsys.transKeyProd');
if(!$transactionKey) {
$transactionKey = $helper->generateKey($mid, $userId, $password);
Config::save('community_store_tsys.transKey', $transactionKey);
}
//$transKey = $helper->generateKey($mid, $userId, $password);
$tsysData = TsysPayment::getById($refNo);
try {
$response = $helper->doVoid(
$deviceId,
$transactionKey,
$tsysData->getTransactionId()
);
if($response['status'] == 'PASS') {
$order = $this->getOrder($refNo);
if($order) {
/var
/www
/boston
/public_html
/concrete
/src
/Controller
/AbstractController.php
public function runTask($action, $parameters)
{
$this->runAction($action, $parameters);
}
/**
* Perform an action of this controller (if shouldRunControllerTask returns true).
*
* @param string $action the action to be performed
* @param array $parameters the action parameters
*
* @return mixed in case the action is executed, you'll receive the result of the action, or NULL otherwise
*/
public function runAction($action, $parameters = [])
{
$this->action = $action;
$this->parameters = $parameters;
if (is_callable([$this, $action])) {
if ($this->shouldRunControllerTask()) {
return call_user_func_array([$this, $action], $parameters);
}
}
}
/**
* Get the whole $_REQUEST array or a specific requested value.
*
* @param string|null $key set to null to get the whole $_REQUEST array, or a string to get a specific value in $_GET or in $_POST
*
* @return mixed
*/
public function request($key = null)
{
return Request::request($key);
}
}
/var
/www
/boston
/public_html
/concrete
/src
/Controller
/AbstractController.php
public function runTask($action, $parameters)
{
$this->runAction($action, $parameters);
}
/**
* Perform an action of this controller (if shouldRunControllerTask returns true).
*
* @param string $action the action to be performed
* @param array $parameters the action parameters
*
* @return mixed in case the action is executed, you'll receive the result of the action, or NULL otherwise
*/
public function runAction($action, $parameters = [])
{
$this->action = $action;
$this->parameters = $parameters;
if (is_callable([$this, $action])) {
if ($this->shouldRunControllerTask()) {
return call_user_func_array([$this, $action], $parameters);
}
}
}
/**
* Get the whole $_REQUEST array or a specific requested value.
*
* @param string|null $key set to null to get the whole $_REQUEST array, or a string to get a specific value in $_GET or in $_POST
*
* @return mixed
*/
public function request($key = null)
{
return Request::request($key);
}
}
/var
/www
/boston
/public_html
/concrete
/src
/Http
/ResponseFactory.php
if ($controller instanceof PageController) {
if ($controller->isReplaced()) {
return $this->controller($controller->getReplacement(), $code, $headers);
}
$controller->setupRequestActionAndParameters($request);
$response = $controller->validateRequest();
// If validaterequest returned a response
if ($response instanceof \Symfony\Component\HttpFoundation\Response) {
return $response;
} else {
// If validateRequest did not return true
if ($response == false) {
return $this->notFound('', Response::HTTP_NOT_FOUND, $headers);
}
}
$requestTask = $controller->getRequestAction();
$requestParameters = $controller->getRequestActionParameters();
$response = $controller->runAction($requestTask, $requestParameters);
if ($response instanceof \Symfony\Component\HttpFoundation\Response) {
return $response;
}
if ($controller->isReplaced()) {
return $this->controller($controller->getReplacement(), $code, $headers);
}
} else {
if ($response = $controller->runAction('view')) {
return $response;
}
}
$view = $controller->getViewObject();
// Mobile theme
if ($this->config->get('concrete.misc.mobile_theme_id') > 0) {
$md = $this->app->make(MobileDetect::class);
if ($md->isMobile()) {
$mobileTheme = Theme::getByID($this->app->config->get('concrete.misc.mobile_theme_id'));
if ($mobileTheme instanceof Theme) {
/var
/www
/boston
/public_html
/concrete
/src
/Http
/ResponseFactory.php
require DIR_BASE_CORE . '/bootstrap/process.php';
$u = $this->app->make(User::class);
// On page view event.
$pe = new Event($collection);
$pe->setUser($u);
$pe->setRequest($request);
$this->app['director']->dispatch('on_page_view', $pe);
// Core menu items
$item = new RelationListItem();
$menu = $this->app->make('helper/concrete/ui/menu');
$menu->addMenuItem($item);
$controller = $collection->getPageController();
// we update the current page with the one bound to this controller.
$collection->setController($controller);
return $this->controller($controller);
}
private function collectionNotFound(Collection $collection, Request $request, array $headers)
{
// if we don't have a path and we're doing cID, then this automatically fires a 404.
if (!$request->getPath() && $request->get('cID')) {
return $this->notFound('', Response::HTTP_NOT_FOUND, $headers);
}
// let's test to see if this is, in fact, the home page,
// and we're routing arguments onto it (which is screwing up the path.)
$home = Page::getByID(Page::getHomePageID());
$request->setCurrentPage($home);
$homeController = $home->getPageController();
$homeController->setupRequestActionAndParameters($request);
$response = $homeController->validateRequest();
if ($response instanceof \Symfony\Component\HttpFoundation\Response) {
return $response;
} elseif ($response === true) {
/var
/www
/boston
/public_html
/concrete
/src
/Http
/DefaultDispatcher.php
new DispatcherDelegate($dispatcher)
);
$stack->setApplication($this->app);
foreach($route->getMiddlewares() as $middleware) {
if (is_string($middleware->getMiddleware())) {
$inflatedMiddleware = $this->app->make($middleware->getMiddleware());
} else {
$inflatedMiddleware = $middleware->getMiddleware();
}
$stack = $stack->withMiddleware(
$inflatedMiddleware,
$middleware->getPriority()
);
}
return $stack->process($request);
} catch (ResourceNotFoundException $e) {
} catch (MethodNotAllowedException $e) {
}
$c = \Page::getFromRequest($request);
$response = $this->app->make(ResponseFactoryInterface::class)->collection($c);
return $response;
}
/**
* @param \Symfony\Component\Routing\RouteCollection $routes
* @param string $path
*
* @return \Symfony\Component\Routing\RouteCollection
*/
private function filterRouteCollectionForPath(RouteCollection $routes, $path)
{
$result = new RouteCollection();
foreach ($routes->getResources() as $resource) {
$result->addResource($resource);
}
foreach ($routes->all() as $name => $route) {
$routePath = $route->getPath();
$p = strpos($routePath, '{');
$skip = false;
/var
/www
/boston
/public_html
/concrete
/src
/Http
/DefaultDispatcher.php
/**
* @param \Symfony\Component\HttpFoundation\Request $request
*
* @return SymfonyResponse
*/
public function dispatch(SymfonyRequest $request)
{
$path = rawurldecode($request->getPathInfo());
if (substr($path, 0, 3) == '../' || substr($path, -3) == '/..' || strpos($path, '/../') ||
substr($path, 0, 3) == '..\\' || substr($path, -3) == '\\..' || strpos($path, '\\..\\')) {
throw new \RuntimeException(t('Invalid path traversal. Please make this request with a valid HTTP client.'));
}
$response = null;
if ($this->app->isInstalled()) {
$response = $this->getEarlyDispatchResponse();
}
if ($response === null) {
$response = $this->handleDispatch($request);
}
return $response;
}
private function getEarlyDispatchResponse()
{
$validator = $this->app->make(SessionValidator::class);
if ($validator->hasActiveSession()) {
$session = $this->app['session'];
if (!$session->has('uID')) {
User::verifyAuthTypeCookie();
}
// User may have been logged in, so lets check status again.
if ($session->has('uID') && $session->get('uID') > 0 && $response = $this->validateUser()) {
return $response;
}
}
}
/var
/www
/boston
/public_html
/concrete
/src
/Http
/Middleware
/DispatcherDelegate.php
private $dispatcher;
/**
* DispatcherFrame constructor.
* @param \Concrete\Core\Http\DispatcherInterface $dispatcher
*/
public function __construct(DispatcherInterface $dispatcher)
{
$this->dispatcher = $dispatcher;
}
/**
* Dispatch the next available middleware and return the response.
*
* @param Request $request
* @return Response
*/
public function next(Request $request)
{
return $this->dispatcher->dispatch($request);
}
}
/var
/www
/boston
/public_html
/concrete
/src
/Http
/Middleware
/ThumbnailMiddleware.php
* @var \Concrete\Core\Config\Repository\Repository
*/
private $config;
public function __construct(Repository $config)
{
$this->config = $config;
}
/**
* Process the request and return a response.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @param DelegateInterface $frame
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function process(Request $request, DelegateInterface $frame)
{
$response = $frame->next($request);
if ($response && $this->app->isInstalled() && $this->config->get('concrete.misc.basic_thumbnailer_generation_strategy') == 'now') {
$responseStatusCode = (int) $response->getStatusCode();
if ($responseStatusCode === 200 || $responseStatusCode === 404) {
$database = $this->tryGetConnection();
if ($database !== null) {
if ($responseStatusCode === 404) {
$searchThumbnailPath = $request->getRequestUri();
} else {
$searchThumbnailPath = null;
}
$thumbnail = $this->getThumbnailToGenerate($database, $searchThumbnailPath);
if ($thumbnail !== null) {
$this->markThumbnailAsBuilt($database, $thumbnail);
if ($this->generateThumbnail($thumbnail)) {
if ($this->couldBeTheRequestedThumbnail($thumbnail, $searchThumbnailPath)) {
$response = $this->buildRedirectToThumbnailResponse($request);
}
}
}
/var
/www
/boston
/public_html
/concrete
/src
/Http
/Middleware
/MiddlewareDelegate.php
public function __construct(
MiddlewareInterface $middleware,
DelegateInterface $nextDelegate,
HttpFoundationFactory $foundationFactory
) {
$this->middleware = $middleware;
$this->nextDelegate = $nextDelegate;
$this->foundationFactory = $foundationFactory;
}
/**
* Dispatch the next available middleware and return the response.
*
* @param Request $request
* @return Response
*/
public function next(Request $request)
{
$response = $this->middleware->process($request, $this->nextDelegate);
// Negotiate PSR7 responses
if ($response instanceof ResponseInterface) {
return $this->foundationFactory->createResponse($response);
}
return $response;
}
}
/var
/www
/boston
/public_html
/concrete
/src
/Http
/Middleware
/FrameOptionsMiddleware.php
private $config;
/**
* @var \Concrete\Core\Utility\Service\Validation\Strings
*/
private $stringValidator;
public function __construct(Repository $config, Strings $stringValidator)
{
$this->config = $config;
$this->stringValidator = $stringValidator;
}
/**
* @param \Concrete\Core\Http\Middleware\DelegateInterface $frame
* @return Response
*/
public function process(Request $request, DelegateInterface $frame)
{
$response = $frame->next($request);
if ($response->headers->has('X-Frame-Options') === false) {
$x_frame_options = $this->config->get('concrete.security.misc.x_frame_options');
if ($this->stringValidator->notempty($x_frame_options)) {
$response->headers->set('X-Frame-Options', $x_frame_options);
}
}
return $response;
}
}
/var
/www
/boston
/public_html
/concrete
/src
/Http
/Middleware
/MiddlewareDelegate.php
public function __construct(
MiddlewareInterface $middleware,
DelegateInterface $nextDelegate,
HttpFoundationFactory $foundationFactory
) {
$this->middleware = $middleware;
$this->nextDelegate = $nextDelegate;
$this->foundationFactory = $foundationFactory;
}
/**
* Dispatch the next available middleware and return the response.
*
* @param Request $request
* @return Response
*/
public function next(Request $request)
{
$response = $this->middleware->process($request, $this->nextDelegate);
// Negotiate PSR7 responses
if ($response instanceof ResponseInterface) {
return $this->foundationFactory->createResponse($response);
}
return $response;
}
}
/var
/www
/boston
/public_html
/concrete
/src
/Http
/Middleware
/CookieMiddleware.php
* @var \Concrete\Core\Cookie\ResponseCookieJar
*/
private $responseCookieJar;
/**
* @param \Concrete\Core\Cookie\ResponseCookieJar $responseCookieJar
*/
public function __construct(ResponseCookieJar $responseCookieJar)
{
$this->responseCookieJar = $responseCookieJar;
}
/**
* {@inheritdoc}
*
* @see \Concrete\Core\Http\Middleware\MiddlewareInterface::process()
*/
public function process(Request $request, DelegateInterface $frame)
{
$response = $frame->next($request);
$cleared = $this->responseCookieJar->getClearedCookies();
foreach ($cleared as $cookie) {
$response->headers->clearCookie($cookie, DIR_REL . '/');
}
$cookies = $this->responseCookieJar->getCookies();
foreach ($cookies as $cookie) {
$response->headers->setCookie($cookie);
}
return $response;
}
}
/var
/www
/boston
/public_html
/concrete
/src
/Http
/Middleware
/MiddlewareDelegate.php
public function __construct(
MiddlewareInterface $middleware,
DelegateInterface $nextDelegate,
HttpFoundationFactory $foundationFactory
) {
$this->middleware = $middleware;
$this->nextDelegate = $nextDelegate;
$this->foundationFactory = $foundationFactory;
}
/**
* Dispatch the next available middleware and return the response.
*
* @param Request $request
* @return Response
*/
public function next(Request $request)
{
$response = $this->middleware->process($request, $this->nextDelegate);
// Negotiate PSR7 responses
if ($response instanceof ResponseInterface) {
return $this->foundationFactory->createResponse($response);
}
return $response;
}
}
/var
/www
/boston
/public_html
/concrete
/src
/Http
/Middleware
/ApplicationMiddleware.php
* Middleware for applying state changes to the application
* @package Concrete\Core\Http\Middleware
*/
class ApplicationMiddleware implements MiddlewareInterface, ApplicationAwareInterface
{
use ApplicationAwareTrait;
/**
* Apply the request instance to the request singleton
* @param \Symfony\Component\HttpFoundation\Request $request
* @param \Concrete\Core\Http\Middleware\DelegateInterface $frame
* @return \Symfony\Component\HttpFoundation\Response
*/
public function process(Request $request, DelegateInterface $frame)
{
\Concrete\Core\Http\Request::setInstance($request);
$this->app->instance('Concrete\Core\Http\Request', $request);
return $frame->next($request);
}
}
/var
/www
/boston
/public_html
/concrete
/src
/Http
/Middleware
/MiddlewareDelegate.php
public function __construct(
MiddlewareInterface $middleware,
DelegateInterface $nextDelegate,
HttpFoundationFactory $foundationFactory
) {
$this->middleware = $middleware;
$this->nextDelegate = $nextDelegate;
$this->foundationFactory = $foundationFactory;
}
/**
* Dispatch the next available middleware and return the response.
*
* @param Request $request
* @return Response
*/
public function next(Request $request)
{
$response = $this->middleware->process($request, $this->nextDelegate);
// Negotiate PSR7 responses
if ($response instanceof ResponseInterface) {
return $this->foundationFactory->createResponse($response);
}
return $response;
}
}
/var
/www
/boston
/public_html
/concrete
/src
/Http
/Middleware
/MiddlewareStack.php
public function withoutMiddleware(MiddlewareInterface $middleware)
{
$stack = clone $this;
$stack->middleware = array_map(function($priorityGroup) use ($middleware) {
return array_map(function($stackMiddleware) use ($middleware) {
return $middleware === $stackMiddleware ? null : $stackMiddleware;
}, $priorityGroup);
}, $stack->middleware);
return $stack;
}
/**
* @inheritdoc
*/
public function process(Request $request)
{
$stack = $this->getStack();
return $stack->next($request);
}
/**
* Reduce middleware into a stack of functions that each call the next
* @return callable
*/
private function getStack()
{
$processed = [];
foreach ($this->middlewareGenerator() as $middleware) {
$processed[] = $middleware;
}
$middleware = array_reverse($processed);
$stack = array_reduce($middleware, $this->getZipper(), $this->dispatcher);
return $stack;
}
/var
/www
/boston
/public_html
/concrete
/src
/Http
/DefaultServer.php
*/
public function removeMiddleware(MiddlewareInterface $middleware)
{
$this->stack = $this->stack->withoutMiddleware($middleware);
return $this;
}
/**
* Take a request and pass it through middleware, then return the response
* @param SymfonyRequest $request
* @return SymfonyResponse
*/
public function handleRequest(SymfonyRequest $request)
{
$stack = $this->stack;
if ($stack instanceof MiddlewareStack) {
$stack = $stack->withDispatcher($this->app->make(DispatcherDelegate::class, [$this->dispatcher]));
}
return $stack->process($request);
}
}
/var
/www
/boston
/public_html
/concrete
/src
/Foundation
/Runtime
/Run
/DefaultRunner.php
// Register legacy config values
'registerLegacyConfigValues',
// Handle loading permission keys
'handlePermissionKeys',
// Handle eventing
'handleEventing',
]);
} else {
$this->initializeSystemTimezone();
$this->preloadClassAliases();
}
// Create the request to use
$request = $this->createRequest();
if (!$response) {
$response = $this->server->handleRequest($request);
}
// Prepare and return the response
return $response->prepare($request);
}
/**
* Define the base url if not defined
* This will define `BASE_URL` to whatever is resolved from the resolver.
*
* @deprecated In a future major version this will be part of HTTP middleware
*
* @return Response|void Returns a response if an error occurs
*/
protected function initializeLegacyURLDefinitions()
{
if (!defined('BASE_URL')) {
$resolver = $this->getUrlResolver();
try {
/var
/www
/boston
/public_html
/concrete
/src
/Foundation
/Runtime
/DefaultRuntime.php
$this->status = self::STATUS_ACTIVE;
}
}
/**
* Begin the runtime.
*/
public function run()
{
switch ($this->status) {
case self::STATUS_ENDED:
// We've already ended, lets just return
return;
case self::STATUS_INACTIVE:
throw new \RuntimeException('Runtime has not yet booted.');
}
$runner = $this->getRunner();
$response = $runner->run();
if ($response) {
$this->sendResponse($response);
}
return $response;
}
/**
* The method that handles properly sending a response.
*
* @param \Symfony\Component\HttpFoundation\Response $response
*/
protected function sendResponse(Response $response)
{
$response->send();
// Set the status to ended
$this->status = self::STATUS_ENDED;
}
/var
/www
/boston
/public_html
/concrete
/dispatcher.php
* Include all autoloaders.
* ----------------------------------------------------------------------------
*/
require __DIR__ . '/bootstrap/autoload.php';
/*
* ----------------------------------------------------------------------------
* Begin concrete5 startup.
* ----------------------------------------------------------------------------
*/
$app = require __DIR__ . '/bootstrap/start.php';
/** @var \Concrete\Core\Application\Application $app */
/*
* ----------------------------------------------------------------------------
* Run the runtime.
* ----------------------------------------------------------------------------
*/
$runtime = $app->getRuntime();
if ($response = $runtime->run()) {
/*
* ------------------------------------------------------------------------
* Shut it down.
* ------------------------------------------------------------------------
*/
$app->shutdown();
} else {
return $app;
}
/var
/www
/boston
/public_html
/index.php
<?php
require 'concrete/dispatcher.php';