Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions app/.htaccess

This file was deleted.

7 changes: 7 additions & 0 deletions app/config/routing/global.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ home:
options:
sitemap: true

old_home_redirect:
path: /
controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController
defaults:
route: 'home'
permanent: false

become_sponsor_latest:
path: /become-sponsor
defaults: { _controller: AppBundle\Controller\Event\Lead\BecomeSponsorLatestAction }
Expand Down
8 changes: 4 additions & 4 deletions htdocs/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
# when compiling LESS/Sass/CoffeScript assets.
# Options FollowSymlinks

# Disabling MultiViews prevents unwanted negotiation, e.g. "/app" should not resolve
# to the front controller "/app.php" but be rewritten to "/app.php/app".
# Disabling MultiViews prevents unwanted negotiation, e.g. "/index" should not resolve
# to the front controller "/index.php" but be rewritten to "/index.php/index".
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
Expand All @@ -29,7 +29,7 @@ RewriteRule ^enquete$ "https://docs.google.com/forms/d/e/1FAIpQLSdtPRqp7AL73RhUS
# 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
# resolution of the index.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.
Expand All @@ -54,4 +54,4 @@ RewriteRule ^ask/forum/? https://event.afup.org [R=301,L]
RewriteRule ^ask/? / [R=301,L]

## This url are handled by symfony
RewriteRule (event|connect|_|association|talks|meetups|blog|admin|p|home|news|techno_watch|member|rss.xml)/? /app.php [END]
RewriteRule (event|connect|_|association|talks|meetups|blog|admin|p|home|news|techno_watch|member|rss.xml)/? /index.php [END]
56 changes: 0 additions & 56 deletions htdocs/app.php

This file was deleted.

68 changes: 53 additions & 15 deletions htdocs/index.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,56 @@
<?php

declare(strict_types=1);
/**
* Page d'accueil du site
*
* @author Perrick Penet <perrick@noparking.fr>
* @author Olivier Hoareau <olivier@phppro.fr>
* @copyright 2010 Association Française des Utilisateurs de PHP
*
* @category AFUP
* @package AFUP
* @group Pages
*/

// redirection vers le sous-site AFUP

header("Location: /home");

use AppBundle\AppKernel;
use Composer\Autoload\ClassLoader;
use Symfony\Component\HttpFoundation\Request;

$isDevEnv = isset($_ENV['APP_ENV']) && $_ENV['APP_ENV'] == 'dev';
$isTestEnv = isset($_ENV['APP_ENV']) && $_ENV['APP_ENV'] == 'test';

if ($_SERVER['HTTP_HOST'] === 'afup.dev' || $isDevEnv || $isTestEnv) {
if (!$isDevEnv && !$isTestEnv
&&
(
isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1', '192.168.42.1']) && php_sapi_name() !== 'cli-server'
)
) {
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check ' . basename(__FILE__) . ' for more information.');
}

/** @var ClassLoader $loader */
$loader = require __DIR__ . '/../vendor/autoload.php';

$kernel = $isDevEnv ? new AppKernel('dev', true) : new AppKernel('test', true);
} else {
/** @var ClassLoader $loader */
$loader = require __DIR__ . '/../vendor/autoload.php';

$kernel = new AppKernel('prod', false);
}

$request = Request::createFromGlobals();

$proxies = [
'127.0.0.1',
];
$ccReverseProxyIps = getenv('CC_REVERSE_PROXY_IPS');
if (false !== $ccReverseProxyIps) {
$proxies = array_merge($proxies, explode(',', $ccReverseProxyIps));
}

Request::setTrustedProxies(
$proxies,
Request::HEADER_X_FORWARDED_FOR
| Request::HEADER_X_FORWARDED_HOST
| Request::HEADER_X_FORWARDED_PORT
| Request::HEADER_X_FORWARDED_PROTO
);

$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
6 changes: 3 additions & 3 deletions htdocs/pages/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ RewriteRule ^(.*)$ "/?" [L,R=302]
RewriteRule ^lille.*$ /association/antennes? [R=302]

## Moved to Symfony
RewriteRule ^forumphp2016/(forum_planning|conferenciers|sessions).php.*$ /app.php [END]
RewriteRule ^forumphp2016/(forum_planning|conferenciers|sessions).php.*$ /index.php [END]

RewriteRule ^phptourluxembourg2015.*$ https://event.afup.org/archives/? [R=302]
RewriteRule ^phptourlyon2014.*$ https://event.afup.org/archives/? [R=302]
Expand All @@ -226,8 +226,8 @@ RewriteRule ^phptourclermont2016/forum_planning.php$ https://event.afup.org/foru
RewriteRule ^phptourclermont2016.*$ https://event.afup.org/archives/ [L,R=301]

## Moved to Symfony
RewriteRule ^rendezvous.*$ /app.php [END]
RewriteRule ^forumphp(2005|2006|2007|2008|2009).*$ /app.php [END]
RewriteRule ^rendezvous.*$ /index.php [END]
RewriteRule ^forumphp(2005|2006|2007|2008|2009).*$ /index.php [END]

# Redirection en cas d'acces direct aux pages Planete PHP
RewriteCond %{REQUEST_URI} ^/?pages/planete
Expand Down