delete_record.php
author peter
Sun, 06 Jan 2008 11:49:17 +0000
changeset 67 2f8c29fc5e2e
parent 65 ce1c4d5e1576
child 71 e1b918eaf69a
permissions -rw-r--r--
[feladat @ 114] Patch for ticket 19. Because of the use of the quote function, empty strings where converted to NULL as MDB2_PORTABILITY_EMPTY_TO_NULL is set by default. This problem also applied to the active state of an user.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     1
<?php
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
     2
47
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
     3
/*  PowerAdmin, a friendly web-based admin tool for PowerDNS.
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
     4
 *  See <https://rejo.zenger.nl/poweradmin> for more details.
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
     5
 *
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
     6
 *  Copyright 2007, 2008  Rejo Zenger <rejo@zenger.nl>
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
     7
 *
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
     8
 *  This program is free software: you can redistribute it and/or modify
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
     9
 *  it under the terms of the GNU General Public License as published by
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    10
 *  the Free Software Foundation, either version 3 of the License, or
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    11
 *  (at your option) any later version.
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    12
 *
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    13
 *  This program is distributed in the hope that it will be useful,
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    16
 *  GNU General Public License for more details.
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    17
 *
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    18
 *  You should have received a copy of the GNU General Public License
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    19
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    20
 */
ae140472d97c [feladat @ 94]
rejo
parents: 37
diff changeset
    21
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    22
require_once("inc/toolkit.inc.php");
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    23
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    24
if ($_GET["id"]) {
37
b785e54690ce [feladat @ 84]
rejo
parents: 13
diff changeset
    25
	// check if we have access to the given id
b785e54690ce [feladat @ 84]
rejo
parents: 13
diff changeset
    26
	$zoneId = recid_to_domid($_GET['id']);
b785e54690ce [feladat @ 84]
rejo
parents: 13
diff changeset
    27
	if ((!level(5)) && (!xs($zoneId))) {
b785e54690ce [feladat @ 84]
rejo
parents: 13
diff changeset
    28
    		error(ERR_RECORD_ACCESS_DENIED);
b785e54690ce [feladat @ 84]
rejo
parents: 13
diff changeset
    29
	}
b785e54690ce [feladat @ 84]
rejo
parents: 13
diff changeset
    30
	if ((!level(5)) && ($_SESSION[$zoneId.'_ispartial'] == 1)) {
65
ce1c4d5e1576 [feladat @ 112]
peter
parents: 48
diff changeset
    31
		$db->setLimit(1);
ce1c4d5e1576 [feladat @ 112]
peter
parents: 48
diff changeset
    32
		$checkPartial = $db->queryOne("SELECT id FROM record_owners WHERE record_id=".$db->quote($_GET["id"])." AND user_id=".$db->quote($_SESSION["userid"]));
37
b785e54690ce [feladat @ 84]
rejo
parents: 13
diff changeset
    33
		if (empty($checkPartial)) {
b785e54690ce [feladat @ 84]
rejo
parents: 13
diff changeset
    34
			error(ERR_RECORD_ACCESS_DENIED);
b785e54690ce [feladat @ 84]
rejo
parents: 13
diff changeset
    35
		}
b785e54690ce [feladat @ 84]
rejo
parents: 13
diff changeset
    36
	}
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    37
        if ($_GET["confirm"] == '0') {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    38
                clean_page("edit.php?id=".$_GET["domain"]);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    39
        } elseif ($_GET["confirm"] == '1') {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    40
                delete_record($_GET["id"]);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    41
                clean_page("edit.php?id=".$_GET["domain"]);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    42
        }
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    43
        include_once("inc/header.inc.php");
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 2
diff changeset
    44
        ?>
2ff220cfde13 [feladat @ 60]
rejo
parents: 2
diff changeset
    45
	
2ff220cfde13 [feladat @ 60]
rejo
parents: 2
diff changeset
    46
	<h2><? echo _('Delete record'); ?> "<?
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    47
        $data = get_record_from_id($_GET["id"]);
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    48
        print $data["name"]." IN ".$data["type"]." ".$data["content"];
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 2
diff changeset
    49
        ?>"</h2><?
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    50
        if (($data["type"] == "NS" && $data["name"] == get_domain_name_from_id($_GET["domain"])) || $data["type"] == "SOA") {
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 2
diff changeset
    51
                print "<font class=\"warning\">" . _('You are trying to delete a record that is needed for this zone to work.') . "</font><br>";
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    52
        }
13
2ff220cfde13 [feladat @ 60]
rejo
parents: 2
diff changeset
    53
        ?><br><font class="warning"><? echo _('Are you sure?'); ?></font><br><br>
2ff220cfde13 [feladat @ 60]
rejo
parents: 2
diff changeset
    54
        <input type="button" class="button" OnClick="location.href='<? echo $_SERVER["REQUEST_URI"] ?>&confirm=1'" value="<? echo _('Yes'); ?>"> 
2ff220cfde13 [feladat @ 60]
rejo
parents: 2
diff changeset
    55
	<input type="button" class="button" OnClick="location.href='<? echo $_SERVER["REQUEST_URI"] ?>&confirm=0'" value="<? echo _('No'); ?>">
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    56
        <?
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    57
} else {
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    58
        include_once("inc/header.inc.php");
48
2b8781fd2e49 [feladat @ 95]
rejo
parents: 47
diff changeset
    59
        echo _('Nothing to do!');
1
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    60
}
58094faf794d [feladat @ 2]
rejo
parents:
diff changeset
    61
include_once("inc/footer.inc.php");