diff --git a/main/course_description/index.php b/main/course_description/index.php index cad4eed133..87dcdd9d5e 100644 --- a/main/course_description/index.php +++ b/main/course_description/index.php @@ -1,9 +1,9 @@ - "index.php", "name" => get_lang('CourseProgram')); +//$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('CourseProgram')); if(isset($_GET['description_id']) && $_GET['description_id']==1) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('GeneralDescription')); if(isset($_GET['description_id']) && $_GET['description_id']==2) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Objectives')); @@ -67,9 +67,9 @@ if(isset($_GET['description_id']) && $_GET['description_id']==7) $interbreadcrum if(isset($_GET['description_id']) && $_GET['description_id']==8) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('NewBloc')); api_protect_course_script(); - -Display :: display_header($nameTools, "Description"); -api_display_tool_title($nameTools); +$nameTools = get_lang('CourseProgram'); +Display :: display_header($nameTools, 'Description'); +//api_display_tool_title($nameTools); @@ -291,7 +291,7 @@ if ($show_description_list) echo '
'; } - if (count($descriptions) > 0) + if (isset($descriptions) && count($descriptions) > 0) { foreach ($descriptions as $id => $description) { diff --git a/main/inc/lib/formvalidator/FormValidator.class.php b/main/inc/lib/formvalidator/FormValidator.class.php index 554305aeec..4812786896 100644 --- a/main/inc/lib/formvalidator/FormValidator.class.php +++ b/main/inc/lib/formvalidator/FormValidator.class.php @@ -141,7 +141,11 @@ EOT; { $this->addElement('html_editor',$name,$label,'rows="15" cols="80"'); $this->applyFilter($name,'trim'); - $html_type = $_SESSION['status'] == COURSEMANAGER ? TEACHER_HTML : STUDENT_HTML; + $html_type = STUDENT_HTML; + if(!empty($_SESSION['status'])) + { + $html_type = $_SESSION['status'] == COURSEMANAGER ? TEACHER_HTML : STUDENT_HTML; + } if($full_page) { $html_type = $_SESSION['status'] == COURSEMANAGER ? TEACHER_HTML_FULLPAGE : STUDENT_HTML_FULLPAGE; diff --git a/main/link/link.php b/main/link/link.php index bef5de32b4..798b7544bd 100644 --- a/main/link/link.php +++ b/main/link/link.php @@ -3,7 +3,7 @@ ============================================================================== Dokeos - elearning and course management software - Copyright (c) 2004-2008 Dokeos S.A. + Copyright (c) 2004-2008 Dokeos SPRL Copyright (c) 2003-2005 Ghent University (UGent) Copyright (c) 2001 Universite catholique de Louvain (UCL) @@ -60,41 +60,41 @@ api_protect_course_script(); // @todo change the $_REQUEST into $_POST or $_GET // @todo remove this code -$link_submitted = $_POST["submitLink"]; -$category_submitted = $_POST["submitCategory"]; -$urlview = $_GET["urlview"]; -$submitImport = $_POST["submitImport"]; -$down = $_GET['down']; -$up = $_GET['up']; -$catmove = $_GET['catmove']; -$editlink = $_REQUEST['editlink']; -$id = $_REQUEST['id']; -$urllink = $_REQUEST['urllink']; -$title = $_REQUEST['title']; -$description = $_REQUEST['description']; -$selectcategory = $_REQUEST['selectcategory']; -$submitLink = $_REQUEST['submitLink']; -$action = $_REQUEST['action']; -$category_title = $_REQUEST['category_title']; -$submitCategory = $_REQUEST['submitCategory']; +$link_submitted = (!empty($_POST['submitLink'])?$_POST['submitLink']:''); +$category_submitted = (!empty($_POST['submitCategory'])?$_POST['submitCategory']:''); +$urlview = (!empty($_GET['urlview'])?$_GET['urlview']:''); +$submitImport = (!empty($_POST['submitImport'])?$_POST['submitImport']:''); +$down = (!empty($_GET['down'])?$_GET['down']:''); +$up = (!empty($_GET['up'])?$_GET['up']:''); +$catmove = (!empty($_GET['catmove'])?$_GET['catmove']:''); +$editlink = (!empty($_REQUEST['editlink'])?$_REQUEST['editlink']:''); +$id = (!empty($_REQUEST['id'])?$_REQUEST['id']:''); +$urllink = (!empty($_REQUEST['urllink'])?$_REQUEST['urllink']:''); +$title = (!empty($_REQUEST['title'])?$_REQUEST['title']:''); +$description = (!empty($_REQUEST['description'])?$_REQUEST['description']:''); +$selectcategory = (!empty($_REQUEST['selectcategory'])?$_REQUEST['selectcategory']:''); +$submitLink = (!empty($_REQUEST['submitLink'])?$_REQUEST['submitLink']:''); +$action = (!empty($_REQUEST['action'])?$_REQUEST['action']:''); +$category_title = (!empty($_REQUEST['category_title'])?$_REQUEST['category_title']:''); +$submitCategory = (!empty($_REQUEST['submitCategory'])?$_REQUEST['submitCategory']:''); $nameTools = get_lang('Links'); - if ($_GET['action']=='addlink') + if (isset($_GET['action']) && $_GET['action']=='addlink') { $nameTools = ''; $interbreadcrumb[] = array ('url' => 'link.php', 'name' => get_lang('Links')); $interbreadcrumb[] = array ('url' => 'link.php?action=addlink', 'name' => get_lang('AddLink')); } - if ($_GET['action']=='addcategory') + if (isset($_GET['action']) && $_GET['action']=='addcategory') { $nameTools = ''; $interbreadcrumb[] = array ('url' => 'link.php', 'name' => get_lang('Links')); $interbreadcrumb[] = array ('url' => 'link.php?action=addcategory', 'name' => get_lang('AddCategory')); } - if ($_GET['action']=='editlink') + if (isset($_GET['action']) && $_GET['action']=='editlink') { $nameTools = ''; $interbreadcrumb[] = array ('url' => 'link.php', 'name' => get_lang('Links')); @@ -131,54 +131,56 @@ function MM_popupMsg(msg) { //v1.0 */ $nameTools = get_lang("Links"); -switch($_GET['action']) +if(isset($_GET['action'])) { - case "addlink": - if($link_submitted) - { - if(!addlinkcategory("link")) // here we add a link + switch($_GET['action']) + { + case "addlink": + if($link_submitted) { - unset($submitLink); + if(!addlinkcategory("link")) // here we add a link + { + unset($submitLink); + } } - } - break; - case "addcategory": - if($category_submitted) - { - if(!addlinkcategory("category")) // here we add a category + break; + case "addcategory": + if($category_submitted) { - unset($submitCategory); + if(!addlinkcategory("category")) // here we add a category + { + unset($submitCategory); + } } - } - break; - case "importcsv": - if($_POST["submitImport"]) - { - import_csvfile(); - } - break; - case "deletelink": - deletelinkcategory("link"); // here we delete a link - break; - - case "deletecategory": - deletelinkcategory("category"); // here we delete a category - break; - case "editlink": - editlinkcategory("link"); // here we edit a link - break; - case "editcategory": - editlinkcategory("category"); // here we edit a category - break; - case "visible": - change_visibility($_GET['id'],$_GET['scope']); // here we edit a category - break; - case "invisible": - change_visibility($_GET['id'],$_GET['scope']); // here we edit a category - break; + break; + case "importcsv": + if($_POST["submitImport"]) + { + import_csvfile(); + } + break; + case "deletelink": + deletelinkcategory("link"); // here we delete a link + break; + + case "deletecategory": + deletelinkcategory("category"); // here we delete a category + break; + case "editlink": + editlinkcategory("link"); // here we edit a link + break; + case "editcategory": + editlinkcategory("category"); // here we edit a category + break; + case "visible": + change_visibility($_GET['id'],$_GET['scope']); // here we edit a category + break; + case "invisible": + change_visibility($_GET['id'],$_GET['scope']); // here we edit a category + break; + } } - /* ----------------------------------------------------------- Introduction section @@ -187,11 +189,11 @@ switch($_GET['action']) Display::display_introduction_section(TOOL_LINK); -if (is_allowed_to_edit()) +if (is_allowed_to_edit() and isset($_GET['action'])) { // Displaying the correct title and the form for adding a category or link. This is only shown when nothing // has been submitted yet, hence !isset($submitLink) - if (($_GET['action']=="addlink" or $_GET['action']=="editlink") and !$_POST['submitLink']) + if (($_GET['action']=="addlink" or $_GET['action']=="editlink") and empty($_POST['submitLink'])) { echo "

"; if ($_GET['action']=="addlink") @@ -280,16 +282,16 @@ if (is_allowed_to_edit()) } -if (isset($down)) +if (!empty($down)) { movecatlink($down); } -if (isset($up)) +if (!empty($up)) { movecatlink($up); } -if ($_GET['action']!='editlink' && $_GET['action']!='addcategory' && $_GET['action']!='addlink' || $link_submitted || $category_submitted) +if (empty($_GET['action']) || ($_GET['action']!='editlink' && $_GET['action']!='addcategory' && $_GET['action']!='addlink') || $link_submitted || $category_submitted) { /* ----------------------------------------------------------- @@ -299,7 +301,7 @@ if ($_GET['action']!='editlink' && $_GET['action']!='addcategory' && $_GET['acti if(is_allowed_to_edit()) { - echo Display::return_icon('file_html_new.gif')." ".get_lang("LinkAdd")."\n"; + echo Display::return_icon('file_html_new.gif')." ".get_lang("LinkAdd")."\n"; echo Display::return_icon('folder_new.gif')." ".get_lang("CategoryAdd")."\n"; /* "".get_lang('CsvImport')."\n", // RH*/ } diff --git a/main/link/linkfunctions.php b/main/link/linkfunctions.php index 2f3c3d63bf..dbfedbd890 100644 --- a/main/link/linkfunctions.php +++ b/main/link/linkfunctions.php @@ -395,7 +395,7 @@ function showlinksofcategory($catid) echo ''; if (api_is_allowed_to_edit()) { - echo "", "\"",", ""; + echo "", "\"",", ""; echo "", "\"",", ""; // DISPLAY MOVE UP COMMAND only if it is not the top link if ($i != 1) @@ -479,12 +479,12 @@ function movecatlink($catlinkid) $tbl_link = Database :: get_course_table(TABLE_LINK); $tbl_categories = Database :: get_course_table(TABLE_LINK_CATEGORY); - if ($_GET['down']) + if (!empty($_GET['down'])) { $thiscatlinkId = $_GET['down']; $sortDirection = "DESC"; } - if ($_GET['up']) + if (!empty($_GET['up'])) { $thiscatlinkId = $_GET['up']; $sortDirection = "ASC"; @@ -500,13 +500,16 @@ function movecatlink($catlinkid) { $movetable = $tbl_link; //getting the category of the link - $sql = "SELECT category_id from ".$movetable." WHERE id='$thiscatlinkId'"; - $result = api_sql_query($sql, __FILE__, __LINE__); - $catid = mysql_fetch_array($result); + if(!empty($thiscatlinkId)) + { + $sql = "SELECT category_id from ".$movetable." WHERE id='$thiscatlinkId'"; + $result = api_sql_query($sql, __FILE__, __LINE__); + $catid = mysql_fetch_array($result); + } } // this code is copied and modified from announcements.php - if ($sortDirection) + if (!empty($sortDirection)) { if (!in_array(trim(strtoupper($sortDirection)), array ('ASC', 'DESC'))) die("Bad sort direction used."); //sanity check of sortDirection var