Juan Carlos Raña 13 éve
szülő
commit
82d10232b1
2 módosított fájl, 8 hozzáadás és 6 törlés
  1. 1 4
      index.php
  2. 7 2
      main/inc/lib/main_api.lib.php

+ 1 - 4
index.php

@@ -45,11 +45,8 @@ $htmlHeadXtra[] ='
 	'.Display::return_message(get_lang("NoJavascript"), 'error').'
 </noscript>';
 
-//check cookies
+//set cookie for check if client browser are cookies enabled
 setcookie("TestCookie", "cookies_yes", time()+3600);
-if( !isset($_COOKIE["TestCookie"]) && empty($_COOKIE["TestCookie"]) ) {
-	Display::display_error_message(get_lang("NoCookies"));
-}
 
 $controller = new IndexManager($header_title);
 

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

@@ -2589,8 +2589,13 @@ function api_not_allowed($print_headers = false) {
         exit;
     }    
 
-    //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
-    $msg = Display::return_message(get_lang('NotAllowed').'<br /><br /><a href="'.$home_url.'">'.get_lang('PleaseLoginAgainFromHomepage').'</a><br />', 'error', false);
+    // 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 {
+		$msg = Display::return_message(get_lang('NotAllowed').'<br /><br /><a href="'.$home_url.'">'.get_lang('PleaseLoginAgainFromHomepage').'</a><br />', 'error', false);
+	}
     $msg = Display::div($msg, array('align'=>'center'));
     $tpl->assign('content', $msg);	
     $tpl->display_one_col_template();