|
@@ -22,22 +22,15 @@ function listFsDirs($username) {
|
|
|
}
|
|
|
|
|
|
function addSite($username, $siteDir, $domain, $domainType, $protocol) {
|
|
|
- $db = new PDO('sqlite:' . DB_PATH);
|
|
|
-
|
|
|
- $op = $db->prepare("INSERT INTO sites(username, site_dir, domain, domain_type, protocol, creation_date, le_enabled) VALUES(:username, :site_dir, :domain, :domain_type, :protocol, :creation_date, :le_enabled)");
|
|
|
-
|
|
|
- $op->bindValue(':username', $username);
|
|
|
- $op->bindValue(':site_dir', $siteDir);
|
|
|
- $op->bindValue(':domain', $domain);
|
|
|
- $op->bindValue(':domain_type', $domainType);
|
|
|
- $op->bindValue(':protocol', $protocol);
|
|
|
- $op->bindValue(':creation_date', date("Y-m-d H:i:s"));
|
|
|
- if ($domainType === "dns" AND $protocol === "http")
|
|
|
- $op->bindValue(':le_enabled', 0);
|
|
|
- else
|
|
|
- $op->bindValue(':le_enabled', NULL);
|
|
|
-
|
|
|
- $op->execute();
|
|
|
+ insert('sites', [
|
|
|
+ 'username' => $username,
|
|
|
+ 'site_dir' => $siteDir,
|
|
|
+ 'domain' => $domain,
|
|
|
+ 'domain_type' => $domainType,
|
|
|
+ 'protocol' => $protocol,
|
|
|
+ 'creation_date' => date("Y-m-d H:i:s"),
|
|
|
+ 'le_enabled' => (($domainType === "dns" AND $protocol === "http") ? 0 : NULL),
|
|
|
+ ]);
|
|
|
}
|
|
|
|
|
|
function dirsStatuses($username, $domainType, $protocol) {
|