Exemplo n.º 1
0
function delete_domain($domain_id)
{
    global $dbh;
    // Delete all admin references to this domain.
    delete_domain_admin_references($domain_id);
    // Delete the domain record itself.
    $sth = $dbh->prepare("DELETE FROM maia_domains WHERE id = ?");
    $res = $sth->execute(array($domain_id));
    if (PEAR::isError($sth)) {
        die($sth->getMessage());
    }
    $sth->free();
    // Find and delete the default user records associated with this domain
    $sth = $dbh->prepare("SELECT maia_user_id FROM users WHERE maia_domain_id = ?");
    $res = $sth->execute(array($domain_id));
    if (PEAR::isError($sth)) {
        die($sth->getMessage());
    }
    if ($row = $res->fetchrow()) {
        $maia_user_id = $row["maia_user_id"];
        delete_user($maia_user_id);
    }
    $sth->free();
}
Exemplo n.º 2
0
function delete_domain($domain_id)
{
    global $dbh;
    // Delete all admin references to this domain.
    delete_domain_admin_references($domain_id);
    // Delete the domain record itself.
    $delete = "DELETE FROM maia_domains WHERE id = ?";
    $res = $dbh->query($delete, array($domain_id));
    sql_check($res, "delete_domain", $delete);
    // Find and delete the default user records associated with this domain
    $select = "SELECT maia_user_id FROM users WHERE maia_domain_id = ?";
    $sth = $dbh->query($select, array($domain_id));
    sql_check($sth, "delete_domain", $select);
    if ($row = $sth->fetchrow()) {
        $maia_user_id = $row["maia_user_id"];
        delete_user($maia_user_id);
    }
    $sth->free();
}