<?php
require_once("inc/base.php");
require_once("inc/error.php");
require_once("inc/security.php");
require_once('class/domain.php');
require_once("certs.php");
function autoipv6_address($vhost_id, $mode = 1)
{
$result = db_query("SELECT uid, v6_prefix FROM vhosts.v_vhost LEFT JOIN system.servers ON (servers.hostname = server) WHERE v_vhost.id={$vhost_id}");
$data = mysql_fetch_assoc($result);
if (!$data['v6_prefix'])
{
warning("IPv6-Adresse nicht verfügbar, Server unterstützt kein IPv6");
return "";
}
list($prefix, $null) = explode('/', $data['v6_prefix']);
$vh = ':1';
if ($mode == 2) {
$vh = implode(':', str_split(sprintf("%08x", $vhost_id), 4));
}
$ipv6 = $prefix . sprintf("%04s", $data['uid']) . ':' . $vh;
return $ipv6;
}
function list_vhosts()
{
$uid = (int) $_SESSION['userinfo']['uid'];
$result = db_query("SELECT vh.id,fqdn,domain,docroot,docroot_is_default,php,cgi,vh.certid AS cert, vh.ssl, vh.options,logtype,errorlog,IF(dav.id IS NULL OR dav.type='svn', 0, 1) AS is_dav,IF(dav.id IS NULL OR dav.type='dav', 0, 1) AS is_svn, IF(webapps.id IS NULL, 0, 1) AS is_webapp, stats FROM vhosts.v_vhost AS vh LEFT JOIN vhosts.dav ON (dav.vhost=vh.id) LEFT JOIN vhosts.webapps ON (webapps.vhost = vh.id) WHERE uid={$uid} ORDER BY domain,hostname");
$ret = array();
while ($item = mysql_fetch_assoc($result))
array_push($ret, $item);
return $ret;
}
function ipv6_possible($server)
{
$serverid = (int) $server;
$servername = mysql_real_escape_string($server);
$result = db_query("SELECT v6_prefix FROM system.servers WHERE id={$serverid} OR hostname='{$servername}'");
$line = mysql_fetch_assoc($result);
DEBUG("Server {$server} is v6-capable: ". ($line['v6_prefix'] != NULL));
return ($line['v6_prefix'] != NULL);
}
function empty_vhost()