]> git.andy128k.dev Git - ipf.git/commitdiff
minor fixes
authorAndrey Kutejko <andy128k@gmail.com>
Sun, 30 Jun 2013 21:10:46 +0000 (00:10 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Sun, 30 Jun 2013 21:10:46 +0000 (00:10 +0300)
ipf/form/model.php
ipf/orm/validator/country.php
ipf/orm/validator/creditcard.php

index 9c1909f084305f31a7f2de624ee5016efdef7cd9..acfa6d4ba307c7dc379218a98c2e26d55a251c2b 100644 (file)
@@ -119,7 +119,7 @@ class IPF_Form_Model extends IPF_Form
             $db_field = new IPF_Form_DB_Foreignkey('',$name);
             $this->fields[$name] = $db_field->formField($defaults);
         } else if ($rt === IPF_ORM_Relation::MANY_AGGREGATE) {
-            $db_field = new IPF_Form_DB_ManyToMany('',$name);
+            $db_field = new IPF_Form_DB_Manytomany('',$name);
             $this->fields[$name] = $db_field->formField($defaults);
         }
     }
index 2536f1511b3da85adbba03ae999e89cd992e2a00..966ede8edcc422cce061777dc3a7493e42b77c58 100644 (file)
@@ -257,4 +257,5 @@ class IPF_ORM_Validator_Country
         $value = strtolower($value);
         return isset(self::$countries[$value]);
     }
-}
\ No newline at end of file
+}
+
index f4a59f600dac4ad24c4e37db11842f87ffef8d0e..62609ac97aedbc358968a8f20be33ae3c945ea8b 100644 (file)
@@ -4,7 +4,6 @@ class IPF_ORM_Validator_Creditcard
 {                                                         
     public function validate($value)
     {
-        $cardType = "";
         $card_regexes = array(
             "/^4\d{12}(\d\d\d){0,1}$/"      => 'visa',
             "/^5[12345]\d{14}$/"            => 'mastercard',
@@ -13,15 +12,17 @@ class IPF_ORM_Validator_Creditcard
             "/^30[012345]\d{11}$/"          => 'diners',
             "/^3[68]\d{12}$/"               => 'diners',
         );
+
+        $cardType = '';
         foreach ($card_regexes as $regex => $type) {
             if (preg_match($regex, $value)) {
                  $cardType = $type;
                  break;
             }
         }
-        if ( ! $cardType) {
+        if (!$cardType)
             return false;
-        }
+
         /* mod 10 checksum algorithm */
         $revcode = strrev($value);
         $checksum = 0;
@@ -36,10 +37,7 @@ class IPF_ORM_Validator_Creditcard
                  $checksum += 1;
             }
         }
-        if ($checksum % 10 == 0) {
-            return true;
-        } else {
-            return false;
-        }
+        return $checksum % 10 == 0;
     }
-}
\ No newline at end of file
+}
+