Fixing home html file parsing, also adding funcionality to get the current user language

skala
Julio Montoya 12 years ago
parent c7063bd7c7
commit d39560306f
  1. 8
      main/inc/lib/main_api.lib.php
  2. 13
      main/inc/lib/page.lib.php

@ -6780,6 +6780,14 @@ function api_mail_html($recipient_name, $recipient_email, $subject, $body, $send
function api_get_user_language() {
$user_language = null;
if (!empty($_SESSION['user_language_choice'])) {
$user_language = $_SESSION['user_language_choice'];
} elseif (!empty($_SESSION['_user']['language'])) {
$user_language = $_SESSION['_user']['language'];
} else {
$user_language = api_get_setting('platformLanguage');
}
if (!empty($_GET['language'])) {
$user_language = $_GET['language'];
}

@ -351,20 +351,15 @@ class PageController
public function return_home_page() {
// Including the page for the news
$html = null;
$home = api_get_home_path();
$home = api_get_path(SYS_PATH).api_get_home_path();
$home_top_temp = null;
if (!empty($_GET['include']) && preg_match('/^[a-zA-Z0-9_-]*\.html$/', $_GET['include'])) {
$open = @(string) file_get_contents(api_get_path(SYS_PATH).$home.$_GET['include']);
$html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
} else {
if (!empty($_SESSION['user_language_choice'])) {
$user_selected_language = $_SESSION['user_language_choice'];
} elseif (!empty($_SESSION['_user']['language'])) {
$user_selected_language = $_SESSION['_user']['language'];
} else {
$user_selected_language = api_get_setting('platformLanguage');
}
$user_selected_language = api_get_user_language();
if (!file_exists($home.'home_news_'.$user_selected_language.'.html')) {
if (file_exists($home.'home_top.html')) {
$home_top_temp = file($home.'home_top.html');
@ -381,7 +376,7 @@ class PageController
$home_top_temp = file_get_contents($home.'home_top.html');
}
}
//trim($home_top_temp) == ''
if (empty($home_top_temp) && api_is_platform_admin()) {
$home_top_temp = get_lang('PortalHomepageDefaultIntroduction');
}

Loading…
Cancel
Save