|
@@ -16,7 +16,7 @@ function listFsDirs($username) {
|
|
$absoluteDirs = glob(CONF['ht']['ht_path'] . '/' . $username . '/*/', GLOB_ONLYDIR);
|
|
$absoluteDirs = glob(CONF['ht']['ht_path'] . '/' . $username . '/*/', GLOB_ONLYDIR);
|
|
$dirs = [];
|
|
$dirs = [];
|
|
foreach ($absoluteDirs as $absoluteDir)
|
|
foreach ($absoluteDirs as $absoluteDir)
|
|
- if (preg_match('/^[\p{L}\p{N}_-]{1,64}$/Du', basename($absoluteDir)))
|
|
|
|
|
|
+ if (preg_match('/^[a-zA-Z0-9_-]{1,64}$/D', basename($absoluteDir)))
|
|
array_push($dirs, basename($absoluteDir));
|
|
array_push($dirs, basename($absoluteDir));
|
|
return $dirs;
|
|
return $dirs;
|
|
}
|
|
}
|
|
@@ -32,14 +32,16 @@ function addSite($username, $siteDir, $domain, $domainType, $protocol) {
|
|
]);
|
|
]);
|
|
}
|
|
}
|
|
|
|
|
|
-function dirsStatuses($username, $domainType, $protocol) {
|
|
|
|
|
|
+function dirsStatuses($domainType, $protocol) {
|
|
|
|
+ if (isset($_SESSION['username']) !== true)
|
|
|
|
+ return [];
|
|
$dbDirs = query('select', 'sites', [
|
|
$dbDirs = query('select', 'sites', [
|
|
- 'username' => $username,
|
|
|
|
|
|
+ 'username' => $_SESSION['username'],
|
|
'domain_type' => $domainType,
|
|
'domain_type' => $domainType,
|
|
'protocol' => $protocol,
|
|
'protocol' => $protocol,
|
|
], 'site_dir');
|
|
], 'site_dir');
|
|
$dirs = [];
|
|
$dirs = [];
|
|
- foreach (listFsDirs($username) as $fsDir)
|
|
|
|
|
|
+ foreach (listFsDirs($_SESSION['username']) as $fsDir)
|
|
$dirs[$fsDir] = in_array($fsDir, $dbDirs);
|
|
$dirs[$fsDir] = in_array($fsDir, $dbDirs);
|
|
return $dirs;
|
|
return $dirs;
|
|
}
|
|
}
|