����JFIF���������
__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace Dropbox;
/**
* Path validation functions.
*/
final class Path
{
/**
* Return whether the given path is a valid Dropbox path.
*
* @param string $path
* The path you want to check for validity.
*
* @return bool
* Whether the path was valid or not.
*/
static function isValid($path)
{
$error = self::findError($path);
return ($error === null);
}
/**
* Return whether the given path is a valid non-root Dropbox path.
* This is the same as {@link isValid} except <code>"/"</code> is not allowed.
*
* @param string $path
* The path you want to check for validity.
*
* @return bool
* Whether the path was valid or not.
*/
static function isValidNonRoot($path)
{
$error = self::findErrorNonRoot($path);
return ($error === null);
}
/**
* If the given path is a valid Dropbox path, return <code>null</code>,
* otherwise return an English string error message describing what is wrong with the path.
*
* @param string $path
* The path you want to check for validity.
*
* @return string|null
* If the path was valid, return <code>null</code>. Otherwise, returns
* an English string describing the problem.
*/
static function findError($path)
{
Checker::argString("path", $path);
$matchResult = preg_match('%^(?:
[\x09\x0A\x0D\x20-\x7E] # ASCII
| [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
| \xE0[\xA0-\xBF][\x80-\xBD] # excluding overlongs, FFFE, and FFFF
| [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
| \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
)*$%xs', $path);
if ($matchResult !== 1) {
return "must be valid UTF-8; BMP only, no surrogates, no U+FFFE or U+FFFF";
}
if (\substr_compare($path, "/", 0, 1) !== 0) return "must start with \"/\"";
$l = strlen($path);
if ($l === 1) return null; // Special case for "/"
if ($path[$l-1] === "/") return "must not end with \"/\"";
// TODO: More checks.
return null;
}
/**
* If the given path is a valid non-root Dropbox path, return <code>null</code>,
* otherwise return an English string error message describing what is wrong with the path.
* This is the same as {@link findError} except <code>"/"</code> will yield an error message.
*
* @param string $path
* The path you want to check for validity.
*
* @return string|null
* If the path was valid, return <code>null</code>. Otherwise, returns
* an English string describing the problem.
*/
static function findErrorNonRoot($path)
{
if ($path == "/") return "root path not allowed";
return self::findError($path);
}
/**
* Return the last component of a path (the file or folder name).
*
* <code>
* Path::getName("/Misc/Notes.txt") // "Notes.txt"
* Path::getName("/Misc") // "Misc"
* Path::getName("/") // null
* </code>
*
* @param string $path
* The full path you want to get the last component of.
*
* @return null|string
* The last component of <code>$path</code> or <code>null</code> if the given
* <code>$path</code> was <code>"/"<code>.
*/
static function getName($path)
{
Checker::argString("path", $path);
if (\substr_compare($path, "/", 0, 1) !== 0) {
throw new \InvalidArgumentException("'path' must start with \"/\"");
}
$l = strlen($path);
if ($l === 1) return null;
if ($path[$l-1] === "/") {
throw new \InvalidArgumentException("'path' must not end with \"/\"");
}
$lastSlash = strrpos($path, "/");
return substr($path, $lastSlash+1);
}
/**
* @internal
*
* @param string $argName
* @param mixed $value
* @throws \InvalidArgumentException
*/
static function checkArg($argName, $value)
{
if ($value === null) throw new \InvalidArgumentException("'$argName' must not be null");
if (!is_string($value)) throw new \InvalidArgumentException("'$argName' must be a string");
$error = self::findError($value);
if ($error !== null) throw new \InvalidArgumentException("'$argName'': bad path: $error: ".var_export($value, true));
}
/**
* @internal
*
* @param string $argName
* @param mixed $value
* @throws \InvalidArgumentException
*/
static function checkArgOrNull($argName, $value)
{
if ($value === null) return;
self::checkArg($argName, $value);
}
/**
* @internal
*
* @param string $argName
* @param mixed $value
* @throws \InvalidArgumentException
*/
static function checkArgNonRoot($argName, $value)
{
if ($value === null) throw new \InvalidArgumentException("'$argName' must not be null");
if (!is_string($value)) throw new \InvalidArgumentException("'$argName' must be a string");
$error = self::findErrorNonRoot($value);
if ($error !== null) throw new \InvalidArgumentException("'$argName'': bad path: $error: ".var_export($value, true));
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Exception | Folder | 0755 |
|
|
| WebAuthException | Folder | 0755 |
|
|
| certs | Folder | 0755 |
|
|
| AppInfo.php | File | 7.07 KB | 0644 |
|
| AppInfoLoadException.php | File | 326 B | 0644 |
|
| ArrayEntryStore.php | File | 1.13 KB | 0644 |
|
| AuthBase.php | File | 2.52 KB | 0644 |
|
| AuthInfo.php | File | 2.64 KB | 0644 |
|
| AuthInfoLoadException.php | File | 328 B | 0644 |
|
| Checker.php | File | 3.22 KB | 0644 |
|
| Client.php | File | 59.93 KB | 0644 |
|
| Curl.php | File | 4 KB | 0644 |
|
| CurlStreamRelay.php | File | 1.04 KB | 0644 |
|
| DeserializeException.php | File | 389 B | 0644 |
|
| DropboxMetadataHeaderCatcher.php | File | 1.93 KB | 0644 |
|
| Exception.php | File | 265 B | 0644 |
|
| Host.php | File | 2.65 KB | 0644 |
|
| HttpResponse.php | File | 246 B | 0644 |
|
| OAuth1AccessToken.php | File | 1.44 KB | 0644 |
|
| OAuth1Upgrader.php | File | 5.26 KB | 0644 |
|
| Path.php | File | 5.36 KB | 0644 |
|
| RequestUtil.php | File | 11.34 KB | 0644 |
|
| RootCertificates.php | File | 4.89 KB | 0644 |
|
| SSLTester.php | File | 4.74 KB | 0644 |
|
| Security.php | File | 2.08 KB | 0644 |
|
| StreamReadException.php | File | 316 B | 0644 |
|
| Util.php | File | 799 B | 0644 |
|
| ValueStore.php | File | 1.28 KB | 0644 |
|
| WebAuth.php | File | 10.23 KB | 0644 |
|
| WebAuthBase.php | File | 4.61 KB | 0644 |
|
| WebAuthNoRedirect.php | File | 2.95 KB | 0644 |
|
| WriteMode.php | File | 3.66 KB | 0644 |
|
| autoload.php | File | 844 B | 0644 |
|
| strict.php | File | 538 B | 0644 |
|