コード例 #1
0
function remove($servername)
{
    $apache = new vhosts();
    $GLOBALS["ADDLOG"] = "{$GLOBALS["ARTICALOGDIR"]}/{$servername}.log";
    $confs = $apache->SearchHosts($servername);
    events(__FUNCTION__ . ":: Check {$servername}");
    events(__FUNCTION__ . ":: remove files and directories");
    if (is_dir("/usr/share/artica-groupware/domains/{$servername}")) {
        shell_exec("/bin/rm -rf /usr/share/artica-groupware/domains/{$servername}");
    }
    $server_database = str_replace(" ", "_", $servername);
    $server_database = str_replace(".", "_", $servername);
    $server_database = str_replace("-", "_", $server_database);
    $q = new mysql();
    if ($q->DATABASE_EXISTS($server_database)) {
        $q->DELETE_DATABASE($server_database);
    }
    $flaseuser["root"] = true;
    $flaseuser["admin"] = true;
    $flaseuser["manager"] = true;
    $sql = "DELETE FROM `mysql`.`db` WHERE `db`.`Db` = '{$server_database}'";
    $q->QUERY_SQL($sql, "mysql");
    events(__FUNCTION__ . ":: removing ldap branch {$confs["dn"]}");
    $ldap = new clladp();
    if ($ldap->ExistsDN($confs["dn"])) {
        $ldap->ldap_delete($confs["dn"]);
    }
    events(__FUNCTION__ . ":: restarting HTTP service...");
    shell_exec("/etc/init.d/artica-postfix restart apache-groupware &");
}
コード例 #2
0
function list_users()
{
    $query = $_GET["SearchPattern"];
    $ldap = new clladp();
    $page = CurrentPageName();
    $www = base64_decode($_GET["www"]);
    if ($www == "MAIN_INSTANCE") {
        $dn = "dc=organizations,{$ldap->suffix}";
    } else {
        $w = new vhosts();
        $array = $w->SearchHosts($www);
        $ou = $array["OU"];
        $dn = "ou={$ou},dc=organizations,{$ldap->suffix}";
    }
    $html = "\n<table cellspacing='0' cellpadding='0' border='0' class='tableView'>\n<thead class='thead'>\n\t<tr>\n\t<th colspan=4>{$ou}- {members} {$query}</th>\n\t</tr>\n</thead>\t\n\t\n\t";
    $sr = @ldap_search($ldap->ldap_connection, $dn, "(&(objectClass=posixAccount)(|(uid={$query}*)(cn={$query}*)(displayName={$query}*)))", array("displayname", "uid"), 0, 10);
    if ($sr) {
        $result = ldap_get_entries($ldap->ldap_connection, $sr);
        for ($i = 0; $i < $result["count"]; $i++) {
            $displayname = $result[$i]["displayname"][0];
            $uid = $result[$i]["uid"][0];
            if (substr($uid, strlen($uid) - 1, 1) == '$') {
                continue;
            }
            if ($displayname == null) {
                $displayname = $uid;
            }
            $res[$uid] = $displayname;
        }
    }
    if (!is_array($res)) {
        return null;
    }
    krsort($res);
    while (list($num, $ligne) = each($res)) {
        if ($num == null) {
            continue;
        }
        if (is_numeric($num)) {
            continue;
        }
        $Displayname = $ligne;
        $uid = $num;
        $js = "AddGADBUser('" . base64_encode($uid) . "');";
        if (strlen($Displayname) > 30) {
            $Displayname = substr($Displayname, 0, 27) . "...";
        }
        $img = "user-18.png";
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $html = $html . "\n\t\t\t\t<tr class={$classtr}>\n\t\t\t\t<td width=1%><img src='img/{$img}'></td>\n\t\t\t\t<td><strong style='font-size:13px' >{$Displayname} ({$uid})</td>\n\t\t\t\t<td width=1%>" . imgtootltip("add-18.png", "{add}", $js) . "</td>\n\t\t\t\t</tr>";
    }
    $html = $html . "</table>";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body("{$html}");
}
コード例 #3
0
function organization_vhostslist($ou)
{
    $sock = new sockets();
    $usersmenus = new usersMenus();
    if ($usersmenus->AsOrgAdmin) {
        $tr[] = Paragraphe('www-add-64.png', '{ADD_WEB_SERVICE}', '{ADD_WEB_SERVICE_TEXT}', "javascript:Loadjs('domains.www.php?ou={$ou}&add=yes')", null, 210, 0, 0, true);
    }
    $ApacheGroupWarePort = $sock->GET_INFO("ApacheGroupWarePort");
    $apache = new vhosts();
    $hash = $apache->LoadVhosts($ou);
    $html = "<table style='width:98%' class=form>";
    $server = $_SERVER['SERVER_NAME'];
    if (preg_match("#(.+?):#", $server, $re)) {
        $server = $re[1];
    }
    while (list($host, $wwwservertype) = each($hash)) {
        $img = null;
        $suffix = null;
        $URI = "http://{$host}:{$ApacheGroupWarePort}{$suffix}";
        $array = $apache->SearchHosts($host);
        if ($array["wwwsslmode"] == "TRUE") {
            $URI = "https://{$host}{$suffix}";
        }
        switch ($wwwservertype) {
            case "JOOMLA":
                $suffix = "/administrator";
                break;
            case "DRUPAL":
                $img = "drupal-logo-32.png";
                $suffix = "/install.php";
                break;
        }
        $img = $apache->IMG_ARRAY_64[$wwwservertype];
        $warn = null;
        $ip = gethostbyname($host);
        if ($ip == $host) {
            $warn = imgtootltip("status_warning.png", "{could_not_find_iphost}:{$host}");
        }
        $link = imgtootltip("alias-32.gif", "<b><u>{$host}</u></b><br>{$URI}", "s_PopUpFull('{$URI}',800,800)");
        $js = "Loadjs('domains.www.php?ou={$ou}&add=yes&host={$host}')";
        $tr[] = Paragraphe(array($img, $warn, $link), $host, '{' . $apache->TEXT_ARRAY[$wwwservertype]["TITLE"] . '}<br>{' . $apache->TEXT_ARRAY[$wwwservertype]["TEXT"] . '}', "javascript:{$js}");
    }
    return $tr;
}
コード例 #4
0
function list_save()
{
    $listname = $_GET["listname"];
    $admin_email = $_GET["admin_email"];
    $tpl = new templates();
    if ($_SESSION["uid"] == -100) {
        echo "ok\n";
        $ou_q = base64_decode($_GET["ou"]);
    } else {
        $ct = new user($_SESSION["uid"]);
        $ou_q = $ct->ou;
    }
    $ldap = new clladp();
    $uid = $ldap->uid_from_email($admin_email);
    if ($uid == null) {
        echo $tpl->_ENGINE_parse_body("{$admin_email}:{mailman_admin_not_exists}");
        exit;
    }
    $ct = new user($uid);
    $listuid = $ldap->uid_from_email("{$listname}@{$domain}");
    if ($listuid != null) {
        echo $tpl->_ENGINE_parse_body("{account_already_exists}:{$listname}@{$domain}");
        exit;
    }
    if ($_GET["webservername"] == null) {
        echo $tpl->_ENGINE_parse_body("{www_server_name}:NULL !");
        exit;
    }
    $apache = new vhosts();
    $array = $apache->SearchHosts($_GET["webservername"] . '.' . $_GET["webservername_domain"]);
    if ($array["apacheservername"] != null) {
        echo $tpl->_ENGINE_parse_body($_GET["webservername"] . '.' . $_GET["webservername_domain"] . " {error_domain_exists}");
        exit;
    }
    $admin_password = $_GET["admin_password"];
    $domain = $_GET["domain"];
    $mailman = new mailman_control($ou_q);
    $mailman->list_name = $listname;
    $mailman->list_domain = $domain;
    $mailman->admin_email = $admin_email;
    $mailman->admin_password = $_GET["admin_password"];
    $mailman->webservername = $_GET["webservername"] . '.' . $_GET["webservername_domain"];
    if ($mailman->EditList()) {
    }
    $sock = new sockets();
    $sock->getFrameWork("cmd.php?syncro-mailman=yes");
}