forked from mautic/mautic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Symfony framework / Mautic skeleton
- Loading branch information
0 parents
commit f8381f0
Showing
32 changed files
with
1,397 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.* | ||
!.gitignore | ||
!.htaccess | ||
/mautic/app/bootstrap* | ||
/mautic/app/cache/* | ||
/mautic/app/logs/* | ||
/mautic/app/config/local.php | ||
/mautic/vendor/* | ||
/mautic/bin/* | ||
/mautic/composer.phar | ||
/mautic/composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Use the front controller as index file. It serves as a fallback solution when | ||
# every other rewrite/redirect fails (e.g. in an aliased environment without | ||
# mod_rewrite). Additionally, this reduces the matching process for the | ||
# start page (path "/") because otherwise Apache will apply the rewriting rules | ||
# to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl). | ||
#DirectoryIndex index.php | ||
|
||
<IfModule mod_rewrite.c> | ||
RewriteEngine On | ||
|
||
# Determine the RewriteBase automatically and set it as environment variable. | ||
# If you are using Apache aliases to do mass virtual hosting or installed the | ||
# project in a subdirectory, the base path will be prepended to allow proper | ||
# resolution of the app.php file and to redirect to the correct URI. It will | ||
# work in environments without path prefix as well, providing a safe, one-size | ||
# fits all solution. But as you do not need it in this case, you can comment | ||
# the following 2 lines to eliminate the overhead. | ||
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ | ||
RewriteRule ^(.*) - [E=BASE:%1] | ||
|
||
# Redirect to URI without front controller to prevent duplicate content | ||
# (with and without `/app.php`). Only do this redirect on the initial | ||
# rewrite by Apache and not on subsequent cycles. Otherwise we would get an | ||
# endless redirect loop (request -> rewrite to front controller -> | ||
# redirect -> request -> ...). | ||
# So in case you get a "too many redirects" error or you always get redirected | ||
# to the start page because your Apache does not expose the REDIRECT_STATUS | ||
# environment variable, you have 2 choices: | ||
# - disable this feature by commenting the following 2 lines or | ||
# - use Apache >= 2.3.9 and replace all L flags by END flags and remove the | ||
# following RewriteCond (best solution) | ||
RewriteCond %{ENV:REDIRECT_STATUS} ^$ | ||
RewriteRule ^index\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L] | ||
|
||
# If the requested filename exists, simply serve it. | ||
# We only want to let Apache serve files and not directories. | ||
RewriteCond %{REQUEST_FILENAME} -f | ||
RewriteRule .? - [L] | ||
|
||
# Rewrite all other queries to the front controller. | ||
RewriteRule .? %{ENV:BASE}/index.php [L] | ||
</IfModule> | ||
|
||
<IfModule !mod_rewrite.c> | ||
<IfModule mod_alias.c> | ||
# When mod_rewrite is not available, we instruct a temporary redirect of | ||
# the start page to the front controller explicitly so that the website | ||
# and the generated links can still be used. | ||
RedirectMatch 302 ^/$ /index.php/ | ||
# RedirectTemp cannot be used instead | ||
</IfModule> | ||
</IfModule> |
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* @package Mautic | ||
* @copyright 2014 Mautic, NP. All rights reserved. | ||
* @author Mautic | ||
* @link http://mautic.com | ||
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html | ||
*/ | ||
|
||
use Symfony\Component\ClassLoader\ApcClassLoader; | ||
use Symfony\Component\HttpFoundation\Request; | ||
|
||
$loader = require_once __DIR__.'/mautic/app/bootstrap.php.cache'; | ||
|
||
// Use APC for autoloading to improve performance. | ||
// Change 'sf2' to a unique prefix in order to prevent cache key conflicts | ||
// with other applications also using APC. | ||
/* | ||
$apcLoader = new ApcClassLoader('sf2', $loader); | ||
$loader->unregister(); | ||
$apcLoader->register(true); | ||
*/ | ||
|
||
require_once __DIR__.'/mautic/app/AppKernel.php'; | ||
//require_once __DIR__.'/mautic/app/AppCache.php'; | ||
|
||
$kernel = new AppKernel('prod', false); | ||
$kernel->loadClassCache(); | ||
//$kernel = new AppCache($kernel); | ||
|
||
// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter | ||
//Request::enableHttpMethodParameterOverride(); | ||
$request = Request::createFromGlobals(); | ||
$response = $kernel->handle($request); | ||
$response->send(); | ||
$kernel->terminate($request, $response); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* @package Mautic | ||
* @copyright 2014 Mautic, NP | ||
* @author Mautic | ||
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html | ||
*/ | ||
|
||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\Debug\Debug; | ||
|
||
// If you don't want to setup permissions the proper way, just uncomment the following PHP line | ||
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information | ||
//umask(0000); | ||
|
||
// This check prevents access to debug front controllers that are deployed by accident to production servers. | ||
// Feel free to remove this, extend it, or make something more sophisticated. | ||
if (isset($_SERVER['HTTP_CLIENT_IP']) | ||
|| isset($_SERVER['HTTP_X_FORWARDED_FOR']) | ||
|| !in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1')) | ||
) { | ||
header('HTTP/1.0 403 Forbidden'); | ||
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); | ||
} | ||
|
||
$loader = require_once __DIR__.'/mautic/app/bootstrap.php.cache'; | ||
Debug::enable(); | ||
|
||
require_once __DIR__.'/mautic/app/AppKernel.php'; | ||
|
||
$kernel = new AppKernel('dev', true); | ||
$kernel->loadClassCache(); | ||
$request = Request::createFromGlobals(); | ||
$response = $kernel->handle($request); | ||
$response->send(); | ||
$kernel->terminate($request, $response); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
deny from all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
require_once __DIR__.'/AppKernel.php'; | ||
|
||
use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache; | ||
|
||
class AppCache extends HttpCache | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
use Symfony\Component\HttpKernel\Kernel; | ||
use Symfony\Component\Config\Loader\LoaderInterface; | ||
|
||
class AppKernel extends Kernel | ||
{ | ||
public function registerBundles() | ||
{ | ||
$bundles = array( | ||
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), | ||
new Symfony\Bundle\SecurityBundle\SecurityBundle(), | ||
new Symfony\Bundle\MonologBundle\MonologBundle(), | ||
new Symfony\Bundle\TwigBundle\TwigBundle(), | ||
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), | ||
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), | ||
new Symfony\Bundle\AsseticBundle\AsseticBundle(), | ||
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), | ||
new Mautic\DashboardBundle\MauticDashboardBundle(), | ||
); | ||
|
||
if (in_array($this->getEnvironment(), array('dev', 'test'))) { | ||
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); | ||
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); | ||
} | ||
|
||
return $bundles; | ||
} | ||
|
||
public function registerContainerConfiguration(LoaderInterface $loader) | ||
{ | ||
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.php'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
use Doctrine\Common\Annotations\AnnotationRegistry; | ||
use Composer\Autoload\ClassLoader; | ||
|
||
/** | ||
* @var ClassLoader $loader | ||
*/ | ||
$loader = require __DIR__.'/../vendor/autoload.php'; | ||
|
||
AnnotationRegistry::registerLoader(array($loader, 'loadClass')); | ||
|
||
return $loader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?php | ||
|
||
$loader->import("parameters.php"); | ||
$loader->import("security.php"); | ||
|
||
$container->loadFromExtension("framework", array( | ||
"secret" => "%secret%", | ||
"router" => array( | ||
"resource" => "%kernel.root_dir%/config/routing.php", | ||
"strict_requirements" => null, | ||
), | ||
"form" => null, | ||
"csrf_protection" => null, | ||
"validation" => array( | ||
"enable_annotations" => true | ||
), | ||
"templating" => array( | ||
"engines" => array( | ||
"twig", | ||
"php" | ||
) | ||
), | ||
"default_locale" => "%locale%", | ||
"trusted_hosts" => null, | ||
"trusted_proxies" => null, | ||
"session" => array( //handler_id set to null will use default session handler from php.ini | ||
"handler_id" => null | ||
), | ||
"fragments" => null, | ||
"http_method_override" => true | ||
)); | ||
|
||
//Twig Configuration | ||
$container->loadFromExtension("twig", array( | ||
"debug" => "%kernel.debug%", | ||
"strict_variables" => "%kernel.debug%", | ||
)); | ||
|
||
|
||
//Assetic Configuration | ||
$container->loadFromExtension("assetic", array( | ||
"debug" => "%kernel.debug%", | ||
"use_controller" => false, | ||
"bundles" => array(), | ||
"filters" => array( | ||
"cssrewrite" => null | ||
) | ||
)); | ||
|
||
//Doctrine Configuration | ||
$container->loadFromExtension("doctrine", array( | ||
"dbal" => array( | ||
"driver" => "%database_driver%", | ||
"host" => "%database_host%", | ||
"port" => "%database_port%", | ||
"dbname" => "%database_name%", | ||
"user" => "%database_user%", | ||
"password" => "%database_password%", | ||
"charset" => "UTF8", | ||
//if using pdo_sqlite as your database driver, add the path in parameters.php | ||
//e.g. "database_path" => "%kernel.root_dir%/data/data.db3" | ||
//"path" => "%database_path%" | ||
), | ||
|
||
"orm" => array( | ||
"auto_generate_proxy_classes" => "%kernel.debug%", | ||
"auto_mapping" => true | ||
) | ||
)); | ||
|
||
//Swiftmailer Configuration | ||
$container->loadFromExtension("swiftmailer", array( | ||
"transport" => "%mailer_transport%", | ||
"host" => "%mailer_host%", | ||
"username" => "%mailer_user%", | ||
"password" => "%mailer_password%", | ||
"spool" => array( | ||
"type" => "memory" | ||
) | ||
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
$loader->import("config.php"); | ||
|
||
$container->loadFromExtension('framework', array( | ||
"router" => array( | ||
"resource" => "%kernel.root_dir%/config/routing_dev.php", | ||
"strict_requirements" => true | ||
), | ||
"profiler" => array( | ||
"only_exceptions" => false | ||
) | ||
)); | ||
|
||
$container->loadFromExtension("web_profiler", array( | ||
"toolbar" => true, | ||
"intercept_redirects" => false | ||
)); | ||
|
||
$container->loadFromExtension("monolog", array( | ||
"handlers" => array( | ||
"main" => array( | ||
"type" => "stream", | ||
"path" => "%kernel.logs_dir%/%kernel.environment%.log", | ||
"level" => "debug" | ||
), | ||
"console" => array( | ||
"type" => "console", | ||
"bubble" => false | ||
), | ||
// uncomment to get logging in your browser | ||
// you may have to allow bigger header sizes in your Web server configuration | ||
/* | ||
"firephp" => array( | ||
"type" => "firephp", | ||
"level" => "info" | ||
), | ||
"chromephp" => array( | ||
"type" => "chromephp", | ||
"level" => "info" | ||
), | ||
*/ | ||
) | ||
)); | ||
|
||
$container->loadFromExtension("assetic", array( | ||
"use_controller" => true | ||
)); | ||
|
||
/* | ||
$container->loadFromExtension("swiftmailer", array( | ||
"delivery_address" => "me@example.com" | ||
)); | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
$loader->import("config.php"); | ||
|
||
/* | ||
$container->loadFromExtension("framework", array( | ||
"validation" => array( | ||
"cache" => "apc" | ||
) | ||
)); | ||
$container->loadFromExtension("doctrine", array( | ||
"orm" => array( | ||
"metadata_cache_driver" => "apc", | ||
"result_cache_driver" => "apc", | ||
"query_cache_driver" => "apc" | ||
) | ||
)); | ||
*/ | ||
|
||
$container->loadFromExtension("monolog", array( | ||
"handlers" => array( | ||
"main" => array( | ||
"type" => "fingers_crossed", | ||
"action_level" => "error", | ||
"handler" => "nested" | ||
), | ||
"nested" => array( | ||
"type" => "stream", | ||
"path" => "%kernel.logs_dir%/%kernel.environment%.log", | ||
"level" => "debug" | ||
), | ||
"console" => array( | ||
"type" => "console" | ||
) | ||
) | ||
)); |
Oops, something went wrong.