diff --git a/assets/js/app.js b/assets/js/app.js index 8c540842bb..708699c85f 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -27,7 +27,6 @@ require('webpack-jquery-ui/css'); // @todo rework url naming const homePublicUrl = Routing.generate('home') + 'public/'; -const legacyIndex = Routing.generate('legacy_index'); const mainUrl = Routing.generate('web.main'); const webAjax = Routing.generate('web.ajax'); diff --git a/public/main/admin/index.php b/public/main/admin/index.php index d473e6abe8..e062bc9dc6 100644 --- a/public/main/admin/index.php +++ b/public/main/admin/index.php @@ -615,7 +615,6 @@ if ($useCookieValidation === 'true') { } $tpl->assign('web_admin_ajax_url', $admin_ajax_url); -$tpl->assign('web_public', api_get_path(WEB_PUBLIC_PATH)); $tpl->assign('blocks_admin', $blocks); if (api_is_platform_admin()) { diff --git a/public/main/document/document.php b/public/main/document/document.php index ed9c8986c0..f9bba84adb 100644 --- a/public/main/document/document.php +++ b/public/main/document/document.php @@ -19,7 +19,7 @@ use ChamiloSession as Session; $courseCode = isset($_GET['cidReq']) ? htmlentities($_GET['cidReq']) : ''; $sessionId = isset($_GET['id_session']) ? (int) $_GET['id_session'] : 0; -$url = "../../public/resources/document/files?cidReq=$courseCode&id_session=$sessionId"; +$url = "../../../public/resources/document/files?cidReq=$courseCode&id_session=$sessionId"; header("Location: $url"); exit; diff --git a/public/main/inc/lib/api.lib.php b/public/main/inc/lib/api.lib.php index cf702fd83c..a85aea7b29 100644 --- a/public/main/inc/lib/api.lib.php +++ b/public/main/inc/lib/api.lib.php @@ -343,9 +343,6 @@ define('SYS_TEST_PATH', 'SYS_TEST_PATH'); define('WEB_TEMPLATE_PATH', 'WEB_TEMPLATE_PATH'); define('SYS_TEMPLATE_PATH', 'SYS_TEMPLATE_PATH'); define('SYS_PUBLIC_PATH', 'SYS_PUBLIC_PATH'); -define('SYS_HOME_PATH', 'SYS_HOME_PATH'); -define('WEB_HOME_PATH', 'WEB_HOME_PATH'); -define('WEB_FONTS_PATH', 'WEB_FONTS_PATH'); define('SYS_FONTS_PATH', 'SYS_FONTS_PATH'); // Relations type with Course manager @@ -770,28 +767,12 @@ function api_get_path($path = '', $configuration = []) if (isset(Container::$container)) { $root_web = Container::$container->get('router')->generate( - 'legacy_index', + 'home', [], UrlGeneratorInterface::ABSOLUTE_URL ); - - // Fix for php files inside main - if (strpos($root_web, 'main') !== false) { - $pos = (int) strpos($root_web, 'main'); - $root_web = substr($root_web, 0, $pos); - } - - // Fix for php files inside courses - if (strpos($root_web, '/courses/') !== false) { - $pos = (int) strpos($root_web, '/courses/'); - $root_web = substr($root_web, 0, $pos); - } - - $root_web = urldecode($root_web); } - $root_web = str_replace('public/../', '', $root_web); - if (isset($configuration['multiple_access_urls']) && $configuration['multiple_access_urls'] ) { @@ -817,21 +798,18 @@ function api_get_path($path = '', $configuration = []) WEB_COURSE_PATH => '', SYS_COURSE_PATH => '', REL_COURSE_PATH => '', - WEB_CODE_PATH => 'main/', + WEB_CODE_PATH => '/main/', SYS_CODE_PATH => 'public/main/', REL_CODE_PATH => '/main/', SYS_LANG_PATH => 'lang/', - WEB_IMG_PATH => 'public/img/', - WEB_CSS_PATH => 'public/build/css/', - SYS_CSS_PATH => 'public/build/css/', + WEB_IMG_PATH => 'img/', + WEB_CSS_PATH => 'build/css/', + SYS_CSS_PATH => 'build/css/', SYS_PLUGIN_PATH => 'plugin/', WEB_PLUGIN_PATH => 'plugin/', WEB_PLUGIN_ASSET_PATH => 'public/plugins/', SYS_ARCHIVE_PATH => 'var/cache/', WEB_ARCHIVE_PATH => 'var/cache/', - SYS_HOME_PATH => 'app/home/', - WEB_HOME_PATH => 'app/home/', - REL_HOME_PATH => 'app/home/', SYS_APP_PATH => 'var/', SYS_UPLOAD_PATH => 'var/upload/', SYS_INC_PATH => 'inc/', @@ -843,10 +821,9 @@ function api_get_path($path = '', $configuration = []) SYS_TEST_PATH => 'tests/', WEB_TEMPLATE_PATH => 'template/', SYS_TEMPLATE_PATH => 'template/', - WEB_UPLOAD_PATH => 'var/upload/', - WEB_PUBLIC_PATH => 'public/', + //WEB_UPLOAD_PATH => 'var/upload/', + WEB_PUBLIC_PATH => '/', SYS_PUBLIC_PATH => 'public/', - WEB_FONTS_PATH => 'fonts/', SYS_FONTS_PATH => 'fonts/', ]; } @@ -873,21 +850,19 @@ function api_get_path($path = '', $configuration = []) $paths[$root_web][REL_PATH] = $root_rel; $paths[$root_web][REL_CODE_PATH] = $root_rel.$code_folder; $paths[$root_web][WEB_PATH] = $rootWebWithSlash; - $paths[$root_web][WEB_CODE_PATH] = $rootWebWithSlash.$code_folder; + $paths[$root_web][WEB_CODE_PATH] = $rootWebWithSlash.'main/'; $paths[$root_web][WEB_COURSE_PATH] = $rootWebWithSlash.$course_folder; $paths[$root_web][WEB_PLUGIN_PATH] = $rootWebWithSlash.$paths[$root_web][WEB_PLUGIN_PATH]; $paths[$root_web][WEB_PLUGIN_ASSET_PATH] = $rootWebWithSlash.$paths[$root_web][WEB_PLUGIN_ASSET_PATH]; $paths[$root_web][WEB_ARCHIVE_PATH] = $rootWebWithSlash.$paths[$root_web][WEB_ARCHIVE_PATH]; $paths[$root_web][WEB_CSS_PATH] = $rootWebWithSlash.$paths[$root_web][WEB_CSS_PATH]; - $paths[$root_web][WEB_UPLOAD_PATH] = $rootWebWithSlash.$paths[$root_web][WEB_UPLOAD_PATH]; - $paths[$root_web][WEB_PUBLIC_PATH] = $rootWebWithSlash.$paths[$root_web][WEB_PUBLIC_PATH]; - $paths[$root_web][WEB_HOME_PATH] = $rootWebWithSlash.$paths[$root_web][REL_HOME_PATH]; + //$paths[$root_web][WEB_UPLOAD_PATH] = $rootWebWithSlash.$paths[$root_web][WEB_UPLOAD_PATH]; + $paths[$root_web][WEB_PUBLIC_PATH] = $rootWebWithSlash; $paths[$root_web][WEB_IMG_PATH] = $rootWebWithSlash.$paths[$root_web][WEB_IMG_PATH]; $paths[$root_web][WEB_LIBRARY_PATH] = $paths[$root_web][WEB_CODE_PATH].$paths[$root_web][WEB_LIBRARY_PATH]; $paths[$root_web][WEB_LIBRARY_JS_PATH] = $paths[$root_web][WEB_CODE_PATH].$paths[$root_web][WEB_LIBRARY_JS_PATH]; $paths[$root_web][WEB_AJAX_PATH] = $paths[$root_web][WEB_CODE_PATH].$paths[$root_web][WEB_AJAX_PATH]; - $paths[$root_web][WEB_FONTS_PATH] = $paths[$root_web][WEB_CODE_PATH].$paths[$root_web][WEB_FONTS_PATH]; $paths[$root_web][WEB_TEMPLATE_PATH] = $paths[$root_web][WEB_CODE_PATH].$paths[$root_web][WEB_TEMPLATE_PATH]; $paths[$root_web][SYS_PATH] = $root_sys; @@ -901,7 +876,6 @@ function api_get_path($path = '', $configuration = []) $paths[$root_web][SYS_APP_PATH] = $paths[$root_web][SYS_PATH].$paths[$root_web][SYS_APP_PATH]; $paths[$root_web][SYS_UPLOAD_PATH] = $paths[$root_web][SYS_PATH].$paths[$root_web][SYS_UPLOAD_PATH]; $paths[$root_web][SYS_LANG_PATH] = $paths[$root_web][SYS_CODE_PATH].$paths[$root_web][SYS_LANG_PATH]; - $paths[$root_web][SYS_HOME_PATH] = $paths[$root_web][SYS_PATH].$paths[$root_web][SYS_HOME_PATH]; $paths[$root_web][SYS_PLUGIN_PATH] = $paths[$root_web][SYS_PATH].$paths[$root_web][SYS_PLUGIN_PATH]; $paths[$root_web][SYS_INC_PATH] = $paths[$root_web][SYS_CODE_PATH].$paths[$root_web][SYS_INC_PATH]; @@ -911,12 +885,9 @@ function api_get_path($path = '', $configuration = []) global $virtualChamilo; if (!empty($virtualChamilo)) { $paths[$root_web][SYS_ARCHIVE_PATH] = api_add_trailing_slash($virtualChamilo[SYS_ARCHIVE_PATH]); - $paths[$root_web][SYS_HOME_PATH] = api_add_trailing_slash($virtualChamilo[SYS_HOME_PATH]); $paths[$root_web][SYS_COURSE_PATH] = api_add_trailing_slash($virtualChamilo[SYS_COURSE_PATH]); $paths[$root_web][SYS_UPLOAD_PATH] = api_add_trailing_slash($virtualChamilo[SYS_UPLOAD_PATH]); - - $paths[$root_web][WEB_HOME_PATH] = api_add_trailing_slash($virtualChamilo[WEB_HOME_PATH]); - $paths[$root_web][WEB_UPLOAD_PATH] = api_add_trailing_slash($virtualChamilo[WEB_UPLOAD_PATH]); + //$paths[$root_web][WEB_UPLOAD_PATH] = api_add_trailing_slash($virtualChamilo[WEB_UPLOAD_PATH]); $paths[$root_web][WEB_ARCHIVE_PATH] = api_add_trailing_slash($virtualChamilo[WEB_ARCHIVE_PATH]); //$paths[$root_web][WEB_COURSE_PATH] = api_add_trailing_slash($virtualChamilo[WEB_COURSE_PATH]); @@ -2713,7 +2684,7 @@ function api_get_setting($variable) $variable = trim($variable); switch ($variable) { - case 'header_extra_content': + /*case 'header_extra_content': $filename = api_get_path(SYS_PATH).api_get_home_path().'header_extra_content.txt'; if (file_exists($filename)) { $value = file_get_contents($filename); @@ -2732,7 +2703,7 @@ function api_get_setting($variable) } else { return ''; } - break; + break;*/ case 'server_type': $test = ['dev', 'test']; $environment = Container::getEnvironment(); @@ -2765,7 +2736,7 @@ function api_get_setting($variable) } global $_setting; - if ($variable == 'header_extra_content') { + /*if ($variable == 'header_extra_content') { $filename = api_get_home_path().'header_extra_content.txt'; if (file_exists($filename)) { $value = file_get_contents($filename); @@ -2784,7 +2755,7 @@ function api_get_setting($variable) } else { return ''; } - } + }*/ $value = null; if (is_null($key)) { $value = ((isset($_setting[$variable]) && $_setting[$variable] != '') ? $_setting[$variable] : null); @@ -7288,7 +7259,7 @@ function api_get_jquery_ui_js() function api_get_jqgrid_js() { - $routePublic = Container::getRouter()->generate('legacy_public'); + $routePublic = Container::getRouter()->generate('home'); return api_get_css($routePublic.'build/free-jqgrid.css').PHP_EOL .api_get_js_simple($routePublic.'build/free-jqgrid.js'); @@ -7438,31 +7409,6 @@ function api_get_unique_id() return $id; } -/** - * Get home path. - * - * @return string - */ -function api_get_home_path() -{ - // FIX : Start the routing determination from central path definition - $home = api_get_path(SYS_HOME_PATH); - if (api_get_multiple_access_url()) { - $access_url_id = api_get_current_access_url_id(); - $url_info = api_get_access_url($access_url_id); - $url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url'])); - $clean_url = api_replace_dangerous_char($url); - $clean_url = str_replace('/', '-', $clean_url); - $clean_url .= '/'; - if ($clean_url != 'localhost/') { - // means that the multiple URL was not well configured we don't rename the $home variable - return "{$home}{$clean_url}"; - } - } - - return $home; -} - /** * @param int Course id * @param int tool id: TOOL_QUIZ, TOOL_FORUM, TOOL_STUDENTPUBLICATION, TOOL_LEARNPATH diff --git a/public/main/inc/lib/formvalidator/Rule/HTML.php b/public/main/inc/lib/formvalidator/Rule/HTML.php index 98fa970b7a..8209282eaa 100644 --- a/public/main/inc/lib/formvalidator/Rule/HTML.php +++ b/public/main/inc/lib/formvalidator/Rule/HTML.php @@ -1,7 +1,7 @@ api_get_path(WEB_PATH), - 'web_public' => api_get_path(WEB_PUBLIC_PATH), - 'web_url' => api_get_web_url(), 'web_relative' => api_get_path(REL_PATH), 'web_course' => api_get_path(WEB_COURSE_PATH), 'web_main' => api_get_path(WEB_CODE_PATH), @@ -475,14 +473,11 @@ class Template 'web_img' => api_get_path(WEB_IMG_PATH), 'web_plugin' => api_get_path(WEB_PLUGIN_PATH), 'web_lib' => api_get_path(WEB_LIBRARY_PATH), - 'web_upload' => api_get_path(WEB_UPLOAD_PATH), 'web_self' => api_get_self(), - 'web_query_vars' => api_htmlentities($queryString), 'web_self_query_vars' => api_htmlentities($requestURI), 'web_cid_query' => api_get_cidreq(), - 'web_rel_code' => api_get_path(REL_CODE_PATH), ]; - + //var_dump(api_get_path(WEB_CODE_PATH)); $_s = [ 'software_name' => api_get_configuration_value('software_name'), 'system_version' => api_get_configuration_value('system_version'), diff --git a/public/main/inc/lib/userportal.lib.php b/public/main/inc/lib/userportal.lib.php index b3baba5459..5c2afaae98 100644 --- a/public/main/inc/lib/userportal.lib.php +++ b/public/main/inc/lib/userportal.lib.php @@ -25,7 +25,7 @@ class IndexManager public function __construct($title) { $this->tpl = new Template($title); - $this->home = api_get_home_path(); + //$this->home = api_get_home_path(); $this->user_id = api_get_user_id(); $this->load_directories_preview = false; diff --git a/src/CoreBundle/EventListener/LoginSuccessHandler.php b/src/CoreBundle/EventListener/LoginSuccessHandler.php index b6e3743ed7..9e4e9e34f6 100644 --- a/src/CoreBundle/EventListener/LoginSuccessHandler.php +++ b/src/CoreBundle/EventListener/LoginSuccessHandler.php @@ -78,7 +78,7 @@ class LoginSuccessHandler /* Possible values: index.php, user_portal.php, main/auth/courses.php */ $pageAfterLogin = $this->settingsManager->getSetting('registration.page_after_login'); - $legacyIndex = $this->router->generate('legacy_index', [], UrlGeneratorInterface::ABSOLUTE_URL); + $legacyIndex = $this->router->generate('home', [], UrlGeneratorInterface::ABSOLUTE_URL); // Default redirect: $url = $legacyIndex; diff --git a/src/CoreBundle/Framework/Container.php b/src/CoreBundle/Framework/Container.php index 8bca1e3b71..da96e1293a 100644 --- a/src/CoreBundle/Framework/Container.php +++ b/src/CoreBundle/Framework/Container.php @@ -134,7 +134,6 @@ class Container if (isset(self::$container)) { return self::$container->get('kernel')->getRealRootDir(); } - return str_replace('\\', '/', realpath(__DIR__.'/../../../')).'/'; } diff --git a/src/CoreBundle/Menu/NavBuilder.php b/src/CoreBundle/Menu/NavBuilder.php index 856aca3c8b..a081c5f55c 100644 --- a/src/CoreBundle/Menu/NavBuilder.php +++ b/src/CoreBundle/Menu/NavBuilder.php @@ -71,13 +71,13 @@ class NavBuilder implements ContainerAwareInterface $menu = $factory->createItem('root', ['childrenAttributes' => ['class' => 'navbar-nav']]); $settingsManager = $container->get('chamilo.settings.manager'); - $rootWeb = $router->generate('legacy_index'); + $rootWeb = $router->generate('home'); $menu->addChild( 'home', [ 'label' => $translator->trans('Home'), - 'route' => 'legacy_index', + 'route' => 'home', 'icon' => 'home', ] ); @@ -293,7 +293,7 @@ class NavBuilder implements ContainerAwareInterface 'settings', [ 'label' => $translator->trans('Advanced settings'), - 'uri' => $rootWeb.'public/admin/settings/platform', + 'uri' => $rootWeb.'admin/settings/platform', ] ); } diff --git a/src/CoreBundle/Resources/config/routing.yml b/src/CoreBundle/Resources/config/routing.yml index 78d0d7c690..d1fc02e62c 100644 --- a/src/CoreBundle/Resources/config/routing.yml +++ b/src/CoreBundle/Resources/config/routing.yml @@ -1,9 +1,3 @@ -# Legacy routes -legacy_public: - path: ./ - -legacy_index: - path: ./ legacy_main: path: /main/{name} diff --git a/src/CoreBundle/Resources/views/Account/edit.html.twig b/src/CoreBundle/Resources/views/Account/edit.html.twig index 0f8e8d8475..db64d108fe 100644 --- a/src/CoreBundle/Resources/views/Account/edit.html.twig +++ b/src/CoreBundle/Resources/views/Account/edit.html.twig @@ -2,10 +2,12 @@ {% block content %} {% autoescape false %} -

{{ 'Settings' | trans }}

+

{{ 'Edit profile' | trans }}

{{ user.username }}

{{ form_start(form, { 'action': path('chamilo_core_account_edit'), 'attr': { 'class': 'edit' } }) }} + {{ form_widget(form) }} +
diff --git a/src/CoreBundle/Resources/views/User/profile.html.twig b/src/CoreBundle/Resources/views/User/profile.html.twig index 5a155b66a1..4263561fa1 100644 --- a/src/CoreBundle/Resources/views/User/profile.html.twig +++ b/src/CoreBundle/Resources/views/User/profile.html.twig @@ -8,7 +8,6 @@ {{ 'Edit profile' | trans }} - {{ user.competences }} {{ user.openarea }} {{ user.teach }} diff --git a/src/ThemeBundle/Resources/views/Course/welcome.html.twig b/src/ThemeBundle/Resources/views/Course/welcome.html.twig index c6087cce36..73278c125c 100644 --- a/src/ThemeBundle/Resources/views/Course/welcome.html.twig +++ b/src/ThemeBundle/Resources/views/Course/welcome.html.twig @@ -12,7 +12,7 @@ {% endif %}

{{ course_title }}

{% if just_created == 1%} - {{ "Go to the course created"|trans }} + {{ "Go to the course created"|trans }} {% endif %}
diff --git a/src/ThemeBundle/Resources/views/Editor/elfinder_standalone.html.twig b/src/ThemeBundle/Resources/views/Editor/elfinder_standalone.html.twig index 75ac65a75b..6d3d7bd8ca 100644 --- a/src/ThemeBundle/Resources/views/Editor/elfinder_standalone.html.twig +++ b/src/ThemeBundle/Resources/views/Editor/elfinder_standalone.html.twig @@ -1,6 +1,6 @@ {% autoescape false %} -{% set finderFolder = url('legacy_public') ~ 'assets/elfinder/dist/' %} +{% set finderFolder = url('home') ~ 'assets/elfinder/dist/' %} @@ -30,7 +30,7 @@ var funcNum = getUrlParam('CKEditorFuncNum'); var elf = $('#elfinder').elfinder({ - url : '{{ url('legacy_public') }}editor/connector{{ course_condition }}', + url : '{{ url('home') }}editor/connector{{ course_condition }}', getFileCallback : function(file) { if (window.opener) { window.opener.CKEDITOR.tools.callFunction(funcNum, file.url); diff --git a/src/ThemeBundle/Resources/views/Layout/head.html.twig b/src/ThemeBundle/Resources/views/Layout/head.html.twig index 5a93d6d56f..2e66fd71ea 100644 --- a/src/ThemeBundle/Resources/views/Layout/head.html.twig +++ b/src/ThemeBundle/Resources/views/Layout/head.html.twig @@ -4,7 +4,7 @@ - + {% autoescape false %} {{ favico }} {% endautoescape %} @@ -28,18 +28,18 @@ {% set message_link = '' %} {# Files app.css is generated from "assets/css/app.scss" file using the file webpack.config.js #} - + {% if theme %} - + {% endif %} - + {# app.js is generated using the file webpack.config.js and using yarn read /assets/README.md for more info #} - - - + + + {# Add third party js libraries that can't be loaded using webpack #} {##} - + {# Check chamilo_js key in assetic.yml #} {% block javascripts %} {% block chamilo_header_js %} diff --git a/src/ThemeBundle/Resources/views/Layout/header.html.twig b/src/ThemeBundle/Resources/views/Layout/header.html.twig index 22771f0f4f..b15621d7d4 100755 --- a/src/ThemeBundle/Resources/views/Layout/header.html.twig +++ b/src/ThemeBundle/Resources/views/Layout/header.html.twig @@ -73,9 +73,9 @@ $(function () { - + Chamilo @@ -144,7 +144,7 @@ $(function () { {% if app.user.pictureUri is empty %} {{ app.user.firstname }} {{ app.user.lastname }} {% else %} @@ -190,7 +190,7 @@ $(function () { + href="{{ path('logout') }}"> {{ "Logout"|trans }} @@ -204,7 +204,7 @@ $(function () { diff --git a/src/ThemeBundle/Resources/views/News/slider.html.twig b/src/ThemeBundle/Resources/views/News/slider.html.twig index d64969877a..47ececfdc6 100644 --- a/src/ThemeBundle/Resources/views/News/slider.html.twig +++ b/src/ThemeBundle/Resources/views/News/slider.html.twig @@ -4,7 +4,7 @@ {% set content %} {% if is_granted('ROLE_ADMIN') %}
- + {{ "Edit this section"|trans }}