@@ -91,7 +91,7 @@ |
||
91 | 91 | /** |
92 | 92 | * ERRORS PROCESS |
93 | 93 | */ |
94 | -if($router->error()) { |
|
94 | +if ($router->error()) { |
|
95 | 95 | $router->redirect('web.error', ['errcode' => $router->error()]); |
96 | 96 | } |
97 | 97 |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | <div class="row row-2"> |
8 | 8 | <h2>All Products</h2> |
9 | - <?php if (!empty($user) && in_array($user->access_level_id->name, [ 'Administrador', 'Gerente', 'Vendedor' ])): ?> |
|
9 | + <?php if (!empty($user) && in_array($user->access_level_id->name, ['Administrador', 'Gerente', 'Vendedor'])): ?> |
|
10 | 10 | <button class="btn" onclick="window.location.href='<?= $router->route('web.productInsert'); ?>';">Adicionar produto</button> |
11 | 11 | <?php endif; ?> |
12 | 12 | <select onchange="window.location.href=this.value;"> |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | </div> |
17 | 17 | |
18 | 18 | <div class="row"> |
19 | - <?php if (!empty($user) && in_array($user->access_level_id->name, [ 'Administrador', 'Gerente', 'Vendedor' ])): ?> |
|
19 | + <?php if (!empty($user) && in_array($user->access_level_id->name, ['Administrador', 'Gerente', 'Vendedor'])): ?> |
|
20 | 20 | <div class="form-message"> |
21 | 21 | <div class="login_form_callback"> |
22 | 22 | <?= flash(); ?> |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | SmallImg[i].onclick = () => { ProductImg.src = SmallImg[i].src } |
113 | 113 | } |
114 | 114 | |
115 | -<?php if (!empty($user) && in_array($user->access_level_id->name, [ 'Administrador', 'Gerente', 'Vendedor' ])): ?> |
|
115 | +<?php if (!empty($user) && in_array($user->access_level_id->name, ['Administrador', 'Gerente', 'Vendedor'])): ?> |
|
116 | 116 | |
117 | 117 | Array.from(SmallImg).forEach(element => { |
118 | 118 | if (element.src.includes('no-product-image.png')) { |
@@ -37,7 +37,7 @@ |
||
37 | 37 | <li><a href="<?= $router->route("web.products"); ?>">Products</a></li> |
38 | 38 | <li><a href="<?= $router->route("web.about"); ?>">About</a></li> |
39 | 39 | |
40 | - <?php if(!empty($_SESSION["user"])): ?> |
|
40 | + <?php if (!empty($_SESSION["user"])): ?> |
|
41 | 41 | <li><a href="<?= $router->route("app.account"); ?>">Account</a></li> |
42 | 42 | <li><a href="<?= $router->route("app.logoff"); ?>">Logoff</a></li> |
43 | 43 | <?php else: ?> |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | public function productInsert(): void |
158 | 158 | { |
159 | - if (empty($this->user) || !in_array($this->user->access_level_id->name, [ 'Administrador', 'Gerente', 'Vendedor' ])) { |
|
159 | + if (empty($this->user) || !in_array($this->user->access_level_id->name, ['Administrador', 'Gerente', 'Vendedor'])) { |
|
160 | 160 | $this->router->redirect('web.products'); |
161 | 161 | } |
162 | 162 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $head = $this->seo->optimize( |
219 | 219 | "Ooooppss {$error} |" . site('name'), |
220 | 220 | site('desc'), |
221 | - $this->router->route('web.error', [ 'errcode' => $error ]), |
|
221 | + $this->router->route('web.error', ['errcode' => $error]), |
|
222 | 222 | routeImage($error) |
223 | 223 | )->render(); |
224 | 224 |
@@ -8,7 +8,7 @@ |
||
8 | 8 | public function __construct($router) { |
9 | 9 | parent::__construct($router); |
10 | 10 | |
11 | - if(!empty($_SESSION["user"])) { |
|
11 | + if (!empty($_SESSION["user"])) { |
|
12 | 12 | $this->router->redirect("app.account"); |
13 | 13 | } |
14 | 14 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | $email = filter_var($data['email'], FILTER_VALIDATE_EMAIL); |
17 | 17 | $passwd = filter_var($data['password'], FILTER_DEFAULT); |
18 | 18 | |
19 | - if(!$email || !$passwd) { |
|
19 | + if (!$email || !$passwd) { |
|
20 | 20 | echo $this->ajaxResponse('message', [ |
21 | 21 | 'type' => 'alert', |
22 | 22 | 'message' => 'Informe seu e-mail e senha para logar' |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | public function register($data): void { |
74 | 74 | $data = filter_var_array($data, FILTER_SANITIZE_STRIPPED); |
75 | - if(in_array('', $data) || empty($data)) { |
|
75 | + if (in_array('', $data) || empty($data)) { |
|
76 | 76 | echo $this->ajaxResponse('message', [ |
77 | 77 | 'type' => 'error', |
78 | 78 | 'message' => 'Preencha todos os campos para cadastrar-se' |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | return; |
81 | 81 | } |
82 | 82 | |
83 | - if(!filter_var($data['email'], FILTER_VALIDATE_EMAIL)) { |
|
83 | + if (!filter_var($data['email'], FILTER_VALIDATE_EMAIL)) { |
|
84 | 84 | echo $this->ajaxResponse('message', [ |
85 | 85 | 'type' => 'error', |
86 | 86 | 'message' => 'Favor informe um e-mail válido para continuar' |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | public function forget($data): void { |
119 | 119 | $email = filter_var($data['email'], FILTER_VALIDATE_EMAIL); |
120 | - if(!$email) { |
|
120 | + if (!$email) { |
|
121 | 121 | echo $this->ajaxResponse('message', [ |
122 | 122 | 'type' => 'alert', |
123 | 123 | 'message' => 'Informe um e-mail valido para continuar' |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | $user = (new User())->find('email = :e', "e={$email}")->fetch(); |
129 | - if(!$user) { |
|
129 | + if (!$user) { |
|
130 | 130 | echo $this->ajaxResponse('message', [ |
131 | 131 | 'type' => 'error', |
132 | 132 | 'message' => 'E-mail informado, não cadastrado' |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | $email = new Email(); |
143 | 143 | $email->add( |
144 | - 'Recupere sua senha |'. site('name'), |
|
144 | + 'Recupere sua senha |' . site('name'), |
|
145 | 145 | $this->view->render('emails/recover', [ |
146 | 146 | 'user' => $user, |
147 | 147 | 'link' => $this->router->route('web.reset', [ |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | } |
162 | 162 | |
163 | 163 | public function reset($data): void { |
164 | - if(empty($_SESSION['forget']) || !$user = (new User())->findById($_SESSION['forget'])) { |
|
164 | + if (empty($_SESSION['forget']) || !$user = (new User())->findById($_SESSION['forget'])) { |
|
165 | 165 | flash('error', 'Não foi possivel recuperar'); |
166 | 166 | echo $this->ajaxResponse('redirect', [ |
167 | 167 | 'url' => $this->router->route('web.forget') |
@@ -169,14 +169,14 @@ discard block |
||
169 | 169 | return; |
170 | 170 | } |
171 | 171 | |
172 | - if(empty($data['password']) || empty($data['password_re'])) { |
|
172 | + if (empty($data['password']) || empty($data['password_re'])) { |
|
173 | 173 | echo $this->ajaxResponse('message', [ |
174 | 174 | 'type' => 'alert', |
175 | 175 | 'message' => 'Informe e repita sua nova senha' |
176 | 176 | ]); |
177 | 177 | } |
178 | 178 | |
179 | - if($data['password'] != $data['password_re']) { |
|
179 | + if ($data['password'] != $data['password_re']) { |
|
180 | 180 | echo $this->ajaxResponse('message', [ |
181 | 181 | 'type' => 'error', |
182 | 182 | 'message' => 'As senhas nao batem' |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $user->passwd = $data['password']; |
187 | 187 | $user->forget = null; |
188 | 188 | |
189 | - if(!$user->save()) { |
|
189 | + if (!$user->save()) { |
|
190 | 190 | echo $this->ajaxResponse('message', [ |
191 | 191 | 'type' => 'error', |
192 | 192 | 'message' => $user->fail()->getMessage() |
@@ -23,7 +23,7 @@ |
||
23 | 23 | public function __construct($router) |
24 | 24 | { |
25 | 25 | $this->router = $router; |
26 | - $this->view = Engine::create(dirname(__DIR__, 2)."/views", "php"); |
|
26 | + $this->view = Engine::create(dirname(__DIR__, 2) . "/views", "php"); |
|
27 | 27 | $this->view->addData(["router" => $this->router]); |
28 | 28 | |
29 | 29 | $this->seo = new Optimizer(); |
@@ -269,7 +269,7 @@ |
||
269 | 269 | $replace = []; |
270 | 270 | $args = func_get_args(); |
271 | 271 | |
272 | - for ($i = 1, $max = count($args); $i < $max; $i ++) { |
|
272 | + for ($i = 1, $max = count($args); $i < $max; $i++) { |
|
273 | 273 | $replace['{arg:' . $i . '}'] = $args[$i]; |
274 | 274 | } |
275 | 275 |