[svn r15174] Various fixes to notice level warning, possibly improving script efficiency as well

skala
Yannick Warnier 18 years ago
parent 55154e906e
commit f60054ebce
  1. 18
      main/admin/index.php
  2. 19
      main/admin/settings.php
  3. 14
      main/course_home/activity.php
  4. 5
      main/create_course/add_course.php
  5. 6
      main/document/document.php
  6. 4
      main/inc/banner.inc.php
  7. 9
      main/inc/introductionSection.inc.php
  8. 4
      main/inc/lib/document.lib.php
  9. 6
      main/inc/lib/main_api.lib.php
  10. 6
      main/inc/lib/text.lib.php
  11. 6
      main/inc/lib/tracking.lib.php
  12. 23
      main/mySpace/myStudents.php
  13. 8
      main/tracking/courseLog.php

@ -1,4 +1,4 @@
<?php // $Id: index.php 15078 2008-04-24 23:15:37Z yannoo $
<?php // $Id: index.php 15174 2008-04-29 18:00:04Z yannoo $
/*
==============================================================================
Dokeos - elearning and course management software
@ -65,7 +65,7 @@ if(is_dir(api_get_path(SYS_CODE_PATH).'install/') && is_readable(api_get_path(SY
ACTION HANDLING
==============================================================================
*/
if ($_POST['Register'])
if (!empty($_POST['Register']))
{
register_site();
Display :: display_confirmation_message(get_lang('VersionCheckEnabled'));
@ -76,7 +76,7 @@ if ($_POST['Register'])
MAIN SECTION
==============================================================================
*/
$keyword_url = Security::remove_XSS($_GET['keyword']);
$keyword_url = Security::remove_XSS((empty($_GET['keyword'])?'':$_GET['keyword']));
?>
<div class="admin_section">
@ -134,12 +134,6 @@ $keyword_url = Security::remove_XSS($_GET['keyword']);
<?php if(!empty($phpMyAdminPath)): ?>
<li><a href="<?php echo $phpMyAdminPath; ?>" target="_blank"><?php echo get_lang("AdminDatabases"); ?></a><br />(<?php echo get_lang("DBManagementOnlyForServerAdmin"); ?>)</li>
<?php endif; ?>
<?php
if(!empty($_configuration['multiple_access_urls']))
{
echo ' <li><a href="access_urls.php">'.get_lang('ConfigureMultipleAccessURLs').'</a></li>';
}
?>
</ul>
</div>
@ -218,7 +212,7 @@ if(api_is_platform_admin()){
</ul>
</div>
<?php
if(count($extAuthSource['ldap'])>0){
if(isset($extAuthSource) && isset($extAuthSource['ldap']) && count($extAuthSource['ldap'])>0){
?>
<!-- dynamic ldap code -->
<div class="admin_section">
@ -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();
?>
</li>
@ -447,4 +441,4 @@ function check_dokeos_version()
==============================================================================
*/
Display::display_footer();
?>
?>

@ -1,5 +1,5 @@
<?php
// $Id: settings.php 15078 2008-04-24 23:15:37Z yannoo $
// $Id: settings.php 15174 2008-04-29 18:00:04Z yannoo $
/*
==============================================================================
Dokeos - elearning and course management software
@ -55,7 +55,7 @@ $this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
// Submit Stylesheets
if ($_POST['submit_stylesheets'])
if (!empty($_POST['submit_stylesheets']))
{
$message = store_stylesheets();
header("Location: ".api_get_self()."?category=stylesheets");
@ -72,7 +72,7 @@ $interbreadcrumb[] = array ("url" => '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</td>\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<td align=\"center\">\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;
}
?>
?>

@ -238,7 +238,7 @@ function show_tools_category($course_tool_category)
$lnk[] = $link;
}
if($toolsRow['adminlink'])
if(!empty($toolsRow['adminlink']))
{
echo '<a href="'.$toolsRow['adminlink'].'"><img src="'.api_get_path(WEB_CODE_PATH).'img/edit.gif" align="absmiddle" alt="'.get_lang("Edit").'"/></a>';
}
@ -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 "<a href=\"" .api_get_self(). "?".api_get_cidreq()."&amp;id=" . $toolsRow["id"] . "&amp;" . $this_link['cmd'] . "\">" . $this_link['name'] . "</a>";
}
@ -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']))
{
?>
<div id="toolhide">
@ -431,4 +431,4 @@ else{
</div>
<?php
}
?>
?>

@ -1,5 +1,5 @@
<?php
// $Id: add_course.php 15112 2008-04-25 17:43:41Z yannoo $
// $Id: add_course.php 15174 2008-04-29 18:00:04Z yannoo $
/*
==============================================================================
Dokeos - elearning and course management software
@ -70,6 +70,7 @@ $table_course_category = Database :: get_main_table(TABLE_MAIN_CATEGORY);
$table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
// Build the form
$categories = array();
$form = new FormValidator('add_course');
$form->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();
?>
?>

@ -1,4 +1,4 @@
<?php // $Id: document.php 14907 2008-04-15 20:21:15Z juliomontoya $
<?php // $Id: document.php 15174 2008-04-29 18:00:04Z yannoo $
/*
==============================================================================
@ -218,7 +218,7 @@ $course_quota = DocumentManager::get_course_quota();
*/
//-------------------------------------------------------------------//
if ($_GET['action']=="download")
if (isset($_GET['action']) && $_GET['action']=="download")
{
//check if the document is in the database
if(!DocumentManager::get_document_id($_course,$_GET['id']))
@ -246,7 +246,7 @@ if ($_GET['action']=="download")
//-------------------------------------------------------------------//
//download of an completed folder
if($_GET['action']=="downloadfolder")
if(isset($_GET['action']) && $_GET['action']=="downloadfolder")
{
include('downloadfolder.inc.php');
}

@ -149,7 +149,7 @@ if ($_user['user_id'] && isset($_cid))
}
if ( api_is_allowed_to_edit() )
{
if( $help != null)
if(!empty($help))
{
// Show help
?>
@ -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)
{

@ -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();

@ -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
?>
?>

@ -1341,15 +1341,15 @@ function api_display_tool_title($titleElement)
$titleElement['mainTitle'] = $tit;
}
echo '<h3>';
if ($titleElement['supraTitle'])
if (!empty($titleElement['supraTitle']))
{
echo '<small>'.$titleElement['supraTitle'].'</small><br>';
}
if ($titleElement['mainTitle'])
if (!empty($titleElement['mainTitle']))
{
echo $titleElement['mainTitle'];
}
if ($titleElement['subTitle'])
if (!empty($titleElement['subTitle']))
{
echo '<br><small>'.$titleElement['subTitle'].'</small>';
}

@ -1,4 +1,4 @@
<?php // $Id: text.lib.php 14637 2008-03-17 22:44:52Z juliomontoya $
<?php // $Id: text.lib.php 15174 2008-04-29 18:00:04Z yannoo $
/*
==============================================================================
Dokeos - elearning and course management software
@ -187,7 +187,7 @@ function _text_parse_tex($textext)
foreach ($input_array as $key=>$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;
}
?>
?>

@ -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 {
}
}
?>
?>

@ -1,4 +1,4 @@
<?php //$Id: myStudents.php 15010 2008-04-22 16:16:13Z juliomontoya $
<?php //$Id: myStudents.php 15174 2008-04-29 18:00:04Z yannoo $
/*
==============================================================================
Dokeos - elearning and course management software
@ -60,7 +60,7 @@ $csv_content = array();
$course_infos = CourseManager :: get_course_information($_GET['course']);
if(empty($cidReq))
$interbreadcrumb[] = array ("url" => 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'].'&nbsp;|&nbsp;'.get_lang('CountToolAccess').' : '.$nb_login.'&nbsp; | &nbsp;'.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();
?>
?>

@ -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)
{

Loading…
Cancel
Save