~ubuntu-branches/ubuntu/trusty/ldap-account-manager/trusty-proposed

« back to all changes in this revision

Viewing changes to lib/modules/dhcp_settings.inc

  • Committer: Package Import Robot
  • Author(s): Roland Gruber
  • Date: 2013-01-05 16:20:28 UTC
  • mfrom: (1.2.19)
  • Revision ID: package-import@ubuntu.com-20130105162028-wxsw4d4i7bp2r6z8
Tags: 4.0.1-1
new upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
2
/*
3
 
$Id: dhcp_settings.inc,v 1.39 2012/07/15 12:05:47 gruberroland Exp $
 
3
$Id: dhcp_settings.inc,v 1.40 2013/01/05 15:14:12 gruberroland Exp $
4
4
 
5
5
  This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
6
6
  Copyright (C) 2008        Thomas Manninger
306
306
                $this->messages['subnet'][1] = array('ERROR', _('Account %s:') . ' dhcp_settings_subnetMask', _('The subnet mask is invalid.'));
307
307
                $this->messages['ranges_reload'][0] = array('INFO', _('The DHCP ranges were changed to fit for the new subnet.'));
308
308
                $this->messages['ips_reload'][0] = array('INFO', 'The fixed IP addresses were changed to fit for the new subnet.');
309
 
                $this->messages['domainname'][1] = array('ERROR', _('The domain name needs to have at least 3 characters.'));
310
309
                $this->messages['domainname'][2] = array('ERROR', _('The domain name includes invalid characters. Valid characters are A-Z, a-z, 0-9, ".", "_","-".'));
311
 
                $this->messages['domainname'][4] = array('ERROR', _('Account %s:') . ' dhcp_settings_domainName', _('The domain name needs to have at least 3 characters.'));
312
310
                $this->messages['domainname'][5] = array('ERROR', _('Account %s:') . ' dhcp_settings_domainName', _('The domain name includes invalid characters. Valid characters are A-Z, a-z, 0-9, ".", "_","-".'));
313
311
        }
314
312
        
380
378
                // Check domainname:
381
379
                if (!empty($_POST['domainname'])) $_POST['domainname'] = trim($_POST['domainname']);
382
380
                if (!empty($_POST['domainname'])) {
383
 
                    if (strlen($_POST['domainname'])<3) {
384
 
                            $errors[] = $this->messages['domainname'][1];
385
 
                        }
386
 
                        elseif (!preg_match("/^[A-Za-z0-9\\._-]*$/", $_POST['domainname'])) {
 
381
                        if (!preg_match("/^[A-Za-z0-9\\._-]*$/", $_POST['domainname'])) {
387
382
                            $errors[] = $this->messages['domainname'][2];
388
383
                        }
389
384
                }
789
784
                        }
790
785
                        // domain name
791
786
                        if ($rawAccounts[$i][$ids['dhcp_settings_domainName']] != "") {
792
 
                                if (strlen($rawAccounts[$i][$ids['dhcp_settings_domainName']])<3) {
793
 
                                        $error = $this->messages['domainname'][4];
794
 
                                        array_push($error, $i);
795
 
                                        $messages[] = $error;
796
 
                                }
797
 
                                elseif (preg_match("/^[A-Za-z0-9\\._-]*$/", $rawAccounts[$i][$ids['dhcp_settings_domainName']])) {
 
787
                                if (preg_match("/^[A-Za-z0-9\\._-]*$/", $rawAccounts[$i][$ids['dhcp_settings_domainName']])) {
798
788
                                        $partialAccounts[$i]['dhcpOption'][] = "domain-name \"".$rawAccounts[$i][$ids['dhcp_settings_domainName']]."\"";
799
789
                                }
800
790
                                else {