return $domain;
}
}
- throw new Horde_Exception(sprintf(_("Unable to read requested domain %s"), $domainname));
+ throw new Beatnik_Exception(sprintf(_("Unable to read requested domain %s"), $domainname));
}
/**
if ($info['rectype'] == 'soa' && $info['zonename'] != $_SESSION['beatnik']['curdomain']['zonename']) {
// Make sure the user has permissions to add domains
if (!Beatnik::hasPermission('beatnik:domains', Horde_Perms::EDIT)) {
- throw new Horde_Exception(_('You do not have permission to create new domains.'));
+ throw new Beatnik_Exception(_('You do not have permission to create new domains.'));
}
// Create a dummy old domain for comparison purposes
if ($info['rectype'] == 'soa') {
$node = 'beatnik:domains:' . $info['zonename'];
if (!Beatnik::hasPermission($node, Horde_Perms::EDIT, 1)) {
- throw new Horde_Exception(_('You do not have permssion to edit the SOA of this zone.'));
+ throw new Beatnik_Exception(_('You do not have permssion to edit the SOA of this zone.'));
}
} else {
$node = 'beatnik:domains:' . $_SESSION['beatnik']['curdomain']['zonename'] . ':' . $info['id'];
if (!Beatnik::hasPermission($node, Horde_Perms::EDIT, 2)) {
- throw new Horde_Exception(_('You do not have permssion to edit this record.'));
+ throw new Beatnik_Exception(_('You do not have permssion to edit this record.'));
}
}
}
if (class_exists($class)) {
return new $class($params);
} else {
- throw new Horde_Exception(_('Driver not found.'));
+ throw new Beatnik_Exception(_('Driver not found.'));
}
}
"(objectClass=dnszone)");
if ($res === false) {
- throw new Horde_Exception("Unable to locate any DNS zones " .
+ throw new Beatnik_Exception("Unable to locate any DNS zones " .
"underneath ".$this->_params['basedn']);
}
$res = ldap_get_entries($this->_LDAP, $res);
if ($res === false) {
- throw new Horde_Exception(sprintf(_("Unable to retrieve data from LDAP results: %s"), @ldap_error($this->_LDAP)));
+ throw new Beatnik_Exception(sprintf(_("Unable to retrieve data from LDAP results: %s"), @ldap_error($this->_LDAP)));
}
$fields = Beatnik::getRecFields('soa');
$res = @ldap_list($this->_LDAP, $dn, '(objectClass=dnsrrset)');
if ($res === false) {
- throw new Horde_Exception("Unable to locate any DNS data for $domain");
+ throw new Beatnik_Exception("Unable to locate any DNS data for $domain");
}
# FIXME Cache these results
$zonedata = array();
$res = @ldap_get_entries($this->_LDAP, $res);
if ($res === false) {
- throw new Horde_Exception(sprintf(_("Internal error: %s"), @ldap_error($this->_LDAP)));
+ throw new Beatnik_Exception(sprintf(_("Internal error: %s"), @ldap_error($this->_LDAP)));
}
$i = 0;
{
// Ensure we have a record ID before continuing
if (!isset($info['id'])) {
- throw new Horde_Exception(_("Unable to delete record: No record ID specified."));
+ throw new Beatnik_Exception(_("Unable to delete record: No record ID specified."));
}
// Attribute used to identify objects
$suffix = $dnattr . '=' . $_SESSION['beatnik']['curdomain']['zonename'] . ',' . $this->_params['basedn'];
if ($info['rectype'] == 'soa') {
// FIXME: Add recursion
- throw new Horde_Exception(_("Unsupported recursive delete."));
+ throw new Beatnik_Exception(_("Unsupported recursive delete."));
$domain = $this->cleanDNString($info['zonename']);
$dn = $suffix;
$res = @ldap_delete($this->_LDAP, $dn);
if ($res === false) {
- throw new Horde_Exception(sprintf(_("Unable to delete record. Reason: %s"), @ldap_error($this->_LDAP)));
+ throw new Beatnik_Exception(sprintf(_("Unable to delete record. Reason: %s"), @ldap_error($this->_LDAP)));
}
return true;
}
}
if (!$rdata) {
- throw new Horde_Exception(_("Invalid record type specified."));
+ throw new Beatnik_Exception(_("Invalid record type specified."));
}
$recfields = Beatnik::getRecFields($rectype);
if (!isset($entry[$key]) && $fdata['required']) {
// No value available but required field
- throw new Horde_Exception(sprintf(_("Missing required field %s to save record."), $fdata['name']));
+ throw new Beatnik_Exception(sprintf(_("Missing required field %s to save record."), $fdata['name']));
}
// Construct an ID for this object as a tuple of its data.
// We have an old DN but it doesn't match the new DN.
// Need to rename the old object
if ($rectype == 'soa') {
- throw new Horde_Exception(_("Unsupported operation: cannot rename a domain."));
+ throw new Beatnik_Exception(_("Unsupported operation: cannot rename a domain."));
}
$res = @ldap_rename($this->_LDAP, $oldRDN . ',' . $suffix,
$dn, $suffix, true);
if ($res === false) {
- throw new Horde_Exception(sprintf(_("Unable to rename old object. Reason: %s"), @ldap_error($this->_LDAP)));
+ throw new Beatnik_Exception(sprintf(_("Unable to rename old object. Reason: %s"), @ldap_error($this->_LDAP)));
}
}
// Modify the existing record
$res = @ldap_mod_replace($this->_LDAP, $dn, $entry);
if ($res === false) {
- throw new Horde_Exception(sprintf(_("Unable to modify record. Reason: %s"), @ldap_error($this->_LDAP)));
+ throw new Beatnik_Exception(sprintf(_("Unable to modify record. Reason: %s"), @ldap_error($this->_LDAP)));
}
} else {
}
$res = @ldap_add($this->_LDAP, $dn, $entry);
if ($res === false) {
- throw new Horde_Exception(sprintf(_("Unable to add record to LDAP. Reason: %s"), @ldap_error($this->_LDAP)));
+ throw new Beatnik_Exception(sprintf(_("Unable to add record to LDAP. Reason: %s"), @ldap_error($this->_LDAP)));
}
}
}
$res = ldap_set_option($this->_LDAP, LDAP_OPT_PROTOCOL_VERSION, $this->_params['version']);
if ($res === false) {
- throw new Horde_Exception("Unable to set LDAP protocol version");
+ throw new Beatnik_Exception("Unable to set LDAP protocol version");
}
$res = ldap_bind($this->_LDAP, $this->_params['binddn'], $this->_params['password']);
if ($res === false) {
- throw new Horde_Exception("Unable to bind to the LDAP server. Check authentication credentials.");
+ throw new Beatnik_Exception("Unable to bind to the LDAP server. Check authentication credentials.");
}
$this->_connected = true;
$domainlist = $this->_db->getAll($query, null, DB_FETCHMODE_ASSOC);
if (is_a($domainlist, 'PEAR_Error')) {
Horde::logMessage($domainlist, __FILE__, __LINE__, PEAR_LOG_ERR);
- throw new Horde_Exception(_("Error getting domain list. Details have been logged for the administrator."));
+ throw new Beatnik_Exception(_("Error getting domain list. Details have been logged for the administrator."));
}
$results = array();
$result = $this->_db->getAll($query, $values, DB_FETCHMODE_ASSOC);
if (is_a($result, 'PEAR_Error')) {
Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR);
- throw new Horde_Exception(_("An error occurred while searching the database. Details have been logged for the administrator."), __FILE__, __LINE__, PEAR_LOG_ERR);
+ throw new Beatnik_Exception(_("An error occurred while searching the database. Details have been logged for the administrator."), __FILE__, __LINE__, PEAR_LOG_ERR);
}
if (count($result) != 1) {
- throw new Horde_Exception(_("Too many domains matched that name. Contact your administrator."));
+ throw new Beatnik_Exception(_("Too many domains matched that name. Contact your administrator."));
}
$info = $result[0];
$soa = explode(' ', $info['content']);
if (count($soa) != 7) {
Horde::logMessage(sprintf('Invalid SOA found for %s, skipping.', $info['name']), __FILE__, __LINE__, PEAR_LOG_WARN);
- throw new Horde_Exception(_("Corrupt SOA found for zone. Contact your administrator."), __FILE__, __LINE__, PEAR_LOG_ERR);
+ throw new Beatnik_Exception(_("Corrupt SOA found for zone. Contact your administrator."), __FILE__, __LINE__, PEAR_LOG_ERR);
}
$ret = array();
$result = $this->_db->getAll($query, $values, DB_FETCHMODE_ASSOC);
if (is_a($result, 'PEAR_Error')) {
Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR);
- throw new Horde_Exception(_("An error occurred while searching the database. Details have been logged for the administrator."), __FILE__, __LINE__, PEAR_LOG_ERR);
+ throw new Beatnik_Exception(_("An error occurred while searching the database. Details have been logged for the administrator."), __FILE__, __LINE__, PEAR_LOG_ERR);
}
foreach ($result as $rec) {
{
$this->_connect();
- throw new Horde_Exception(_("Not implemented."));
+ throw new Beatnik_Exception(_("Not implemented."));
}
/**