Forráskód Böngészése

Fixing PHP warning

ref 9648c1f1f7fa79930d30adfc426a93964efd7aa7
Julio Montoya 11 éve
szülő
commit
f8687d7f4e
1 módosított fájl, 7 hozzáadás és 4 törlés
  1. 7 4
      main/inc/lib/userportal.lib.php

+ 7 - 4
main/inc/lib/userportal.lib.php

@@ -208,7 +208,9 @@ class IndexManager {
 	}
 
 	/* Includes a created page */
-	function return_home_page() {
+	function return_home_page()
+    {
+        $userId = api_get_user_id();
         global $_configuration;
 		// Including the page for the news
 		$html = '';
@@ -217,11 +219,11 @@ class IndexManager {
 			$open = @(string)file_get_contents(api_get_path(SYS_PATH).$this->home.$_GET['include']);
 			$html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
 		} else {
-            //hiding home top when user not connected
-            global $_user;
-            if ($_configuration['hide_home_top_when_connected'] && isset($_user['user_id'])) {
+            // Hiding home top when user not connected.
+            if (isset($_configuration['hide_home_top_when_connected']) && $_configuration['hide_home_top_when_connected'] && !empty($userId)) {
                 return $html;
             }
+
 			if (!empty($_SESSION['user_language_choice'])) {
 				$user_selected_language = $_SESSION['user_language_choice'];
 			} elseif (!empty($_SESSION['_user']['language'])) {
@@ -229,6 +231,7 @@ class IndexManager {
 			} else {
 				$user_selected_language = api_get_setting('platformLanguage');
 			}
+
 			if (!file_exists($this->home.'home_news_'.$user_selected_language.'.html')) {
 				if (file_exists($this->home.'home_top.html')) {
 					$home_top_temp = file($this->home.'home_top.html');