Issues (162)

Web/Frontend/index.php (4 issues)

1
<?php
2
3
@ob_start();
4
@session_start();
5
6
require __DIR__ . '/vendor/autoload.php';
7
8
@set_error_handler('errorHandler');
9
@set_exception_handler('exceptionHandler');
10
11
$_SERVER['REMOTE_ADDR'] = getallheaders()['X-Real-IP'];
12
13
use CoffeeCode\Router\Router;
0 ignored issues
show
The type CoffeeCode\Router\Router was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use \Source\Language\Locale;
0 ignored issues
show
This use statement conflicts with another class in this namespace, Locale. Consider defining an alias.

Let?s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let?s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
The type \Source\Language\Locale was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use \Source\Logger\Log;
0 ignored issues
show
The type \Source\Logger\Log was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
17
$router = new Router(site());
18
$router->namespace('Source\Controllers');
19
20
Locale::init();
21
Log::init();
22
23
/**
24
 * WEB
25
 */
26
$router->group(null);
27
$router->get('/', 'Web:home', 'web.home');
28
$router->get('/products', 'Web:products', 'web.products');
29
$router->get('/products/{page}', 'Web:products', 'web.products');
30
$router->get('/products/{sort}/{page}', 'Web:products', 'web.products');
31
$router->get('/product/{id}', 'Web:productsDetails', 'web.productsDetails');
32
$router->get('/about', 'Web:about', 'web.about');
33
$router->get('/cart', 'Web:cart', 'web.cart');
34
// Checkout
35
$router->group('/checkout');
36
$router->get('/select-address', 'Checkout:selectAddress', 'checkout.selectAddress');
37
$router->get('/payment-method', 'Checkout:paymentMethod', 'checkout.paymentMethod');
38
$router->get('/method/boleto', 'Checkout:boleto', 'checkout.boleto');
39
$router->get('/method/credit', 'Checkout:credit', 'checkout.credit');
40
$router->get('/method/debit', 'Checkout:debit', 'checkout.debit');
41
$router->get('/success', 'Checkout:success', 'checkout.success');
42
43
// Products
44
$router->get('/product/insert', 'Web:productInsert', 'web.productInsert');
45
$router->post('/product/insert', 'Products:insert', 'products.insert');
46
$router->post('/product/image/insert', 'Products:image', 'products.image');
47
48
/**
49
 * LOGIN
50
 */
51
$router->group(null);
52
$router->get('/login', 'Login:loginn', 'login.login');
53
$router->get('/login/facebook', 'Login:loginn', 'auth.facebook');
54
$router->get('/login/google', 'Login:loginn', 'auth.google');
55
$router->get('/forget', 'Login:forget', 'login.forget');
56
$router->get('/reset/{email}/{forget}', 'Login:reset', 'login.reset');
57
$router->get('/register', 'Login:register', 'login.register');
58
59
/**
60
 * AUTH
61
 */
62
// $router->group(null);
63
$router->post('/login', 'Auth:login', 'auth.login');
64
$router->post('/register', 'Auth:register', 'auth.register');
65
$router->post('/forget', 'Auth:forget', 'auth.forget');
66
$router->post('/reset', 'Auth:reset', 'auth.reset');
67
68
/**
69
 * AUTH SOCIAL
70
 */
71
// $router->post('/login/facebook', 'Auth:loginFacebook', 'auth.loginFacebook');
72
73
/**
74
 * PROFILE
75
 */
76
$router->group('/me');
77
$router->get('/', 'App:account', 'app.account');
78
$router->get('/logoff', 'App:logoff', 'app.logoff');
79
80
/**
81
 * ERRORS
82
 */
83
$router->group('ops');
84
$router->get('/{errcode}', 'Web:error', 'web.error');
85
86
/**
87
 * ROUTE PROCESS
88
 */
89
$router->dispatch();
90
91
/**
92
 * ERRORS PROCESS
93
 */
94
if ($router->error()) {
95
    $router->redirect('web.error', ['errcode' => $router->error()]);
96
}
97
98
@ob_end_flush();
99
@closelog();
100