Permalink
Browse files

added error messages

  • Loading branch information...
1 parent 685180a commit 111282f19ce04a153e580c63cf5b031634321dbd @stasic committed Jun 6, 2012
Showing with 8 additions and 5 deletions.
  1. +1 −1 delete_record.php
  2. +1 −1 edit.php
  3. +1 −1 edit_record.php
  4. +2 −1 inc/error.inc.php
  5. +3 −1 inc/record.inc.php
View
@@ -58,7 +58,7 @@
*/
update_soa_serial($zid);
/* do also rectify-zone */
- do_rectify_zone($zid);
+ if (do_rectify_zone($zid)) { success(SUC_EXEC_PDNSSEC_RECTIFY_ZONE); };
}
} else {
$zone_id = recid_to_domid($record_id);
View
@@ -51,8 +51,8 @@
if (false === $error) {
update_soa_serial($_GET['id']);
- do_rectify_zone($_GET['id']);
success(SUC_ZONE_UPD);
+ if (do_rectify_zone($_GET['id'])) { success(SUC_EXEC_PDNSSEC_RECTIFY_ZONE); };
} else {
error(ERR_ZONE_UPD);
}
View
@@ -49,8 +49,8 @@
$ret_val = edit_record($_POST);
if ( $ret_val == "1" ) {
update_soa_serial($zid);
- do_rectify_zone($zid);
success(SUC_RECORD_UPD);
+ if (do_rectify_zone($zid)) { success(SUC_EXEC_PDNSSEC_RECTIFY_ZONE); };
} else {
echo " <div class=\"error\">" . $ret_val . "</div>\n";
}
View
@@ -69,7 +69,7 @@
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_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 */
define("ERR_DB_NO_DB_NAME", _('No database name has been set in config.inc.php.'));
@@ -130,5 +130,6 @@
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_DEL", _('Zone template has been deleted successfully.'));
+define("SUC_EXEC_PDNSSEC_RECTIFY_ZONE", _('pdnssec rectify-zone has been executed successfully.'));
?>
View
@@ -1562,10 +1562,12 @@ function do_rectify_zone ($domain_id) {
if ($count >= 1 && isset($pdnssec_command)) {
$domain = get_zone_name_from_id($domain_id);
$command = $pdnssec_command . " rectify-zone " . $domain;
+ if (!function_exists('exec')) { error(sprintf(ERR_EXEC_NOT_ALLOWED, $command)); return false; }
exec($command, $output, $return_code);
if ($return_code != 0) {
- /* if rectify-zone failed: display output */
+ /* if rectify-zone failed: display error */
print_r($output);
+ error(sprintf(ERR_EXEC_PDNSSEC_RECTIFY_ZONE, $command));
return false;
}
return true;

0 comments on commit 111282f

Please sign in to comment.