Merge branch '1.9.x' of github.com:chamilo/chamilo-lms into 1.9.x

1.9.x
Yannick Warnier 11 years ago
commit e7b098c200
  1. 34
      main/admin/configure_homepage.php

@ -40,9 +40,7 @@ function home_tabs($file_logged_in)
fputs($fp, implode("\n", $data_logged_in));
fclose($fp);
}
/**
* Code
*/
$language_file = array('index','admin', 'accessibility');
$cidReset = true;
require_once '../inc/global.inc.php';
@ -258,7 +256,6 @@ if (!empty($action)) {
$fp = fopen($homep.$topf.'_'.$lang_name.$ext, 'w');
fputs($fp, $home_top);
fclose($fp);
}
}
}
@ -295,7 +292,6 @@ if (!empty($action)) {
}
}
}
} else {
fputs($fp, '');
@ -306,7 +302,6 @@ if (!empty($action)) {
$fp1 = fopen($homep.$noticef.'_'.$lang_name.$ext, 'w');
fputs($fp1, '');
fclose($fp1);
}
}
}
@ -395,6 +390,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 +400,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);
@ -476,8 +473,6 @@ if (!empty($action)) {
break;
}
}
$home_menu[$insert_where + 1] = '<li '.$class_add_in_tab.'><a href="'.$link_url.'" target="'.($target_blank ? '_blank' : '_self').'"><span>'.$link_name.'</span></a></li>';
} else {
// If the request is about a link edition, change the link
@ -679,6 +674,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();
}
@ -922,7 +924,7 @@ switch ($action) {
$renderer->setRequiredNoteTemplate('');
$form->addElement('hidden', 'formSent', '1');
if ($action == 'edit_news'){
if ($action == 'edit_news') {
$_languages = api_get_languages();
$html = '<tr><td>'.get_lang('ChooseNewsLanguage').' : ';
$html .= '<select name="news_languages">';
@ -963,7 +965,6 @@ switch ($action) {
$html_langs .= '</tr><tr>';
}
$form->addElement('html', $html_langs);
}
}
$form->addElement('html','</tr></table><br/>');
@ -1055,14 +1056,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)));
@ -1133,12 +1143,9 @@ switch ($action) {
echo '</div>';
?>
</div>
<div class="well sidebar-nav">
<a href="<?php echo api_get_self(); ?>?action=insert_link"><?php Display::display_icon('addd.gif', get_lang('InsertLink')); ?></a>
<a href="<?php echo api_get_self(); ?>?action=insert_link"><?php echo get_lang('InsertLink'); ?></a>
<h4><?php echo api_ucfirst(get_lang('General')); ?></h4>
<ul class="menulist">
<?php
@ -1169,7 +1176,6 @@ switch ($action) {
?>
</ul>
</div>
</td>
</tr>
</table>

Loading…
Cancel
Save