Browse Source

Adding new files due new changes.

jmontoyaa 7 years ago
parent
commit
9a22df04b9

+ 3 - 0
.gitignore

@@ -52,3 +52,6 @@ plugin/bbb/config.vm.php
 # Cron temp files
 main/cron/incoming/*
 plugin/vchamilo/templates/*
+###> symfony/web-server-bundle ###
+.web-server-pid
+###< symfony/web-server-bundle ###

+ 34 - 0
Makefile

@@ -0,0 +1,34 @@
+ifndef APP_ENV
+	include .env
+endif
+
+###> symfony/framework-bundle ###
+cache-clear:
+	@test -f bin/console && bin/console cache:clear --no-warmup || rm -rf var/cache/*
+.PHONY: cache-clear
+
+cache-warmup: cache-clear
+	@test -f bin/console && bin/console cache:warmup || echo "cannot warmup the cache (needs symfony/console)"
+.PHONY: cache-warmup
+
+CONSOLE=bin/console
+sf_console:
+	@test -f $(CONSOLE) || printf "Run \033[32mcomposer require cli\033[39m to install the Symfony console.\n"
+	@exit
+
+serve_as_sf: sf_console
+	@test -f $(CONSOLE) && $(CONSOLE)|grep server:start > /dev/null || ${MAKE} serve_as_php
+	@$(CONSOLE) server:start --docroot=public/ || exit 1
+
+	@printf "Quit the server with \033[32;49mbin/console server:stop.\033[39m\n"
+
+serve_as_php:
+	@printf "\033[32;49mServer listening on http://127.0.0.1:8000\033[39m\n";
+	@printf "Quit the server with CTRL-C.\n"
+	@printf "Run \033[32mcomposer require symfony/web-server-bundle\033[39m for a better web server\n"
+	php -S 127.0.0.1:8000 -t public
+
+serve:
+	@${MAKE} serve_as_sf
+.PHONY: sf_console serve serve_as_sf serve_as_php
+###< symfony/framework-bundle ###

+ 60 - 0
config/bundles.php

@@ -0,0 +1,60 @@
+<?php
+
+return [
+    'Symfony\Bundle\FrameworkBundle\FrameworkBundle' => ['all' => true],
+    'Chamilo\CoreBundle\ChamiloCoreBundle' => ['all' => true],
+    'Chamilo\CourseBundle\ChamiloCourseBundle' => ['all' => true],
+    'Chamilo\SettingsBundle\ChamiloSettingsBundle' => ['all' => true],
+    'Chamilo\PageBundle\ChamiloPageBundle' => ['all' => true],
+    'Chamilo\UserBundle\ChamiloUserBundle' => ['all' => true],
+    'Sonata\UserBundle\SonataUserBundle' => ['all' => true],
+    'Symfony\Bundle\MonologBundle\MonologBundle' => ['all' => true],
+    'Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle' => ['all' => true],
+    'Doctrine\Bundle\DoctrineBundle\DoctrineBundle' => ['all' => true],
+    'Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle' => ['all' => true],
+    'Knp\Bundle\MenuBundle\KnpMenuBundle' => ['all' => true],
+    'Symfony\Bundle\AsseticBundle\AsseticBundle' => ['all' => true],
+    'Sonata\EasyExtendsBundle\SonataEasyExtendsBundle' => ['all' => true],
+    'FOS\UserBundle\FOSUserBundle' => ['all' => true],
+    'Sonata\DatagridBundle\SonataDatagridBundle' => ['all' => true],
+    'Sonata\CoreBundle\SonataCoreBundle' => ['all' => true],
+    'Sonata\BlockBundle\SonataBlockBundle' => ['all' => true],
+    'Sonata\AdminBundle\SonataAdminBundle' => ['all' => true],
+    'Sonata\IntlBundle\SonataIntlBundle' => ['all' => true],
+    'Spy\TimelineBundle\SpyTimelineBundle' => ['all' => true],
+    'Sonata\TimelineBundle\SonataTimelineBundle' => ['all' => true],
+    'FOS\RestBundle\FOSRestBundle' => ['all' => true],
+    //'Sonata\CommentBundle\SonataCommentBundle' => ['all' => true],
+    'winzou\Bundle\StateMachineBundle\winzouStateMachineBundle' => ['all' => true],
+    //'Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle' => ['all' => true],
+    'WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle' => ['all' => true],
+    'Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle' => ['all' => true],
+    'Sylius\Bundle\ResourceBundle\SyliusResourceBundle' => ['all' => true],
+    'Oneup\FlysystemBundle\OneupFlysystemBundle' => ['all' => true],
+    'Sylius\Bundle\FlowBundle\SyliusFlowBundle' => ['all' => true],
+    'Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle' => ['all' => true],
+    'Sylius\Bundle\SettingsBundle\SyliusSettingsBundle' => ['all' => true],
+    'Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle' => ['all' => true],
+    'Sonata\NotificationBundle\SonataNotificationBundle' => ['all' => true],
+    'Sonata\MediaBundle\SonataMediaBundle' => ['all' => true],
+    'Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle' => ['all' => true],
+    'Sonata\SeoBundle\SonataSeoBundle' => ['all' => true],
+    'Sonata\CacheBundle\SonataCacheBundle' => ['all' => true],
+    'Sonata\PageBundle\SonataPageBundle' => ['all' => true],
+    'Knp\Bundle\MarkdownBundle\KnpMarkdownBundle' => ['all' => true],
+    'Ivory\CKEditorBundle\IvoryCKEditorBundle' => ['all' => true],
+    'Sonata\FormatterBundle\SonataFormatterBundle' => ['all' => true],
+    'Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle' => ['all' => true],
+    'Sonata\ClassificationBundle\SonataClassificationBundle' => ['all' => true],
+    'Liip\ThemeBundle\LiipThemeBundle' => ['all' => true],
+    'Liip\ImagineBundle\LiipImagineBundle' => ['all' => true],
+    'FM\ElfinderBundle\FMElfinderBundle' => ['all' => true],
+    'FOS\JsRoutingBundle\FOSJsRoutingBundle' => ['all' => true],
+    'HWI\Bundle\OAuthBundle\HWIOAuthBundle' => ['all' => true],
+    'Symfony\Bundle\TwigBundle\TwigBundle' => ['all' => true],
+    'Symfony\Bundle\SecurityBundle\SecurityBundle' => ['all' => true],
+    //'FOS\CommentBundle\FOSCommentBundle' => ['all' => true],
+    'Symfony\Bundle\WebServerBundle\WebServerBundle' => ['dev' => true],
+    'Lunetics\LocaleBundle\LuneticsLocaleBundle' => ['all' => true],
+    'Symfony\Bundle\WebProfilerBundle\WebProfilerBundle' => ['dev' => true, 'test' => true],
+];

+ 18 - 0
config/container.yaml

@@ -0,0 +1,18 @@
+# Put parameters here that don't need to change on each machine where the app is deployed
+# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
+parameters:
+    password_encryption: sha1
+    locale: 'en'
+    url_append: ''
+    course_info_is_not_editable: false
+    sonata_media.cdn.host: /uploads/media
+    sonata_page.varnish.command: 'if [ ! -r "/etc/varnish/secret" ]; then echo "VALID ERROR :/"; else varnishadm -S /etc/varnish/secret -T 127.0.0.1:6082 {{ COMMAND }} "{{ EXPRESSION }}"; fi;'
+    locales:
+        - en
+        - fr
+        - es
+        - de
+    twig.form.resources: ['bootstrap_3_layout.html.twig']
+
+
+services:

+ 103 - 0
config/packages/chamilo.yaml

@@ -0,0 +1,103 @@
+services:
+    # default configuration for services in *this* file
+    _defaults:
+        # automatically injects dependencies in your services
+        autowire: true
+        # automatically registers your services as commands, event subscribers, etc.
+        autoconfigure: true
+        # this means you cannot fetch services directly from the container via $container->get()
+        # if you need to do this, you can override this setting on individual services
+        public: false
+
+    # makes classes in src/ available to be used as services
+    # this creates a service per class whose id is the fully-qualified class name
+    AdminBundle\:
+        resource: '../../src/AdminBundle/*'
+        # you can exclude directories or files
+        # but if a service is unused, it's removed anyway
+        exclude: '../../src/AdminBundle/{ChamiloAdminBundle.php,Entity,Repository,Tests}'
+
+    ClassificationBundle\:
+        resource: '../../src/ClassificationBundle/*'
+        # you can exclude directories or files
+        # but if a service is unused, it's removed anyway
+        exclude: '../../src/ClassificationBundle/{ChamiloClassificationBundle.php,Entity,Admin,Document,Repository,Tests}'
+
+    ContactBundle\:
+        resource: '../../src/ContactBundle/*'
+        # you can exclude directories or files
+        # but if a service is unused, it's removed anyway
+        exclude: '../../src/ContactBundle/{ChamiloContactBundle.php,Entity,Admin,Controller,DependencyInjection,Form,Repository,Tests}'
+
+    Chamilo\CoreBundle\:
+        resource: '../../src/CoreBundle/*'
+        # you can exclude directories or files
+        # but if a service is unused, it's removed anyway
+        exclude: '../../src/CoreBundle/{Admin,Block,Component,Composer,DependencyInjection,EventListener,Form,Framework,Menu,Migrations,Security,Settings,Twig,Controller,ChamiloCoreBundle.php,Entity,Repository,Tests}'
+
+    Chamilo\CoreBundle\Controller\:
+        resource: '../../src/CoreBundle/Controller'
+        public: true
+        tags: ['controller.service_arguments']
+
+    Chamilo\UserBundle\:
+        resource: '../../src/UserBundle/*'
+        # you can exclude directories or files
+        # but if a service is unused, it's removed anyway
+        exclude: '../../src/UserBundle/{Admin,Block,Component,Composer,DependencyInjection,EventListener,Form,Framework,Menu,Migrations,Security,Settings,Twig,Controller,ChamiloUserBundle.php,Entity,Repository,Tests}'
+
+
+    # controllers are imported separately to make sure they're public
+    # and have a tag that allows actions to type-hint services
+#    CoreBundle\Controller\:
+#        resource: '../../src/CoreBundle/Controller'
+#        public: true
+#        tags: ['controller.service_arguments']
+
+fos_user:
+    db_driver: orm # can be orm or odm
+    firewall_name:  secured_area
+
+    # if you change the class configuration, please also alter the sonata_user.yml file
+    user_class: Chamilo\UserBundle\Entity\User
+
+    group:
+        group_class:   Chamilo\UserBundle\Entity\Group
+        group_manager: sonata.user.orm.group_manager
+
+    service:
+        user_manager: sonata.user.orm.user_manager
+
+    from_email:
+        address: 'test@example.com'
+        sender_name: 'test@example.com'
+
+#fos_comment:
+#    db_driver: orm
+#    class:
+#        model:
+#            comment: Application\Sonata\CommentBundle\Entity\Comment
+#            thread: Application\Sonata\CommentBundle\Entity\Thread
+#    form:
+#        comment:
+#            type: sonata_comment_comment
+lunetics_locale:
+    guessing_order:
+        - session
+        - query
+        - router
+
+        #- browser
+
+    allowed_locales: '%locales%'
+
+imports:
+    - { resource: ../../src/CoreBundle/Resources/config/services.yml }
+    - { resource: ../../app/config/sonata/sonata_admin.yml }
+    - { resource: ../../app/config/sonata/sonata_user.yml }
+    - { resource: ../../app/config/sonata/sonata_block.yml }
+    - { resource: ../../app/config/sonata/sonata_timeline.yml }
+    - { resource: ../../app/config/sonata/sonata_media.yml }
+    - { resource: ../../app/config/sonata/sonata_page.yml }
+    - { resource: ../../app/config/sonata/sonata_formatter.yml }
+    - { resource: ../../app/config/sonata/sonata_block.yml }

+ 15 - 0
config/packages/doctrine.yaml

@@ -0,0 +1,15 @@
+doctrine:
+    dbal:
+        url: '%env(DATABASE_URL)%'
+    orm:
+        auto_generate_proxy_classes: '%kernel.debug%'
+        naming_strategy: doctrine.orm.naming_strategy.underscore
+        auto_mapping: true
+        mappings:
+            App:
+                is_bundle: false
+                type: annotation
+                dir: '%kernel.project_dir%/src/Entity'
+                prefix: 'App\Entity\'
+                alias: App
+

+ 2 - 0
config/packages/doctrine_migrations.yaml

@@ -0,0 +1,2 @@
+doctrine_migrations:
+    dir_name: '%kernel.project_dir%/src/Migrations'

+ 31 - 0
config/packages/fm_elfinder.yaml

@@ -0,0 +1,31 @@
+fm_elfinder:
+    assets_path: /chamilo_master/web/assets
+    instances:
+        default:
+            locale: %locale% # defaults to current request locale
+            editor: ckeditor # other options are tinymce, tinymce4, form, custom and simple
+            fullscreen: true # defaults true, applies to simple and ckeditor editors
+            theme: smoothness # jquery theme
+            include_assets: true # disable if you want to handle loading of the javascript and css assets yourself
+            connector:
+                debug: false # defaults to false
+                roots:       # at least one root must be defined
+#                    uploads:
+#                        show_hidden: false # defaults to false
+#                        driver: LocalFileSystem
+#                        path: uploads
+#                        upload_allow: ['image/png', 'image/jpg', 'image/jpeg']
+#                        upload_deny: ['all']
+#                        upload_max_size: 2M
+                    local:
+                        driver: Flysystem
+                        path: uploads
+                        flysystem:
+                            type: local
+                            options:
+                              local:
+                                  path: %kernel.root_dir%/../web/media/
+                        upload_allow: ['all']
+                        #upload_allow: ['image/png', 'image/jpg', 'image/jpeg']
+                        #upload_deny: ['all']
+                        upload_max_size: 2M

+ 24 - 0
config/packages/framework.yaml

@@ -0,0 +1,24 @@
+framework:
+    secret: '%env(APP_SECRET)%'
+    #default_locale: en
+    #csrf_protection: null
+    #http_method_override: true
+    #trusted_hosts: null
+    # https://symfony.com/doc/current/reference/configuration/framework.html#handler-id
+    #session:
+    #    handler_id: session.handler.native_file
+    #    save_path: '%kernel.project_dir%/var/sessions/%kernel.environment%'
+    #esi: ~
+    #fragments: ~
+    php_errors:
+        log: true
+
+    templating:
+        engines: ['twig', 'php']
+    session:
+        # handler_id set to null will use default session handler from php.ini
+        handler_id: ~
+        name: ch_sid
+    fragments:       ~
+    http_method_override: true
+    assets: ~

+ 2 - 0
config/packages/framework_extra.yaml

@@ -0,0 +1,2 @@
+framework:
+    annotations: true

+ 41 - 0
config/packages/hwi_oauth.yaml

@@ -0,0 +1,41 @@
+hwi_oauth:
+    connect:
+        account_connector: chamilo_user_provider
+    firewall_names: [secured_area]
+    resource_owners:
+        github:
+            type:                github
+            client_id:           <client_id>
+            client_secret:       <client_secret>
+        facebook:
+            type:                facebook
+            client_id:           <client_id>
+            client_secret:       <client_secret>
+        google:
+            type:                google
+            client_id:           <client_id>
+            client_secret:       <client_secret>
+            scope:               "email profile"
+        my_custom_oauth2:
+            type:                oauth2
+            client_id:           <client_id>
+            client_secret:       <client_secret>
+            access_token_url:    https://path.to/oauth/v2/token
+            authorization_url:   https://path.to/oauth/v2/authorize
+            infos_url:           https://path.to/api/user
+            scope:               "user_details"
+            user_response_class: HWI\Bundle\OAuthBundle\OAuth\Response\PathUserResponse
+            paths:
+                identifier: id
+                nickname:   username
+                realname:   fullname
+    fosub:
+        # try 30 times to check if a username is available (foo, foo1, foo2 etc)
+        username_iterations: 30
+
+        # mapping between resource owners (see below) and properties
+        properties:
+            github: githubId
+            google: googleId
+            facebook: facebookId
+            my_custom_provider: customId

+ 3 - 0
config/packages/routing.yaml

@@ -0,0 +1,3 @@
+framework:
+    router:
+        strict_requirements: null

+ 18 - 0
config/packages/security.yaml

@@ -0,0 +1,18 @@
+security:
+    # https://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
+    providers:
+        in_memory: { memory: ~ }
+    firewalls:
+        dev:
+            pattern: ^/(_(profiler|wdt)|css|images|js)/
+            security: false
+        main:
+            anonymous: ~
+
+            # activate different ways to authenticate
+
+            # http_basic: ~
+            # https://symfony.com/doc/current/book/security.html#a-configuring-how-your-users-will-authenticate
+
+            # form_login: ~
+            # https://symfony.com/doc/current/cookbook/security/form_login_setup.html

+ 3 - 0
config/packages/swiftmailer.yaml

@@ -0,0 +1,3 @@
+swiftmailer:
+    url: '%env(MAILER_URL)%'
+    spool: { type: 'memory' }

+ 7 - 0
config/packages/translation.yaml

@@ -0,0 +1,7 @@
+framework:
+    default_locale: '%locale%'
+    translator:
+        paths:
+            - '%kernel.project_dir%/translations/'
+        fallbacks:
+            - '%locale%'

+ 4 - 0
config/packages/twig.yaml

@@ -0,0 +1,4 @@
+twig:
+    paths: ['%kernel.project_dir%/templates']
+    debug: '%kernel.debug%'
+    strict_variables: '%kernel.debug%'

+ 13 - 0
config/routing.yaml

@@ -0,0 +1,13 @@
+#index:
+#    path: /
+#    defaults: { _controller: 'App\Controller\DefaultController::index' }
+
+# Depends on sensio/framework-extra-bundle, doctrine/annotations, and doctrine/cache
+#   install with composer req sensio/framework-extra-bundle annot
+#controllers:
+#    resource: ../src/Controller/
+#    type: annotation
+
+#core:
+#    resource: '../../src/CoreBundle/Controller'
+#    type: annotation

+ 48 - 0
config/services.yaml

@@ -0,0 +1,48 @@
+# Put parameters here that don't need to change on each machine where the app is deployed
+# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
+parameters:
+    locale: 'en'
+
+    twig:
+        form:
+            resources:
+                - 'GeneratorBundle::fields.html.twig'
+
+    mailer_transport: smtp
+    mailer_host: 127.0.0.1
+    mailer_user: admin@example.com
+    mailer_password: null
+    url_append: ''
+    course_info_is_not_editable: false
+    sonata_media.cdn.host: /uploads/media
+
+
+services:
+    # default configuration for services in *this* file
+    _defaults:
+        # automatically injects dependencies in your services
+        autowire: true
+        # automatically registers your services as commands, event subscribers, etc.
+        autoconfigure: true
+        # this means you cannot fetch services directly from the container via $container->get()
+        # if you need to do this, you can override this setting on individual services
+        public: false
+
+    # makes classes in src/ available to be used as services
+    # this creates a service per class whose id is the fully-qualified class name
+    App\:
+        resource: '../src/*'
+        # you can exclude directories or files
+        # but if a service is unused, it's removed anyway
+        exclude: '../src/{Entity,Repository,Tests}'
+
+    # controllers are imported separately to make sure they're public
+    # and have a tag that allows actions to type-hint services
+    App\Controller\:
+        resource: '../src/Controller'
+        public: true
+        tags: ['controller.service_arguments']
+   twig:
+      form:
+          resources:
+              - 'GeneratorBundle::fields.html.twig'

+ 1 - 175
index.php

@@ -7,179 +7,5 @@
 */
 
 // @todo change root .htaccess
-header('Location: web/app_dev.php');
+header('Location: public/index.php');
 exit;
-
-use ChamiloSession as Session;
-
-/**
- * @package chamilo.main
- */
-
-define('CHAMILO_HOMEPAGE', true);
-define('CHAMILO_LOAD_WYSIWYG', false);
-
-/* Flag forcing the 'current course' reset, as we're not inside a course anymore. */
-// Maybe we should change this into an api function? an example: CourseManager::unset();
-$cidReset = true;
-
-require_once 'main/inc/global.inc.php';
-//require_once 'main/auth/external_login/facebook.inc.php';
-
-// The section (for the tabs).
-$this_section = SECTION_CAMPUS;
-
-$header_title = null;
-if (!api_is_anonymous()) {
-    $header_title = ' ';
-}
-
-$controller = new IndexManager($header_title);
-
-//Actions
-$loginFailed = isset($_GET['loginFailed']) ? true : isset($loginFailed);
-
-if (!empty($_GET['logout'])) {
-    $redirect = !empty($_GET['no_redirect']) ? false : true;
-    // pass $logoutInfo defined in local.inc.php
-    $controller->logout($redirect, $logoutInfo);
-}
-
-/**
- * Registers in the track_e_default table (view in important activities in admin
- * interface) a possible attempted break in, sending auth data through get.
- * @todo This piece of code should probably move to local.inc.php where the
- * actual login / logout procedure is handled.
- * The real use of this code block should be seriously considered as well.
- * This form should just use a security token and get done with it.
- */
-if (isset($_GET['submitAuth']) && $_GET['submitAuth'] == 1) {
-    $i = api_get_anonymous_id();
-    Event::addEvent(
-        LOG_ATTEMPTED_FORCED_LOGIN,
-        'tried_hacking_get',
-        $_SERVER['REMOTE_ADDR'].(empty($_POST['login']) ? '' : '/'.$_POST['login']),
-        null,
-        $i
-    );
-    echo 'Attempted breakin - sysadmins notified.';
-    session_destroy();
-    die();
-}
-
-// Delete session item necessary to check for legal terms
-if (api_get_setting('allow_terms_conditions') === 'true') {
-    Session::erase('term_and_condition');
-}
-//If we are not logged in and customapages activated
-if (!api_get_user_id() && CustomPages::enabled()) {
-    if (Request::get('loggedout')) {
-        CustomPages::display(CustomPages::LOGGED_OUT);
-    } else {
-        CustomPages::display(CustomPages::INDEX_UNLOGGED);
-    }
-}
-
-/**
- * @todo This piece of code should probably move to local.inc.php where the
- * actual login procedure is handled.
- * @todo Check if this code is used. I think this code is never executed because
- * after clicking the submit button the code does the stuff
- * in local.inc.php and then redirects to index.php or user_portal.php depending
- * on api_get_setting('page_after_login').
- */
-if (!empty($_POST['submitAuth'])) {
-    // The user has been already authenticated, we are now to find the last login of the user.
-    if (isset($_user['user_id'])) {
-        $track_login_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
-        $sql = "SELECT UNIX_TIMESTAMP(login_date)
-                FROM $track_login_table
-                WHERE login_user_id = '".$_user['user_id']."'
-                ORDER BY login_date DESC LIMIT 1";
-        $result_last_login = Database::query($sql);
-        if (!$result_last_login) {
-            if (Database::num_rows($result_last_login) > 0) {
-                $user_last_login_datetime = Database::fetch_array($result_last_login);
-                $user_last_login_datetime = $user_last_login_datetime[0];
-                Session::write('user_last_login_datetime', $user_last_login_datetime);
-            }
-        }
-    }
-} else {
-    // Only if login form was not sent because if the form is sent the user was already on the page.
-    Event::event_open();
-}
-
-if (api_get_setting('display_categories_on_homepage') === 'true') {
-    $controller->tpl->assign('course_category_block', $controller->return_courses_in_categories());
-}
-
-$controller->set_login_form();
-
-//@todo move this inside the IndexManager
-if (!api_is_anonymous()) {
-    $controller->tpl->assign('profile_block', $controller->return_profile_block());
-    $controller->tpl->assign('user_image_block', $controller->return_user_image_block());
-
-    if (api_is_platform_admin()) {
-        $controller->tpl->assign('course_block', $controller->return_course_block());
-    } else {
-        $controller->tpl->assign('teacher_block', $controller->return_teacher_link());
-    }
-}
-
-$hot_courses = '';
-$announcements_block = '';
-
-// Display the Site Use Cookie Warning Validation
-$useCookieValidation = api_get_setting('cookie_warning');
-if ($useCookieValidation === 'true') {
-    if (isset($_POST['acceptCookies'])) {
-        api_set_site_use_cookie_warning_cookie();
-    } elseif (!api_site_use_cookie_warning_cookie_exist()) {
-        if (Template::isToolBarDisplayedForUser()) {
-            $controller->tpl->assign('toolBarDisplayed', true);
-        } else {
-            $controller->tpl->assign('toolBarDisplayed', false);
-        }
-        $controller->tpl->assign('displayCookieUsageWarning', true);
-    }
-}
-
-// When loading a chamilo page do not include the hot courses and news
-
-if (!isset($_REQUEST['include'])) {
-    if (api_get_setting('show_hot_courses') == 'true') {
-        $hot_courses = $controller->return_hot_courses();
-    }
-    $announcements_block = $controller->return_announcements();
-}
-
-$controller->tpl->assign('hot_courses', $hot_courses);
-$controller->tpl->assign('announcements_block', $announcements_block);
-$controller->tpl->assign('home_page_block', $controller->return_home_page());
-$controller->tpl->assign('navigation_course_links', $controller->return_navigation_links());
-$controller->tpl->assign('notice_block', $controller->return_notice());
-//$controller->tpl->assign('main_navigation_block', $controller->return_navigation_links());
-$controller->tpl->assign('help_block', $controller->return_help());
-
-if (api_is_platform_admin() || api_is_drh()) {
-    $controller->tpl->assign('skills_block', $controller->return_skills_links());
-}
-
-if (api_is_anonymous()) {
-    $controller->tpl->setLoginBodyClass();
-}
-
-// direct login to course
-if (isset($_GET['firstpage'])) {
-    api_set_firstpage_parameter($_GET['firstpage']);
-    // if we are already logged, go directly to course
-    if (api_user_is_login()) {
-        echo "<script>self.location.href='index.php?firstpage=".Security::remove_XSS($_GET['firstpage'])."'</script>";
-    }
-} else {
-    api_delete_firstpage_parameter();
-}
-
-$controller->tpl->display_two_col_template();

+ 30 - 0
public/index.php

@@ -0,0 +1,30 @@
+<?php
+
+use Chamilo\Kernel;
+use Symfony\Component\Dotenv\Dotenv;
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\Debug\Debug;
+
+require __DIR__.'/../vendor/autoload.php';
+
+// The check is to ensure we don't use .env in production
+if (!getenv('APP_ENV')) {
+    (new Dotenv())->load(__DIR__.'/../.env');
+}
+
+if (getenv('APP_DEBUG')) {
+    // WARNING: You should setup permissions the proper way!
+    // REMOVE the following PHP line and read
+    // https://symfony.com/doc/current/book/installation.html#checking-symfony-application-configuration-and-setup
+    umask(0000);
+
+    Debug::enable();
+}
+
+// Request::setTrustedProxies(['0.0.0.0/0'], Request::HEADER_FORWARDED);
+
+$kernel = new Kernel(getenv('APP_ENV'), getenv('APP_DEBUG'));
+$request = Request::createFromGlobals();
+$response = $kernel->handle($request);
+$response->send();
+$kernel->terminate($request, $response);

+ 35 - 0
src/CourseBundle/Resources/views/Home/activity.html.twig

@@ -0,0 +1,35 @@
+{% for block in blocks %}
+    {% if block.title %}
+        <h2 class="title-tools">{{ block.title }}</h2>
+    {% endif %}
+
+    <div class="row {{ block.class }}">
+        {% if 'homepage_view'|api_get_setting == 'activity' %}
+            {% for item in block.content %}
+                <div class="offset2 col-md-4 course-tool">
+                    {{ item.extra }}
+                    {{ item.visibility }}
+                    {{ item.icon }}
+                    {{ item.link }}
+                </div>
+            {% endfor %}
+        {% endif %}
+
+        {% if 'homepage_view'|api_get_setting == 'activity_big' %}
+            {% for item in block.content %}
+                <div class="col-xs-6 col-md-3 course-tool">
+                    <div class="big_icon">
+                        {{ item.tool.image }}
+                    </div>
+                    <div class="content">
+                        <h4>
+                            {{ item.visibility }}
+                            {{ item.extra }}
+                            {{ item.link }}
+                        </h4>
+                    </div>
+                </div>
+            {% endfor %}
+        {% endif %}
+    </div>
+{% endfor %}