Fixing old links see BT#8704

1.9.x
Julio Montoya 11 years ago
parent b61eab0c00
commit 8dd695ebcf
  1. 18
      main/admin/configure_homepage.php

@ -395,6 +395,7 @@ if (!empty($action)) {
$link_url='http://'.$link_url;
}
$menuf = ($action == 'insert_tabs' || $action == 'edit_tabs')? $mtloggedin : $menuf;
if (!is_writable($homep.$menuf.'_'.$lang.$ext)) {
$errorMsg = get_lang('HomePageFilesNotWritable');
} elseif (empty($link_name)) {
@ -404,6 +405,7 @@ if (!empty($action)) {
if ($action == 'insert_link' || $action == 'insert_tabs' || empty($filename) || strstr($filename, '/') || !strstr($filename, '.html')) {
$filename = replace_dangerous_char($link_name, 'strict').'.html';
}
// "home_" prefix for links are renamed to "user_" prefix (to avoid name clash with existing home page files)
if (!empty($filename)) {
$filename = str_replace('home_', 'user_', $filename);
@ -679,6 +681,13 @@ if (!empty($action)) {
} else {
$errorMsg = get_lang('HomePageFilesNotReadable');
}
if (empty($home_menu)) {
if (file_exists($homep.$menutabs.'_'.$lang.$ext)) {
$home_menu = @file($homep.$menutabs.'_'.$lang.$ext);
}
}
if (empty($home_menu)) {
$home_menu = array();
}
@ -1055,14 +1064,23 @@ switch ($action) {
// Add new page
$home_menu = '';
if (file_exists($homep.$mtloggedin.'_'.$lang.$ext)) {
$home_menu = @file($homep.$mtloggedin.'_'.$lang.$ext);
} else {
$home_menu = @file($homep.$mtloggedin.$ext);
}
if (empty($home_menu)) {
if (file_exists($homep.$menutabs.'_'.$lang.$ext)) {
$home_menu = @file($homep.$menutabs.'_'.$lang.$ext);
}
}
if (empty($home_menu)) {
$home_menu = array();
}
if (!empty($home_menu)) {
$home_menu = implode("\n", $home_menu);
$home_menu = api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu)));

Loading…
Cancel
Save