|
|
|
@ -1,29 +1,6 @@ |
|
|
|
|
<?php // $Id: configure_homepage.php 22243 2009-07-20 15:08:31Z ivantcholakov $
|
|
|
|
|
/* |
|
|
|
|
============================================================================== |
|
|
|
|
Dokeos - elearning and course management software |
|
|
|
|
|
|
|
|
|
Copyright (c) 2004-2009 Dokeos SPRL |
|
|
|
|
Copyright (c) 2003 Ghent University (UGent) |
|
|
|
|
Copyright (c) 2001 Universite catholique de Louvain (UCL) |
|
|
|
|
Copyright (c) Olivier Brouckaert |
|
|
|
|
|
|
|
|
|
For a full list of contributors, see "credits.txt". |
|
|
|
|
The full license can be read in "license.txt". |
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or |
|
|
|
|
modify it under the terms of the GNU General Public License |
|
|
|
|
as published by the Free Software Foundation; either version 2 |
|
|
|
|
of the License, or (at your option) any later version. |
|
|
|
|
|
|
|
|
|
See the GNU General Public License for more details. |
|
|
|
|
|
|
|
|
|
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium |
|
|
|
|
Mail: info@dokeos.com |
|
|
|
|
============================================================================== |
|
|
|
|
*/ |
|
|
|
|
<?php |
|
|
|
|
/* For licensing terms, see /license.txt */ |
|
|
|
|
|
|
|
|
|
// name of the language file that needs to be included |
|
|
|
|
$language_file = array('admin', 'accessibility'); |
|
|
|
|
|
|
|
|
|
$cidReset = true; |
|
|
|
@ -35,40 +12,40 @@ $_SESSION['this_section']=$this_section; |
|
|
|
|
$this_page = ''; |
|
|
|
|
|
|
|
|
|
api_protect_admin_script(); |
|
|
|
|
require_once(api_get_path(LIBRARY_PATH).'WCAG/WCAG_rendering.php'); |
|
|
|
|
require_once(api_get_path(LIBRARY_PATH).'fileUpload.lib.php'); |
|
|
|
|
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'); |
|
|
|
|
require_once(api_get_path(LIBRARY_PATH).'security.lib.php'); |
|
|
|
|
require_once api_get_path(LIBRARY_PATH).'WCAG/WCAG_rendering.php'; |
|
|
|
|
require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php'; |
|
|
|
|
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'; |
|
|
|
|
require_once api_get_path(LIBRARY_PATH).'security.lib.php'; |
|
|
|
|
|
|
|
|
|
$action = Security::remove_XSS($_GET['action']); |
|
|
|
|
$tbl_category = Database::get_main_table(TABLE_MAIN_CATEGORY); |
|
|
|
|
$tool_name = get_lang('ConfigureHomePage'); |
|
|
|
|
|
|
|
|
|
$interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin')); |
|
|
|
|
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
|
|
|
|
|
|
|
|
if (!empty($action)) { |
|
|
|
|
$interbreadcrumb[]=array('url' => 'configure_homepage.php',"name" => get_lang('ConfigureHomePage')); |
|
|
|
|
$interbreadcrumb[] = array('url' => 'configure_homepage.php', 'name' => get_lang('ConfigureHomePage')); |
|
|
|
|
switch ($action) { |
|
|
|
|
case "edit_top": |
|
|
|
|
$tool_name=get_lang("EditHomePage"); |
|
|
|
|
case 'edit_top': |
|
|
|
|
$tool_name = get_lang('EditHomePage'); |
|
|
|
|
break; |
|
|
|
|
case "edit_news": |
|
|
|
|
$tool_name=get_lang("EditNews"); |
|
|
|
|
case 'edit_news': |
|
|
|
|
$tool_name = get_lang('EditNews'); |
|
|
|
|
break; |
|
|
|
|
case "edit_notice": |
|
|
|
|
$tool_name=get_lang("EditNotice"); |
|
|
|
|
case 'edit_notice': |
|
|
|
|
$tool_name = get_lang('EditNotice'); |
|
|
|
|
break; |
|
|
|
|
case "insert_link": |
|
|
|
|
$tool_name=get_lang("InsertLink"); |
|
|
|
|
case 'insert_link': |
|
|
|
|
$tool_name = get_lang('InsertLink'); |
|
|
|
|
break; |
|
|
|
|
case "edit_link": |
|
|
|
|
$tool_name=get_lang("EditLink"); |
|
|
|
|
case 'edit_link': |
|
|
|
|
$tool_name = get_lang('EditLink'); |
|
|
|
|
break; |
|
|
|
|
case "insert_tabs": |
|
|
|
|
$tool_name=get_lang("InsertTabs"); |
|
|
|
|
case 'insert_tabs': |
|
|
|
|
$tool_name = get_lang('InsertTabs'); |
|
|
|
|
break; |
|
|
|
|
case "edit_tabs": |
|
|
|
|
$tool_name=get_lang("EditTabs"); |
|
|
|
|
case 'edit_tabs': |
|
|
|
|
$tool_name = get_lang('EditTabs'); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -102,12 +79,10 @@ if(!empty($_SESSION['user_language_choice'])) { |
|
|
|
|
|
|
|
|
|
// ----- Ensuring availability of main files in the corresponding language ----- |
|
|
|
|
|
|
|
|
|
if ($_configuration['multiple_access_urls']==true) { |
|
|
|
|
if ($_configuration['multiple_access_urls']) { |
|
|
|
|
$access_url_id = api_get_current_access_url_id(); |
|
|
|
|
if ($access_url_id != -1) { |
|
|
|
|
$url_info = api_get_access_url($access_url_id); |
|
|
|
|
// "http://" and the final "/" replaced |
|
|
|
|
//$url = substr($url_info['url'],7,strlen($url_info['url'])-8); |
|
|
|
|
$url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url'])); |
|
|
|
|
$clean_url = replace_dangerous_char($url); |
|
|
|
|
$clean_url = str_replace('/','-',$clean_url); |
|
|
|
@ -138,7 +113,7 @@ $homef = array($menuf,$newsf,$topf,$noticef,$menutabs); |
|
|
|
|
|
|
|
|
|
// If language-specific file does not exist, create it by copying default file |
|
|
|
|
foreach ($homef as $my_file) { |
|
|
|
|
if ($_configuration['multiple_access_urls']==true) { |
|
|
|
|
if ($_configuration['multiple_access_urls']) { |
|
|
|
|
if (!file_exists($homep_new.$my_file.'_'.$lang.$ext)) { |
|
|
|
|
copy($homep.$my_file.$ext,$homep_new.$my_file.'_'.$lang.$ext); |
|
|
|
|
} |
|
|
|
@ -148,7 +123,7 @@ foreach($homef as $my_file) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if ($_configuration['multiple_access_urls']==true) { |
|
|
|
|
if ($_configuration['multiple_access_urls']) { |
|
|
|
|
$homep = $homep_new; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -174,7 +149,7 @@ global $_configuration; |
|
|
|
|
// Start analysing requested actions |
|
|
|
|
if (!empty($action)) { |
|
|
|
|
if ($_POST['formSent']) { |
|
|
|
|
//variables used are $homep for home path, $menuf for menu file, $newsf |
|
|
|
|
// Variables used are $homep for home path, $menuf for menu file, $newsf |
|
|
|
|
// for news file, $topf for top file, $noticef for noticefile, |
|
|
|
|
// $ext for '.html' |
|
|
|
|
switch ($action) { |
|
|
|
@ -190,7 +165,7 @@ if(!empty($action)) { |
|
|
|
|
// Write |
|
|
|
|
if (file_exists($homep.$topf.'_'.$lang.$ext)) { |
|
|
|
|
if (is_writable($homep.$topf.'_'.$lang.$ext)) { |
|
|
|
|
$fp=fopen($homep.$topf.'_'.$lang.$ext,"w"); |
|
|
|
|
$fp = fopen($homep.$topf.'_'.$lang.$ext, 'w'); |
|
|
|
|
fputs($fp, $home_top); |
|
|
|
|
fclose($fp); |
|
|
|
|
} else { |
|
|
|
@ -198,7 +173,7 @@ if(!empty($action)) { |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
//File does not exist |
|
|
|
|
$fp=fopen($homep.$topf.'_'.$lang.$ext,"w"); |
|
|
|
|
$fp = fopen($homep.$topf.'_'.$lang.$ext, 'w'); |
|
|
|
|
fputs($fp, $home_top); |
|
|
|
|
fclose($fp); |
|
|
|
|
} |
|
|
|
@ -207,26 +182,18 @@ if(!empty($action)) { |
|
|
|
|
case 'edit_notice': |
|
|
|
|
// Filter |
|
|
|
|
$notice_title = trim(strip_tags(stripslashes($_POST['notice_title']))); |
|
|
|
|
$notice_text=trim(str_replace(array("\r","\n"),array("","<br />"),strip_tags(stripslashes($_POST['notice_text']),'<a>'))); |
|
|
|
|
/*if(empty($notice_title)) |
|
|
|
|
{ |
|
|
|
|
$errorMsg=get_lang('PleaseEnterNoticeTitle'); |
|
|
|
|
} |
|
|
|
|
elseif(empty($notice_text)) |
|
|
|
|
{ |
|
|
|
|
$errorMsg=get_lang('PleaseEnterNoticeText'); |
|
|
|
|
}*/ |
|
|
|
|
$notice_text = trim(str_replace(array("\r", "\n"), array('', '<br />'), strip_tags(stripslashes($_POST['notice_text']), '<a>'))); |
|
|
|
|
if (empty($notice_title) || empty($notice_text)) { |
|
|
|
|
$errorMsg = get_lang('NoticeWillBeNotDisplayed'); |
|
|
|
|
} |
|
|
|
|
// Write |
|
|
|
|
if (file_exists($homep.$noticef.'_'.$lang.$ext)) { |
|
|
|
|
if (is_writable($homep.$noticef.'_'.$lang.$ext)) { |
|
|
|
|
$fp=fopen($homep.$noticef.'_'.$lang.$ext,"w"); |
|
|
|
|
$fp = fopen($homep.$noticef.'_'.$lang.$ext, 'w'); |
|
|
|
|
if ($errorMsg == '') { |
|
|
|
|
fputs($fp, "<b>$notice_title</b><br />\n$notice_text"); |
|
|
|
|
} else { |
|
|
|
|
fputs($fp,""); |
|
|
|
|
fputs($fp, ''); |
|
|
|
|
} |
|
|
|
|
fclose($fp); |
|
|
|
|
} else { |
|
|
|
@ -234,60 +201,51 @@ if(!empty($action)) { |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
//File does not exist |
|
|
|
|
$fp=fopen($homep.$noticef.'_'.$lang.$ext,"w"); |
|
|
|
|
$fp = fopen($homep.$noticef.'_'.$lang.$ext, 'w'); |
|
|
|
|
fputs($fp, "<b>$notice_title</b><br />\n$notice_text"); |
|
|
|
|
fclose($fp); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case 'edit_news': |
|
|
|
|
//Filter |
|
|
|
|
//$s_languages_news=$_POST["news_languages"]; |
|
|
|
|
//$s_languages_news=$_POST["news_languages"]; // TODO: Why this line has been disabled? |
|
|
|
|
if (api_get_setting('wcag_anysurfer_public_pages') == 'true') { |
|
|
|
|
$home_news = WCAG_rendering::prepareXHTML(); |
|
|
|
|
} else { |
|
|
|
|
$home_news = trim(stripslashes($_POST['home_news'])); |
|
|
|
|
} |
|
|
|
|
//Write |
|
|
|
|
if($s_languages_news!="all"){ |
|
|
|
|
|
|
|
|
|
if ($s_languages_news != 'all') { |
|
|
|
|
if (file_exists($homep.$newsf.'_'.$s_languages_news.$ext)) { |
|
|
|
|
if (is_writable($homep.$newsf.'_'.$s_languages_news.$ext)) { |
|
|
|
|
$fp=fopen($homep.$newsf.'_'.$s_languages_news.$ext,"w"); |
|
|
|
|
$fp = fopen($homep.$newsf.'_'.$s_languages_news.$ext, 'w'); |
|
|
|
|
fputs($fp, $home_news); |
|
|
|
|
fclose($fp); |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
} else { |
|
|
|
|
$errorMsg = get_lang('HomePageFilesNotWritable'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//File not exists |
|
|
|
|
else{ |
|
|
|
|
$fp=fopen($homep.$newsf.'_'.$s_languages_news.$ext,"w"); |
|
|
|
|
} else { |
|
|
|
|
// File does not exist |
|
|
|
|
$fp = fopen($homep.$newsf.'_'.$s_languages_news.$ext, 'w'); |
|
|
|
|
fputs($fp, $home_news); |
|
|
|
|
fclose($fp); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else //we update all the news file |
|
|
|
|
{ |
|
|
|
|
} else { |
|
|
|
|
// We update all the news file |
|
|
|
|
$_languages = api_get_languages(); |
|
|
|
|
|
|
|
|
|
foreach ($_languages["name"] as $key => $value) { |
|
|
|
|
|
|
|
|
|
$english_name = $_languages["folder"][$key]; |
|
|
|
|
|
|
|
|
|
if (file_exists($homep.$newsf.'_'.$english_name.$ext)) { |
|
|
|
|
if (is_writable($homep.$newsf.'_'.$english_name.$ext)) { |
|
|
|
|
$fp=fopen($homep.$newsf.'_'.$english_name.$ext,"w"); |
|
|
|
|
$fp = fopen($homep.$newsf.'_'.$english_name.$ext, 'w'); |
|
|
|
|
fputs($fp, $home_news); |
|
|
|
|
fclose($fp); |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
} else { |
|
|
|
|
$errorMsg = get_lang('HomePageFilesNotWritable'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//File not exists |
|
|
|
|
else{ |
|
|
|
|
$fp=fopen($homep.$newsf.'_'.$english_name.$ext,"w"); |
|
|
|
|
} else { |
|
|
|
|
// File does not exist |
|
|
|
|
$fp = fopen($homep.$newsf.'_'.$english_name.$ext, 'w'); |
|
|
|
|
fputs($fp, $home_news); |
|
|
|
|
fclose($fp); |
|
|
|
|
} |
|
|
|
@ -313,15 +271,13 @@ if(!empty($action)) { |
|
|
|
|
|
|
|
|
|
if ($link_url == 'http://') { |
|
|
|
|
$link_url = ''; |
|
|
|
|
} |
|
|
|
|
elseif(!empty($link_url) && !strstr($link_url,'://')) { |
|
|
|
|
} elseif (!empty($link_url) && !strstr($link_url,'://')) { |
|
|
|
|
$link_url='http://'.$link_url; |
|
|
|
|
} |
|
|
|
|
$menuf = ($action == 'insert_tabs' || $action == 'edit_tabs')? $menutabs : $menuf; |
|
|
|
|
if (!is_writable($homep.$menuf.'_'.$lang.$ext)) { |
|
|
|
|
$errorMsg = get_lang('HomePageFilesNotWritable'); |
|
|
|
|
} |
|
|
|
|
elseif(empty($link_name)) { |
|
|
|
|
} elseif (empty($link_name)) { |
|
|
|
|
$errorMsg = get_lang('PleaseEnterLinkName'); |
|
|
|
|
} else { |
|
|
|
|
// New links are added as new files in the home/ directory |
|
|
|
@ -355,10 +311,8 @@ if(!empty($action)) { |
|
|
|
|
// fill it with default text |
|
|
|
|
if (!file_exists(api_get_path(SYS_PATH).'home/'.$filename)) { |
|
|
|
|
$fp = @fopen(api_get_path(SYS_PATH).'home/'.$filename, 'w'); |
|
|
|
|
|
|
|
|
|
if ($fp) { |
|
|
|
|
fputs($fp, get_lang('MyTextHere')); |
|
|
|
|
|
|
|
|
|
fclose($fp); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -367,7 +321,6 @@ if(!empty($action)) { |
|
|
|
|
// write to it (if the file doesn't exist, create it) |
|
|
|
|
if ($action == 'edit_link' && !empty($link_html)) { |
|
|
|
|
$fp = @fopen(api_get_path(SYS_PATH).'home/'.$filename, 'w'); |
|
|
|
|
|
|
|
|
|
if ($fp) { |
|
|
|
|
fputs($fp, $link_html); |
|
|
|
|
fclose($fp); |
|
|
|
@ -384,11 +337,9 @@ if(!empty($action)) { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$home_menu[$insert_where + 1] = '<li><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 |
|
|
|
|
{ |
|
|
|
|
} else { |
|
|
|
|
// If the request is about a link edition, change the link |
|
|
|
|
$home_menu[$link_index]='<li><a href="'.$link_url.'" target="'.($target_blank?'_blank':'_self').'"><span>'.$link_name.'</span></a></li>'; |
|
|
|
|
} |
|
|
|
|
// Re-build the file from the home_menu array |
|
|
|
@ -396,24 +347,22 @@ if(!empty($action)) { |
|
|
|
|
// Write |
|
|
|
|
if (file_exists($homep.$menuf.'_'.$lang.$ext)) { |
|
|
|
|
if (is_writable($homep.$menuf.'_'.$lang.$ext)) { |
|
|
|
|
$fp=fopen($homep.$menuf.'_'.$lang.$ext,"w"); |
|
|
|
|
$fp = fopen($homep.$menuf.'_'.$lang.$ext, 'w'); |
|
|
|
|
fputs($fp, $home_menu); |
|
|
|
|
fclose($fp); |
|
|
|
|
if (file_exists($homep.$menuf.$ext)) { |
|
|
|
|
if (is_writable($homep.$menuf.$ext)) { |
|
|
|
|
$fpo=fopen($homep.$menuf.$ext,"w"); |
|
|
|
|
$fpo = fopen($homep.$menuf.$ext, 'w'); |
|
|
|
|
fputs($fpo, $home_menu); |
|
|
|
|
fclose($fpo); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
$errorMsg = get_lang('HomePageFilesNotWritable'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else //File does not exist |
|
|
|
|
{ |
|
|
|
|
$fp=fopen($homep.$menuf.'_'.$lang.$ext,"w"); |
|
|
|
|
} else { |
|
|
|
|
//File does not exist |
|
|
|
|
$fp = fopen($homep.$menuf.'_'.$lang.$ext, 'w'); |
|
|
|
|
fputs($fp, $home_menu); |
|
|
|
|
fclose($fp); |
|
|
|
|
} |
|
|
|
@ -479,18 +428,11 @@ if(!empty($action)) { |
|
|
|
|
case 'edit_notice': |
|
|
|
|
// This request is only the preparation for the update of the home_notice |
|
|
|
|
$home_notice = ''; |
|
|
|
|
if(is_file($homep.$noticef.'_'.$lang.$ext) |
|
|
|
|
&& is_readable($homep.$noticef.'_'.$lang.$ext)) |
|
|
|
|
{ |
|
|
|
|
if (is_file($homep.$noticef.'_'.$lang.$ext) && is_readable($homep.$noticef.'_'.$lang.$ext)) { |
|
|
|
|
$home_notice = file($homep.$noticef.'_'.$lang.$ext); |
|
|
|
|
} |
|
|
|
|
elseif(is_file($homep.$noticef.$lang.$ext) |
|
|
|
|
&& is_readable($homep.$noticef.$lang.$ext)) |
|
|
|
|
{ |
|
|
|
|
} elseif (is_file($homep.$noticef.$lang.$ext) && is_readable($homep.$noticef.$lang.$ext)) { |
|
|
|
|
$home_notice = file($homep.$noticef.$lang.$ext); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
} else { |
|
|
|
|
$errorMsg = get_lang('HomePageFilesNotReadable'); |
|
|
|
|
} |
|
|
|
|
if (empty($home_notice)) { |
|
|
|
@ -499,25 +441,16 @@ if(!empty($action)) { |
|
|
|
|
$notice_title = strip_tags($home_notice[0]); |
|
|
|
|
$notice_title = api_to_system_encoding($notice_title, api_detect_encoding($notice_title)); |
|
|
|
|
$notice_text = strip_tags(str_replace('<br />', "\n", $home_notice[1]), '<a>'); |
|
|
|
|
$notice_text = api_to_system_encoding($notice_text, api_detect_encoding($notice_text)); |
|
|
|
|
$notice_text = api_to_system_encoding($notice_text, api_detect_encoding(strip_tags($notice_text))); |
|
|
|
|
break; |
|
|
|
|
case 'edit_news': |
|
|
|
|
// This request is the preparation for the update of the home_news page |
|
|
|
|
$home_news = ''; |
|
|
|
|
if(is_file($homep.$newsf.'_'.$lang.$ext) |
|
|
|
|
&& is_readable($homep.$newsf.'_'.$lang.$ext)) |
|
|
|
|
{ |
|
|
|
|
if (is_file($homep.$newsf.'_'.$lang.$ext) && is_readable($homep.$newsf.'_'.$lang.$ext)) { |
|
|
|
|
$home_news = file_get_contents($homep.$newsf.'_'.$lang.$ext); |
|
|
|
|
// $home_news=file($homep.$newsf.$ext); |
|
|
|
|
// $home_news=implode('',$home_news); |
|
|
|
|
} |
|
|
|
|
elseif(is_file($homep.$newsf.$lang.$ext) |
|
|
|
|
&& is_readable($homep.$newsf.$lang.$ext)) |
|
|
|
|
{ |
|
|
|
|
} elseif (is_file($homep.$newsf.$lang.$ext) && is_readable($homep.$newsf.$lang.$ext)) { |
|
|
|
|
$home_news = file_get_contents($homep.$newsf.$lang.$ext); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
} else { |
|
|
|
|
$errorMsg = get_lang('HomePageFilesNotReadable'); |
|
|
|
|
} |
|
|
|
|
$home_news = api_to_system_encoding($home_news, api_detect_encoding(strip_tags($home_news))); |
|
|
|
@ -526,18 +459,11 @@ if(!empty($action)) { |
|
|
|
|
// This request is the preparation for the addition of an item in home_menu |
|
|
|
|
$home_menu = ''; |
|
|
|
|
$menuf = ($action == 'edit_tabs')? $menutabs : $menuf; |
|
|
|
|
if(is_file($homep.$menuf.'_'.$lang.$ext) |
|
|
|
|
&& is_readable($homep.$menuf.'_'.$lang.$ext)) |
|
|
|
|
{ |
|
|
|
|
if (is_file($homep.$menuf.'_'.$lang.$ext) && is_readable($homep.$menuf.'_'.$lang.$ext)) { |
|
|
|
|
$home_menu = file($homep.$menuf.'_'.$lang.$ext); |
|
|
|
|
} |
|
|
|
|
elseif(is_file($homep.$menuf.$lang.$ext) |
|
|
|
|
&& is_readable($homep.$menuf.$lang.$ext)) |
|
|
|
|
{ |
|
|
|
|
} elseif(is_file($homep.$menuf.$lang.$ext) && is_readable($homep.$menuf.$lang.$ext)) { |
|
|
|
|
$home_menu = file($homep.$menuf.$lang.$ext); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
} else { |
|
|
|
|
$errorMsg = get_lang('HomePageFilesNotReadable'); |
|
|
|
|
} |
|
|
|
|
if (empty($home_menu)) { |
|
|
|
@ -552,18 +478,11 @@ if(!empty($action)) { |
|
|
|
|
case 'insert_tabs': |
|
|
|
|
// This request is the preparation for the addition of an item in home_menu |
|
|
|
|
$home_menu = ''; |
|
|
|
|
if(is_file($homep.$menutabs.'_'.$lang.$ext) |
|
|
|
|
&& is_readable($homep.$menutabs.'_'.$lang.$ext)) |
|
|
|
|
{ |
|
|
|
|
if (is_file($homep.$menutabs.'_'.$lang.$ext) && is_readable($homep.$menutabs.'_'.$lang.$ext)) { |
|
|
|
|
$home_menu = file($homep.$menutabs.'_'.$lang.$ext); |
|
|
|
|
} |
|
|
|
|
elseif(is_file($homep.$menutabs.$lang.$ext) |
|
|
|
|
&& is_readable($homep.$menutabs.$lang.$ext)) |
|
|
|
|
{ |
|
|
|
|
} elseif (is_file($homep.$menutabs.$lang.$ext) && is_readable($homep.$menutabs.$lang.$ext)) { |
|
|
|
|
$home_menu = file($homep.$menutabs.$lang.$ext); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
} else { |
|
|
|
|
$errorMsg = get_lang('HomePageFilesNotReadable'); |
|
|
|
|
} |
|
|
|
|
if (empty($home_menu)) { |
|
|
|
@ -580,18 +499,11 @@ if(!empty($action)) { |
|
|
|
|
// This request is the preparation for the edition of the links array |
|
|
|
|
$home_menu = ''; |
|
|
|
|
$menuf = ($action == 'edit_tabs')? $menutabs : $menuf; |
|
|
|
|
if(is_file($homep.$menuf.'_'.$lang.$ext) |
|
|
|
|
&& is_readable($homep.$menuf.'_'.$lang.$ext)) |
|
|
|
|
{ |
|
|
|
|
if (is_file($homep.$menuf.'_'.$lang.$ext) && is_readable($homep.$menuf.'_'.$lang.$ext)) { |
|
|
|
|
$home_menu = file($homep.$menuf.'_'.$lang.$ext); |
|
|
|
|
} |
|
|
|
|
elseif(is_file($homep.$menuf.$lang.$ext) |
|
|
|
|
&& is_readable($homep.$menuf.$lang.$ext)) |
|
|
|
|
{ |
|
|
|
|
} elseif(is_file($homep.$menuf.$lang.$ext) && is_readable($homep.$menuf.$lang.$ext)) { |
|
|
|
|
$home_menu = file($homep.$menuf.$lang.$ext); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
} else { |
|
|
|
|
$errorMsg = get_lang('HomePageFilesNotReadable'); |
|
|
|
|
} |
|
|
|
|
if (empty($home_menu)) { |
|
|
|
@ -648,11 +560,9 @@ if(!empty($action)) { |
|
|
|
|
break; |
|
|
|
|
}//end of second switch($action) (when POST['formSent'] was not set, yet) |
|
|
|
|
}// end of "else" in if($_POST['formSent']) condition |
|
|
|
|
} |
|
|
|
|
else //if $action is empty, then prepare a list of the course categories to display (?) |
|
|
|
|
{ |
|
|
|
|
$result=Database::query("SELECT name FROM $tbl_category WHERE parent_id IS NULL ORDER BY tree_pos"); |
|
|
|
|
$Categories=Database::store_result($result); |
|
|
|
|
} else { |
|
|
|
|
//if $action is empty, then prepare a list of the course categories to display (?) |
|
|
|
|
$Categories = Database::store_result(Database::query("SELECT name FROM $tbl_category WHERE parent_id IS NULL ORDER BY tree_pos")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// ------------------------- |
|
|
|
@ -685,7 +595,6 @@ switch($action){ |
|
|
|
|
Display::display_normal_message($errorMsg); |
|
|
|
|
//echo '</td></tr>'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
?> |
|
|
|
|
|
|
|
|
|
<table border="0" cellpadding="5" cellspacing="0"> |
|
|
|
@ -712,7 +621,7 @@ switch($action){ |
|
|
|
|
case 'edit_link': |
|
|
|
|
|
|
|
|
|
if (!empty($errorMsg)) { |
|
|
|
|
Display::display_normal_message($errorMsg); //main API |
|
|
|
|
Display::display_normal_message($errorMsg); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$default = array(); |
|
|
|
@ -783,8 +692,8 @@ switch($action){ |
|
|
|
|
} else { |
|
|
|
|
$name = $newsf; |
|
|
|
|
$open = @file_get_contents($homep.$newsf.'_'.$lang.$ext); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
$open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); |
|
|
|
|
|
|
|
|
|
if (!empty($errorMsg)) { |
|
|
|
|
Display::display_normal_message($errorMsg); //main API |
|
|
|
@ -861,7 +770,7 @@ switch($action){ |
|
|
|
|
<?php |
|
|
|
|
$access_url_id = 1; |
|
|
|
|
// we only show the category options for the main Dokeos installation |
|
|
|
|
if ($_configuration['multiple_access_urls']==true) { |
|
|
|
|
if ($_configuration['multiple_access_urls']) { |
|
|
|
|
$access_url_id = api_get_current_access_url_id(); |
|
|
|
|
} |
|
|
|
|
echo '<td width="50%">'; |
|
|
|
@ -1001,10 +910,5 @@ switch($action){ |
|
|
|
|
<?php |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
/* |
|
|
|
|
============================================================================== |
|
|
|
|
FOOTER |
|
|
|
|
============================================================================== |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
Display::display_footer(); |
|
|
|
|
?> |
|
|
|
|