示例#1
0
    $domains[] = $_SESSION['beatnik']['curdomain'];
} elseif (Horde_Util::getGet('domain') == 'all') {
    $url = Horde::url('listzones.php');
    foreach (Beatnik::needCommit() as $domain) {
        $domains[] = $beatnik->driver->getDomain($domain);
    }
}
foreach ($domains as $domain) {
    $_SESSION['beatnik']['curdomain'] = $domain;
    $vars = new Horde_Variables();
    $vars->set('rectype', 'soa');
    foreach ($domain as $field => $value) {
        $vars->set($field, $value);
    }
    $vars->set('serial', Beatnik::incrementSerial($domain['serial']));
    $form = new EditRecord($vars);
    $form->useToken(false);
    $form->setSubmitted(true);
    if ($form->validate($vars)) {
        $form->getInfo($vars, $info);
        try {
            $result = $beatnik->driver->saveRecord($info);
        } catch (Exception $e) {
            $notification->push($e->getMessage(), 'horde.error');
        }
        $notification->push(sprintf(_('Zone serial for %s incremented.'), $domain['zonename']), 'horde.success');
    } else {
        $notification->push(sprintf(_("Unable to construct valid SOA for %s.  Not incrementing serial."), $domain['zonename']), 'horde.error');
    }
}
$url->redirect();
示例#2
0
文件: editrec.php 项目: horde/horde
/**
 * Copyright 2005-2016 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.horde.org/licenses/gpl.
 *
 * @author Ben Klang <*****@*****.**>
 */
require_once __DIR__ . '/lib/Application.php';
$beatnik = Horde_Registry::appInit('beatnik');
require_once BEATNIK_BASE . '/lib/Forms/EditRecord.php';
$vars = Horde_Variables::getDefaultVariables();
$url = Horde::url('editrec.php');
list($type, $record) = $beatnik->driver->getRecord(Horde_Util::getFormData('id'));
$form = new EditRecord($vars);
if ($form->validate($vars)) {
    $form->getInfo($vars, $info);
    try {
        $result = $beatnik->driver->saveRecord($info);
    } catch (Exception $e) {
        $notification->push($e->getMessage(), 'horde.error');
    }
    $notification->push('Record data saved.', 'horde.success');
    // Check to see if this is a new domain
    $edit = $vars->get('id');
    if ($info['rectype'] == 'soa' && !$edit) {
        // if added a soa redirect to the autogeneration page
        $url = Horde::url('autogenerate.php')->add(array('rectype' => 'soa', 'curdomain' => $info['zonename']));
    } else {
        $url = Horde::url('viewzone.php');