From 3f20f02b89f68fd7cf7cc1cb200bed3fb66bed0d Mon Sep 17 00:00:00 2001 From: thowen Date: Tue, 31 Oct 2017 19:10:34 +0100 Subject: [PATCH 01/25] Create de.php German translation file. --- lang/de.php | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 lang/de.php diff --git a/lang/de.php b/lang/de.php new file mode 100644 index 00000000..f3bf8c38 --- /dev/null +++ b/lang/de.php @@ -0,0 +1,46 @@ + 'Das Feld "{field}" ist erforderlich.', + 'validate_valid_email' => 'Das Feld "{field}" muss eine gültige E-Mail-Adresse sein.', + 'validate_max_len' => 'Das Feld "{field}" darf maximal {param} Zeichen enthalten.', + 'validate_min_len' => 'Das Feld "{field}" muss mindestens {param} Zeichen enthalten.', + 'validate_exact_len' => 'Das Feld "{field}" muss genau {param} Zeichen enthalten.', + 'validate_alpha' => 'Das Feld "{field}" darf nur Buchstaben enthalten.', + 'validate_alpha_numeric' => 'Das Feld "{field}" darf nur Buchstaben und Ziffern enthalten.', + 'validate_alpha_numeric_space' => 'Das Feld "{field}" darf nur Buchstaben, Ziffern und Leerzeichen enthalten.', + 'validate_alpha_dash' => 'Das Feld "{field}" darf nur Buchstaben und Bindestriche enthalten.', + 'validate_alpha_space' => 'Das Feld "{field}" darf nur Buchstaben und Leerzeichen enthalten.', + 'validate_numeric' => 'Das Feld "{field}" muss eine Nummer sein.', + 'validate_integer' => 'Das Feld "{field}" muss eine Nummer ohne Nachkommastellen (ganze Zahl) sein.', + 'validate_boolean' => 'Das Feld "{field}" muss entweder wahr oder falsch sein.', + 'validate_float' => 'Das Feld "{field}" muss eine Nummer mit einem Dezimalpunkt (Gleitpunktzahl) sein.', + 'validate_valid_url' => 'Das Feld "{field}" muss eine URL sein.', + 'validate_url_exists' => 'Die im Feld "{field}" angegebene URL existiert nicht.', + 'validate_valid_ip' => 'Das Feld "{field}" muss eine gültige IP-Adresse sein.', + 'validate_valid_ipv4' => 'Das Feld "{field}" muss eine gültige IPv4-Adresse enthalten.', + 'validate_valid_ipv6' => 'Das Feld "{field}" muss eine gültige IPv6-Adresse enthalten.', + 'validate_guidv4' => 'Das Feld "{field}" muss eine gültige GUID enthalten.', + 'validate_valid_cc' => 'Das Feld "{field}" ist keine gültige Kreditkartennummer.', + 'validate_valid_name' => 'Das Feld "{field}" muss ein voller Name sein.', + 'validate_contains' => 'Das Feld "{field}" kann nur eines der folgenden sein: {param}', + 'validate_contains_list' => 'Das Feld "{field}" ist keine gültige Wahl.', + 'validate_doesnt_contain_list' => 'Das Feld "{field}" enthält einen nicht akzeptierten Wert.', + 'validate_street_address' => 'Das Feld "{field}" muss eine gültige Straßenangabe sein.', + 'validate_date' => 'Das Feld "{field}" muss ein gültiges Datum sein.', + 'validate_min_numeric' => 'Das Feld "{field}" muss ein numerischer Wert größergleich {param} sein.', + 'validate_max_numeric' => 'Das Feld "{field}" muss ein numerischer Wert kleinergleich {param} sein.', + 'validate_min_age' => 'Das Feld "{field}" muss ein Alter größergleich {param} haben.', + 'validate_invalid' => 'Das Feld "{field}" ist ungültig.', + 'validate_starts' => 'Das Feld "{field}" muss mit {param} beginnen.', + 'validate_extension' => 'Das Feld "{field}" kann nur eine der folgenden Erweiterungen haben: {param}', + 'validate_required_file' => 'Das Feld "{field}" ist erforderlich.', + 'validate_equalsfield' => 'Das Feld "{field}" ist nicht gleich dem Feld "{param}".', + 'validate_iban' => 'Das Feld "{field}" muss eine gültige IBAN enthalten.', + 'validate_phone_number' => 'Das Feld "{field}" muss eine gültige Telefonnummer sein.', + 'validate_regex' => 'Das Feld "{field}" muss einen Wert im gültigem Format enthalten.', + 'validate_valid_json_string' => 'Das Feld "{field}" muss eine gültige JSON-Format-Zeichenfolge enthalten.', + 'validate_valid_array_size_greater' => 'Das Feld "{field}" muss ein Array mit einer Größe größergleich {param} sein.', + 'validate_valid_array_size_lesser' => 'Das Feld "{field}" muss ein Array mit einer Größe kleinergleich {param} sein.', + 'validate_valid_array_size_equal' => 'Das Feld "{field}" muss ein Array mit einer Größe gleich {param} sein.', +); From 51c51fc1e74479a6c141fffb5768303ab9d4d99e Mon Sep 17 00:00:00 2001 From: Filis Futsarov Date: Wed, 1 Nov 2017 13:58:16 +0100 Subject: [PATCH 02/25] FIX #218 --- gump.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gump.class.php b/gump.class.php index 81b05546..4f5f73e7 100644 --- a/gump.class.php +++ b/gump.class.php @@ -1999,7 +1999,7 @@ protected function validate_extension($field, $input, $param = null) $path_info = pathinfo($input[$field]['name']); $extension = isset($path_info['extension']) ? $path_info['extension'] : false; - if ($extension && in_array($extension, $allowed_extensions)) { + if ($extension && in_array(strtolower($extension), $allowed_extensions)) { return; } From 06ba42e8cbae2684a2234838f3faef3edc53b376 Mon Sep 17 00:00:00 2001 From: SaphiLC Date: Fri, 24 Nov 2017 03:42:52 -0600 Subject: [PATCH 03/25] Update es.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit carácteres does not use á, more info here -> http://www.fundeu.es/recomendacion/caracter-y-caracteres-no-caracter-ni-caracteres-1386/ (in spanish, sorry) --- lang/es.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lang/es.php b/lang/es.php index 38ec2ce9..17f1d2d0 100644 --- a/lang/es.php +++ b/lang/es.php @@ -3,15 +3,15 @@ return array( 'validate_required' => 'El campo {field} es requerido', 'validate_valid_email' => 'El campo {field} debe ser una dirección de correo electrónico válida', - 'validate_max_len' => 'El campo {field} no puede tener más de {param} carácteres de longitud', - 'validate_min_len' => 'El campo {field} debe tener al menos {param} carácteres de longitud', - 'validate_exact_len' => 'El campo {field} debe tener {param} carácteres de longitud', + 'validate_max_len' => 'El campo {field} no puede tener más de {param} caracteres de longitud', + 'validate_min_len' => 'El campo {field} debe tener al menos {param} caracteres de longitud', + 'validate_exact_len' => 'El campo {field} debe tener {param} caracteres de longitud', 'validate_alpha' => 'El campo {field} sólo puede contener letras', 'validate_alpha_numeric' => 'El campo {field} sólo puede contener letras y números', 'validate_alpha_numeric_space' => 'El campo {field} solo puede contener letras, números y espacios', 'validate_alpha_dash' => 'El campo {field} sólo puede contener letras y guiones', 'validate_alpha_space' => 'El campo {field} sólo puede contener letras y espacios', - 'validate_numeric' => 'El campo {field} sólo puede contener carácteres numéricos', + 'validate_numeric' => 'El campo {field} sólo puede contener caracteres numéricos', 'validate_integer' => 'El campo {field} sólo puede contener un valor numérico', 'validate_boolean' => 'El campo {field} debe ser verdadero o falso', 'validate_float' => 'El campo {field} sólo puede contener un valor flotante', From a98fed7e0cc5b009cad29f57ba57dde9403b1808 Mon Sep 17 00:00:00 2001 From: Rupak Dhiman Date: Wed, 27 Dec 2017 10:23:33 +0530 Subject: [PATCH 04/25] Fixed : Credit Card Validation not working if all alphabets are entered by a user --- gump.class.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gump.class.php b/gump.class.php index 4f5f73e7..7300f809 100644 --- a/gump.class.php +++ b/gump.class.php @@ -1646,6 +1646,23 @@ protected function validate_valid_cc($field, $input, $param = null) $number_length = strlen($number); } + + /** + * Bail out if $number_lenght is 0. + * This can be the case if a user has entered only digits + * + * @since 1.5 + */ + if( $number_length == 0 ) { + return array( + 'field' => $field, + 'value' => $input[$field], + 'rule' => __FUNCTION__, + 'param' => $param, + ); + } + + $parity = $number_length % 2; $total = 0; From c1d85a3376d424a36f9855aa2aaf1ef1e5eb54a1 Mon Sep 17 00:00:00 2001 From: Rupak Dhiman Date: Wed, 27 Dec 2017 10:35:58 +0530 Subject: [PATCH 05/25] Fixed typos --- gump.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gump.class.php b/gump.class.php index 7300f809..ba342631 100644 --- a/gump.class.php +++ b/gump.class.php @@ -1648,8 +1648,8 @@ protected function validate_valid_cc($field, $input, $param = null) /** - * Bail out if $number_lenght is 0. - * This can be the case if a user has entered only digits + * Bail out if $number_length is 0. + * This can be the case if a user has entered only alphabets * * @since 1.5 */ From af4be9ceed368e9c3ce86005b87eb93e450ae9e7 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 28 Dec 2017 08:24:21 +0100 Subject: [PATCH 06/25] fix "coquilles" in french translations. --- lang/fr.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lang/fr.php b/lang/fr.php index 0cfe1afe..d4de981d 100644 --- a/lang/fr.php +++ b/lang/fr.php @@ -29,14 +29,14 @@ 'validate_date' => 'Le champ {field} doit être une date valide', 'validate_min_numeric' => 'Le champ {field} doit être une valeur numérique égale ou supérieur à {param}', 'validate_max_numeric' => 'Le champ {field} doit être une valeur numérique égale ou inférieur à {param}', - 'validate_min_age' => 'Le champ {field} doit être un age égale ou supérieur à {param}', + 'validate_min_age' => 'Le champ {field} doit être un âge égale ou supérieur à {param}', 'validate_invalid' => 'Le champ {field} est invalide', 'validate_starts' => 'Le champ {field} doit commencer par {param}', 'validate_extension' => 'Le champ {field} doit avoir les extensions suivantes {param}', 'validate_required_file' => 'Le champ {field} est obligatoire', 'validate_equalsfield' => 'Le champ {field} n,est pas égale au champ {param}', 'validate_iban' => 'Le champ {field} doit contenir un IBAN valide', - 'validate_phone_number' => 'Le champ {field} doit contenir numéro de téléphone valide', + 'validate_phone_number' => 'Le champ {field} doit contenir un numéro de téléphone valide', 'validate_regex' => 'Le champ {field} doit contenir une valeur valide', 'validate_valid_json_string' => 'Le champ {field} doit avoir un format JSON', ); From 229482929c963724f20b0c67a6ea50704f377d68 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 28 Dec 2017 08:32:03 +0100 Subject: [PATCH 07/25] french grammatical fix. --- lang/fr.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/fr.php b/lang/fr.php index d4de981d..a2806c69 100644 --- a/lang/fr.php +++ b/lang/fr.php @@ -29,7 +29,7 @@ 'validate_date' => 'Le champ {field} doit être une date valide', 'validate_min_numeric' => 'Le champ {field} doit être une valeur numérique égale ou supérieur à {param}', 'validate_max_numeric' => 'Le champ {field} doit être une valeur numérique égale ou inférieur à {param}', - 'validate_min_age' => 'Le champ {field} doit être un âge égale ou supérieur à {param}', + 'validate_min_age' => 'Le champ {field} doit être un âge égal ou supérieur à {param}', 'validate_invalid' => 'Le champ {field} est invalide', 'validate_starts' => 'Le champ {field} doit commencer par {param}', 'validate_extension' => 'Le champ {field} doit avoir les extensions suivantes {param}', From e4b12ce69f1d00173f64eafdad7f9ecabe37d1c0 Mon Sep 17 00:00:00 2001 From: Mike Arrison Date: Mon, 22 Jan 2018 10:07:02 -0600 Subject: [PATCH 08/25] added period to valid characters in phone number --- gump.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gump.class.php b/gump.class.php index ba342631..c8fbe8f9 100644 --- a/gump.class.php +++ b/gump.class.php @@ -2116,6 +2116,7 @@ private function trimScalar($value) * Examples: * * 555-555-5555: valid + * 555.555.5555: valid * 5555425555: valid * 555 555 5555: valid * 1(519) 555-4444: valid @@ -2129,7 +2130,7 @@ protected function validate_phone_number($field, $input, $param = null) return; } - $regex = '/^(\d[\s-]?)?[\(\[\s-]{0,2}?\d{3}[\)\]\s-]{0,2}?\d{3}[\s-]?\d{4}$/i'; + $regex = '/^(\d[\s-\.]?)?[\(\[\s-\.]{0,2}?\d{3}[\)\]\s-\.]{0,2}?\d{3}[\s-\.]?\d{4}$/i'; if (!preg_match($regex, $input[$field])) { return array( 'field' => $field, From 1f659154d3a7aa10e7d1cb2e7bdbe408ff83977d Mon Sep 17 00:00:00 2001 From: rifton007 Date: Thu, 15 Feb 2018 16:47:53 +0100 Subject: [PATCH 09/25] Update gump.class.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This rule Regex is more powerful and accepts more characters than previous rule. `\p{L}` matches a single code point in the category "letter". For example: "cœur" or "sœur" in french is not supported with the previous rule. --- gump.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gump.class.php b/gump.class.php index ba342631..7cb7e6c9 100644 --- a/gump.class.php +++ b/gump.class.php @@ -1710,7 +1710,7 @@ protected function validate_valid_name($field, $input, $param = null) return; } - if (!preg_match("/^([a-zÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖßÙÚÛÜÝàáâãäåçèéêëìíîïñðòóôõöùúûüýÿ '-])+$/i", $input[$field]) !== false) { + if (!preg_match("/^([a-z \p{L} '-])+$/i", $input[$field]) !== false) { return array( 'field' => $field, 'value' => $input[$field], From 4cbbae0bd93c74c2afb02c596bf8ee09017a9879 Mon Sep 17 00:00:00 2001 From: rifton007 Date: Thu, 15 Feb 2018 16:52:02 +0100 Subject: [PATCH 10/25] Create nl.php Errors' translation in dutch (nederlands) --- lang/nl.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 lang/nl.php diff --git a/lang/nl.php b/lang/nl.php new file mode 100644 index 00000000..50d907c7 --- /dev/null +++ b/lang/nl.php @@ -0,0 +1,42 @@ + 'Het veld {field} is verplicht', + 'validate_valid_email' => 'Het veld {field} moet een geldige e-mail zijn', + 'validate_max_len' => 'Het veld {field} moet een aantal tekens van {param} of minder hebben', + 'validate_min_len' => 'Het veld {field} moet een tekennummer van {param} of meer hebben', + 'validate_exact_len' => 'Het veld {field} moet een tekennummer van {param} hebben', + 'validate_alpha' => 'Het veld {field} mag alleen alfa (a-z) tekens bevatten', + 'validate_alpha_numeric' => 'Het veld {field} mag alleen alfanumerieke tekens bevatten (a-z)', + 'validate_alpha_dash' => 'Het veld {field} mag alleen alfa (a-z) en streepjes tekens bevatten', + 'validate_alpha_space' => 'Het veld {field} mag alleen alfa (a-z) tekens en spatie bevatten', + 'validate_numeric' => 'Het veld {field} mag alleen numerieke tekens bevatten', + 'validate_integer' => 'Het veld {field} moet een numerieke waarde zijn', + 'validate_boolean' => 'Het veld {field} moet waar of onwaar zijn', + 'validate_float' => 'Het veld {field} moet een decimale waarde zijn', + 'validate_valid_url' => 'Het veld {field} moet een geldige URL zijn', + 'validate_url_exists' => 'De {field} URL bestaat niet', + 'validate_valid_ip' => 'Het veld {field} moet een geldig IP-adres bevatten', + 'validate_valid_ipv4' => 'Het veld {field} moet een geldig IPv4-adres bevatten', + 'validate_valid_ipv6' => 'Het veld {field} moet een geldig IPv6-adres bevatten', + 'validate_guidv4' => 'Het veld {field} moet een geldige GUID bevatten', + 'validate_valid_cc' => 'Het veld {field} moet een geldig creditcardnummer bevatten', + 'validate_valid_name' => 'Het veld {field} moet een geldige naam bevatten', + 'validate_contains' => 'Het veld {field} moet een van deze waarden bevatten: {param}', + 'validate_contains_list' => 'Het veld {field} moet een waarde uit het vervolgkeuzemenu bevatten', + 'validate_doesnt_contain_list' => 'Het veld {field} bevat een waarde die niet acceptabel is', + 'validate_street_address' => 'Het veld {field} moet een geldig postadres zijn', + 'validate_date' => 'Het veld {field} moet een geldige datum zijn', + 'validate_min_numeric' => 'Het veld {field} moet een numerieke waarde gelijk aan of groter zijn dan {param}', + 'validate_max_numeric' => 'Het veld {field} moet een numerieke waarde gelijk aan of kleiner zijn dan {param}', + 'validate_min_age' => 'Het veld {field} moet gelijk zijn aan of groter zijn dan {param}', + 'validate_invalid' => 'Het veld {field} is ongeldig', + 'validate_starts' => 'Het veld {field} moet beginnen met {param}', + 'validate_extension' => 'Het veld {field} moet de volgende extensies hebben {parameter}', + 'validate_required_file' => 'Het veld {field} is verplicht', + 'validate_equalsfield' => 'Het veld {field} is niet gelijk aan het veld {param}', + 'validate_iban' => 'Het veld {field} moet een geldige IBAN bevatten', + 'validate_phone_number' => 'Het veld {field} moet een geldig telefoonnummer bevatten', + 'validate_regex' => 'Het veld {field} moet een geldige waarde bevatten', + 'validate_valid_json_string' => 'Het veld {field} moet een JSON-indeling hebben', + ); From 0564c9b2971f809fe2d36e2453b3c6d76b773173 Mon Sep 17 00:00:00 2001 From: scottcase Date: Sun, 25 Feb 2018 09:49:29 -0500 Subject: [PATCH 11/25] Add Twitter Username Validation --- gump.class.php | 27 +++++++++++++++++++++++++++ lang/en.php | 1 + 2 files changed, 28 insertions(+) diff --git a/gump.class.php b/gump.class.php index ba342631..224ba3a8 100644 --- a/gump.class.php +++ b/gump.class.php @@ -2404,4 +2404,31 @@ protected function validate_valid_pashtu_text($field, $input, $param = null) } } + /** + * Determine if the provided value is a valid twitter handle. + * + * @access protected + * @param string $field + * @param array $input + * @return mixed + */ + protected function validate_valid_twitter($field, $input, $param = NULL) + { + if(!isset($input[$field]) || empty($input[$field])) + { + return; + } + $json_twitter = file_get_contents("http://twitter.com/users/username_available?username=".$input[$field]); + + $twitter_response = json_decode($json_twitter); + if($twitter_response->reason != "taken"){ + return array( + 'field' => $field, + 'value' => $input[$field], + 'rule' => __FUNCTION__, + 'param' => $param + ); + } + } + } diff --git a/lang/en.php b/lang/en.php index 7d0cbc20..1297d99e 100644 --- a/lang/en.php +++ b/lang/en.php @@ -48,4 +48,5 @@ 'validate_valid_persian_digit' => 'The {field} should be a valid digit in Persian/Dari or Arabic format', 'validate_valid_persian_text' => 'The {field} should be a valid text in Persian/Dari or Arabic format', 'validate_valid_pashtu_text' => 'The {field} should be a valid text in Pashtu format', + 'validate_valid_twitter' => 'The {field} is not a valid twitter handle', ); From 0501bfef2fa51b633d6f52aa611b4ee93785d8b8 Mon Sep 17 00:00:00 2001 From: scottcase Date: Mon, 26 Feb 2018 19:41:43 -0500 Subject: [PATCH 12/25] Add && function_exists('idn_to_ascii') --- gump.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gump.class.php b/gump.class.php index 224ba3a8..f34f3f86 100644 --- a/gump.class.php +++ b/gump.class.php @@ -1513,7 +1513,7 @@ protected function validate_url_exists($field, $input, $param = null) $url = $url['host']; } - if (function_exists('checkdnsrr')) { + if (function_exists('checkdnsrr') && function_exists('idn_to_ascii')) { if (checkdnsrr(idn_to_ascii($url), 'A') === false) { return array( 'field' => $field, From 6b56713909745c60fafe11f556faaa5c8d1ca8c3 Mon Sep 17 00:00:00 2001 From: Bora Alp Arat Date: Fri, 6 Apr 2018 12:13:31 +0300 Subject: [PATCH 13/25] Create tr.php --- lang/tr.php | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 lang/tr.php diff --git a/lang/tr.php b/lang/tr.php new file mode 100644 index 00000000..94c47a30 --- /dev/null +++ b/lang/tr.php @@ -0,0 +1,46 @@ + '{field} alanı zorunludur', + 'validate_valid_email' => '{field} alanı geçerli bir e-posta adresi olmalı', + 'validate_max_len' => '{field} alanı en fazla {param} karakter veya daha az olmalı', + 'validate_min_len' => '{field} alanı en az {param} karakter olmalı', + 'validate_exact_len' => '{field} alanı tam {param} karakter olmalı', + 'validate_alpha' => '{field} alanı sadece harflerden oluşabilir', + 'validate_alpha_numeric' => '{field} alanı sadece harf ve sayılardan oluşabilir', + 'validate_alpha_numeric_space' => '{field} alanı sadece harf, sayı ve boşluklardan oluşabilir', + 'validate_alpha_dash' => '{field} alanı sadece harf ve çizgilerden oluşabilir', + 'validate_alpha_space' => '{field} alanı sadece harf ve boşluklardan oluşabilir', + 'validate_numeric' => '{field} alanı bir sayı olmalı', + 'validate_integer' => '{field} alanı sadece tam sayı olabilir', + 'validate_boolean' => '{field} alanı Doğru yada Yanlış olmak zorunda', + 'validate_float' => '{field} alanı ondalık noktası olan bir sayı olmalı (float)', + 'validate_valid_url' => '{field} alanı URL olmak zorunda', + 'validate_url_exists' => '{field} URL bulunamadı', + 'validate_valid_ip' => '{field} alanı geçerli bir IP adresi olamlı', + 'validate_valid_ipv4' => '{field} alanı geçerli bir IPv4 adresi içermesi gerekiyor', + 'validate_valid_ipv6' => '{field} alanı geçerli bir IPv6 adresi içermesi gerekiyor', + 'validate_guidv4' => '{field} alanı geçerli bir GUID içermesi gerekiyor', + 'validate_valid_cc' => '{field} geçerli bir kredi kartı numarası değil', + 'validate_valid_name' => '{field} tam isim olmalı', + 'validate_contains' => '{field} sadece aşağıdakilerden biri olabilir: {param}', + 'validate_contains_list' => '{field} geçerli bir seçenek değil', + 'validate_doesnt_contain_list' => '{field} alanı kabul edilmeyen bir değer içeriyor', + 'validate_street_address' => '{field} alanı geçerli bir sokak adresi olmalı', + 'validate_date' => '{field} geçerli bir tarih olmalı', + 'validate_min_numeric' => '{field} alanı {param} veya ondan yüksek sayısal bir değer olması gerekir', + 'validate_max_numeric' => '{field} alanı {param} veya ondan düşük sayısal bir değer olması gerekir', + 'validate_min_age' => '{field} alanı {param} veya daha büyük bir yaşta olması gerekir', + 'validate_invalid' => '{field} alanı geçersiz', + 'validate_starts' => '{field} alanı {param} ile başlamalıdır', + 'validate_extension' => '{field} alanı Aşağıdaki uzantılardan yalnızca biri olabilir: {param}', + 'validate_required_file' => '{field} alanı zorunlu', + 'validate_equalsfield' => '{field} alanı {param} alanına eşit değil.', + 'validate_iban' => '{field} alanı geçerli bir IBAN olmalı', + 'validate_phone_number' => '{field} alanı geçerli bir telefon numarası olmalı', + 'validate_regex' => '{field} alanı geçerli biçime sahip bir değer içermesi gerekiyor', + 'validate_valid_json_string' => '{field} alanı geçerli bir JSON biçiminde dize içermesi gerekiyor', + 'validate_valid_array_size_greater' => '{field} alanı {param} veya daha yüksek bir dizi olması gerekir', + 'validate_valid_array_size_lesser' => '{field} alanı {param} veya daha küçük bir dizi olması gerekir', + 'validate_valid_array_size_equal' => '{field} alanı {param} boyutuna eşit bir dizi olması gerekiyor', +); From 7b1b7a3a8ad6958d18cf7b359aa442c607527989 Mon Sep 17 00:00:00 2001 From: Riky Lesmana Date: Sat, 2 Jun 2018 18:48:06 +0700 Subject: [PATCH 14/25] adding indonesian language --- lang/id.php | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 lang/id.php diff --git a/lang/id.php b/lang/id.php new file mode 100644 index 00000000..ca1debe5 --- /dev/null +++ b/lang/id.php @@ -0,0 +1,52 @@ + 'Bagian {field} harus diisi', + 'validate_valid_email' => 'Bagian {field} harus berisi alamat email yang benar', + 'validate_max_len' => 'Bagian {field} harus memiliki {param} karakter atau kurang', + 'validate_min_len' => 'Bagian {field} memiliki sedikitnya {param} karakter', + 'validate_exact_len' => 'Bagian {field} harus memiliki tepat {param} karakter', + 'validate_alpha' => 'Bagian {field} hanya boleh berisi huruf', + 'validate_alpha_numeric' => 'Bagian {field} hanya boleh berisi huruf dan angkat', + 'validate_alpha_numeric_space' => 'Bagian {field} hanya boleh berisi huruf, angkat dan spasi', + 'validate_alpha_dash' => 'Bagian {field} hanya boleh berisi huruf dan \'-\'', + 'validate_alpha_space' => 'Bagian {field} hanya boleh berisi huruf dan spasi', + 'validate_numeric' => 'Bagian {field} hanya boleh berisi angka', + 'validate_integer' => 'Bagian {field} hanya boleh berisi angka tanpa memiliki desimal', + 'validate_boolean' => 'Bagian {field} hanya boleh berisi true atau false', + 'validate_float' => 'Bagian {field} hanya boleh berisi angka yang memiliki desimal (float)', + 'validate_valid_url' => 'Bagian {field} harus berupa URL', + 'validate_url_exists' => 'Bagian {field} tidak memiliki URL didalamnya', + 'validate_valid_ip' => 'Bagian {field} harus berupa IP address yang benar', + 'validate_valid_ipv4' => 'Bagian {field} harus berupa IPv4 address yang benar', + 'validate_valid_ipv6' => 'Bagian {field} harus berupa IPv6 address yang benar', + 'validate_guidv4' => 'Bagian {field} harus berupa GUID yang benar', + 'validate_valid_cc' => 'Bagian {field} bukan merupakan nomor kartu kredit yang benar', + 'validate_valid_name' => 'Bagian {field} harus berupa nama lengkap', + 'validate_contains' => 'Bagian {field} hanya boleh berisi salah satu dari pilihan berikut: {param}', + 'validate_contains_list' => 'Bagian {field} bukan merupakan opsi yang benar', + 'validate_doesnt_contain_list' => 'Bagian {field} memiliki nilai yang tidak diperbolehkan', + 'validate_street_address' => 'Bagian {field} harus berupa alamat lengkap yang benar', + 'validate_date' => 'Bagian {field} harus memiliki format tanggal yang benar', + 'validate_min_numeric' => 'Bagian {field} hanya boleh berisi angka, yang memiliki karakter lebih besar atau sama dengan {param}', + 'validate_max_numeric' => 'Bagian {field} hanya boleh berisi angka, yang memiliki karakter lebih kecil atau sama dengan {param}', + 'validate_min_age' => 'Bagian {field}hanya boleh berisi \'umur\' yang lebih besar atau sama dengan {param}', + 'validate_invalid' => 'Bagian {field} memiliki nilai yang salah', + 'validate_starts' => 'Bagian {field} harus dimulai oleh {param}', + 'validate_extension' => 'Bagian {field} hanya boleh memiliki salah satu daru ekstensi: {param}', + 'validate_required_file' => 'Bagian {field} harus diisi', + 'validate_iban' => 'Bagian {field} harus berupa IBAN yang benar', + 'validate_equalsfield' => 'Bagian {field} harus sama dengan Bagian {param}', + 'validate_phone_number' => 'Bagian {field} harus berupa Nomor Telepon yang benar', + 'validate_regex' => 'Bagian {field} harus memiliki nilai dengan format yang benar', + 'validate_valid_json_string' => 'Bagian {field} harus memiliki format JSON yang benar', + 'validate_valid_array_size_greater' => 'Bagian {field} harus berupa array dengan ukuran lebih besar atau sama dengan {param}', + 'validate_valid_array_size_lesser' => 'Bagian {field} harus berupa array dengan ukuran lebih kecil atau sama dengan {param}', + 'validate_valid_array_size_equal' => 'Bagian {field} harus berupa array dengan ukuran {param}', + 'validate_valid_persian_name' => 'Bagian {field} seharusnya berisi nama Persian/Dari atau Arabic', + 'validate_valid_eng_per_pas_name' => 'Bagian {field} seharusnya berisi nama English, Persian/Dari/Pashtu atau Arabic', + 'validate_valid_persian_digit' => 'Bagian {field} seharusnya berisi angka dalam bahasa Persian/Dari atau Arabic', + 'validate_valid_persian_text' => 'Bagian {field} seharusnya berisi teks dalam bahasa Persian/Dari atau Arabic ', + 'validate_valid_pashtu_text' => 'Bagian {field} seharusnya berisi teks dalam bahasa Pashtu', + 'validate_valid_twitter' => 'Bagian {field} bukan merupakan format alamat twitter yang benar', +); From 269be44252bf1b39770e3a212d7676f134f7f449 Mon Sep 17 00:00:00 2001 From: Riky Lesmana Date: Sat, 2 Jun 2018 19:01:14 +0700 Subject: [PATCH 15/25] adding array_column for php that not have the function --- tests.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests.php b/tests.php index 6e2e3a6c..2b27afda 100644 --- a/tests.php +++ b/tests.php @@ -105,3 +105,31 @@ } echo "\nDONE\n\n"; + +//For PHP 5.4 / other version that not support array_column +if (! function_exists('array_column')) { + function array_column(array $input, $columnKey, $indexKey = null) { + $array = array(); + foreach ($input as $value) { + if ( !array_key_exists($columnKey, $value)) { + trigger_error("Key \"$columnKey\" does not exist in array"); + return false; + } + if (is_null($indexKey)) { + $array[] = $value[$columnKey]; + } + else { + if ( !array_key_exists($indexKey, $value)) { + trigger_error("Key \"$indexKey\" does not exist in array"); + return false; + } + if ( ! is_scalar($value[$indexKey])) { + trigger_error("Key \"$indexKey\" does not contain scalar value"); + return false; + } + $array[$value[$indexKey]] = $value[$columnKey]; + } + } + return $array; + } +} From ecd4111e62464bb85827c3ae58d6ee7ce64280f2 Mon Sep 17 00:00:00 2001 From: Riky Lesmana Date: Sat, 2 Jun 2018 19:05:48 +0700 Subject: [PATCH 16/25] adding array_column for php that not have the function --- tests.php | 56 +++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/tests.php b/tests.php index 2b27afda..499a3618 100644 --- a/tests.php +++ b/tests.php @@ -2,6 +2,34 @@ error_reporting(-1); ini_set('display_errors', 1); +//For PHP 5.4 / other version that not support array_column +if (! function_exists('array_column')) { + function array_column(array $input, $columnKey, $indexKey = null) { + $array = array(); + foreach ($input as $value) { + if ( !array_key_exists($columnKey, $value)) { + trigger_error("Key \"$columnKey\" does not exist in array"); + return false; + } + if (is_null($indexKey)) { + $array[] = $value[$columnKey]; + } + else { + if ( !array_key_exists($indexKey, $value)) { + trigger_error("Key \"$indexKey\" does not exist in array"); + return false; + } + if ( ! is_scalar($value[$indexKey])) { + trigger_error("Key \"$indexKey\" does not contain scalar value"); + return false; + } + $array[$value[$indexKey]] = $value[$columnKey]; + } + } + return $array; + } +} + require "gump.class.php"; $validator = new GUMP(); @@ -105,31 +133,3 @@ } echo "\nDONE\n\n"; - -//For PHP 5.4 / other version that not support array_column -if (! function_exists('array_column')) { - function array_column(array $input, $columnKey, $indexKey = null) { - $array = array(); - foreach ($input as $value) { - if ( !array_key_exists($columnKey, $value)) { - trigger_error("Key \"$columnKey\" does not exist in array"); - return false; - } - if (is_null($indexKey)) { - $array[] = $value[$columnKey]; - } - else { - if ( !array_key_exists($indexKey, $value)) { - trigger_error("Key \"$indexKey\" does not exist in array"); - return false; - } - if ( ! is_scalar($value[$indexKey])) { - trigger_error("Key \"$indexKey\" does not contain scalar value"); - return false; - } - $array[$value[$indexKey]] = $value[$columnKey]; - } - } - return $array; - } -} From 08a63134e6fa46069ee01b29d84d4e9476506052 Mon Sep 17 00:00:00 2001 From: Filis Futsarov Date: Sat, 2 Jun 2018 14:45:57 +0200 Subject: [PATCH 17/25] Revert "adding indonesian language" --- lang/id.php | 52 ---------------------------------------------------- tests.php | 28 ---------------------------- 2 files changed, 80 deletions(-) delete mode 100644 lang/id.php diff --git a/lang/id.php b/lang/id.php deleted file mode 100644 index ca1debe5..00000000 --- a/lang/id.php +++ /dev/null @@ -1,52 +0,0 @@ - 'Bagian {field} harus diisi', - 'validate_valid_email' => 'Bagian {field} harus berisi alamat email yang benar', - 'validate_max_len' => 'Bagian {field} harus memiliki {param} karakter atau kurang', - 'validate_min_len' => 'Bagian {field} memiliki sedikitnya {param} karakter', - 'validate_exact_len' => 'Bagian {field} harus memiliki tepat {param} karakter', - 'validate_alpha' => 'Bagian {field} hanya boleh berisi huruf', - 'validate_alpha_numeric' => 'Bagian {field} hanya boleh berisi huruf dan angkat', - 'validate_alpha_numeric_space' => 'Bagian {field} hanya boleh berisi huruf, angkat dan spasi', - 'validate_alpha_dash' => 'Bagian {field} hanya boleh berisi huruf dan \'-\'', - 'validate_alpha_space' => 'Bagian {field} hanya boleh berisi huruf dan spasi', - 'validate_numeric' => 'Bagian {field} hanya boleh berisi angka', - 'validate_integer' => 'Bagian {field} hanya boleh berisi angka tanpa memiliki desimal', - 'validate_boolean' => 'Bagian {field} hanya boleh berisi true atau false', - 'validate_float' => 'Bagian {field} hanya boleh berisi angka yang memiliki desimal (float)', - 'validate_valid_url' => 'Bagian {field} harus berupa URL', - 'validate_url_exists' => 'Bagian {field} tidak memiliki URL didalamnya', - 'validate_valid_ip' => 'Bagian {field} harus berupa IP address yang benar', - 'validate_valid_ipv4' => 'Bagian {field} harus berupa IPv4 address yang benar', - 'validate_valid_ipv6' => 'Bagian {field} harus berupa IPv6 address yang benar', - 'validate_guidv4' => 'Bagian {field} harus berupa GUID yang benar', - 'validate_valid_cc' => 'Bagian {field} bukan merupakan nomor kartu kredit yang benar', - 'validate_valid_name' => 'Bagian {field} harus berupa nama lengkap', - 'validate_contains' => 'Bagian {field} hanya boleh berisi salah satu dari pilihan berikut: {param}', - 'validate_contains_list' => 'Bagian {field} bukan merupakan opsi yang benar', - 'validate_doesnt_contain_list' => 'Bagian {field} memiliki nilai yang tidak diperbolehkan', - 'validate_street_address' => 'Bagian {field} harus berupa alamat lengkap yang benar', - 'validate_date' => 'Bagian {field} harus memiliki format tanggal yang benar', - 'validate_min_numeric' => 'Bagian {field} hanya boleh berisi angka, yang memiliki karakter lebih besar atau sama dengan {param}', - 'validate_max_numeric' => 'Bagian {field} hanya boleh berisi angka, yang memiliki karakter lebih kecil atau sama dengan {param}', - 'validate_min_age' => 'Bagian {field}hanya boleh berisi \'umur\' yang lebih besar atau sama dengan {param}', - 'validate_invalid' => 'Bagian {field} memiliki nilai yang salah', - 'validate_starts' => 'Bagian {field} harus dimulai oleh {param}', - 'validate_extension' => 'Bagian {field} hanya boleh memiliki salah satu daru ekstensi: {param}', - 'validate_required_file' => 'Bagian {field} harus diisi', - 'validate_iban' => 'Bagian {field} harus berupa IBAN yang benar', - 'validate_equalsfield' => 'Bagian {field} harus sama dengan Bagian {param}', - 'validate_phone_number' => 'Bagian {field} harus berupa Nomor Telepon yang benar', - 'validate_regex' => 'Bagian {field} harus memiliki nilai dengan format yang benar', - 'validate_valid_json_string' => 'Bagian {field} harus memiliki format JSON yang benar', - 'validate_valid_array_size_greater' => 'Bagian {field} harus berupa array dengan ukuran lebih besar atau sama dengan {param}', - 'validate_valid_array_size_lesser' => 'Bagian {field} harus berupa array dengan ukuran lebih kecil atau sama dengan {param}', - 'validate_valid_array_size_equal' => 'Bagian {field} harus berupa array dengan ukuran {param}', - 'validate_valid_persian_name' => 'Bagian {field} seharusnya berisi nama Persian/Dari atau Arabic', - 'validate_valid_eng_per_pas_name' => 'Bagian {field} seharusnya berisi nama English, Persian/Dari/Pashtu atau Arabic', - 'validate_valid_persian_digit' => 'Bagian {field} seharusnya berisi angka dalam bahasa Persian/Dari atau Arabic', - 'validate_valid_persian_text' => 'Bagian {field} seharusnya berisi teks dalam bahasa Persian/Dari atau Arabic ', - 'validate_valid_pashtu_text' => 'Bagian {field} seharusnya berisi teks dalam bahasa Pashtu', - 'validate_valid_twitter' => 'Bagian {field} bukan merupakan format alamat twitter yang benar', -); diff --git a/tests.php b/tests.php index 499a3618..6e2e3a6c 100644 --- a/tests.php +++ b/tests.php @@ -2,34 +2,6 @@ error_reporting(-1); ini_set('display_errors', 1); -//For PHP 5.4 / other version that not support array_column -if (! function_exists('array_column')) { - function array_column(array $input, $columnKey, $indexKey = null) { - $array = array(); - foreach ($input as $value) { - if ( !array_key_exists($columnKey, $value)) { - trigger_error("Key \"$columnKey\" does not exist in array"); - return false; - } - if (is_null($indexKey)) { - $array[] = $value[$columnKey]; - } - else { - if ( !array_key_exists($indexKey, $value)) { - trigger_error("Key \"$indexKey\" does not exist in array"); - return false; - } - if ( ! is_scalar($value[$indexKey])) { - trigger_error("Key \"$indexKey\" does not contain scalar value"); - return false; - } - $array[$value[$indexKey]] = $value[$columnKey]; - } - } - return $array; - } -} - require "gump.class.php"; $validator = new GUMP(); From 8376f24d7d17db4a283503cced94241f54fdb82c Mon Sep 17 00:00:00 2001 From: Riky Lesmana Date: Sat, 2 Jun 2018 19:52:32 +0700 Subject: [PATCH 18/25] Revert "adding array_column for php that not have the function" This reverts commit ecd4111e62464bb85827c3ae58d6ee7ce64280f2. --- tests.php | 56 +++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/tests.php b/tests.php index 499a3618..2b27afda 100644 --- a/tests.php +++ b/tests.php @@ -2,34 +2,6 @@ error_reporting(-1); ini_set('display_errors', 1); -//For PHP 5.4 / other version that not support array_column -if (! function_exists('array_column')) { - function array_column(array $input, $columnKey, $indexKey = null) { - $array = array(); - foreach ($input as $value) { - if ( !array_key_exists($columnKey, $value)) { - trigger_error("Key \"$columnKey\" does not exist in array"); - return false; - } - if (is_null($indexKey)) { - $array[] = $value[$columnKey]; - } - else { - if ( !array_key_exists($indexKey, $value)) { - trigger_error("Key \"$indexKey\" does not exist in array"); - return false; - } - if ( ! is_scalar($value[$indexKey])) { - trigger_error("Key \"$indexKey\" does not contain scalar value"); - return false; - } - $array[$value[$indexKey]] = $value[$columnKey]; - } - } - return $array; - } -} - require "gump.class.php"; $validator = new GUMP(); @@ -133,3 +105,31 @@ function array_column(array $input, $columnKey, $indexKey = null) { } echo "\nDONE\n\n"; + +//For PHP 5.4 / other version that not support array_column +if (! function_exists('array_column')) { + function array_column(array $input, $columnKey, $indexKey = null) { + $array = array(); + foreach ($input as $value) { + if ( !array_key_exists($columnKey, $value)) { + trigger_error("Key \"$columnKey\" does not exist in array"); + return false; + } + if (is_null($indexKey)) { + $array[] = $value[$columnKey]; + } + else { + if ( !array_key_exists($indexKey, $value)) { + trigger_error("Key \"$indexKey\" does not exist in array"); + return false; + } + if ( ! is_scalar($value[$indexKey])) { + trigger_error("Key \"$indexKey\" does not contain scalar value"); + return false; + } + $array[$value[$indexKey]] = $value[$columnKey]; + } + } + return $array; + } +} From 657a515cf3125f80bc4dd6a9e03a6fb4283f6eaa Mon Sep 17 00:00:00 2001 From: Riky Lesmana Date: Sat, 2 Jun 2018 19:52:38 +0700 Subject: [PATCH 19/25] Revert "adding array_column for php that not have the function" This reverts commit 269be44252bf1b39770e3a212d7676f134f7f449. --- tests.php | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/tests.php b/tests.php index 2b27afda..6e2e3a6c 100644 --- a/tests.php +++ b/tests.php @@ -105,31 +105,3 @@ } echo "\nDONE\n\n"; - -//For PHP 5.4 / other version that not support array_column -if (! function_exists('array_column')) { - function array_column(array $input, $columnKey, $indexKey = null) { - $array = array(); - foreach ($input as $value) { - if ( !array_key_exists($columnKey, $value)) { - trigger_error("Key \"$columnKey\" does not exist in array"); - return false; - } - if (is_null($indexKey)) { - $array[] = $value[$columnKey]; - } - else { - if ( !array_key_exists($indexKey, $value)) { - trigger_error("Key \"$indexKey\" does not exist in array"); - return false; - } - if ( ! is_scalar($value[$indexKey])) { - trigger_error("Key \"$indexKey\" does not contain scalar value"); - return false; - } - $array[$value[$indexKey]] = $value[$columnKey]; - } - } - return $array; - } -} From 37595e05218ad0a7625efafe27b805a24df2f77e Mon Sep 17 00:00:00 2001 From: Filis Futsarov Date: Sun, 3 Jun 2018 01:07:02 +0200 Subject: [PATCH 20/25] Update .travis.yml --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index bccb225f..e1dbb246 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,5 @@ language: php php: - "7.0" - "5.6" - - "5.5" - - "5.4" - hhvm script: php tests.php From b32c92206fb7014a40179b8468ba8bab90b3f879 Mon Sep 17 00:00:00 2001 From: Filis Futsarov Date: Sun, 3 Jun 2018 01:09:34 +0200 Subject: [PATCH 21/25] Create id.php --- lang/id.php | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 lang/id.php diff --git a/lang/id.php b/lang/id.php new file mode 100644 index 00000000..ca1debe5 --- /dev/null +++ b/lang/id.php @@ -0,0 +1,52 @@ + 'Bagian {field} harus diisi', + 'validate_valid_email' => 'Bagian {field} harus berisi alamat email yang benar', + 'validate_max_len' => 'Bagian {field} harus memiliki {param} karakter atau kurang', + 'validate_min_len' => 'Bagian {field} memiliki sedikitnya {param} karakter', + 'validate_exact_len' => 'Bagian {field} harus memiliki tepat {param} karakter', + 'validate_alpha' => 'Bagian {field} hanya boleh berisi huruf', + 'validate_alpha_numeric' => 'Bagian {field} hanya boleh berisi huruf dan angkat', + 'validate_alpha_numeric_space' => 'Bagian {field} hanya boleh berisi huruf, angkat dan spasi', + 'validate_alpha_dash' => 'Bagian {field} hanya boleh berisi huruf dan \'-\'', + 'validate_alpha_space' => 'Bagian {field} hanya boleh berisi huruf dan spasi', + 'validate_numeric' => 'Bagian {field} hanya boleh berisi angka', + 'validate_integer' => 'Bagian {field} hanya boleh berisi angka tanpa memiliki desimal', + 'validate_boolean' => 'Bagian {field} hanya boleh berisi true atau false', + 'validate_float' => 'Bagian {field} hanya boleh berisi angka yang memiliki desimal (float)', + 'validate_valid_url' => 'Bagian {field} harus berupa URL', + 'validate_url_exists' => 'Bagian {field} tidak memiliki URL didalamnya', + 'validate_valid_ip' => 'Bagian {field} harus berupa IP address yang benar', + 'validate_valid_ipv4' => 'Bagian {field} harus berupa IPv4 address yang benar', + 'validate_valid_ipv6' => 'Bagian {field} harus berupa IPv6 address yang benar', + 'validate_guidv4' => 'Bagian {field} harus berupa GUID yang benar', + 'validate_valid_cc' => 'Bagian {field} bukan merupakan nomor kartu kredit yang benar', + 'validate_valid_name' => 'Bagian {field} harus berupa nama lengkap', + 'validate_contains' => 'Bagian {field} hanya boleh berisi salah satu dari pilihan berikut: {param}', + 'validate_contains_list' => 'Bagian {field} bukan merupakan opsi yang benar', + 'validate_doesnt_contain_list' => 'Bagian {field} memiliki nilai yang tidak diperbolehkan', + 'validate_street_address' => 'Bagian {field} harus berupa alamat lengkap yang benar', + 'validate_date' => 'Bagian {field} harus memiliki format tanggal yang benar', + 'validate_min_numeric' => 'Bagian {field} hanya boleh berisi angka, yang memiliki karakter lebih besar atau sama dengan {param}', + 'validate_max_numeric' => 'Bagian {field} hanya boleh berisi angka, yang memiliki karakter lebih kecil atau sama dengan {param}', + 'validate_min_age' => 'Bagian {field}hanya boleh berisi \'umur\' yang lebih besar atau sama dengan {param}', + 'validate_invalid' => 'Bagian {field} memiliki nilai yang salah', + 'validate_starts' => 'Bagian {field} harus dimulai oleh {param}', + 'validate_extension' => 'Bagian {field} hanya boleh memiliki salah satu daru ekstensi: {param}', + 'validate_required_file' => 'Bagian {field} harus diisi', + 'validate_iban' => 'Bagian {field} harus berupa IBAN yang benar', + 'validate_equalsfield' => 'Bagian {field} harus sama dengan Bagian {param}', + 'validate_phone_number' => 'Bagian {field} harus berupa Nomor Telepon yang benar', + 'validate_regex' => 'Bagian {field} harus memiliki nilai dengan format yang benar', + 'validate_valid_json_string' => 'Bagian {field} harus memiliki format JSON yang benar', + 'validate_valid_array_size_greater' => 'Bagian {field} harus berupa array dengan ukuran lebih besar atau sama dengan {param}', + 'validate_valid_array_size_lesser' => 'Bagian {field} harus berupa array dengan ukuran lebih kecil atau sama dengan {param}', + 'validate_valid_array_size_equal' => 'Bagian {field} harus berupa array dengan ukuran {param}', + 'validate_valid_persian_name' => 'Bagian {field} seharusnya berisi nama Persian/Dari atau Arabic', + 'validate_valid_eng_per_pas_name' => 'Bagian {field} seharusnya berisi nama English, Persian/Dari/Pashtu atau Arabic', + 'validate_valid_persian_digit' => 'Bagian {field} seharusnya berisi angka dalam bahasa Persian/Dari atau Arabic', + 'validate_valid_persian_text' => 'Bagian {field} seharusnya berisi teks dalam bahasa Persian/Dari atau Arabic ', + 'validate_valid_pashtu_text' => 'Bagian {field} seharusnya berisi teks dalam bahasa Pashtu', + 'validate_valid_twitter' => 'Bagian {field} bukan merupakan format alamat twitter yang benar', +); From f172a456abeb69f6da8ecd58b581268758076217 Mon Sep 17 00:00:00 2001 From: Christian ARNAUD Date: Mon, 6 Aug 2018 08:05:42 +0200 Subject: [PATCH 22/25] Allow '|' and ',' by optionally using custom separators for rules and parameter --- .gitignore | 1 - gump.class.php | 31 ++++++++++++++++++++----------- 2 files changed, 20 insertions(+), 12 deletions(-) delete mode 100644 .gitignore diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 496ee2ca..00000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.DS_Store \ No newline at end of file diff --git a/gump.class.php b/gump.class.php index 15024e0f..87131604 100644 --- a/gump.class.php +++ b/gump.class.php @@ -257,17 +257,20 @@ public function filter_rules(array $rules = array()) * * @param array $data * @param bool $check_fields + * @param string $rules_delimiter + * @param string $parameters_delimiters * * @return array * * @throws Exception */ - public function run(array $data, $check_fields = false) + public function run(array $data, $check_fields = false, $rules_delimiter='|', $parameters_delimiters=',') { - $data = $this->filter($data, $this->filter_rules()); + $data = $this->filter($data, $this->filter_rules(), $rules_delimiter, $parameters_delimiters); $validated = $this->validate( - $data, $this->validation_rules() + $data, $this->validation_rules(), + $rules_delimiter, $parameters_delimiters ); if ($check_fields === true) { @@ -368,21 +371,24 @@ public function errors() /** * Perform data validation against the provided ruleset. + * If any rule's parameter contains either '|' or ',', the corresponding default separator can be changed * * @param mixed $input * @param array $ruleset + * @param string $rules_delimiter + * @param string $parameters_delimiter * * @return mixed * * @throws Exception */ - public function validate(array $input, array $ruleset) + public function validate(array $input, array $ruleset, $rules_delimiter='|', $parameters_delimiter=',') { $this->errors = array(); foreach ($ruleset as $field => $rules) { - $rules = explode('|', $rules); + $rules = explode($rules_delimiter, $rules); $look_for = array('required_file', 'required'); @@ -407,8 +413,8 @@ public function validate(array $input, array $ruleset) $param = null; // Check if we have rule parameters - if (strstr($rule, ',') !== false) { - $rule = explode(',', $rule); + if (strstr($rule, $parameters_delimiter) !== false) { + $rule = explode($parameters_delimiter, $rule); $method = 'validate_'.$rule[0]; $param = $rule[1]; $rule = $rule[0]; @@ -651,9 +657,12 @@ public function get_errors_array($convert_to_string = null) /** * Filter the input data according to the specified filter set. + * If any filter's parameter contains either '|' or ',', the corresponding default separator can be changed * * @param mixed $input * @param array $filterset + * @param string $filters_delimeter + * @param string $parameters_delimiter * * @throws Exception * @@ -661,20 +670,20 @@ public function get_errors_array($convert_to_string = null) * * @throws Exception */ - public function filter(array $input, array $filterset) + public function filter(array $input, array $filterset, $filters_delimeter='|', $parameters_delimiter=',') { foreach ($filterset as $field => $filters) { if (!array_key_exists($field, $input)) { continue; } - $filters = explode('|', $filters); + $filters = explode($filters_delimeter, $filters); foreach ($filters as $filter) { $params = null; - if (strstr($filter, ',') !== false) { - $filter = explode(',', $filter); + if (strstr($filter, $parameters_delimiter) !== false) { + $filter = explode($parameters_delimiter, $filter); $params = array_slice($filter, 1, count($filter) - 1); From a6c4fce5df6d2455c7622563e67752aafb1b7d9d Mon Sep 17 00:00:00 2001 From: Sean Nieuwoudt Date: Fri, 16 Nov 2018 08:12:29 +0200 Subject: [PATCH 23/25] Updated .gitignore --- .gitignore | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..9da98cab --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +.DS_Store +.idea +nbproject +nb-configuration.xml +Session.vim +*.tmproj +*.tmproject +tmtags +Thumbs.db +Desktop.ini + From 98ec02d22411596df27b76ab3ac0078a23555015 Mon Sep 17 00:00:00 2001 From: scottcase Date: Thu, 6 Dec 2018 16:37:40 -0500 Subject: [PATCH 24/25] add file_size validation --- gump.class.php | 36 ++++++++++++++++++++++++++++++++++++ lang/en.php | 1 + 2 files changed, 37 insertions(+) diff --git a/gump.class.php b/gump.class.php index c9d0d3f6..3d3c0231 100644 --- a/gump.class.php +++ b/gump.class.php @@ -2037,6 +2037,42 @@ protected function validate_extension($field, $input, $param = null) ); } } + + /** + * Check the uploaded file for filesize + * checks only the ext should add mime type check. + * + * Usage: '' => 'file_size,500kb + * + * @param string $field + * @param array $input + * + * @return mixed + */ + protected function validate_file_size($field, $input, $param = null) + { + if (!isset($input[$field])) { + return; + } + + if (is_array($input[$field]) && $input[$field]['error'] !== 4) { + $max_filesize = str_replace('kb', '', trim(strtolower($param))) * 1024; + + //get the image filesize + $imagesize = $input[$field]['size']; + + if ( ($imagesize > 0) && ($imagesize < $max_filesize) ) { + return; + } + + return array( + 'field' => $field, + 'value' => $input[$field], + 'rule' => __FUNCTION__, + 'param' => $param, + ); + } + } /** * Determine if the provided field value equals current field value. diff --git a/lang/en.php b/lang/en.php index 1297d99e..0911615b 100644 --- a/lang/en.php +++ b/lang/en.php @@ -34,6 +34,7 @@ 'validate_invalid' => 'The {field} field is invalid', 'validate_starts' => 'The {field} field needs to start with {param}', 'validate_extension' => 'The {field} field can only have one of the following extensions: {param}', + 'validate_file_size' => 'The {field} must be smaller than: {param}', 'validate_required_file' => 'The {field} field is required', 'validate_equalsfield' => 'The {field} field does not equal {param} field', 'validate_iban' => 'The {field} field needs to contain a valid IBAN', From 11047e9da72e195ee173a9f57645d56a65d37acd Mon Sep 17 00:00:00 2001 From: Alexandre Plennevaux Date: Thu, 12 Sep 2019 17:36:53 +0200 Subject: [PATCH 25/25] Fix slug filter returning empty value --- gump.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gump.class.php b/gump.class.php index c9d0d3f6..62117207 100644 --- a/gump.class.php +++ b/gump.class.php @@ -951,7 +951,7 @@ protected function filter_upper_case($value, $params = null) protected function filter_slug($value, $params = null) { $delimiter = '-'; - $slug = strtolower(trim(preg_replace('/[\s-]+/', $delimiter, preg_replace('/[^A-Za-z0-9-]+/', $delimiter, preg_replace('/[&]/', 'and', preg_replace('/[\']/', '', iconv('UTF-8', 'ASCII//TRANSLIT', $str))))), $delimiter)); + $slug = strtolower(trim(preg_replace('/[\s-]+/', $delimiter, preg_replace('/[^A-Za-z0-9-]+/', $delimiter, preg_replace('/[&]/', 'and', preg_replace('/[\']/', '', iconv('UTF-8', 'ASCII//TRANSLIT', $value))))), $delimiter)); return $slug; }