mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
all the types
This commit is contained in:
parent
515b42586e
commit
84fa890ea7
28 changed files with 330 additions and 110 deletions
|
|
@ -10,13 +10,18 @@ namespace Icewind\SMB;
|
|||
use Icewind\SMB\Exception\InvalidPathException;
|
||||
|
||||
abstract class AbstractShare implements IShare {
|
||||
/** @var string[] */
|
||||
private $forbiddenCharacters;
|
||||
|
||||
public function __construct() {
|
||||
$this->forbiddenCharacters = ['?', '<', '>', ':', '*', '|', '"', chr(0), "\n", "\r"];
|
||||
}
|
||||
|
||||
protected function verifyPath($path) {
|
||||
/**
|
||||
* @param string $path
|
||||
* @throws InvalidPathException
|
||||
*/
|
||||
protected function verifyPath(string $path): void {
|
||||
foreach ($this->forbiddenCharacters as $char) {
|
||||
if (strpos($path, $char) !== false) {
|
||||
throw new InvalidPathException('Invalid path, "' . $char . '" is not allowed');
|
||||
|
|
@ -24,7 +29,10 @@ abstract class AbstractShare implements IShare {
|
|||
}
|
||||
}
|
||||
|
||||
public function setForbiddenChars(array $charList) {
|
||||
/**
|
||||
* @param string[] $charList
|
||||
*/
|
||||
public function setForbiddenChars(array $charList): void {
|
||||
$this->forbiddenCharacters = $charList;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue