=== added file 'phone.hu.inc'
--- phone.hu.inc	1970-01-01 00:00:00 +0000
+++ phone.hu.inc	2008-07-28 10:48:13 +0000
@@ -0,0 +1,61 @@
+<?php
+// $Id: phone.hu.inc,v 1.7 2008/05/28 22:44:51 thierrygd Exp $
+
+/**
+ * Verifies that $phonenumber is a valid nine-digit Hungarion phone number
+ *
+ * @param string $phonenumber
+ * @return boolean Returns boolean FALSE if the phone number is not valid. 
+ */
+function valid_hu_phone_number($phonenumber) {
+
+  //$phonenumber = trim($phonenumber);
+
+  // define regular expression
+  $regex = "/
+    \D*           # optional separator 
+	(?:\+?36|06)? # country code
+    (\d\d?)       # area code
+    \D*           # optional separator
+    (\d{3})       # second group
+    \D*           # optional separator
+    (\d{2})       # third group
+    \D*           # optional separator
+    (\d{2})       # fourth group
+    \D*           # ignore trailing non-digits
+    $/x";
+  // return true if valid, false otherwise
+  return (bool) preg_match($regex, $phonenumber); 
+} 
+
+/**
+ * Convert a valid Spanish phone number into standard (+34) 916 555 777 format
+ * 
+ * @param $phonenumber must be a valid nine-digit number (with optional international prefix)
+ * 
+ */
+function format_hu_phone_number($phonenumber) {
+
+  // define regular expression   
+  $regex = "/
+    \D*           # optional separator 
+	(?:\+?36|06)? # country code
+    (\d\d?)       # area code
+    \D*           # optional separator
+    (\d{3})       # second group
+    \D*           # optional separator
+    (\d{2})       # third group
+    \D*           # optional separator
+    (\d{2})       # fourth group
+    \D*           # ignore trailing non-digits
+    $/x"; 
+    
+  // get digits of phone number
+  preg_match($regex, $phonenumber, $matches);
+  
+  // construct ten-digit phone number
+  $phonenumber = '+36 ' . $matches[1] . ' ' . $matches[2] . ' ' . $matches[3] . ' ' . $matches[4];
+  
+  return $phonenumber;
+}
+

=== modified file 'phone.module'
--- phone.module	2008-07-28 10:36:04 +0000
+++ phone.module	2008-07-28 10:59:24 +0000
@@ -21,7 +21,8 @@
     'ru_phone' => array('label' => t('Russian Phone Numbers')),
     'es_phone' => array('label' => t('Spanish Phone Numbers')),
     'au_phone' => array('label' => t('Australian Phone Numbers')),
-    'cs_phone' => array('label' => t('Czech Phone Numbers'))    
+    'cs_phone' => array('label' => t('Czech Phone Numbers')), 
+    'hu_phone' => array('label' => t('Hungarian Phone Numbers')),
    );
 }
 
@@ -67,6 +68,7 @@
        || $field['type'] == 'es_phone'
        || $field['type'] == 'au_phone'
        || $field['type'] == 'cs_phone'
+       || $field['type'] == 'hu_phone'
        ){ 
       	$columns = array(
         	'value' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE),
@@ -114,7 +116,8 @@
       			'ru_phone',
       			'es_phone',
       			'au_phone',
-      			'cs_phone'      			
+      			'cs_phone', 
+      			'hu_phone',
       			),
     ),
   );
@@ -154,7 +157,8 @@
       			'ru_phone',
       			'es_phone',
       			'au_phone',
-      			'cs_phone'      			
+      			'cs_phone', 
+      			'hu_phone',
       			),
     ),
   );
@@ -246,6 +250,9 @@
     	        if ($field['type'] == 'cs_phone') { 
 	          $node_field[0]['value'] = format_phone_number('cs', $node_field[0]['value'], $field);
 	        }	        
+    	        if ($field['type'] == 'hu_phone') { 
+	          $node_field[0]['value'] = format_phone_number('hu', $node_field[0]['value'], $field);
+	        }	        
 	      }
 	    }
 	  }
@@ -281,6 +288,9 @@
               if ($field['type'] == 'cs_phone' && !valid_phone_number('cs', $item['value'])) {
                 form_set_error($field['field_name'],t('"%value" is not a valid Czech phone number!<br>Czech phone numbers should contain only numbers and spaces be like 999 999 999 with an optional prefix of "+420" or "00420".', array('%value' => $item['value'])));
               }                 
+              if ($field['type'] == 'hu_phone' && !valid_phone_number('hu', $item['value'])) {
+                form_set_error($field['field_name'],t('"%value" is not a valid Hungarion phone number!<br>Hungarion phone numbers should contain only numbers and spaces be like 70 999 9999 with an optional prefix of "+36" or "06".', array('%value' => $item['value'])));
+              }                 
             }
           }
       }      
@@ -308,6 +318,7 @@
   	|| $countrycode == 'es'
   	|| $countrycode == 'au'
   	|| $countrycode == 'cs'  	
+  	|| $countrycode == 'hu'  	
   	) { 
 	
         //drupal_set_message('langue = ' . $countrycode, 'error');
@@ -348,6 +359,7 @@
   	|| $countrycode == 'es'
   	|| $countrycode == 'au'
    	|| $countrycode == 'cs' 	
+   	|| $countrycode == 'hu' 	
   	) { 
 	
         //drupal_set_message('langue = ' . $countrycode, 'error');       

