}
$confirm = "-1";
if (isset($_GET['confirm']) && v_num($_GET['confirm'])) {
    $confirm = $_GET['confirm'];
}
if ($record_id == "-1" || $zone_templ_id == "-1") {
    error(ERR_INV_INPUT);
} else {
    $owner = get_zone_templ_is_owner($zone_templ_id, $_SESSION['userid']);
    if ($confirm == '1' && $owner) {
        if (delete_zone_templ_record($record_id)) {
            success(SUC_RECORD_DEL);
        }
    } else {
        $templ_details = get_zone_templ_details($zone_templ_id);
        $record_info = get_zone_templ_record_from_id($record_id);
        echo "     <h2>" . _('Delete record in zone') . " \"" . $templ_details['name'] . "\"</h2>\n";
        if (!do_hook('verify_permission', 'zone_master_add') || !$owner) {
            error(ERR_PERM_DEL_RECORD);
        } else {
            echo "     <table>\n";
            echo "      <tr>\n";
            echo "       <th>Name</th>\n";
            echo "       <th>Type</th>\n";
            echo "       <th>Content</th>\n";
            echo "       <th>Priority</th>\n";
            echo "       <th>TTL</th>\n";
            echo "      </tr>\n";
            echo "      <tr>\n";
            echo "       <td>" . $record_info['name'] . "</td>\n";
            echo "       <td>" . $record_info['type'] . "</td>\n";
Exemplo n.º 2
0
/** Get all zone template records from a zone template id
 *
 * Retrieve all fields of the records and send it back to the function caller.
 *
 * @param int $id zone template ID
 * @param int $rowstart Starting row (default=0)
 * @param int $rowamount Number of rows per query (default=999999)
 * @param string $sortby Column to sort by (default='name')
 *
 * @return mixed[] zone template records numerically indexed
 * [id,zone_templd_id,name,type,content,ttl,pro] or -1 if nothing is found
 */
function get_zone_templ_records($id, $rowstart = 0, $rowamount = 999999, $sortby = 'name')
{
    global $db;
    if (is_numeric($id)) {
        $db->setLimit($rowamount, $rowstart);
        $result = $db->query("SELECT id FROM zone_templ_records WHERE zone_templ_id=" . $db->quote($id, 'integer') . " ORDER BY " . $sortby);
        $ret[] = array();
        $retcount = 0;
        while ($r = $result->fetchRow()) {
            // Call get_record_from_id for each row.
            $ret[$retcount] = get_zone_templ_record_from_id($r["id"]);
            $retcount++;
        }
        return $retcount > 0 ? $ret : -1;
    } else {
        error(sprintf(ERR_INV_ARG, "get_zone_templ_records"));
    }
}