[ghelda-devel] [41] Change g_getFormattedField behavior.

[ Thread Index | Date Index | More lists.tuxfamily.org/ghelda-devel Archives ]


Revision: 41
Author:   odyx
Date:     2009-05-20 13:48:15 +0200 (Wed, 20 May 2009)

Log Message:
-----------
Change g_getFormattedField behavior. Also in every place where it is used.

Modified Paths:
--------------
    trunk/inc/g_functions.php
    trunk/plugins/Address.php
    trunk/plugins/People.php


Modified: trunk/inc/g_functions.php
===================================================================
--- trunk/inc/g_functions.php	2009-05-20 11:48:12 UTC (rev 40)
+++ trunk/inc/g_functions.php	2009-05-20 11:48:15 UTC (rev 41)
@@ -33,7 +33,7 @@
 define('G_DB_PEOPLE_LOCALE','locale');
 define('G_DB_PEOPLE_ID','people_id');
 
-function g_getFormattedField($ArrayVals,$type,$fieldName,$fieldName_,$fieldsSpec) {
+function g_getFormattedField($ArrayVals,$type,$fieldName,$fieldSpec) {
     // For dates
     if(stripos($type,'date') !== false) {
         // It's a date
@@ -42,13 +42,13 @@
         } elseif(checkdate((int)$ArrayVals[$fieldName.'_month'],(int)$ArrayVals[$fieldName.'_day'],(int)$ArrayVals[$fieldName.'_year'])) {
             return $ArrayVals[$fieldName.'_year'].'-'.$ArrayVals[$fieldName.'_month'].'-'.$ArrayVals[$fieldName.'_day'];
         }
-    } elseif(array_key_exists('ereg',$fieldsSpec[$fieldName_])) { // for fields which have a verification pattern
-        if(ereg($fieldsSpec[$fieldName_]['ereg'],$ArrayVals[$fieldName]) || empty($ArrayVals[$fieldName])) {
+    } elseif(array_key_exists('ereg',$fieldSpec)) { // for fields which have a verification pattern
+        if(ereg($fieldSpec['ereg'],$ArrayVals[$fieldName]) || empty($ArrayVals[$fieldName])) {
             return $ArrayVals[$fieldName];
         }
         return false;
-    } elseif(array_key_exists('preg',$fieldsSpec[$fieldName_])) { // for fields which have a verification pattern
-        if(preg_match($fieldsSpec[$fieldName_]['preg'],$ArrayVals[$fieldName])|| empty($ArrayVals[$fieldName])) {
+    } elseif(array_key_exists('preg',$fieldSpec)) { // for fields which have a verification pattern
+        if(preg_match($fieldSpec['preg'],$ArrayVals[$fieldName])|| empty($ArrayVals[$fieldName])) {
             return $ArrayVals[$fieldName];
         } 
     } else {

Modified: trunk/plugins/Address.php
===================================================================
--- trunk/plugins/Address.php	2009-05-20 11:48:12 UTC (rev 40)
+++ trunk/plugins/Address.php	2009-05-20 11:48:15 UTC (rev 41)
@@ -161,7 +161,7 @@
                     continue;
                 }
 
-                $fieldContent = g_getFormattedField($_POST,$type,$fieldName,$fieldName_,$fieldsSpec);
+                $fieldContent = g_getFormattedField($_POST,$type,$fieldName,$fieldsSpec[$fieldName_]);
                 if( $fieldContent === false ) { // The given date is false
                     $fieldsSpec[$fieldName_]['error'] = true;
                     $newError = true;

Modified: trunk/plugins/People.php
===================================================================
--- trunk/plugins/People.php	2009-05-20 11:48:12 UTC (rev 40)
+++ trunk/plugins/People.php	2009-05-20 11:48:15 UTC (rev 41)
@@ -221,7 +221,7 @@
                         }
                     } else continue;
                 } else {
-                    $fieldContent = g_getFormattedField($_POST,$type,$fieldName,$fieldName_,$fieldsSpec);
+                    $fieldContent = g_getFormattedField($_POST,$type,$fieldName,$fieldsSpec[$fieldName_]);
                     if( $fieldContent === false ) { // The given date is false
                         $fieldsSpec[$fieldName]['error'] = true;
                         $newError = true;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/