Skip to content

Commit 5f0aea6

Browse files
committed
Merge branch 'master' of github.com:chamilo/chamilo-lms
2 parents b2f5e55 + 0973bd0 commit 5f0aea6

File tree

2 files changed

+39
-16
lines changed

2 files changed

+39
-16
lines changed

public/main/auth/inscription.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,19 @@
119119
$htmlHeadXtra[] = api_get_password_checker_js('#username', '#pass1');
120120
// User is not allowed if Terms and Conditions are disabled and
121121
// registration is disabled too.
122-
$isNotAllowedHere = ('false' === api_get_setting('allow_terms_conditions') && 'false' === api_get_setting('allow_registration'));
123-
if ($isNotAllowedHere) {
124-
api_not_allowed(true, get_lang('Sorry, you are trying to access the registration page for this portal, but registration is currently disabled. Please contact the administrator (see contact information in the footer). If you already have an account on this site.'));
122+
$isCreatingIntroPage = isset($_GET['create_intro_page']);
123+
$isPlatformAdmin = api_is_platform_admin();
124+
125+
$isNotAllowedHere = (
126+
'false' === api_get_setting('allow_terms_conditions') &&
127+
'false' === api_get_setting('allow_registration')
128+
);
129+
130+
if ($isNotAllowedHere && !($isCreatingIntroPage && $isPlatformAdmin)) {
131+
api_not_allowed(
132+
true,
133+
get_lang('Sorry, you are trying to access the registration page for this portal, but registration is currently disabled. Please contact the administrator (see contact information in the footer). If you already have an account on this site.')
134+
);
125135
}
126136

127137
$settingConditions = api_get_setting('profile.show_conditions_to_user', true);
@@ -633,16 +643,6 @@
633643
$toolName = get_lang('Terms and Conditions');
634644
}
635645

636-
// Forbidden to self-register
637-
if ($isNotAllowedHere) {
638-
api_not_allowed(
639-
true,
640-
get_lang(
641-
'Sorry, you are trying to access the registration page for this portal, but registration is currently disabled. Please contact the administrator (see contact information in the footer). If you already have an account on this site.'
642-
)
643-
);
644-
}
645-
646646
if ('approval' === api_get_setting('allow_registration')) {
647647
$content .= Display::return_message(get_lang('Your account has to be approved'));
648648
}
@@ -658,7 +658,7 @@
658658
// Terms and conditions
659659
$infoMessage = '';
660660
if ('true' === api_get_setting('allow_terms_conditions')) {
661-
if (!api_is_platform_admin()) {
661+
if (!$isPlatformAdmin) {
662662
if ('true' === api_get_setting('ticket.show_terms_if_profile_completed')) {
663663
$userId = api_get_user_id();
664664
if (empty($userId) && isset($termRegistered['user_id'])) {
@@ -1381,7 +1381,7 @@
13811381
. '</div>' . $content;
13821382
}
13831383

1384-
if (isset($_GET['create_intro_page']) && api_is_platform_admin()) {
1384+
if ($isCreatingIntroPage && $isPlatformAdmin) {
13851385
$user = api_get_user_entity();
13861386

13871387
if ($introPage) {

src/CoreBundle/Controller/TemplateController.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,34 @@ private function formatSystemTemplates(array $systemTemplates, AssetRepository $
134134
$imageUrl = $assetRepository->getAssetUrl($template->getImage());
135135
}
136136

137+
$content = $template->getContent();
138+
$content = str_replace('<table', '<table class="responsive-table"', $content);
139+
$content = str_replace(
140+
'{CSS}',
141+
'<style>
142+
.responsive-table {
143+
width: 100%;
144+
max-width: 100%;
145+
overflow-x: auto;
146+
display: block;
147+
border-collapse: collapse;
148+
}
149+
.responsive-table th,
150+
.responsive-table td {
151+
padding: 8px;
152+
text-align: left;
153+
word-wrap: break-word;
154+
border: 1px solid #ccc;
155+
}
156+
</style>',
157+
$content
158+
);
159+
137160
return [
138161
'id' => $template->getId(),
139162
'title' => $template->getTitle(),
140163
'comment' => $template->getComment(),
141-
'content' => $template->getContent(),
164+
'content' => $content,
142165
'image' => $imageUrl,
143166
];
144167
}, $systemTemplates);

0 commit comments

Comments
 (0)