Changeset 203


Ignore:
Timestamp:
09/24/2009 01:25:39 AM (2 years ago)
Author:
Acinonyx
Message:

[awmn] Add zone name validation

Location:
branches/awmn
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/awmn/globals/functions.php

    r198 r203  
    44 * 
    55 * Copyright (C) 2005 Nikolaos Nikalexis <winner@cube.gr> 
     6 * Copyright (C) 2009 Vasilis Tsiligiannis <b_tsiligiannis@silverton.gr> 
    67 *  
    78 * This program is free software; you can redistribute it and/or modify 
     
    312313} 
    313314 
     315function validate_zone($name) { 
     316        $name = str_replace("_", "-", $name); 
     317        $name = strtolower($name); 
     318        if (preg_match('/^((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)*([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])|)$/', $name) == 0) return NULL; 
     319        return $name; 
     320} 
     321 
    314322function validate_name_ns($name, $node) { 
    315323        global $db; 
  • branches/awmn/globals/language/english.php

    r199 r203  
    496496                                'body' => 'The node you are looking for does not exist. Check that you supplied the correct data and try again. If you are sure that you submit the correct data, it is likely that the node has been deleted or that the user has not activated his/her account yet.' 
    497497                        ), 
     498                        'zone_invalid_name' => array( 
     499                                'title' => 'Invalid zone name', 
     500                                body => 'The name of the zone contains invalid characters.' 
     501                        ), 
    498502                        'generic' => array( 
    499503                                'title' => "General error", 
  • branches/awmn/globals/language/greek.php

    r199 r203  
    686686 Î»Î¿Î³Î±ÏÎ¹Î±ÏƒÎŒÎ¿Ï.' 
    687687                        ), 
     688                        'zone_invalid_name' => array( 
     689                                'title' => 'Μη έγκϠ
     690ρο όΜοΌα ζώΜης', 
     691                                body => '΀ο όΜοΌα ζώΜης ποϠ
     692 ÎŽÎ·Î»ÏŽÏƒÎ±Ï„ε περιέχει Όη έγκϠ
     693ροϠ
     694ς χαρακτήρες.' 
     695                        ), 
    688696                        'generic' => array( 
    689697                                'title' => "ΓεΜικό σφάλΌα", 
  • branches/awmn/includes/pages/mynodes/mynodes_dnszone.php

    r202 r203  
    44 * 
    55 * Copyright (C) 2005 Nikolaos Nikalexis <winner@cube.gr> 
     6 * Copyright (C) 2009 Vasilis Tsiligiannis <b_tsiligiannis@silverton.gr> 
    67 *  
    78 * This program is free software; you can redistribute it and/or modify 
     
    7778                        $_POST['dns_zones__name'] = substr($_POST['dns_zones__name'], 0, -strlen($vars['dns']['root_zone'])-1); 
    7879                } 
     80                $_POST['dns_zones__name'] = validate_zone($_POST['dns_zones__name']); 
    7981                $form_zone = $this->form_zone(); 
    8082                $ret = TRUE; 
     
    8284                if (get('zone') == 'add') { 
    8385                        if ($_POST['dns_zones__name'] == '') { 
    84                                 $db->output_error_fields_required(array('dns_zones__name')); 
     86                                if (is_null($_POST['dns_zones__name'])) $main->message->set_fromlang('error', 'zone_invalid_name'); 
     87                                else $db->output_error_fields_required(array('dns_zones__name')); 
    8588                                return; 
    8689                        } 
Note: See TracChangeset for help on using the changeset viewer.