示例#1
0
function vhosts_users()
{
    $ldap = new clladp();
    $pattern = "(&(objectclass=apacheConfig)(apacheServerName=*)(wwwservertype=WEBDAV))";
    $attr = array();
    $sr = @ldap_search($ldap->ldap_connection, $ldap->suffix, $pattern, $attr);
    $hash = ldap_get_entries($ldap->ldap_connection, $sr);
    for ($i = 0; $i < $hash["count"]; $i++) {
        $dn = $hash[$i]["dn"];
        if (preg_match("#ou=www,ou=(.+?),dc=organizations#", $dn, $re)) {
            $hash[$i]["OU"][0] = trim($re[1]);
            $ouexec = trim($re[1]);
        }
        $conf[] = vhosts_users_ou($hash[$i]);
    }
    $sock = new sockets();
    $unix = new unix();
    $ApacheGroupware = $sock->GET_INFO("ApacheGroupware");
    if ($ApacheGroupware == null) {
        $ApacheGroupware = 1;
    }
    $d_path = $unix->APACHE_DIR_SITES_ENABLED();
    if ($ApacheGroupware == 0) {
        echo "Starting......: Apache Groupware adding {$d_path}/webdav-artica-vhosts.conf\n";
        @file_put_contents("{$d_path}/groupware-artica-vhosts.conf", @implode("\n", $conf));
        $conf = null;
        $apache2ctl = $unix->LOCATE_APACHE_CTL();
        if (is_file($apache2ctl)) {
            shell_exec("{$apache2ctl} -k restart");
        }
    }
    @file_put_contents("/usr/local/apache-groupware/conf/webdav-vhosts.conf", @implode("\n", $conf));
}
示例#2
0
function vhosts()
{
    $ldap = new clladp();
    $pattern = "(&(objectclass=apacheConfig)(apacheServerName=*)(wwwservertype=BACKUPPC))";
    $attr = array();
    $sr = @ldap_search($ldap->ldap_connection, $ldap->suffix, $pattern, $attr);
    $hash = ldap_get_entries($ldap->ldap_connection, $sr);
    for ($i = 0; $i < $hash["count"]; $i++) {
        $dn = $hash[$i]["dn"];
        if (preg_match("#ou=www,ou=(.+?),dc=organizations#", $dn, $re)) {
            $hash[$i]["OU"][0] = trim($re[1]);
            $ouexec = trim($re[1]);
        }
        $conf[] = vhosts_users_ou($hash[$i]);
    }
    @file_put_contents("/usr/local/apache-groupware/conf/backuppc-vhosts.conf", @implode("\n", $conf));
}