From 9554cf2b53f0dedeefb1f0de7250148511248fcc Mon Sep 17 00:00:00 2001 From: bim-g Date: Fri, 5 Jan 2024 10:39:08 +0200 Subject: [PATCH 1/7] [FIX] update missing class from namespace changed --- controller/exampleController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/controller/exampleController.php b/controller/exampleController.php index 440f104..3789bad 100644 --- a/controller/exampleController.php +++ b/controller/exampleController.php @@ -10,8 +10,9 @@ namespace Wepesi\Controller; -use Wepesi\Core\Input; -use Wepesi\Core\Redirect; + +use Wepesi\Core\Http\Input; +use Wepesi\Core\Http\Redirect; use Wepesi\Core\Session; class exampleController From 3d3d4b4c6945edb8bbd6e69a683bb15d9722a1d1 Mon Sep 17 00:00:00 2001 From: bim-g Date: Fri, 5 Jan 2024 10:41:42 +0200 Subject: [PATCH 2/7] [FIX] remove duplicated dumper function and use from main application --- config/function.php | 19 ++++--------------- middleware/Validation/exampleValidation.php | 4 ++-- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/config/function.php b/config/function.php index 29bf15e..4ef9eca 100644 --- a/config/function.php +++ b/config/function.php @@ -70,6 +70,7 @@ function autoIndexFolder(array $exclude_folder = []) } /** + * check content from cache file * @param string $cash_file_dir * @param array $filter * @return bool @@ -88,9 +89,9 @@ function checkCacheContent(string $cash_file_dir, array $filter): bool if ($content != $file_content) { $cache_file = fOpen($cash_file_path, 'w'); fwrite($cache_file, $file_content); - } else { - $status = false; - } + } else { + $status = false; + } } fclose($cache_file); return $status; @@ -106,15 +107,3 @@ function appDirSeparator(string $path): string if ((substr(PHP_OS, 0, 3)) === 'WIN') $new_path = str_replace("\\", '/', $path); return $new_path; } - -/** - * @param $ex - * @return void - */ -function dumper($ex) -{ - print('
');
-    print_r($ex);
-    print('
'); - exit(); -} \ No newline at end of file diff --git a/middleware/Validation/exampleValidation.php b/middleware/Validation/exampleValidation.php index 63bc0fa..643c6df 100644 --- a/middleware/Validation/exampleValidation.php +++ b/middleware/Validation/exampleValidation.php @@ -2,6 +2,7 @@ namespace Wepesi\Middleware\Validation; +use Wepesi\Core\Application; use Wepesi\Core\MiddleWare; class exampleValidation extends MiddleWare @@ -21,8 +22,7 @@ function changeLang() $this->validate->check($_POST, $rules); if (!$this->validate->passed()) { - dumper($this->validate->errors()); - exit(); + Application::dumper($this->validate->errors()); } } } \ No newline at end of file From e1a72137d3e497484e77575b659166e784d60ce5 Mon Sep 17 00:00:00 2001 From: bim-g Date: Fri, 5 Jan 2024 10:48:24 +0200 Subject: [PATCH 3/7] [UPD] use real token in stead of defined lang value --- middleware/Validation/exampleValidation.php | 4 ++-- views/home.php | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/middleware/Validation/exampleValidation.php b/middleware/Validation/exampleValidation.php index 643c6df..c5c4ad3 100644 --- a/middleware/Validation/exampleValidation.php +++ b/middleware/Validation/exampleValidation.php @@ -11,8 +11,8 @@ function changeLang() { $rules = [ "token" => $this->schema->string("token") - ->min(1) - ->max(2) + ->min(5) + ->max(30) ->required(), "lang" => $this->schema->string("lang") ->min(1) diff --git a/views/home.php b/views/home.php index 1c8e082..da04799 100644 --- a/views/home.php +++ b/views/home.php @@ -6,6 +6,7 @@ use Wepesi\Core\Bundles; use Wepesi\Core\I18n; use Wepesi\Core\Session; +use Wepesi\Core\Token; $lang = Session::exists("lang") ? Session::get("lang") : "en"; $errors = Session::exists("errors") ? Session::flash("errors") : null; @@ -44,7 +45,7 @@

translate("Change the language") ?>

" method="post"> - +