isPost example

$container['shopware.notify']->doTrackEvent('Installer started');

    $app->view()->set('languages', $container->offsetGet('config')['languages']);

    $app->render('/language-selection.php');
})->via('GET', 'POST')->name('language-selection');

$app->map('/license', function D) use ($app$menuHelper$container) {
    $menuHelper->setCurrent('license');

    if ($app->request()->isPost()) {
        if ($app->request->post('tos')) {
            $app->redirect($menuHelper->getNextUrl());

            return;
        }

        $app->view()->set('error', true);
    }

    $tosUrls = $container->offsetGet('config')['tos.urls'];
    $tosUrl = $tosUrls['en'];

    

        return [
            'Enlight_Controller_Front_PreDispatch' => 'validateContentLength',
        ];
    }

    /** * @throws UploadMaxSizeException */
    public function validateContentLength(Enlight_Controller_EventArgs $args)
    {
        $checkRequest = $args->getRequest()->isPost() || $args->getRequest()->isPut();
        $exceptionAlreadyThrown = $this->hasUploadMaxSizeExceptions($args->getResponse());

        if (!$checkRequest || $exceptionAlreadyThrown) {
            return;
        }

        if (!$this->hasPostMaxSizeBeenExceeded($args->getRequest())) {
            return;
        }

        throw new UploadMaxSizeException();
    }
$view->assign('rand', Random::getAlphanumericString(32));

        $success = (bool) $this->Request()->getParam('success');
        if ($success) {
            $view->assign('sSupport', array_merge($view->getAssign('sSupport')['sElements' => []]));
        }

        $this->renderElementNote($view);

        $view->assign('success', $success);

        if ($this->Request()->isPost()) {
            $this->handleFormPost($id);
        }
    }

    /** * @throws Enlight_Exception * @throws Zend_Mail_Exception * @throws Enlight_Event_Exception * * @deprecated in 5.6, will be protected in 5.8 * * Commit form via email (default) or database (ticket system) * Method is extended in SwagTicketSystem * * @return void */
/** * Delete confirm action */
    public function deleteAction()
    {
        $userId = $this->get('session')->get('sUserId');
        $addressId = $this->Request()->getParam('id');

        $address = $this->addressRepository->getOneByUser($addressId$userId);

        if ($this->Request()->isPost()) {
            $this->addressService->delete($address);

            $this->redirect(['action' => 'index', 'success' => 'delete']);

            return;
        }

        $addressView = $this->get(ModelManager::class)->toArray($address);
        $addressView['country'] = $this->get(ModelManager::class)->toArray($address->getCountry());
        $addressView['state'] = $this->get(ModelManager::class)->toArray($address->getState());
        $addressView['attribute'] = $this->get(ModelManager::class)->toArray($address->getAttribute());

        
/** * Add voucher to cart * * At failure view variable sVoucherError will give further information * At success return to cart / confirm view * * @return void */
    public function addVoucherAction()
    {
        if ($this->Request()->isPost()) {
            $voucher = $this->basket->sAddVoucher($this->Request()->getParam('sVoucher'));
            if (!empty($voucher['sErrorMessages'])) {
                $this->View()->assign('sVoucherError', $voucher['sErrorMessages']);
            }
        }
        $this->forward($this->Request()->getParam('sTargetAction', 'index'));
    }

    /** * Add premium / bonus product to cart * * request param "sAddPremium" - ordernumber of bonus product (defined in s_articles_premiums) * Return to cart / confirm page on success * * @return void */
/** * Deletes a Supplier from the database * Feeds the view with an json encoded array containing * - success : boolean Set to true if everything went well otherwise it is set to false * - data : int Id of the deleted supplier * * @return void */
    public function deleteSupplierAction()
    {
        if (!$this->Request()->isPost()) {
            $this->View()->assign(['success' => false]);

            return;
        }

        $id = (int) $this->Request()->get('id');
        $supplierModel = $this->get('models')->find(Supplier::class$id);

        $this->get('models')->remove($supplierModel);
        $this->get('models')->flush();

        
// Fill the timePart with the datePart         return $timePart->setDate((int) $datePart->format('Y')(int) $datePart->format('m')(int) $datePart->format('d'));
    }

    /** * Helper to assure that everything is alright. * * @return bool */
    private function defaultCheck()
    {
        if (!$this->Request()->isPost()) {
            $this->View()->assign([
                'success' => false,
                'errorMsg' => $this->namespace->get('wrong_transmit_method', 'Wrong transmit method.')]);

            return false;
        }

        return true;
    }
}
$data['iconCls'] = 'sprite-cross';
            }

            $this->View()->assign(['success' => true, 'data' => $data]);
        } catch (ORMException $e) {
            $this->View()->assign(['success' => false, 'errorMsg' => $e->getMessage()]);
        }
    }

    public function deletePaymentAction()
    {
        if (!$this->Request()->isPost()) {
            $this->View()->assign(['success' => false, 'errorMsg' => 'Empty Post Request']);

            return;
        }
        $repository = $this->get('models')->getRepository(Payment::class);
        $id = $this->Request()->get('id');
        $model = $repository->find($id);
        if ($model->getSource() == 1) {
            try {
                $this->get('models')->remove($model);
                $this->get('models')->flush();
                
$this->View()->assign('isAccountless', $this->get('session')->get('isAccountless'));
        $this->View()->assign('register', $this->getRegisterData());
        $this->View()->assign('countryList', $this->get('modules')->Admin()->sGetCountryList());
    }

    /** * Checks the registration */
    public function saveRegisterAction()
    {
        if (!$this->request->isPost()) {
            $this->forward('index');

            return;
        }

        /** @var ShopContextInterface $context */
        $context = $this->get(ContextServiceInterface::class)->getShopContext();

        /** @var Enlight_Components_Session_Namespace $session */
        $session = $this->get('session');

        
$this->shopwarePath = $shopwarePath;
        $this->conn = $conn;
        $this->backupDirectory = $backupDir;
    }

    public function cleanupOldFiles()
    {
        $_SESSION['DB_DONE'] = true;

        $cleanupList = $this->getCleanupList();

        if ($this->request->isPost()) {
            $this->cleanupMedia();
        }

        if (\count($cleanupList) == 0) {
            $_SESSION['CLEANUP_DONE'] = true;
            $this->response->redirect($this->app->urlFor('done'));
        }

        if ($this->request->isPost()) {
            $this->cleanupTemplateRelations();

            
$this->View()->assign([
            'data' => $data,
            'success' => true,
        ]);
    }

    /** * saves the property list values in the product module */
    public function setPropertyListAction()
    {
        if (!$this->Request()->isPost()) {
            // don't save the property list on a get request. This will only occur when there is an ext js problem             return;
        }
        $models = $this->get('models');
        $productId = $this->Request()->getParam('articleId');
        $product = $models->find(Product::class$productId);
        $properties = $this->Request()->getParam('properties', []);

        if (empty($properties[0])) {
            $properties[0] = [
                'id' => $this->Request()->getParam('id'),
                


    /** * @deprecated in 5.6, will be private in 5.8 * * Saves one entry of the shipping aka dispatch costs matrix * * @return void */
    public function saveCostsMatrix()
    {
        if (!$this->Request()->isPost()) {
            $this->View()->assign(['success' => false, 'errorMsg' => 'Empty Post Request']);

            return;
        }
        $dispatchId = (int) $this->Request()->getParam('dispatchId');
        $costsMatrix = $this->Request()->getParam('costMatrix');
        $params = $this->Request()->getParams();

        if (!empty($params) && !\is_array($costsMatrix)) {
            $costsMatrix = [$params];
        }

        


    /** * Checks the url / the request and passes it around if necessary. */
    public function onPreDispatch(Enlight_Controller_EventArgs $args)
    {
        $request = $args->getRequest();
        $response = $args->getResponse();

        if ($response->isException()
            || $request->isPost()
            || $request->isXmlHttpRequest()             // is a ajax call             || $request->has('callback')                // is a jsonp call             || $request->getModuleName() != 'frontend'  // is not frontend             || !$request->getParam('rewriteAlias')      // is not a rewrite url alias         ) {
            return;
        }
        $router = $args->getSubject()->ensureRouter();

        $query = $request->getQuery();
        $location = $router->assemble($query);

        
$getPaymentDetails = $this->admin->sGetPaymentMeanById($this->View()->getAssign('sFormData')['payment']);

        $paymentClass = $this->admin->sInitiatePaymentClass($getPaymentDetails);
        if ($paymentClass instanceof BasePaymentMethod) {
            $data = $paymentClass->getCurrentPaymentDataAsArray(Shopware()->Session()->get('sUserId'));
            if (!empty($data)) {
                $this->View()->assign('sFormData', $this->View()->getAssign('sFormData') + $data);
            }
        }

        if ($this->Request()->isPost()) {
            $values = $this->Request()->getPost();
            $values['payment'] = $this->Request()->getPost('register');
            $values['payment'] = $values['payment']['payment'];
            $values['isPost'] = true;
            $this->View()->assign('sFormData', $values);
        }
    }

    /** * Read last orders * * @return void */
$request = $controller->Request();

        // do not check internal sub-requests or validated requests         if ($request->getAttribute('_isSubrequest') || $request->getAttribute(self::CSRF_WAS_VALIDATED)) {
            return;
        }

        if ($request->isGet() && !$this->isProtected($controller)) {
            return;
        }

        if ($request->isPost() && $request->isXmlHttpRequest()) {
            return;
        }

        // skip whitelisted actions         if ($this->isWhitelisted($controller)) {
            return;
        }

        if (!$this->checkRequest($request)) {
            throw new CSRFTokenValidationException(sprintf('The provided X-CSRF-Token for path "%s" is invalid. Please go back, reload the page and try again.', $request->getRequestUri()));
        }

        
Home | Imprint | This part of the site doesn't use cookies.