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)"); if ($domainType === "dns" AND $protocol === "http") $le_enabled = 0; else $le_enabled = NULL; $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")); $op->bindValue(':le_enabled', $le_enabled); $op->execute(); } function dirsStatuses($username, $domainType, $protocol) { $dbDirs = query('select', 'sites', [ 'username' => $username, 'domain_type' => $domainType, 'protocol' => $protocol, ], 'site_dir'); $dirs = []; foreach (listFsDirs($username) as $fsDir) $dirs[$fsDir] = in_array($fsDir, $dbDirs); return $dirs; }