소스 검색

Merge pull request #154 from ycastillo/yoselyn.6605

Fixing message when registration is disabled -refs #6605
ycastillo 11 년 전
부모
커밋
1462320ea5
2개의 변경된 파일7개의 추가작업 그리고 4개의 파일을 삭제
  1. 2 2
      main/auth/inscription.php
  2. 5 2
      main/inc/lib/main_api.lib.php

+ 2 - 2
main/auth/inscription.php

@@ -20,7 +20,7 @@ require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php';
 $htmlHeadXtra[] = api_get_password_checker_js('#username', '#pass1');
 
 if (api_get_setting('allow_registration') === 'false') {
-    api_not_allowed(true);
+    api_not_allowed(true,get_lang('RegistrationDisabled'));
 }
 
 if (!empty($_SESSION['user_language_choice'])) {
@@ -258,7 +258,7 @@ if (!CustomPages::enabled()) {
 
     // Forbidden to self-register
     if (api_get_setting('allow_registration') == 'false') {
-        api_not_allowed(true);
+        api_not_allowed(true,get_lang('RegistrationDisabled'));
     }
 
     if (api_get_setting('allow_registration') == 'approval') {

+ 5 - 2
main/inc/lib/main_api.lib.php

@@ -2909,6 +2909,7 @@ function api_not_allowed($print_headers = false, $message = null) {
     $origin = isset($_GET['origin']) ? $_GET['origin'] : '';
 
     $msg = null;
+    
     if (isset($message)) {
         $msg = $message;
     } else {
@@ -2976,8 +2977,10 @@ function api_not_allowed($print_headers = false, $message = null) {
     // Check if the cookies are enabled. If are enabled and if no course ID was included in the requested URL, then the user has either lost his session or is anonymous, so redirect to homepage
 	if( !isset($_COOKIE['TestCookie']) && empty($_COOKIE['TestCookie']) ) {
 		$msg = Display::return_message(get_lang('NoCookies').'<br /><br /><a href="'.$home_url.'">'.get_lang('BackTo').' '.get_lang('CampusHomepage').'</a><br />', 'error', false);
-	} else {
+	} elseif ($message == null){ 
 		$msg = Display::return_message(get_lang('NotAllowed').'<br /><br /><a href="'.$home_url.'">'.get_lang('PleaseLoginAgainFromHomepage').'</a><br />', 'error', false);
+	} else {
+	    $msg = Display::return_message($message.'&nbsp;<a href="'.$home_url.'">'.get_lang('PleaseLoginAgainFromHomepage').'</a><br />', 'error', false);
 	}
     $msg = Display::div($msg, array('align'=>'center'));
     $tpl->assign('content', $msg);
@@ -6711,4 +6714,4 @@ function api_can_login_as($loginAsUserId, $userId = null)
     };
 
     return (api_is_platform_admin() OR (api_is_session_admin() && $user_info['status'] == 5) OR $isDrh());
-}
+}