diff --git a/main/admin/index.php b/main/admin/index.php index 03cb38bf23..34e5f0fcee 100644 --- a/main/admin/index.php +++ b/main/admin/index.php @@ -1,4 +1,4 @@ -
@@ -134,12 +134,6 @@ $keyword_url = Security::remove_XSS($_GET['keyword']);

  • ()
  • - '.get_lang('ConfigureMultipleAccessURLs').''; - } - ?>
    @@ -218,7 +212,7 @@ if(api_is_platform_admin()){ 0){ + if(isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap'])>0){ ?>
    @@ -249,7 +243,7 @@ if(api_is_platform_admin()){ //try to display a maximum before we check the dokeos version and all that session_write_close(); //close session to avoid blocking concurrent access flush(); //send data to client as much as allowed by the web server - ob_flush(); + //ob_flush(); echo get_lang('VersionCheck').': '.version_check(); ?> @@ -447,4 +441,4 @@ function check_dokeos_version() ============================================================================== */ Display::display_footer(); -?> \ No newline at end of file +?> diff --git a/main/admin/settings.php b/main/admin/settings.php index 8c25573a3a..c092e1828b 100644 --- a/main/admin/settings.php +++ b/main/admin/settings.php @@ -1,5 +1,5 @@ 'index.php', "name" => get_lang('PlatformAd $tool_name = get_lang('DokeosConfigSettings'); // Build the form -if ($_GET['category'] and $_GET['category'] <> "Plugins" and $_GET['category'] <> "stylesheets") +if (!empty($_GET['category']) and $_GET['category'] <> "Plugins" and $_GET['category'] <> "stylesheets") { $form = new FormValidator('settings', 'post', 'settings.php?category='.$_GET['category']); $renderer = & $form->defaultRenderer(); @@ -83,6 +83,7 @@ if ($_GET['category'] and $_GET['category'] <> "Plugins" and $_GET['category'] < //$sqlsettings = "SELECT DISTINCT * FROM $table_settings_current WHERE category='$my_category' GROUP BY variable ORDER BY id ASC"; //$resultsettings = api_sql_query($sqlsettings, __FILE__, __LINE__); //while ($row = mysql_fetch_array($resultsettings)) + $default_values = array(); foreach($settings as $row) { $form->addElement('header', null, get_lang($row['title'])); @@ -167,7 +168,7 @@ Display :: display_header($tool_name); //api_display_tool_title($tool_name); // displaying the message that the settings have been stored -if ($_GET['action'] == "stored") +if (!empty($_GET['action']) && $_GET['action'] == "stored") { Display :: display_normal_message($SettingsStored); } @@ -245,7 +246,7 @@ function handle_plugins() $userplugins = array(); $table_settings_current = Database :: get_main_table(TABLE_MAIN_SETTINGS_CURRENT); - if ($_POST['submit_plugins']) + if (!empty($_POST['submit_plugins'])) { store_plugins(); Display :: display_normal_message($SettingsStored); @@ -346,6 +347,10 @@ function handle_plugins() echo "\t\t\n"; // column: LoginPageMainArea + if(empty($usedplugins)) + { + $usedplugins = array(); + } display_plugin_cell('loginpage_main', $plugin_info, $testplugin, $usedplugins); display_plugin_cell('loginpage_menu', $plugin_info, $testplugin, $usedplugins); display_plugin_cell('campushomepage_main', $plugin_info, $testplugin, $usedplugins); @@ -368,7 +373,7 @@ function display_plugin_cell($location, $plugin_info, $current_plugin, $active_p echo "\t\t\n"; if (in_array($location, $plugin_info['location'])) { - if (is_array($active_plugins[$location]) + if (isset($active_plugins[$location]) && is_array($active_plugins[$location]) && in_array($current_plugin, $active_plugins[$location])) { $checked = "checked"; @@ -524,4 +529,4 @@ function is_style($style) } return false; } -?> \ No newline at end of file +?> diff --git a/main/course_home/activity.php b/main/course_home/activity.php index 2f5a84c7c2..a242169bba 100644 --- a/main/course_home/activity.php +++ b/main/course_home/activity.php @@ -238,7 +238,7 @@ function show_tools_category($course_tool_category) $lnk[] = $link; } - if($toolsRow['adminlink']) + if(!empty($toolsRow['adminlink'])) { echo ''.get_lang('; } @@ -256,11 +256,11 @@ function show_tools_category($course_tool_category) } - if(is_array($lnk)) + if(isset($lnk) && is_array($lnk)) { foreach($lnk as $this_link) { - if(!$toolsRow['adminlink']) + if(empty($toolsRow['adminlink'])) { echo "" . $this_link['name'] . ""; } @@ -337,7 +337,7 @@ if(api_is_allowed_to_edit()) HIDE ----------------------------------------------------------- */ - if($_GET["hide"]) // visibility 1 -> 0 + if(!empty($_GET['hide'])) // visibility 1 -> 0 { api_sql_query("UPDATE $tool_table SET visibility=0 WHERE id='".$_GET["id"]."'",__FILE__,__LINE__); Display::display_confirmation_message(get_lang('ToolIsNowHidden')); @@ -348,7 +348,7 @@ if(api_is_allowed_to_edit()) REACTIVATE ----------------------------------------------------------- */ - elseif($_GET["restore"]) // visibility 0,2 -> 1 + elseif(!empty($_GET['restore'])) // visibility 0,2 -> 1 { api_sql_query("UPDATE $tool_table SET visibility=1 WHERE id='".$_GET["id"]."'",__FILE__,__LINE__); Display::display_confirmation_message(get_lang('ToolIsNowVisible')); @@ -361,7 +361,7 @@ if(api_is_platform_admin()) { // Show message to confirm that a tools must be hide from available tools // visibility 0,1->2 - if($_GET["askDelete"]) + if(!empty($_GET['askDelete'])) { ?>
    @@ -431,4 +431,4 @@ else{
    \ No newline at end of file +?> diff --git a/main/create_course/add_course.php b/main/create_course/add_course.php index 4cbc0ac8a4..a29f9f6eca 100644 --- a/main/create_course/add_course.php +++ b/main/create_course/add_course.php @@ -1,5 +1,5 @@ add_textfield('title',get_lang('Title'),true,array('size'=>'60')); $form->addElement('static',null,null,get_lang('Ex')); @@ -155,4 +156,4 @@ else ============================================================================== */ Display :: display_footer(); -?> \ No newline at end of file +?> diff --git a/main/document/document.php b/main/document/document.php index 35a0ff8f34..5d737103cb 100644 --- a/main/document/document.php +++ b/main/document/document.php @@ -1,4 +1,4 @@ - @@ -355,7 +355,7 @@ if (isset ($_cid) and $_cid!=-1 and isset($_course)) $navigation[] = $navigation_item; } // part 2: Interbreadcrumbs. If there is an array $interbreadcrumb defined then these have to appear before the last breadcrumb (which is the tool itself) -if (is_array($interbreadcrumb)) +if (isset($interbreadcrumb) && is_array($interbreadcrumb)) { foreach($interbreadcrumb as $breadcrumb_step) { diff --git a/main/inc/introductionSection.inc.php b/main/inc/introductionSection.inc.php index 44d8775cc7..ffc46fe963 100644 --- a/main/inc/introductionSection.inc.php +++ b/main/inc/introductionSection.inc.php @@ -56,10 +56,11 @@ include_once(api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php') $TBL_INTRODUCTION = Database::get_course_table(TABLE_TOOL_INTRO); $intro_editAllowed = $is_allowed_to_edit; -$intro_cmdEdit = $_GET['intro_cmdEdit']; -$intro_cmdUpdate = $_POST['intro_cmdUpdate']; -$intro_cmdDel= $_GET['intro_cmdDel']; -$intro_cmdAdd= $_GET['intro_cmdAdd']; +global $charset; +$intro_cmdEdit = (empty($_GET['intro_cmdEdit'])?'':$_GET['intro_cmdEdit']); +$intro_cmdUpdate = (empty($_POST['intro_cmdUpdate'])?'':$_GET['intro_cmdUpdate']); +$intro_cmdDel= (empty($_GET['intro_cmdDel'])?'':$_GET['intro_cmdDel']); +$intro_cmdAdd= (empty($_GET['intro_cmdAdd'])?'':$_GET['intro_cmdAdd']); $form = new FormValidator('introduction_text'); $renderer =& $form->defaultRenderer(); diff --git a/main/inc/lib/document.lib.php b/main/inc/lib/document.lib.php index 44240aaa9e..05880c8e99 100644 --- a/main/inc/lib/document.lib.php +++ b/main/inc/lib/document.lib.php @@ -59,7 +59,7 @@ define("DEFAULT_DOCUMENT_QUOTA", get_setting('default_document_quotum')); $sys_course_path = api_get_path(SYS_COURSE_PATH); $baseServDir = api_get_path(SYS_PATH); $baseServUrl = $_configuration['url_append']."/"; -$baseWorkDir = $sys_course_path.$courseDir; +$baseWorkDir = $sys_course_path.(!empty($courseDir)?$courseDir:''); /* ============================================================================== @@ -855,4 +855,4 @@ class DocumentManager } //end class DocumentManager -?> \ No newline at end of file +?> diff --git a/main/inc/lib/main_api.lib.php b/main/inc/lib/main_api.lib.php index 163fb868d9..70c19117b2 100644 --- a/main/inc/lib/main_api.lib.php +++ b/main/inc/lib/main_api.lib.php @@ -1341,15 +1341,15 @@ function api_display_tool_title($titleElement) $titleElement['mainTitle'] = $tit; } echo '

    '; - if ($titleElement['supraTitle']) + if (!empty($titleElement['supraTitle'])) { echo ''.$titleElement['supraTitle'].'
    '; } - if ($titleElement['mainTitle']) + if (!empty($titleElement['mainTitle'])) { echo $titleElement['mainTitle']; } - if ($titleElement['subTitle']) + if (!empty($titleElement['subTitle'])) { echo '
    '.$titleElement['subTitle'].''; } diff --git a/main/inc/lib/text.lib.php b/main/inc/lib/text.lib.php index d5886b3316..2bb55bbc4c 100644 --- a/main/inc/lib/text.lib.php +++ b/main/inc/lib/text.lib.php @@ -1,4 +1,4 @@ -$value) { - if ($input_array[$key-1]=='[tex]' AND $input_array[$key+1]=='[/tex]') + if ($key>0 && $input_array[$key-1]=='[tex]' AND $input_array[$key+1]=='[/tex]') { $input_array[$key]=latex_gif_renderer($value); unset($input_array[$key-1]); @@ -406,4 +406,4 @@ function date_to_str_ago($date) return $str; } -?> \ No newline at end of file +?> diff --git a/main/inc/lib/tracking.lib.php b/main/inc/lib/tracking.lib.php index cea447dad2..d4306125e3 100644 --- a/main/inc/lib/tracking.lib.php +++ b/main/inc/lib/tracking.lib.php @@ -74,13 +74,13 @@ class Tracking { */ function get_time_spent_on_the_course($user_id, $course_code) { // protect datas - $student_id = intval($student_id); + $user_id = intval($user_id); $course_code = addslashes($course_code); $tbl_track_course = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); $sql = 'SELECT login_course_date, logout_course_date FROM ' . $tbl_track_course . ' - WHERE user_id = ' . intval($user_id) . ' + WHERE user_id = ' . $user_id . ' AND course_code="' . $course_code . '"'; $rs = api_sql_query($sql,__FILE__,__LINE__); @@ -822,4 +822,4 @@ class Tracking { } } -?> \ No newline at end of file +?> diff --git a/main/mySpace/myStudents.php b/main/mySpace/myStudents.php index 62bd0f118a..69363c9b2f 100644 --- a/main/mySpace/myStudents.php +++ b/main/mySpace/myStudents.php @@ -1,4 +1,4 @@ - api_get_path(WEB_COURSE_PATH).$course_infos['directory'], 'name' => $course_infos['title']); - $interbreadcrumb[] = array ("url" => "../tracking/courseLog.php?cidReq=".$_GET['course'].'&studentlist=true&id_session='.$_SESSION['id_session'], "name" => get_lang("Tracking")); + $interbreadcrumb[] = array ("url" => "../tracking/courseLog.php?cidReq=".$_GET['course'].'&studentlist=true&id_session='.(empty($_SESSION['id_session'])?'':$_SESSION['id_session']), "name" => get_lang("Tracking")); } else { @@ -497,11 +497,18 @@ if(!empty($_GET['student'])) } } // end if(api_get_setting('use_session_mode')=='true') - - $a_date_start = explode('-',$a_infosCours['date_start']); - $date_start = $a_date_start[2].'/'.$a_date_start[1].'/'.$a_date_start[0]; - $a_date_end = explode('-',$a_infosCours['date_end']); - $date_end = $a_date_end[2].'/'.$a_date_end[1].'/'.$a_date_end[0]; + $date_start = ''; + if(!empty($a_infosCours['date_start'])) + { + $a_date_start = explode('-',$a_infosCours['date_start']); + $date_start = $a_date_start[2].'/'.$a_date_start[1].'/'.$a_date_start[0]; + } + $date_end = ''; + if(!empty($a_infosCours['date_end'])) + { + $a_date_end = explode('-',$a_infosCours['date_end']); + $date_end = $a_date_end[2].'/'.$a_date_end[1].'/'.$a_date_end[0]; + } $dateSession = get_lang('From').' '.$date_start.' '.get_lang('To').' '.$date_end; $nb_login = Tracking :: count_login_per_student($a_infosUser['user_id'], $_GET['course']); $tableTitle = $a_infosCours['title'].' | '.get_lang('CountToolAccess').' : '.$nb_login.'  |  '.get_lang('Tutor').' : '.stripslashes($a_infosCours['tutor_name']).((!empty($session_name)) ? ' | '.get_lang('Session').' : '.$session_name : ''); @@ -1107,4 +1114,4 @@ if($export_csv) ============================================================================== */ Display::display_footer(); -?> \ No newline at end of file +?> diff --git a/main/tracking/courseLog.php b/main/tracking/courseLog.php index a0da003529..eac0d22dda 100644 --- a/main/tracking/courseLog.php +++ b/main/tracking/courseLog.php @@ -78,7 +78,7 @@ if($export_csv) $csv_content = array(); // charset determination -if ($_GET['scormcontopen']) +if (!empty($_GET['scormcontopen'])) { $tbl_lp = Database::get_course_table('lp'); $contopen = (int) $_GET['scormcontopen']; @@ -127,7 +127,7 @@ $tbl_learnpath_item = Database::get_course_table(TABLE_LP_ITEM); $tbl_learnpath_view = Database::get_course_table(TABLE_LP_VIEW); $tbl_learnpath_item_view = Database::get_course_table(TABLE_LP_ITEM_VIEW); -$view = $_REQUEST['view']; +$view = (isset($_REQUEST['view'])?$_REQUEST['view']:''); $nameTools = get_lang('Tracking'); @@ -137,7 +137,7 @@ include("../resourcelinker/resourcelinker.inc.php"); -$a_students = CourseManager :: get_student_list_from_course_code($_course['id'], true, $_SESSION['id_session']); +$a_students = CourseManager :: get_student_list_from_course_code($_course['id'], true, (empty($_SESSION['id_session'])?null:$_SESSION['id_session'])); $nbStudents = count($a_students); /** @@ -503,7 +503,7 @@ else { $tracking_column = isset($_GET['tracking_column']) ? $_GET['tracking_column'] : 0; - $tracking_direction = isset($_GET['tracking_direction']) ? $_GET['tracking_direction'] : DESC; + $tracking_direction = isset($_GET['tracking_direction']) ? $_GET['tracking_direction'] : 'DESC'; if(count($a_students)>0) {