Minor - WIP Fix UI installation process

- Fix login to use legacy and new login
pull/2487/head
jmontoyaa 7 years ago
parent 45532ef348
commit 4d505e07e2
  1. 33
      composer.json
  2. 2
      config/bundles.php
  3. 17
      config/packages/cmf_routing_bundle.yaml
  4. 24
      config/packages/fos_rest.yaml
  5. 12
      config/packages/prod/jms_serializer.yaml
  6. 67
      config/packages/sonata_cache.yaml
  7. 3
      config/packages/sonata_formatter.yaml
  8. 8
      config/packages/sonata_page.yaml
  9. 24
      config/packages/twig.yaml
  10. 1
      index.php
  11. 95
      main/inc/global.inc.php
  12. 34
      main/inc/lib/api.lib.php
  13. 17
      main/inc/lib/internationalization.lib.php
  14. 1
      main/inc/lib/template.lib.php
  15. 25
      main/install/index.php
  16. 5
      main/install/install.lib.php
  17. 6
      src/CoreBundle/Entity/SettingsCurrent.php
  18. 16
      src/CoreBundle/EventListener/LegacyListener.php
  19. 17
      src/CoreBundle/EventListener/LegacyLoginListener.php
  20. 1
      src/CoreBundle/EventListener/LoginSuccessHandler.php
  21. 10
      src/CoreBundle/Framework/Container.php
  22. 3
      src/CoreBundle/Resources/config/services.yml
  23. 19
      src/Kernel.php
  24. 10
      src/SettingsBundle/Manager/SettingsManager.php
  25. 2
      src/SettingsBundle/Templating/Helper/SettingsHelper.php
  26. 1
      src/ThemeBundle/ChamiloThemeBundle.php
  27. 16
      src/ThemeBundle/Controller/ExceptionController.php
  28. 51
      src/ThemeBundle/DependencyInjection/ChamiloThemeExtension.php
  29. 2
      src/UserBundle/Entity/User.php

@ -59,7 +59,7 @@
"twig/twig": "2.*",
"doctrine/orm": "^2.5.11",
"doctrine/dbal": "~2.5",
"doctrine/data-fixtures": "~1.0@dev",
"doctrine/doctrine-bundle": "^1.6.10",
"doctrine/doctrine-fixtures-bundle": "^3.0",
"doctrine/doctrine-migrations-bundle": "^1.3",
@ -75,26 +75,26 @@
"symfony/form": "^3.0|^4.0",
"symfony/framework-bundle": "^3.0|^4.0",
"symfony/monolog-bundle": "^3.1",
"symfony/polyfill-apcu": "^1.5",
"symfony/polyfill-apcu": "^1.6",
"symfony/security-bundle": "^3.0|^4.0",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/translation": "^4.0",
"symfony/twig-bundle": "^3.0|^4.0",
"symfony/validator": "^3.0|^4.0",
"symfony/yaml": "^3.0|^4.0",
"symfony/annotations-pack": "^1.0",
"symfony/webpack-encore-pack": "^1.0",
"symfony/apache-pack": "^1.0",
"twig/extensions": "^1.5",
"white-october/pagerfanta-bundle": "^1.1",
"chamilo/settings-bundle": "dev-master",
"sonata-project/admin-bundle": "3.x-dev",
"sonata-project/block-bundle": "~3.0",
"sonata-project/cache": "1.x-dev",
"sonata-project/cache-bundle": "~2.1@dev",
"sonata-project/classification-bundle": "~3.0",
"sonata-project/timeline-bundle" : "~3.0",
"sonata-project/core-bundle": "~3.0",
"sonata-project/datagrid-bundle": "^2.2",
"sonata-project/doctrine-extensions": "~1@dev",
@ -105,7 +105,7 @@
"sonata-project/intl-bundle": "~2.4.0",
"sonata-project/media-bundle": "~3.0",
"sonata-project/notification-bundle": "~3.0",
"sonata-project/page-bundle": "dev-master",
"sonata-project/page-bundle": "3.7.*",
"sonata-project/seo-bundle": "~2.0",
"sonata-project/sonata-composer": "dev-master",
"sonata-project/user-bundle": "4.x-dev",
@ -116,19 +116,18 @@
"sylius/resource-bundle": "1.0.4",
"sylius/resource": "~1.0",
"symfony/annotations-pack": "^1.0",
"friendsofsymfony/jsrouting-bundle": "~2.0",
"friendsofsymfony/rest-bundle": "~2.0",
"gedmo/doctrine-extensions": "~2.4",
"gregwar/captcha-bundle": "^2.0",
"helios-ag/fm-elfinder-bundle": "~6.0",
"doctrine/data-fixtures": "~1.0@dev",
"knplabs/gaufrette": "~0.3",
"knplabs/doctrine-behaviors": "~1.5",
"knplabs/knp-components": "^1.3",
"michelf/php-markdown": "~1.7",
"michelf/php-markdown": "~1.8",
"mopa/bootstrap-bundle": "~3.0",
"sabre/vobject": "~3.1",
@ -140,9 +139,7 @@
"zendframework/zend-http": "~2.7",
"zendframework/zend-permissions-acl": "~2.6",
"zendframework/zend-soap": "~2.6",
"robrichards/xmlseclibs": "3.0.*",
"szymach/c-pchart": "3.0.4",
"aferrandini/phpqrcode": "1.0.1",
"alchemy/zippy": "~0.4",
@ -150,8 +147,6 @@
"oneup/flysystem-bundle": "~3.0",
"studio-42/elfinder": "2.1.*",
"jbroadway/urlify": "1.1.0-stable",
"ircmaxell/password-compat": "~1.0.4",
"patchwork/utf8": "~1.3",
"ddeboer/data-import": "@stable",
"phpoffice/phpexcel": "~1.8",
@ -161,20 +156,16 @@
"graphp/algorithms": "~0.8.0",
"php-ffmpeg/php-ffmpeg": "0.5.1",
"imagine/imagine": "~0.6",
"jeroendesloovere/vcard": "^1.2",
"knplabs/doctrine-behaviors": "~1.1",
"jeroendesloovere/vcard": "~1.5",
"jimmiw/php-time-ago": "2.0.*",
"phpoffice/phpword": "^0.14.0",
"kigkonsult/icalcreator": "2.*",
"essence/essence": "~3.0",
"paragonie/random-lib": "2.0.0",
"knplabs/knp-components": "^1.3",
"symfony/webpack-encore-pack": "^1.0",
"lunetics/locale-bundle": "2.5.*",
"hwi/oauth-bundle": "^0.6.0",
"php-http/guzzle6-adapter": "^1.1",
"php-http/httplug-bundle": "^1.8",
"symfony/apache-pack": "^1.0"
"php-http/httplug-bundle": "^1.8"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.7",

@ -26,7 +26,6 @@ return [
Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle::class => ['all' => true],
Sonata\SeoBundle\SonataSeoBundle::class => ['all' => true],
Sonata\NotificationBundle\SonataNotificationBundle::class => ['all' => true],
Sonata\CacheBundle\SonataCacheBundle::class => ['all' => true],
Sonata\PageBundle\SonataPageBundle::class => ['all' => true],
Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle::class => ['all' => true],
Sonata\ClassificationBundle\SonataClassificationBundle::class => ['all' => true],
@ -66,4 +65,5 @@ return [
Lunetics\LocaleBundle\LuneticsLocaleBundle::class => ['all' => true],
Http\HttplugBundle\HttplugBundle::class => ['all' => true],
Oneup\FlysystemBundle\OneupFlysystemBundle::class => ['all' => true],
Sonata\CacheBundle\SonataCacheBundle::class => ['all' => true],
];

@ -1,10 +1,9 @@
# Install phpcr stack before using this configuration
#cmf_routing:
# chain:
# routers_by_id:
# cmf_routing.dynamic_router: 200
# router.default: 100
# dynamic:
# persistence:
# phpcr:
# enabled: true
cmf_routing:
chain:
routers_by_id:
# enable the DynamicRouter with high priority to allow overwriting configured routes with content
#symfony_cmf_routing_extra.dynamic_router: 200
# enable the symfony default router with a lower priority
router.default: 150 # First chamilo/symfony2 router
sonata.page.router: 100 # then the page router

@ -1,12 +1,12 @@
fos_rest:
param_fetcher_listener: true
body_listener: true
format_listener: true
view:
view_response_listener: force
body_converter:
enabled: false
validate: true
exception:
messages:
'Symfony\Component\HttpKernel\Exception\NotFoundHttpException': true
#fos_rest:
# param_fetcher_listener: true
# body_listener: true
# format_listener: true
# view:
# view_response_listener: force
# body_converter:
# enabled: false
# validate: true
# exception:
# messages:
# 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException': true

@ -1,6 +1,6 @@
jms_serializer:
visitors:
json:
options:
- JSON_UNESCAPED_SLASHES
- JSON_PRESERVE_ZERO_FRACTION
#jms_serializer:
# visitors:
# json:
# options:
# - JSON_UNESCAPED_SLASHES
# - JSON_PRESERVE_ZERO_FRACTION

@ -1,33 +1,42 @@
#
# more information can be found here http://sonata-project.org/bundles/cache
#
#sonata_cache:
# caches:
# esi:
# servers:
# - varnishadm -T 127.0.0.1:2000 {{ COMMAND }} "{{ EXPRESSION }}"
#
# ssi:
# token: TheToken
#
# mongo:
# database: cache
# collection: cache
# servers:
# - {host: 127.0.0.1, port: 27017, user: username, password: pASS'}
# - {host: 127.0.0.2}
#
# memcached:
# prefix: test # prefix to ensure there is no clash between instances
# servers:
# - {host: 127.0.0.1, port: 11211, weight: 0}
#
# predis:
# servers:
# - {host: 127.0.0.1, port: 11211, database: 6379}
## esi:
## servers:
## - varnishadm -T 127.0.0.1:2000 {{ COMMAND }} "{{ EXPRESSION }}"
##
## ssi:
## token: TheToken
##
## mongo:
## database: cache
## collection: cache
## servers:
## - {host: 127.0.0.1, port: 27017, user: username, password: pASS'}
## - {host: 127.0.0.2}
##
## memcached:
## prefix: test # prefix to ensure there is no clash between instances
## servers:
## - {host: 127.0.0.1, port: 11211, weight: 0}
##
## predis:
## servers:
## - {host: 127.0.0.1, port: 11211, database: 6379}
##
## apc:
## token: s3cur3 # token used to clear the related cache
## prefix: test # prefix to ensure there is no clash between instances
## servers:
## - { domain: kooqit.local, ip: 127.0.0.1, port: 80}
#
# apc:
# token: s3cur3 # token used to clear the related cache
# prefix: test # prefix to ensure there is no clash between instances
# servers:
# - { domain: kooqit.local, ip: 127.0.0.1, port: 80}
# symfony:
# token: s3cur3 # token used to clear the related cache
# php_cache_enabled: true # Optional (default: false), clear OPcache
## types: [mytype1, mycustomtype2] # Optional, you can restrict allowed cache types
## servers:
## - { domain: kooqit.local, ip: 127.0.0.1, port: 80 }
## timeout:
## RCV: { sec: 2, usec: 0 }
## SND: { sec: 2, usec: 0 }

@ -1,6 +1,3 @@
#
# more information can be found here http://sonata-project.org/bundles/formatter
#
sonata_formatter:
formatters:
markdown:

@ -1,12 +1,4 @@
# more information can be found here http://sonata-project.org/bundles/page
cmf_routing:
chain:
routers_by_id:
# enable the DynamicRouter with high priority to allow overwriting configured routes with content
#symfony_cmf_routing_extra.dynamic_router: 200
# enable the symfony default router with a lower priority
router.default: 150 # First chamilo/symfony2 router
sonata.page.router: 100 # then the page router
sonata_page:
class:
page: Chamilo\PageBundle\Entity\Page

@ -1,5 +1,5 @@
twig:
paths: ['%kernel.project_dir%/templates']
# paths: ['%kernel.project_dir%/templates']
debug: '%kernel.debug%'
strict_variables: '%kernel.debug%'
exception_controller: 'FOS\RestBundle\Controller\ExceptionController::showAction'
@ -24,3 +24,25 @@ twig:
header:
message:
show_media_element: 1
plugin_content_bottom:
plugin_content_top:
plugin_main_bottom:
plugin_course_tool_plugin:
plugin_footer_center:
plugin_footer_left:
plugin_footer_right:
plugin_header_center:
plugin_header_left:
plugin_header_right:
plugin_header_main:
plugin_login_bottom:
plugin_login_top:
plugin_login_left:
plugin_login_right:
plugin_main_top:
plugin_main_bottom:
plugin_menu_administrator:
plugin_menu_bottom:
plugin_menu_top:
plugin_pre_footer:
footer_extra_content:

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**

@ -21,31 +21,36 @@ use Chamilo\CoreBundle\Framework\Container;
// Showing/hiding error codes in global error messages.
define('SHOW_ERROR_CODES', false);
// Include the libraries that are necessary everywhere
require_once __DIR__.'/../../vendor/autoload.php';
$kernel = new Chamilo\Kernel('dev', true);
// Get settings from .env file created when installation Chamilo
$envFile = __DIR__.'/../../.env';
if (file_exists($envFile)) {
(new Dotenv())->load($envFile);
} else {
throw new \RuntimeException('APP_ENV environment variable is not defined.
You need to define environment variables for configuration to load variables from a .env file.');
}
// Determine the directory path where this current file lies.
// This path will be useful to include the other initialisation files.
$includePath = __DIR__;
$env = $_SERVER['APP_ENV'] ?? 'dev';
$kernel = new Chamilo\Kernel($env, true);
// Include the main Chamilo platform configuration file.
$alreadyInstalled = false;
if (file_exists($kernel->getConfigurationFile())) {
// Boot Symfony container
$kernel->boot();
if ($kernel->isInstalled()) {
require_once $kernel->getConfigurationFile();
$alreadyInstalled = true;
// Recalculate a system absolute path symlinks insensible.
$includePath = $_configuration['root_sys'].'main/inc/';
} else {
$_configuration = [];
//Redirects to the main/install/ page
if (!$alreadyInstalled) {
$global_error_code = 2;
// The system has not been installed yet.
require_once __DIR__.'/../inc/global_error_message.inc.php';
die();
}
// Redirects to the main/install/ page
$global_error_code = 2;
// The system has not been installed yet.
require_once __DIR__.'/../inc/global_error_message.inc.php';
exit;
}
$kernel->setApi($_configuration);
@ -56,31 +61,23 @@ if (!isset($GLOBALS['_configuration'])) {
$GLOBALS['_configuration'] = $_configuration;
}
// Include the main Chamilo platform library file.
require_once $_configuration['root_sys'].'main/inc/lib/api.lib.php';
$passwordEncryption = api_get_configuration_value('password_encryption');
// Do not over-use this variable. It is only for this script's local use.
$libraryPath = __DIR__.'/lib/';
if ($passwordEncryption === 'bcrypt') {
require_once __DIR__.'/../../vendor/ircmaxell/password-compat/lib/password.php';
}
// Include the main Chamilo platform library file.
require_once $libraryPath.'api.lib.php';
// Check the PHP version
api_check_php_version($includePath.'/');
api_check_php_version(__DIR__.'/');
// Specification for usernames:
// 1. ASCII-letters, digits, "." (dot), "_" (underscore) are acceptable, 40 characters maximum length.
// 2. Empty username is formally valid, but it is reserved for the anonymous user.
// 3. Checking the login_is_email portal setting in order to accept 100 chars maximum
define('USERNAME_MAX_LENGTH', 100);
// Fix bug in IIS that doesn't fill the $_SERVER['REQUEST_URI'].
api_request_uri();
define('_MPDF_TEMP_PATH', __DIR__.'/../../var/cache/mpdf/');
define('_MPDF_TTFONTDATAPATH', __DIR__.'/../../var/cache/mpdf/');
// Do not over-use this variable. It is only for this script's local use.
$libraryPath = __DIR__.'/lib/';
// @todo convert this libs in classes
require_once $libraryPath.'database.constants.inc.php';
require_once $libraryPath.'text.lib.php';
@ -92,33 +89,23 @@ require_once $libraryPath.'fileUpload.lib.php';
require_once $libraryPath.'fileDisplay.lib.php';
require_once $libraryPath.'course_category.lib.php';
$container = $kernel->getContainer();
$doctrine = $container->get('doctrine');
// Connect Chamilo with the Symfony container
$database = new \Database();
$database->setManager($doctrine->getManager());
$database->setConnection($doctrine->getConnection());
Container::setContainer($container);
\CourseManager::setCourseManager(
$container->get('chamilo_core.entity.manager.course_manager')
);
if (!is_dir(_MPDF_TEMP_PATH)) {
mkdir(_MPDF_TEMP_PATH, api_get_permissions_for_new_directories(), true);
}
if (file_exists(__DIR__.'/../../.env')) {
// Get settings from .env file created when installation chamilo
(new Dotenv())->load(__DIR__.'/../../.env');
$kernel->boot();
$container = $kernel->getContainer();
$doctrine = $container->get('doctrine');
// Connect Chamilo with the Symfony container
$database = new \Database();
$database->setManager($doctrine->getManager());
$database->setConnection($doctrine->getConnection());
Container::setContainer($container);
\CourseManager::setCourseManager(
$container->get('chamilo_core.entity.manager.course_manager')
);
} else {
$global_error_code = 3;
// The database server is not available or credentials are invalid.
require $includePath.'/global_error_message.inc.php';
die();
}
/* RETRIEVING ALL THE CHAMILO CONFIG SETTINGS FOR MULTIPLE URLs FEATURE*/
if (!empty($_configuration['multiple_access_urls'])) {
$_configuration['access_url'] = 1;
@ -401,7 +388,7 @@ if (isset($this_script) && $this_script == 'sub_language') {
$valid_languages = api_get_languages();
if (!empty($valid_languages)) {
if (!in_array($user_language, $valid_languages['folder'])) {
if (!in_array($user_language, $valid_languages)) {
$user_language = api_get_setting('platformLanguage');
}
@ -531,7 +518,7 @@ if (!empty($parent_path)) {
}
// include the local (contextual) parameters of this course or section
require $includePath.'/local.inc.php';
require __DIR__.'/local.inc.php';
// The global variable $text_dir has been defined in the language file trad4all.inc.php.
// For determining text direction correspondent to the current language

@ -1002,8 +1002,6 @@ function api_is_facebook_auth_activated()
function api_add_trailing_slash($path)
{
return substr($path, -1) == '/' ? $path : $path.'/';
// This code is about 20% faster than the preg_replace equivalent
//return preg_replace('/([^\/])$/', '$1/', $path);
}
/**
@ -3425,32 +3423,18 @@ function api_is_allowed($tool, $action, $task_id = 0)
*/
function api_is_anonymous($user_id = null, $db_check = false)
{
if (!isset($user_id)) {
$user_id = api_get_user_id();
}
if ($db_check) {
$info = api_get_user_info($user_id);
if ($info['status'] == ANONYMOUS) {
return true;
if (!isset($user_id)) {
$user_id = api_get_user_id();
}
}
$_user = api_get_user_info();
$info = api_get_user_info($user_id);
if (isset($_user['status']) && $_user['status'] == ANONYMOUS) {
//if ($_user['user_id'] == 0) {
// In some cases, api_set_anonymous doesn't seem to be triggered in local.inc.php. Make sure it is.
// Occurs in agenda for admin links - YW
global $use_anonymous;
if (isset($use_anonymous) && $use_anonymous) {
api_set_anonymous();
if ($info['status'] == 6 || $user_id == 0 || empty($info)) {
return true;
}
return true;
}
return (isset($_user['is_anonymous']) && $_user['is_anonymous'] === true) || $_user === false;
return Session::read('IS_AUTHENTICATED_FULLY', false);
}
/**
@ -4429,7 +4413,7 @@ function api_get_languages_combo($name = 'language')
* The form works with or without javascript
* @param boolean Hide form if only one language available (defaults to false = show the box anyway)
* @param bool $showAsButton
* @return null|string Display the box directly
* @return string Display the box directly
*/
function api_display_language_form($hide_if_no_choice = false, $showAsButton = false)
{
@ -4437,7 +4421,8 @@ function api_display_language_form($hide_if_no_choice = false, $showAsButton = f
$language_list = api_get_languages();
if (count($language_list) <= 1 && $hide_if_no_choice) {
return; //don't show any form
// don't show any form
return '';
}
// The the current language of the user so that his/her language occurs as selected in the dropdown menu.
@ -4448,6 +4433,7 @@ function api_display_language_form($hide_if_no_choice = false, $showAsButton = f
$user_selected_language = api_get_setting('platformLanguage');
}
$user_selected_language = 'en';
$countryCode = languageToCountryIsoCode($user_selected_language);
$language = api_get_language_from_iso($user_selected_language);

@ -310,19 +310,20 @@ function api_get_timezone()
if ($timezone_value != null) {
$to_timezone = $timezone_value;
}
// If allowed by the administrator
$use_users_timezone = api_get_setting('use_users_timezone');
$useUsersTimezone = api_get_setting('use_users_timezone');
if ($use_users_timezone === 'true') {
if ($useUsersTimezone === 'true') {
if (!api_is_anonymous()) {
$userId = api_get_user_id();
// Get the timezone based on user preference, if it exists
$timezone_user = UserManager::get_extra_user_data_by_field(
$userTimezone = UserManager::get_extra_user_data_by_field(
$userId,
'timezone'
);
if (isset($timezone_user['timezone']) && $timezone_user['timezone'] != null) {
$to_timezone = $timezone_user['timezone'];
if (isset($userTimezone['timezone']) && $userTimezone['timezone'] != null) {
$to_timezone = $userTimezone['timezone'];
}
}
}
@ -368,6 +369,7 @@ function api_get_utc_datetime(
return gmdate('Y-m-d H:i:s', $time);
}
try {
$date = new DateTime($time, new DateTimezone($from_timezone));
$date->setTimezone(new DateTimeZone($to_timezone));
@ -792,7 +794,6 @@ function api_get_person_name(
if (is_int($format)) {
switch ($format) {
case PERSON_NAME_COMMON_CONVENTION:
$valid[$format][$language] = _api_get_person_name_convention($language, 'format');
$usernameOrderFromDatabase = api_get_setting('user_name_order');
if (isset($usernameOrderFromDatabase) && !empty($usernameOrderFromDatabase)) {
@ -1874,8 +1875,10 @@ function &_api_get_day_month_names($language = null)
function _api_get_person_name_convention($language, $type)
{
static $conventions;
$language = api_get_language_from_iso($language);
$language = $language->getOriginalName();
$language = $language->getEnglishName();
if (!isset($conventions)) {
$file = __DIR__.'/internationalization_database/name_order_conventions.php';
if (file_exists($file)) {

@ -675,7 +675,6 @@ class Template
];
}
/**
* Set theme, include mainstream CSS files
* @return void

@ -9,6 +9,7 @@ use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Dotenv\Dotenv;
use Chamilo\CoreBundle\Framework\Container;
use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\Loader\PoFileLoader;
/**
* Chamilo installation
@ -44,7 +45,6 @@ require_once '../inc/lib/text.lib.php';
api_check_php_version('../inc/');
// Defaults settings
putenv("APP_LOCALE=en");
putenv("APP_URL_APPEND=''");
putenv("APP_ENCRYPT_METHOD='bcrypt'");
@ -58,6 +58,11 @@ putenv("APP_DEBUG=1");
// Calling Symfony container
$kernel = new Chamilo\Kernel('dev', true);
$kernel->boot();
$container = $kernel->getContainer();
$oldSession = $container->get('session');
$oldSession->set('s', 's');
Container::setContainer($container);
require_once api_get_path(LIBRARY_PATH).'database.constants.inc.php';
require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
@ -66,7 +71,6 @@ require_once api_get_path(LIBRARY_PATH).'banner.lib.php';
require_once 'install.lib.php';
$installationLanguage = 'en';
// Determination of the language during the installation procedure.
if (!empty($_POST['language_list'])) {
$search = ['../', '\\0'];
@ -84,7 +88,7 @@ if (!array_key_exists($installationLanguage, get_language_folder_list())) {
// Set translation
$translator = new Translator($installationLanguage);
$translator->addLoader('po', new \Symfony\Component\Translation\Loader\PoFileLoader());
$translator->addLoader('po', new PoFileLoader());
$translator->addResource('po', "../../translations/installation.$installationLanguage.po", $installationLanguage);
Container::$translator = $translator;
@ -125,7 +129,6 @@ $institutionForm = 'My Organisation';
$session_lifetime = 360000;
$installLanguage = isset($_SESSION['install_language']) ? $_SESSION['install_language'] : 'english';
$installationGuideLink = '../../documentation/installation_guide.html';
/*
// Loading language files.
@ -162,7 +165,6 @@ error_reporting(E_ALL);
// Overriding the timelimit (for large campusses that have to be migrated).
//@set_time_limit(0);
// Upgrading from any subversion of 1.9
$update_from_version_8 = [
'1.9.0',
@ -213,9 +215,6 @@ if (isAlreadyInstalledSystem()) {
}
/* STEP 1 : INITIALIZES FORM VARIABLES IF IT IS THE FIRST VISIT */
// Is valid request
$is_valid_request = isset($_REQUEST['is_executable']) ? $_REQUEST['is_executable'] : null;
$badUpdatePath = false;
$emptyUpdatePath = true;
$proposedUpdatePath = '';
@ -276,14 +275,10 @@ if (!isset($_GET['running'])) {
if (isset($email_parts[1]) && $email_parts[1] == 'localhost') {
$emailForm .= '.localdomain';
}
//$adminLastName = get_lang('DefaultInstallAdminLastname');
//$adminFirstName = get_lang('DefaultInstallAdminFirstname');
$adminLastName = 'admin';
$adminFirstName = 'admin';
$adminLastName = get_lang('DefaultInstallAdminLastname');
$adminFirstName = get_lang('DefaultInstallAdminFirstname');
$loginForm = 'admin';
$passForm = api_generate_password();
$institutionUrlForm = 'http://www.chamilo.org';
$languageForm = api_get_interface_language();
$checkEmailByHashSent = 0;
@ -797,12 +792,12 @@ if (@$_POST['step2']) {
$dbNameForm,
$dbPortForm
);
$manager = $database->getManager();
// Create .env file
$envFile = api_get_path(SYS_PATH).'.env';
$distFile = api_get_path(SYS_PATH).'.env.dist';
//$oldSession = $container->get('session');
$params = [
'{{DATABASE_HOST}}' => $dbHostForm,
'{{DATABASE_PORT}}' => $dbPortForm,

@ -2089,7 +2089,6 @@ function migrate($chamiloVersion, EntityManager $manager)
{
$debug = true;
$connection = $manager->getConnection();
$config = new \Doctrine\DBAL\Migrations\Configuration\Configuration($connection);
// Table name that will store migrations log (will be created automatically,
@ -2109,9 +2108,7 @@ function migrate($chamiloVersion, EntityManager $manager)
foreach ($versions as $version) {
$version->getMigration()->setEntityManager($manager);
}
$to = null; // if $to == null then schema will be migrated to latest version
echo "<pre>";
try {
// Execute migration!
@ -2131,7 +2128,6 @@ function migrate($chamiloVersion, EntityManager $manager)
$counter++;
}
}
echo "<br>DONE!<br>";
}
@ -2142,7 +2138,6 @@ function migrate($chamiloVersion, EntityManager $manager)
return false;
}
}
echo "</pre>";
return false;

@ -120,12 +120,6 @@ class SettingsCurrent
*/
protected $url;
private $parameters;
/**
* @var string
**/
private $schemaAlias;
/**
* Constructor
*/

@ -3,6 +3,7 @@
namespace Chamilo\CoreBundle\EventListener;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\DependencyInjection\ContainerInterface;
@ -18,22 +19,17 @@ use Chamilo\CoreBundle\Framework\Container;
*/
class LegacyListener
{
/** @var ContainerInterface */
protected $container;
/**
* @param ContainerInterface $container
*/
public function __construct(ContainerInterface $container)
{
$this->container = $container;
}
use ContainerAwareTrait;
/**
* @param GetResponseEvent $event
*/
public function onKernelRequest(GetResponseEvent $event)
{
if (!$event->isMasterRequest()) {
return;
}
$request = $event->getRequest();
$controller = $request->get('_controller');
// Only process legacy listener when loading legacy controller

@ -47,18 +47,23 @@ class LegacyLoginListener implements EventSubscriberInterface
return;
}
$container = $this->container;
$token = $this->tokenStorage->getToken();
$session = $request->getSession();
if ($token) {
$isGranted = $this->container->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY');
if (!$isGranted) {
$isGranted = $container->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY');
if ($isGranted) {
$session->set('IS_AUTHENTICATED_FULLY', true);
} else {
$session->set('IS_AUTHENTICATED_FULLY', false);
if (isset($_SESSION) && isset($_SESSION['_user'])) {
if ($_SESSION['_user']['active'] == 1) {
$username = $_SESSION['_user']['username'];
$criteria = ['username' => $username];
/** @var User $user */
$user = $this->container->get('sonata.user.user_manager')->findOneBy($criteria);
$user = $container->get('sonata.user.user_manager')->findOneBy($criteria);
if ($user) {
$em = $this->container->get('doctrine');
$em = $container->get('doctrine');
/** @var User $completeUser */
$completeUser = $em->getRepository('ChamiloUserBundle:User')->findOneBy($criteria);
$user->setLanguage($completeUser->getLanguage());
@ -88,8 +93,8 @@ class LegacyLoginListener implements EventSubscriberInterface
//now dispatch the login event
$event = new InteractiveLoginEvent($request, $token);
$this->container->get('event_dispatcher')->dispatch("security.interactive_login", $event);
$this->container->get('event_dispatcher')->addListener(
$container->get('event_dispatcher')->dispatch("security.interactive_login", $event);
$container->get('event_dispatcher')->addListener(
KernelEvents::RESPONSE,
[$this, 'redirectUser']
);

@ -45,7 +45,6 @@ class LoginSuccessHandler implements AuthenticationSuccessHandlerInterface
$user = $token->getUser();
$userId = $user->getId();
$session = $request->getSession();
dump($user->getId());
$userInfo = api_get_user_info($user->getId());
$userInfo['is_anonymous'] = false;

@ -233,7 +233,15 @@ class Container
*/
public static function getTranslator()
{
return self::$container->get('translator.default');
if (isset(self::$translator)) {
return self::$translator;
}
if (self::$container) {
return self::$container->get('translator.default');
}
return false;
}
/**

@ -125,7 +125,8 @@ services:
# Setting user and platform locale
chamilo_core.listener.legacy:
class: Chamilo\CoreBundle\EventListener\LegacyListener
arguments: ['@service_container']
calls:
- [setContainer, ['@service_container']]
tags:
- {name: kernel.event_listener, event: kernel.request, method: onKernelRequest, priority: 10}
- {name: kernel.event_listener, event: kernel.response, method: onKernelResponse}

@ -20,16 +20,25 @@ class Kernel extends BaseKernel
const CONFIG_EXTS = '.{php,xml,yaml,yml}';
/**
* @return string
*/
public function getCacheDir()
{
return $this->getProjectDir().'/var/cache/'.$this->environment;
}
/**
* @return string
*/
public function getLogDir()
{
return $this->getProjectDir().'/var/log';
}
/**
* @return \Generator|\Symfony\Component\HttpKernel\Bundle\BundleInterface[]
*/
public function registerBundles()
{
$contents = require $this->getProjectDir().'/config/bundles.php';
@ -40,6 +49,11 @@ class Kernel extends BaseKernel
}
}
/**
* @param ContainerBuilder $container
* @param LoaderInterface $loader
* @throws \Exception
*/
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader)
{
$container->setParameter('container.autowiring.strict_mode', true);
@ -53,6 +67,10 @@ class Kernel extends BaseKernel
$loader->load($confDir.'/services_'.$this->environment.self::CONFIG_EXTS, 'glob');
}
/**
* @param RouteCollectionBuilder $routes
* @throws \Symfony\Component\Config\Exception\FileLoaderLoadException
*/
protected function configureRoutes(RouteCollectionBuilder $routes)
{
$confDir = $this->getProjectDir().'/config';
@ -130,6 +148,7 @@ class Kernel extends BaseKernel
/**
* Check if system is installed
* Checks the APP_INSTALLED env value
* @return bool
*/
public function isInstalled()

@ -689,10 +689,14 @@ class SettingsManager implements SettingsManagerInterface
$schemaAliasNoPrefix = $schemaAlias;
$schemaAlias = 'chamilo_core.settings.'.$schemaAlias;
/** @var SchemaInterface $schema */
$schema = $this->schemaRegistry->get($schemaAlias);
if ($this->schemaRegistry->has($schemaAlias)) {
/** @var SchemaInterface $schema */
$schema = $this->schemaRegistry->get($schemaAlias);
} else {
return [];
}
/** @var \Sylius\Bundle\SettingsBundle\Model\Settings $settings */
/** @var \Sylius\Bundle\SettingsBundle\Model\Settings $settings */
$settings = $this->settingsFactory->createNew();
$settings->setSchemaAlias($schemaAlias);

@ -37,7 +37,7 @@ class SettingsHelper extends Helper implements SettingsHelperInterface
/**
* @param string $schemaAlias Example: admin, agenda, etc
* @return object|\Sylius\Bundle\SettingsBundle\Model\SettingsInterface
* @return \Sylius\Bundle\SettingsBundle\Model\Settings
*/
public function getSettings($schemaAlias)
{

@ -3,7 +3,6 @@
namespace Chamilo\ThemeBundle;
use Chamilo\ThemeBundle\DependencyInjection\AssetsCompilerPass;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**

@ -1,20 +1,18 @@
<?php
/**
* ExceptionController.php
* avanzu-admin
* Date: 01.03.14
*/
/* For licensing terms, see /license.txt */
namespace Chamilo\ThemeBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
use Symfony\Bundle\TwigBundle\Controller\ExceptionController as BaseExceptionController;
use Symfony\Component\HttpFoundation\Request;
class ExceptionController extends \Symfony\Bundle\TwigBundle\Controller\ExceptionController
/**
* Class ExceptionController
* @package Chamilo\ThemeBundle\Controller
*/
class ExceptionController extends BaseExceptionController
{
/**
* @param Request $request
* @param string $format

@ -0,0 +1,51 @@
<?php
namespace Chamilo\ThemeBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
/**
* This is the class that loads and manages your bundle configuration
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class ChamiloThemeExtension extends Extension implements PrependExtensionInterface
{
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
//$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
//$loader->load('services.xml');
}
/**
* Allow an extension to prepend the extension configurations.
*
* @param ContainerBuilder $container
*/
public function prepend(ContainerBuilder $container)
{
$bundles = $container->getParameter('kernel.bundles');
if (isset($bundles['TwigBundle'])) {
$container->prependExtensionConfig('twig', [
/*'form' => [
'resources' => [
'ChamiloThemeBundle:Layout:form-theme.html.twig'
]
],*/
'globals' => [
'admin_theme' => 'chamilo_admin_theme.theme_manager'
]
]);
}
return;
}
}

@ -789,7 +789,6 @@ class User extends BaseUser implements ThemeUser //implements ParticipantInterfa
}
/**
* @todo don't use api_get_person_name
* @return string
*/
public function getCompleteName()
@ -1347,6 +1346,7 @@ class User extends BaseUser implements ThemeUser //implements ParticipantInterfa
}
/**
* @param int $size
* @return string
*/
public function getAvatarOrAnonymous($size = 22)

Loading…
Cancel
Save