Changes

From SME Server
Jump to navigationJump to search
Line 391: Line 391:  
     if (defined ($q->param ('ntpdEnabled')))
 
     if (defined ($q->param ('ntpdEnabled')))
 
     {
 
     {
$newStatus = "on";
+
    $newStatus = "on";
 
     }
 
     }
 
     else
 
     else
 
     {
 
     {
$newStatus = "off";
+
    $newStatus = "off";
 
     }
 
     }
   Line 402: Line 402:  
     my $day = $q->param ('day');
 
     my $day = $q->param ('day');
 
     if ($day =~ /^(.*)$/) {
 
     if ($day =~ /^(.*)$/) {
$day = $1;
+
    $day = $1;
 
     } else {
 
     } else {
$day = "1";
+
    $day = "1";
 
     }
 
     }
 
     if (($day < 1) || ($day > 31))
 
     if (($day < 1) || ($day > 31))
Line 412: Line 412:  
     {
 
     {
 
         esmith::cgi::genResult ($q, "Error: invalid day of month ($day). ',
 
         esmith::cgi::genResult ($q, "Error: invalid day of month ($day). ',
  'Please choose a day between 1 and 31.");
+
                      'Please choose a day between 1 and 31.");
return;
+
    return;
 
     }
 
     }
    
The final part of the panel saves the key/values pair or key/prop|values sets and then calls an e-smith action or a unix command
 
The final part of the panel saves the key/values pair or key/prop|values sets and then calls an e-smith action or a unix command
   −
    #------------------------------------------------------------
+
        #------------------------------------------------------------
    # Looks good; go ahead and change the parameters.
+
        # Looks good; go ahead and change the parameters.
    #------------------------------------------------------------
+
        #------------------------------------------------------------
   −
     if ($newStatus ne "on") # asking to have NTP disabled
+
     if ($newStatus ne "on")     # asking to have NTP disabled
 
     {
 
     {
# make sure that the parameters are set for disabled
+
    # make sure that the parameters are set for disabled
   −
    my $old = $conf {'UnsavedChanges'};
+
        my $old = $conf {'UnsavedChanges'};
    db_set_prop(\%conf, 'ntpd', 'status', 'disabled');
+
        db_set_prop(\%conf, 'ntpd', 'status', 'disabled');
    db_set_prop(\%conf, 'ntpd', 'NTPServer', '');
+
        db_set_prop(\%conf, 'ntpd', 'NTPServer', '');
  $conf {'UnsavedChanges'} = $old;
+
    $conf {'UnsavedChanges'} = $old;
   −
    system ("/sbin/e-smith/signal-event", "timeserver-update") == 0
+
        system ("/sbin/e-smith/signal-event", "timeserver-update") == 0
or die ("Error occurred while updating system configuration.\n");
+
        or die ("Error occurred while updating system configuration.\n");
   −
    esmith::cgi::genHeaderNonCacheable
+
        esmith::cgi::genHeaderNonCacheable
($q, \%conf, "Network time server disabled successfully");
+
        ($q, \%conf, "Network time server disabled successfully");
   −
esmith::cgi::genResult ($q, "You have disabled this service:  The server will rely on its',                                          'internal clock, and will not try to synchronize from a time server.");
+
    esmith::cgi::genResult ($q, "You have disabled this service:  The server will rely on its',                                          'internal clock, and will not try to synchronize from a time server.");
 
     }
 
     }
     else # enable service and synch with ntpServer
+
     else               # enable service and synch with ntpServer
    
     {
 
     {
    if ($ntpServer =~ /^([a-zA-Z0-9\.\-]+)$/)
+
        if ($ntpServer =~ /^([a-zA-Z0-9\.\-]+)$/)
    {
+
        {
$ntpServer = $1;
+
        $ntpServer = $1;
    }
+
        }
    elsif ($ntpServer =~ /^\s*$/)
+
        elsif ($ntpServer =~ /^\s*$/)
    {
+
        {
$ntpServer = "";
+
        $ntpServer = "";
    }
+
        }
    else
+
        else
    {
+
        {
        esmith::cgi::genHeaderNonCacheable ($q, \%conf, "Error while changing network',
+
            esmith::cgi::genHeaderNonCacheable ($q, \%conf, "Error while changing network',
 
                                                       'time server setting");
 
                                                       'time server setting");
        esmith::cgi::genResult ($q, "Invalid NTP server address \"$ntpServer\".");
+
            esmith::cgi::genResult ($q, "Invalid NTP server address \"$ntpServer\".");
return;
+
        return;
    }
+
        }
 
     }
 
     }
  

Navigation menu