[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@18.221.157.203: ~ $
<?php

namespace Negotiation;

class Negotiator extends AbstractNegotiator
{
    /**
     * {@inheritdoc}
     */
    protected function acceptFactory($accept)
    {
        return new Accept($accept);
    }

    /**
     * {@inheritdoc}
     */
    protected function match(AcceptHeader $accept, AcceptHeader $priority, $index)
    {
        if (!$accept instanceof Accept || !$priority instanceof Accept) {
            return null;
        }

        $acceptBase = $accept->getBasePart();
        $priorityBase = $priority->getBasePart();

        $acceptSub = $accept->getSubPart();
        $prioritySub = $priority->getSubPart();

        $intersection = array_intersect_assoc($accept->getParameters(), $priority->getParameters());

        $baseEqual = !strcasecmp($acceptBase, $priorityBase);
        $subEqual  = !strcasecmp($acceptSub, $prioritySub);

        if (($acceptBase === '*' || $baseEqual)
            && ($acceptSub === '*' || $subEqual)
            && count($intersection) === count($accept->getParameters())
        ) {
            $score = 100 * $baseEqual + 10 * $subEqual + count($intersection);

            return new AcceptMatch($accept->getQuality() * $priority->getQuality(), $score, $index);
        }

        if (!strstr($acceptSub, '+') || !strstr($prioritySub, '+')) {
            return null;
        }

        // Handle "+" segment wildcards
        list($acceptSub, $acceptPlus) = $this->splitSubPart($acceptSub);
        list($prioritySub, $priorityPlus) = $this->splitSubPart($prioritySub);

        // If no wildcards in either the subtype or + segment, do nothing.
        if (!($acceptBase === '*' || $baseEqual)
            || !($acceptSub === '*' || $prioritySub === '*' || $acceptPlus === '*' || $priorityPlus === '*')
        ) {
            return null;
        }

        $subEqual  = !strcasecmp($acceptSub, $prioritySub);
        $plusEqual = !strcasecmp($acceptPlus, $priorityPlus);

        if (($acceptSub === '*' || $prioritySub === '*' || $subEqual)
            && ($acceptPlus === '*' || $priorityPlus === '*' || $plusEqual)
            && count($intersection) === count($accept->getParameters())
        ) {
            $score = 100 * $baseEqual + 10 * $subEqual + $plusEqual + count($intersection);

            return new AcceptMatch($accept->getQuality() * $priority->getQuality(), $score, $index);
        }

        return null;
    }

    /**
     * Split a subpart into the subpart and "plus" part.
     *
     * For media-types of the form "application/vnd.example+json", matching
     * should allow wildcards for either the portion before the "+" or
     * after. This method splits the subpart to allow such matching.
     */
    protected function splitSubPart($subPart)
    {
        if (!strstr($subPart, '+')) {
            return [$subPart, ''];
        }

        return explode('+', $subPart, 2);
    }
}

Filemanager

Name Type Size Permission Actions
Exception Folder 0755
AbstractNegotiator.php File 5 KB 0644
Accept.php File 825 B 0644
AcceptCharset.php File 104 B 0644
AcceptEncoding.php File 105 B 0644
AcceptHeader.php File 58 B 0644
AcceptLanguage.php File 1.04 KB 0644
AcceptMatch.php File 1.17 KB 0644
BaseAccept.php File 2.95 KB 0644
CharsetNegotiator.php File 224 B 0644
EncodingNegotiator.php File 226 B 0644
LanguageNegotiator.php File 1.05 KB 0644
Match.php File 1.12 KB 0644
Negotiator.php File 2.81 KB 0644