Proyectos de Subversion LeadersLinked - Services

Rev

Rev 3 | Rev 5 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
use Laminas\Mvc\Application;
6
use Laminas\Stdlib\ArrayUtils;
7
 
8
//define('DIR_URL', dirname(__DIR__));
9
//define('SITE_URL',  'http://'  . $_SERVER['SERVER_NAME'] . '/');
10
//date_default_timezone_set('Etc/GMT+6');
11
 
3 efrain 12
 
13
header('Access-Control-Allow-Origin: *');
14
header("Access-Control-Allow-Headers: X-API-KEY, Origin, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method");
15
header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");
16
header("Allow: GET, POST, OPTIONS, PUT, DELETE");
17
$method = $_SERVER['REQUEST_METHOD'];
18
if($method == "OPTIONS") {
19
    die();
20
}
21
 
22
 
23
/*
24
 *
25
if (isset($_SERVER['HTTP_ORIGIN'])) {
26
    // should do a check here to match $_SERVER['HTTP_ORIGIN'] to a
27
    // whitelist of safe domains
28
    header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
29
    header('Access-Control-Allow-Credentials: true');
30
    header('Access-Control-Max-Age: 86400');    // cache for 1 day
31
}
32
// Access-Control headers are received during OPTIONS requests
33
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
34
 
35
    if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
36
        header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");
37
 
38
    if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
39
        header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
40
 
41
}
42
 */
43
 
1 efrain 44
ini_set('display_errors', '1');
45
ini_set('display_startup_errors', '1');
46
ini_set('log_errors', '1');
47
error_reporting(E_ALL);
48
 
4 efrain 49
echo '<pre>';
50
print_r($_SERVER);
51
print_r($_ENV);
52
print_r($_REQUEST);
53
echo '<pre>';
54
exit;
1 efrain 55
 
4 efrain 56
 
1 efrain 57
/**
58
 * This makes our life easier when dealing with paths. Everything is relative
59
 * to the application root now.
60
 */
61
chdir(dirname(__DIR__));
62
 
63
// Decline static file requests back to the PHP built-in webserver
64
if (php_sapi_name() === 'cli-server') {
65
    $path = realpath(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
66
    if (is_string($path) && __FILE__ !== $path && is_file($path)) {
67
        return false;
68
    }
69
    unset($path);
70
}
71
 
72
// Composer autoloading
73
include __DIR__ . '/../vendor/autoload.php';
74
 
75
if (! class_exists(Application::class)) {
76
    throw new RuntimeException(
77
        "Unable to load application.\n"
78
        . "- Type `composer install` if you are developing locally.\n"
79
        . "- Type `vagrant ssh -c 'composer install'` if you are using Vagrant.\n"
80
        . "- Type `docker-compose run lamians composer install` if you are using Docker.\n"
81
    );
82
}
83
 
84
// Retrieve configuration
85
$appConfig = require __DIR__ . '/../config/application.config.php';
86
if (file_exists(__DIR__ . '/../config/development.config.php')) {
87
    $appConfig = ArrayUtils::merge($appConfig, require __DIR__ . '/../config/development.config.php');
88
}
89
 
90
// Run the application!
91
Application::init($appConfig)->run();