Failed Conditions
Push — improve/performance ( a6615f...85882a )
by Ryo
422:59 queued 414:38
created

html/index_dev.php (7 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/*
4
 * This file is part of EC-CUBE
5
 *
6
 * Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved.
7
 *
8
 * http://www.lockon.co.jp/
9
 *
10
 * This program is free software; you can redistribute it and/or
11
 * modify it under the terms of the GNU General Public License
12
 * as published by the Free Software Foundation; either version 2
13
 * of the License, or (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program; if not, write to the Free Software
22
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23
 */
24
25
use Symfony\Component\Debug\Debug;
26
use Symfony\Component\Yaml\Yaml;
27
28
// This check prevents access to debug front controllers that are deployed by accident to production servers.
29
// Feel free to remove this, extend it, or make something more sophisticated.
30
31
$allow = array(
32
    '127.0.0.1',
33
    'fe80::1',
34
    '::1',
35
);
36
37
if (isset($_SERVER['HTTP_CLIENT_IP'])
38
    || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
39
    || !in_array(@$_SERVER['REMOTE_ADDR'], $allow)
40
) {
41
    header('HTTP/1.0 403 Forbidden');
42
    exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
43
}
44
45
require_once __DIR__.'/../autoload.php';
46
47
Debug::enable();
48
49
// see http://silex.sensiolabs.org/doc/web_servers.html#php-5-4
50
$filename = __DIR__.preg_replace('#(\?.*)$#', '', $_SERVER['REQUEST_URI']);
51
if (php_sapi_name() === 'cli-server' && is_file($filename)) {
52
    return false;
53
}
54
55
// load configs.
56
$app = \Eccube\Application::getInstance();
57
58
// debug enable.
59
$app['debug'] = true;
60
61
// initialize servicies.
62
$app->initialize();
0 ignored issues
show
The method initialize cannot be called on $app (of type array<string,boolean,{"debug":"boolean"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
63
$app->initializePlugin();
0 ignored issues
show
The method initializePlugin cannot be called on $app (of type array<string,boolean,{"debug":"boolean"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
64
65
// load config dev
66
$conf = $app['config'];
67
$app['config'] = $app->share(function () use ($conf) {
0 ignored issues
show
The method share cannot be called on $app (of type array<string,boolean,{"debug":"boolean"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
68
    $confarray = array();
69
    $config_dev_file = __DIR__.'/../app/config/eccube/config_dev.yml';
70
    if (file_exists($config_dev_file)) {
71
        $config_dev = Yaml::parse(file_get_contents($config_dev_file));
72
        if (isset($config_dev)) {
73
            $confarray = array_replace_recursive($confarray, $config_dev);
74
        }
75
    }
76
77
    return array_replace_recursive($conf, $confarray);
78
});
79
// config_dev.ymlにmailが設定されていた場合、config_dev.ymlの設定内容を反映
80
$app['swiftmailer.options'] = $app['config']['mail'];
81
82
// Mail
83
if (isset($app['config']['delivery_address'])) {
84
    $app['mailer']->registerPlugin(new \Swift_Plugins_RedirectingPlugin($app['config']['delivery_address']));
85
}
86
87
// Silex Web Profiler
88
$app->register(new \Silex\Provider\WebProfilerServiceProvider(), array(
0 ignored issues
show
The method register cannot be called on $app (of type array<string,?,{"swiftmailer.options":"?"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
89
    'profiler.cache_dir' => __DIR__.'/../app/cache/profiler',
90
    'profiler.mount_prefix' => '/_profiler',
91
));
92
93
// Debug出力
94
$app->register(new \Eccube\ServiceProvider\DebugServiceProvider());
0 ignored issues
show
The method register cannot be called on $app (of type array<string,?,{"swiftmailer.options":"?"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
95
96
$app->register(new \Saxulum\SaxulumWebProfiler\Provider\SaxulumWebProfilerProvider());
0 ignored issues
show
The method register cannot be called on $app (of type array<string,?,{"swiftmailer.options":"?"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
97
98
$app->run();
0 ignored issues
show
The method run cannot be called on $app (of type array<string,?,{"swiftmailer.options":"?"}>).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
99