Skip to content

Commit

Permalink
added error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
stasic committed Jun 6, 2012
1 parent 685180a commit 111282f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion delete_record.php
Expand Up @@ -58,7 +58,7 @@
*/ */
update_soa_serial($zid); update_soa_serial($zid);
/* do also rectify-zone */ /* do also rectify-zone */
do_rectify_zone($zid); if (do_rectify_zone($zid)) { success(SUC_EXEC_PDNSSEC_RECTIFY_ZONE); };
} }
} else { } else {
$zone_id = recid_to_domid($record_id); $zone_id = recid_to_domid($record_id);
Expand Down
2 changes: 1 addition & 1 deletion edit.php
Expand Up @@ -51,8 +51,8 @@


if (false === $error) { if (false === $error) {
update_soa_serial($_GET['id']); update_soa_serial($_GET['id']);
do_rectify_zone($_GET['id']);
success(SUC_ZONE_UPD); success(SUC_ZONE_UPD);
if (do_rectify_zone($_GET['id'])) { success(SUC_EXEC_PDNSSEC_RECTIFY_ZONE); };
} else { } else {
error(ERR_ZONE_UPD); error(ERR_ZONE_UPD);
} }
Expand Down
2 changes: 1 addition & 1 deletion edit_record.php
Expand Up @@ -49,8 +49,8 @@
$ret_val = edit_record($_POST); $ret_val = edit_record($_POST);
if ( $ret_val == "1" ) { if ( $ret_val == "1" ) {
update_soa_serial($zid); update_soa_serial($zid);
do_rectify_zone($zid);
success(SUC_RECORD_UPD); success(SUC_RECORD_UPD);
if (do_rectify_zone($zid)) { success(SUC_EXEC_PDNSSEC_RECTIFY_ZONE); };
} else { } else {
echo " <div class=\"error\">" . $ret_val . "</div>\n"; echo " <div class=\"error\">" . $ret_val . "</div>\n";
} }
Expand Down
3 changes: 2 additions & 1 deletion inc/error.inc.php
Expand Up @@ -69,7 +69,7 @@
define("ERR_ZONE_TEMPL_IS_EMPTY", _('Template name can\'t be an empty string.')); define("ERR_ZONE_TEMPL_IS_EMPTY", _('Template name can\'t be an empty string.'));
define("ERR_DEFAULT_CRYPTOKEY_USED", _('Default session encryption key is used, please set it in your configuration file.')); define("ERR_DEFAULT_CRYPTOKEY_USED", _('Default session encryption key is used, please set it in your configuration file.'));
define("ERR_LOCALE_FAILURE", _('Failed to set locale.')); define("ERR_LOCALE_FAILURE", _('Failed to set locale.'));
define("ERR_ZONE_UPD", _('Zone has not been updated successfully.')); define("ERR_EXEC_NOT_ALLOWED", _('Failed to call function exec. Make sure that exec is not listed in disable_functions at php.ini. Run this command manually to serve the zone: %s'));


/* DATABASE */ /* DATABASE */
define("ERR_DB_NO_DB_NAME", _('No database name has been set in config.inc.php.')); define("ERR_DB_NO_DB_NAME", _('No database name has been set in config.inc.php.'));
Expand Down Expand Up @@ -130,5 +130,6 @@
define("SUC_ZONE_TEMPL_ADD", _('Zone template has been added successfully.')); define("SUC_ZONE_TEMPL_ADD", _('Zone template has been added successfully.'));
define("SUC_ZONE_TEMPL_UPD", _('Zone template has been updated successfully.')); define("SUC_ZONE_TEMPL_UPD", _('Zone template has been updated successfully.'));
define("SUC_ZONE_TEMPL_DEL", _('Zone template has been deleted successfully.')); define("SUC_ZONE_TEMPL_DEL", _('Zone template has been deleted successfully.'));
define("SUC_EXEC_PDNSSEC_RECTIFY_ZONE", _('pdnssec rectify-zone has been executed successfully.'));


?> ?>
4 changes: 3 additions & 1 deletion inc/record.inc.php
Expand Up @@ -1562,10 +1562,12 @@ function do_rectify_zone ($domain_id) {
if ($count >= 1 && isset($pdnssec_command)) { if ($count >= 1 && isset($pdnssec_command)) {
$domain = get_zone_name_from_id($domain_id); $domain = get_zone_name_from_id($domain_id);
$command = $pdnssec_command . " rectify-zone " . $domain; $command = $pdnssec_command . " rectify-zone " . $domain;
if (!function_exists('exec')) { error(sprintf(ERR_EXEC_NOT_ALLOWED, $command)); return false; }
exec($command, $output, $return_code); exec($command, $output, $return_code);
if ($return_code != 0) { if ($return_code != 0) {
/* if rectify-zone failed: display output */ /* if rectify-zone failed: display error */
print_r($output); print_r($output);
error(sprintf(ERR_EXEC_PDNSSEC_RECTIFY_ZONE, $command));
return false; return false;
} }
return true; return true;
Expand Down

0 comments on commit 111282f

Please sign in to comment.