Returns the referer, if it is safely validated as an internal URL
and can be redirected to.

@internal called from {@see Form::getValidationErrorResponse}
@return string|null
331598
public function getReturnReferer()
    {
        $referer = $this->getReferer();
        if ($referer && Director::is_site_url($referer)) {
            return $referer;
        }
        return null;
    }
393136
public function getError()
    {
        if (count($this->errors) > 1) {
            trigger_error("There are multiple errors, returning only the first", E_USER_NOTICE);
        }
        
        return reset($this->errors) ?: null;
    }
1313943
private function getEmail(): ? string
    {
        $email = $this->ask("Enter email address");

        $validator = Validator::make(['email' => $email], [
            'email' => 'required|min:3|email',
        ]);

        if ($validator->fails()) {
            $this->error('Email is required, minimum 3 symbols length and must be email format');

            return $this->getEmail();
        }

        $this->email = $email;

        return null;
    }
89773
public function getIPNRequestValidator()
    {
        if ($this->ipnRequestValidator === null) {
            $this->ipnRequestValidator = oxNew(\OxidEsales\PayPalModule\Model\IPNRequestValidator::class);
        }

        return $this->ipnRequestValidator;
    }
1000896
protected function getValidationSchemaUrl()
    {
        $profile = $this->getValidationProfile();
        if ($filename = $this->getJsonSchemaFileFromRegistry($profile)) {
            // known profile id in the registry
            return $this->convertValidationSchemaFilenameToUrl($filename);
        } elseif (Utils::isHttpSource($profile)) {
            // url
            return $profile;
        } elseif (file_exists($filename = $this->basePath.DIRECTORY_SEPARATOR.$profile)) {
            // relative path - prefixed with basePath
            return $this->convertValidationSchemaFilenameToUrl($filename);
        } else {
            // absolute path (or relative to current working directory)
            return $this->convertValidationSchemaFilenameToUrl($profile);
        }
    }
1267873
public function getError()
    {
        $oOut       = new \stdClass();
        $oOut->msg  = $this->sErrorMsg;
        $oOut->code = $this->sErrorCode;
        $oOut->user = $this->sErrorUser;

        return $oOut;
    }
525109
public function getResponse()
    {
        $response = redirect()->to($this->getRedirectUrl());
        $response->withInput($this->request->input());
        $response->withErrors($this->getErrors(), 'default');
        $response->setCharset(config('app.charset', 'UTF-8'));

        return $response;
    }
1261060
protected function getError() {
		if ($this->_error === false) {
			if (is_resource($this->_dbh)) {
				$this->_error = @oci_error($this->_dbh);
			}
			else {
				$this->_error = @oci_error();
			}
		}

		return $this->_error;
	}
980409
public function getRedirectUrl()
    {
        $siteId = $this->getSiteId();

        $requestUrl = $this->getRequestUrl();

        $redirect = $this->redirectRepo->getRedirect($requestUrl, $siteId);

        if (!empty($redirect)) {
            return $redirect->getRedirectUrl();
        }

        return null;
    }
1294157
public function requestCorrect()
    {
        $request = $this->getRequest();
        $rawRequestData = $request->getPost();

        $responseDoVerifyWithPayPal = $this->doVerifyWithPayPal($rawRequestData);

        $ipnRequestValidator = $this->getIPNRequestValidator();
        $ipnRequestValidator->setPayPalRequest($rawRequestData);
        $ipnRequestValidator->setPayPalResponse($responseDoVerifyWithPayPal);
        $ipnRequestValidator->setShopOwnerUserName($this->getShopOwner());

        $requestCorrect = $ipnRequestValidator->isValid();
        if (!$requestCorrect) {
            $failureMessage = $ipnRequestValidator->getValidationFailureMessage();
            $this->setFailureMessage($failureMessage);
        }

        return $requestCorrect;
    }
970839
public static function getExternalIP()
    {
        $ip = \Cache::rememberForever('external-ip-address', function () {
            $response = Curl::get('http://ipinfo.io/ip');
            $ip = trim($response, "\t\r\n");
            try {
                $validator = Validator::make(['ip' => $ip], ['ip' => 'ip']);
                $validator->validate();
            } catch (ValidationException $e) {
                $ip = null;
            }

            return $ip;
        });

        return $ip;
    }
1038827
public function redirect() : ?RedirectResponse
    {
        if (!$this->enabled()) {
            return null;
        }

        return redirect()
            ->back()
            ->withErrors([
                'form-verify-error' => $this->redirectMessage,
            ])
            ->withInput();
    }
1140274
public static function check_referer()
    {
        $uri     = parse_url($_SERVER['REQUEST_URI']);
        $referer = parse_url(self::request_header('Referer'));

        return $referer['host'] == self::request_header('Host') && $referer['path'] == $uri['path'];
    }
485121
public function noReferer()
    {
        if ($this->getParameter('url') == null)
            return;

        if ($this->getParameter('service') == null)
            return "http://hiderefer.com/?" . $this->getParameter('url');

        return $this->getParameter('service') . $this->getParameter('url');
    }
485238
protected function redirectToReferer(): RedirectResponse
    {
        $url = $this->requestService->fetchRefererUrl();

        // Oops, url of referer is unknown
        if ('' === $url) {
            throw CannotRedirectToEmptyRefererUrlException::create();
        }

        return $this->redirect($url);
    }
486998
protected function getReferralUrl(): string
    {
        return str_replace($this->method, 'referral', $this->url) . '?apiKey=' . substr($this->apiKey, 0, 16);
    }
903266
protected function GetErrorCodesFromResponse()
    {
        $sReturnMessage = false;
        $oGlobal = TGlobal::instance();
        $this->sRefNo = $oGlobal->GetUserData('refno');
        $sReturnState = $oGlobal->GetUserData('status');
        if ($this->bIsCorrectPaymentType()) {
            $oBasket = TShopBasket::GetInstance();
            if ($this->sRefNo == crc32($oBasket->sBasketIdentifier.'__'.$this->GetRefNoPaymentId().'__'.$this->sRefNoCount)) {
                if ('error' == $sReturnState) {
                    $sResponseHash = $this->GetSecurityHash($this->GetTestLiveModeParameter('sign'), $oGlobal->GetUserData('merchantId'), $oGlobal->GetUserData('amount'), $oGlobal->GetUserData('currency'), $oGlobal->GetUserData('refno'));
                    if ($sResponseHash == $oGlobal->GetUserData('sign')) {
                        $sReturnMessage = $oGlobal->GetUserData('errorDetail');
                        $sReturnMessage = $this->TransformDataTransMessages($oGlobal->GetUserData('errorCode'));
                    } else {
                        $sReturnMessage = 'ERROR_PAYMENT_DATA_TRANS_SECURITY_CHECK_ERROR';
                    }
                } elseif ('cancel' == $sReturnState) {
                    $sResponseHash = $this->GetSecurityHash($this->GetTestLiveModeParameter('sign'), $oGlobal->GetUserData('merchantId'), $oGlobal->GetUserData('amount'), $oGlobal->GetUserData('currency'), $oGlobal->GetUserData('refno'));
                    if ($sResponseHash == $oGlobal->GetUserData('sign')) {
                        $sReturnMessage = 'ERROR_PAYMENT_DATA_TRANS_PAYMENT_CANCEL';
                    } else {
                        $sReturnMessage = 'ERROR_PAYMENT_DATA_TRANS_SECURITY_CHECK_ERROR';
                    }
                } else {
                    $sTransactionId = $oGlobal->GetUserData('uppTransactionId');
                    $sAuthorisedAmount = $oGlobal->GetUserData('amount');
                    $sResponseHash = $this->GetSecurityHash($this->GetTestLiveModeParameter('sign2'), $oGlobal->GetUserData('merchantId'), $oGlobal->GetUserData('amount'), $oGlobal->GetUserData('currency'), $oGlobal->GetUserData('uppTransactionId'));
                    if ($sResponseHash == $oGlobal->GetUserData('sign2')) {
                        if (strlen($sTransactionId) <= 0 || strlen($sAuthorisedAmount) <= 0) {
                            $sReturnMessage = 'ERROR_PAYMENT_DATA_TRANS_MISSING_PARAMETER_IN_RESPONSE';
                            TTools::WriteLogEntrySimple('Payment DataTrans: Beim Autorisierungsresponse wurden benötigte Daten nicht zurückgegeben', 1, __FILE__, __LINE__);
                        } else {
                            $this->sTransactionId = $sTransactionId;
                            $this->sAuthorisedAmount = $sAuthorisedAmount;
                        }
                    } else {
                        $sReturnMessage = 'ERROR_PAYMENT_DATA_TRANS_SECURITY_CHECK_ERROR';
                    }
                }
            } else {
                $sReturnMessage = 'ERROR_PAYMENT_DATA_TRANS_REFERENCE_NUMER_NOT_VALID';
            }
        } else {
            $sReturnMessage = 'ERROR_PAYMENT_DATA_TRANS_PAYMEN_SELECTION_NOT_VALID';
        }

        return $sReturnMessage;
    }